PageSourceSearch

https://www.gites-de-france-22-35-56.fr/lib_2/js/foncs/foncPanier.js

js gites-de-france-22-35-56.fr collected 2026-10-07 13:38:48 UTC 8,710 bytes, 270 lines download raw bytes

1var urlPanierV2 = '/lib_2/ajax/gerePanierV2.php?';
2
3function initGestionPanier() {
4    gestprod = true;
5    initEventAjoutPanier();
6    initEventRecapPanier();    
7    initEventViderPanier();
8
9    majRecapPanier();
10
11// A valider avec Cyril, on aura forcément un message du navigateur pour bloquer la sortie d'une page
12//    window.onbeforeunload = function(){
13//        return "Attention votre panier n'est pas vide";
14//    }
15}
16
17function initEventRecapPanier() {
18    (function ($) {
19        $('#span_fiche_btnVoirPanier').on('click', function (event) {
20            var instance = $(this).attr('data-instance');
21            var exercice = $(this).attr('data-exercice');
22            var ident = $(this).attr('data-ident');
23            var date = $('#inpt_datePickerDeb').val();
24            
25            event.preventDefault();
26            afficheLoaderGlobal_site();
27            var data = 'type=getHTMLRecapPanierV2&instance=' + instance + '&exercice=' + exercice + '&ident=' + ident + '&datedeb=' + date;
28            $.ajax({
29                url: urlPanierV2,
30                data: data,
31                    
32                success: function (data) {
33                    effaceLoaderGlobal_site();
34                    data = JSON.parse(data);
35                    if (data.code === 'KO') {
36                        return;
37                    }
38                    affichePopinRecapPanier(data.message);
39                },
40                error: function () {
41                    effaceLoaderGlobal_site();
42                }
43
44            });
45        });
46    })(jQuery);
47}
48
49function initEventAjoutAutreDate() {
50    (function ($) {
51        $('#ajouterAutreDate').on('click', function (event) {
52            ajouterUneAutreDate();
53        });
54    })(jQuery);
55}
56
57function initEventSupprimeLignefacture() {
58    (function ($) {
59        $('.supprimeLigneFacture').off('click');
60        $('.supprimeLigneFacture').on('click', function (event) {
61            supprimeLigneFacture(this);
62        });
63    })(jQuery);
64}
65
66function initEventModifieLignefacture(){
67    (function ($) {
68        $('.modifieLigneFacture').off('click');
69        $('.modifieLigneFacture').on('click', function (event) {
70            modifieLigneFacture(this);
71        });
72    })(jQuery);
73}
74
75function initEventViderPanier() {
76    (function ($) {
77        $('#span_fiche_btnViderPanier, .span_fiche_btnViderPanier').on('click', function (event) {
78            var instance = $(this).attr('data-instance');
79            var exercice = $(this).attr('data-exercice');
80            var ident = $(this).attr('data-ident');
81            var date = $('#inpt_datePickerDeb').val();
82            if (!date) {
83
84            }
85            event.preventDefault();
86            afficheLoaderGlobal_site();
87            var data = 'type=videPanier&instance=' + instance + "&" + getIdSessionInHtml();
88            $.ajax({
89                url: urlPanierV2,
90                data: data,
91                success: function (data) {
92                    $('#ficheRecapPanier').html('').removeClass('panierNonVide');
93                    jQuery.fancybox.close();
94                    effaceLoaderGlobal_site();
95                },
96                error: function () {
97                    effaceLoaderGlobal_site();
98                }
99
100            });
101        });
102    })(jQuery);
103}
104
105function initEventAjoutPanier() {
106    (function ($) {
107        if ($('#span_fiche_btnResaPanier').length > 0) {
108            $('#span_fiche_btnResaPanier').on('click', function (event) {
109                var instance = $(this).attr('data-instance');
110                var exercice = $(this).attr('data-exercice');
111                var ident = $(this).attr('data-ident');
112                var date = $('#inpt_datePickerDeb').val();
113                if (!date) {
114                    $('#inpt_datePickerDeb').datepicker('show');
115                    return;
116                }
117                event.preventDefault();
118                afficheLoaderGlobal_site();
119                var data = 'type=getHtmlPopinPanier&instance=' + instance + '&exercice=' + exercice + '&ident=' + ident + '&datedeb=' + date;
120                $.ajax({
121                    url: urlPanierV2,
122                    data: data,
123                    dataType: 'json',
124                    success: function (json) {
125                        effaceLoaderGlobal_site();
126                        if (json.code === 'KO') {
127                            if (json.message === 'ERR_PANIER_IDENT') {
128                                affichePopinPanierEnCours(json.html);
129                            }
130                            return;
131                        }
132                        affichePopinPanier(json.message, date);
133                        initEventAjoutAutreDate();
134                        initEventSupprimeLignefacture();
135                        effaceLoaderGlobal_site();
136                    },
137                    error: function () {
138                        effaceLoaderGlobal_site();
139                    }
140
141                });
142            });
143        }
144    })(jQuery);
145}
146
147function affichePopinPanier(html, date) {
148    (function ($) {
149        affichePopinFancyBox(html, null, {closeClick: majRecapPanier()});
150        setEventsForPack(date);
151        initActionsCanevas();
152    })(jQuery);
153}
154
155function affichePopinRecapPanier(html) {
156    (function ($) {
157        affichePopinFancyBox( html);
158    })(jQuery);
159}
160
161function majRecapPanier(){
162    (function ($) {
163
164        if ($('#ficheRecapPanier').length === 0) {
165            return;
166        }
167
168        var instance = $('#ficheRecapPanier').attr('data-instance');
169        var exercice = $('#ficheRecapPanier').attr('data-exercice');
170        var ident = $('#ficheRecapPanier').attr('data-ident');
171
172        var data = 'type=getHTMLRecapPanierV2&instance=' + instance + '&exercice=' + exercice + '&ident=' + ident;
173        $.ajax({
174            url: urlPanierV2,
175            data: data,
176            dataType: 'json',
177            beforeSend: function(){
178                afficheLoaderGlobal_site();
179            },
180            success: function (json) {
181                effaceLoaderGlobal_site();
182                if (json.code === 'KO') {
183                    if (json.message === 'ERR_PANIER_IDENT') {
184                        affichePopinPanierEnCours(json.html);
185                    }
186                    return;
187                }
188                if (json.message === '') {
189                    $('#ficheRecapPanier').html(json.message).removeClass('panierNonVide');
190                } else {
191                    $('#ficheRecapPanier').html(json.message).addClass('panierNonVide');
192                    initEventSupprimeLignefacture();
193                    initEventModifieLignefacture();
194                }
195            },
196            error: function () {
197                effaceLoaderGlobal_site();
198            }
199
200        });
201    })(jQuery);
202}
203
204function ajouterUneAutreDate() {
205    majRecapPanier();
206    jQuery.fancybox.close();
207    if (typeof foncQdFini_ajouterUneAutreDate === 'function') {
208        foncQdFini_ajouterUneAutreDate();
209    }
210}
211
212function supprimeLigneFacture(element) {
213    if (!$(element)) {
214        return;
215    }
216    (function ($) {
217        var data = 'type=supprimeLigneFacture&identifiant=' + $(element).attr('data-identifiant');
218        $.ajax({
219            url: '/lib_2/ajax/gereResa.php',
220            data: data,
221            dataType: 'json',
222            beforeSend: function(){
223                afficheLoaderGlobal_site();
224            },
225            success: function () {
226                effaceLoaderGlobal_site();
227                majRecapPanier();
228            },
229            error: function () {
230                effaceLoaderGlobal_site();
231            }
232
233        });
234    })(jQuery);
235}
236
237function modifieLigneFacture(element){
238    if (!$(element)) {
239        return;
240    }
241    (function($){
242        var ident = $('#ficheRecapPanier').attr('data-ident');
243        var data = 'type=getHtmlPopinPanier&datedeb=' + $(element).attr('data-identifiant')+'&ident='+ident;
244        $.ajax({
245            url: urlPanierV2,
246            data: data,
247            dataType: 'json',
248            beforeSend: function(){
249                afficheLoaderGlobal_site();
250            },
251            success: function (json) {
252                if (json.code === 'KO') {
253                    return;
254                }
255                affichePopinPanier(json.message, $(element).attr('data-identifiant'));
256                initEventAjoutAutreDate();
257                effaceLoaderGlobal_site();
258            },
259            error: function () {
260                effaceLoaderGlobal_site();
261            }
262
263        });
264    })(jQuery);
265}
266
267function affichePopinPanierEnCours(html){
268    affichePopinFancyBox(html);
269    initEventViderPanier();
270}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.