PageSourceSearch

https://cdn.laleague.fr/fr-fr/eresa/javascript/ereservation-v-271.js

js laleague.fr collected 2026-09-25 11:43:15 UTC 32,943 bytes, 762 lines download raw bytes

1var pageURL = slq.vars.pagesURL;
2
3// Gestion du cookie dis_customer_uuid (pour safari)
4var dis_customer_uuid = "";
5var find_dis_customer_uuid = document.cookie.match(new RegExp('(^| )dis_customer_uuid=([^;]+)'));
6if (find_dis_customer_uuid) {
7	dis_customer_uuid = find_dis_customer_uuid[2];
8	window.param_url = "&dis_customer_uuid=" + dis_customer_uuid;
9}
10// Si le cookie n'existe pas
11if( dis_customer_uuid == "" ) {
12	$.ajax({
13		xhrFields: {
14			withCredentials: true
15		},
16		type: "GET",
17		dataType: "json",
18		url: pageURL + "eresa/get_uuid.cfm" 
19	}).done(function (data) {
20		document.cookie = "dis_customer_uuid=" + data.dis_customer_uuid;
21		dis_customer_uuid = data.dis_customer_uuid;
22		window.param_url = "&dis_customer_uuid=" + dis_customer_uuid;
23		send_gencod(true);
24	});	
25} else send_gencod(true);
26
27// Envoi de tous les gencods à l'init
28function send_gencod( geoloc ){
29	if( document.querySelectorAll("[data-eresa_slq-gencod]").length > 0 ) {
30		if( geoloc ) {
31			var btn_eresa = document.querySelector("[data-eresa_slq-gencod]");
32			// Si la latitude et la longitude sont vides, on les récupère via le navigateur
33			if( btn_eresa.getAttribute("data-eresa_slq-latitude") == "" && btn_eresa.getAttribute("data-eresa_slq-longitude") == "" && navigator.geolocation ) {
34				navigator.geolocation.getCurrentPosition(
35					// Geolocalisation réussie
36					function (position) {
37						window.eresa_latitude = position.coords.latitude,
38						window.eresa_longitude = position.coords.longitude;
39						get_dispo(true);
40					}, 
41					// Geolocalisation refusée
42					function (error) {
43						window.eresa_latitude = "",
44						window.eresa_longitude = "";
45						get_dispo(true);
46					}, 
47					{ enableHighAccuracy: true } );
48			} else {
49				window.eresa_latitude = btn_eresa.getAttribute("data-eresa_slq-latitude");
50				window.eresa_longitude = btn_eresa.getAttribute("data-eresa_slq-longitude");
51				get_dispo(true);
52			}
53		} else get_dispo(false);
54	}
55}
56function get_dispo( geoloc ) {
57	var btn_eresa = document.querySelector("[data-eresa_slq-gencod]"),
58		gencod_btns = document.querySelectorAll("[data-eresa_slq-gencod_upd]"), 
59		i,
60		gencods = "",
61		url_geoloc= "",
62		code_enseigne = btn_eresa.getAttribute("data-eresa_slq-enseigne"),
63		init = ( geoloc ) ? true : false;
64	
65	if( geoloc ) var url_geoloc = "&latitude=" + window.eresa_latitude + "&longitude=" + window.eresa_longitude;
66		
67	for (i = 0; i < gencod_btns.length; ++i) {
68		var item = gencod_btns[i];
69		gencods = ( gencods == "" ) ? item.getAttribute("data-eresa_slq-gencod_upd") : gencods + "," + item.getAttribute("data-eresa_slq-gencod_upd");
70		if( geoloc && i == 0) document.querySelector("[data-eresa_slq-gencod]").setAttribute("data-eresa_slq-gencod", item.getAttribute("data-eresa_slq-gencod_upd"));
71		else $("[data-eresa_slq-msg_mag]").removeClass("eresa_slq_msg_dispo_0 eresa_slq_msg_dispo_1 eresa_slq_msg_dispo_2").html("");
72	}
73	
74	if( code_enseigne != "" ) {
75		$.ajax({
76			xhrFields: {
77				withCredentials: true
78			},
79			type: "GET",
80			dataType: "json",
81			url: pageURL + "eresa/quick_dispo.cfm?gencods=" + gencods + "&code_enseigne=" + code_enseigne + url_geoloc + window.param_url
82		}).always(function (data) {
83			eresa_slq_gencods_list = data;
84			// Ajout de la dispo sur les attributs
85			if( typeof( eresa_slq_gencods_list.response ) != "undefined" ) {
86				for (var i = 0; i < eresa_slq_gencods_list.response.length; i++) {
87					for (i = 0; i < gencod_btns.length; ++i) {
88						var item = gencod_btns[i];
89						if( item.getAttribute("data-eresa_slq-gencod_upd") == eresa_slq_gencods_list.response[i].gencode ) {
90							item.setAttribute("eresa_slq_attribs_dispo", eresa_slq_gencods_list.response[i].response_code);
91							if( typeof(eresa_slq_gencods_list.response[i].response_store) != "undefined" ) item.setAttribute("eresa_slq_attribs_store", eresa_slq_gencods_list.response[i].response_store);
92						}   
93					};
94				}
95			}
96			// Activation du bouton réservation
97			init_eresa_slq_btn(init);
98		});	
99	}
100}
101
102// Gestion des boutons
103function init_eresa_slq_btn( init ) {
104
105	if( $('#eresa_modal').length == 0 ) {
106		$('body').append('<div id="eresa_modal" class="modal fade" tabindex="-1" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header clearfix"><button type="button" class="close fa fa-times" data-dismiss="modal" aria-label="Close"></button><div class="modal-title"></div></div><div class="modal-body"></div></div></div></div>');
107	}
108	
109	$('#eresa_modal').on('show.bs.modal', function (e) {
110		$('body').addClass('eresa_modal_opened');
111	}).on('hidden.bs.modal', function (e) {
112		$('body').removeClass('eresa_modal_opened');
113		$('#eresa_modal').attr('class','modal fade');
114		$('#eresa_modal.modal .modal-header .modal-title').html('');
115		$('#eresa_modal.modal .modal-body').html('');
116	});
117	
118	// Tailles
119	var gencod_btn_upd = document.querySelectorAll("[data-eresa_slq-gencod_upd]"),
120		btn_eresa = document.querySelector("[data-eresa_slq-gencod]");
121
122	for (i = 0; i < gencod_btn_upd.length; ++i) {
123		var item = gencod_btn_upd[i];
124		item.onclick = function() {
125			var gencod = this.getAttribute("data-eresa_slq-gencod_upd");
126			if( gencod != "" ) {
127				// MAJ du gencod sur le bouton eresa
128				btn_eresa.setAttribute("data-eresa_slq-gencod", gencod);
129				//MAJ du message PDP
130				if( typeof( eresa_slq_gencods_list.response ) != "undefined" ) {
131					for (var i = 0; i < eresa_slq_gencods_list.response.length; i++) {
132						if( eresa_slq_gencods_list.response[i].gencode == gencod ) {
133							if( eresa_slq_gencods_list.response[i].response_code == 0 ) {
134								btn_eresa.style.display = "none";
135								$("[data-eresa_slq-msg_mag]").html("");
136							} else {
137								btn_eresa.style.display = "inline-block";
138								$("[data-eresa_slq-msg_mag]")
139								.removeClass("eresa_slq_msg_dispo_1 eresa_slq_msg_dispo_2 eresa_slq_msg_dispo_3")
140								.addClass("eresa_slq_msg_dispo_" + $(this).attr("eresa_slq_attribs_dispo") )
141								.html(eresa_slq_gencods_list.response[i].response_string);
142							}
143						}
144					}
145				}
146				if( typeof( $(this).attr("eresa_slq_attribs_store") ) != "undefined" ) btn_eresa.setAttribute("data-eresa_slq-store", $(this).attr("eresa_slq_attribs_store"));
147				else btn_eresa.setAttribute("data-eresa_slq-store", "");
148			}
149		}
150	}
151	// Retrait du message d'erreur des tailles
152	$("[data-eresa_slq-gencod_upd]").on("click", function() {
153		$("[data-eresa_slq-msg_size]").html("");
154	});
155	
156	// Bouton réservation
157	if( document.querySelector("[data-eresa_slq-gencod]") != null ) {
158		document.querySelector("[data-eresa_slq-gencod]").onclick = function() {
159			
160			var code_enseigne = $(this).attr("data-eresa_slq-enseigne"),
161				prod_gencod = $(this).attr("data-eresa_slq-gencod"),
162				prod_code_fab = ( $(this).attr("data-eresa_slq-code_fab") != "" ) ? "&code_fabricant=" + $(this).attr("data-eresa_slq-code_fab") : "",
163				prod_name = ( $(this).attr("data-eresa_slq-name") != "" ) ? "&name=" + $(this).attr("data-eresa_slq-name") : "",
164				prod_img = ( $(this).attr("data-eresa_slq-img") != "" ) ? "&image_produit=" + $(this).attr("data-eresa_slq-img") : "",
165				prod_price = ( $(this).attr("data-eresa_slq-price") != "" ) ? "&price=" + $(this).attr("data-eresa_slq-price") : "",
166				prod_old_price = ( $(this).attr("data-eresa_slq-old_price") != "" ) ? "&old_price=" + $(this).attr("data-eresa_slq-old_price") : "",
167				prod_currency = ( $(this).attr("data-eresa_slq-currency") != "" ) ? "&currency=" + $(this).attr("data-eresa_slq-currency") : "",
168				prod_qty = ( $(this).attr("data-eresa_slq-qty") != "" ) ? "&quantite=" + $(this).attr("data-eresa_slq-qty") : "&quantite=1",
169				prod_color = ( $(this).attr("data-eresa_slq-color") != "" ) ? "&color=" + $(this).attr("data-eresa_slq-color") : "",
170				prod_size = ( $(this).attr("data-eresa_slq-size") != "" ) ? "&size=" + $(this).attr("data-eresa_slq-size") : "",
171				prod_id = ( $(this).attr("data-eresa_slq-prod_id") != "" ) ? "&product_id=" + $(this).attr("data-eresa_slq-prod_id") : "",
172				prod_color_id = ( $(this).attr("data-eresa_slq-color_id") != "" ) ? "&color_id=" + $(this).attr("data-eresa_slq-color_id") : "&color_id=''",
173				latitude = ( $(this).attr("data-eresa_slq-latitude") != "" ) ? "&latitude=" + $(this).attr("data-eresa_slq-latitude") : "",
174				longitude = ( $(this).attr("data-eresa_slq-longitude") != "" ) ? "&longitude=" + $(this).attr("data-eresa_slq-longitude") : "",
175				store = ( $(this).attr("data-eresa_slq-store") != "" ) ? "&store=" + $(this).attr("data-eresa_slq-store") : "";
176	
177			if( prod_gencod != "" ) {
178				
179				// Appel de l'ereservation
180				$('#eresa_modal').addClass("eresa_slq_modal");
181				slq.ajax.get( pageURL + "eresa/ereservation.cfm?gencod=" + prod_gencod + "&code_enseigne=" + code_enseigne + prod_code_fab + prod_name + prod_img + prod_price + prod_old_price + prod_currency + prod_qty + prod_id + prod_color_id + latitude + longitude + window.param_url );
182				// Callback popin
183				$("#eresa_modal.eresa_slq_modal").off("shown.bs.modal").on("shown.bs.modal", function (e) {
184					$("#eresa_modal.eresa_slq_modal").attr("data-gencod", prod_gencod);
185					if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
186					else init_step_1();
187				});
188				
189				/*
190				Recentrer verticalement
191				var modal_height = $(".eresa_slq_modal .modal-dialog").outerHeight(),
192					window_height = $(window).height();
193				
194				if( modal_height < window_height ) {
195					var margin_top = window_height/2 - modal_height/2;
196					$(".eresa_slq_modal .modal-dialog").css({ marginTop: margin_top });
197				}
198				*/
199			};
200		};
201	}
202}
203
204/* Centrer la popin verticalement */
205function vertical_align_popin() {
206	var modal_height = $(".eresa_slq_modal .modal-dialog").outerHeight(),
207		window_height = $(window).height();
208	if( modal_height < window_height ) {
209		var margin_top = window_height/2 - modal_height/2;
210		$(".eresa_slq_modal .modal-dialog").css({ marginTop: margin_top });
211	} 
212	else {
213		$(".eresa_slq_modal .modal-dialog").css({ marginTop: "30px" });
214	}
215}
216
217/* Magasins + recherche */
218function init_step_1() {
219	vertical_align_popin();
220	$("#eresa_slq_map_content").remove();
221	if( $("form[name='mags']").length > 0 ) $(".eresa_slq_modal .modal-body").removeClass("no_mags");
222	init_accordions();
223	// Focus sur le champs s'il n'y a pas de magasins
224	if( $(".eresa_slq_modal .eresa_slq_mags").length == 0 ) { 
225		$("#eresa_slq_cp").focus();
226		var eresa_slq_cp_tmp = $("#eresa_slq_cp").val();
227		$("#eresa_slq_cp").val("");
228		$("#eresa_slq_cp").val(eresa_slq_cp_tmp);
229	}
230	// Recherche
231	$("[name='search']").off("submit").on("submit", function(e){ 
232		e.preventDefault();
233		$("[name='search'] .submit").trigger("click");
234	});
235	$("[name='search'] .submit").off("click").on("click", function(e){
236		step_loader(true);
237		$.ajax({
238			xhrFields: {
239				withCredentials: true
240			},
241			type: "POST",
242			url: $("[name='search']").attr("action"),
243			data: $("[name='search']").serialize(),
244			dataType: "html",
245			success: function(data_success_step_1){
246				$(".eresa_slq_modal .content").html("");
247				$(".eresa_slq_modal .content").html(data_success_step_1);
248				if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
249				else init_step_1(); 
250				step_loader(false);
251			}
252		});
253	});
254	// Géolocalisation
255	$(".eresa_slq_modal .eresa_slq_geoloc").off("click").on("click", function(){
256		var geoloc_btn = $(this),
257			geoloc_btn_title = geoloc_btn.attr('data-title');
258		// Géolocalisation navigateur active
259		if(navigator.geolocation) {
260			geoloc_btn.addClass("loading");
261			navigator.geolocation.getCurrentPosition(
262				// Geolocalisation réussie
263				function (position) {
264					var lat = position.coords.latitude,
265						lng = position.coords.longitude;
266					sessionStorage.setItem("eresa_slq_lat",lat);
267					sessionStorage.setItem("eresa_slq_lng",lng);
268					geoloc_btn.removeClass("show_tooltip");
269					step_loader(true);
270					$.ajax({
271						xhrFields: {
272							withCredentials: true
273						},
274						type: "POST",
275						url: pageURL + "eresa/ereservation.cfm?step=1&change_magasin&latitude=" + lat + "&longitude=" + lng + "&code_enseigne=" + slq.vars.code_enseigne + window.param_url,
276						dataType: "html",
277						success: function(data_success_step_1){
278							$(".eresa_slq_modal .content").html("");
279							$(".eresa_slq_modal .content").html(data_success_step_1);
280							if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
281							else init_step_1(); 
282							step_loader(false);
283						}
284					});
285				}, 
286				// Geolocalisation refusée
287				function (error) {
288		
289					switch(error.code){
290						case error.PERMISSION_DENIED:
291							geoloc_btn.removeClass("loading");
292							geoloc_btn.attr('data-toggle', 'tooltip').attr('title', geoloc_btn_title).tooltip('show');
293						break;     
294						case error.POSITION_UNAVAILABLE:
295							geoloc_btn.removeClass("loading");
296							geoloc_btn.attr('data-toggle', 'tooltip').attr('title', geoloc_btn_title).tooltip('show');
297						break;
298						case error.TIMEOUT:
299							geoloc_btn.removeClass("loading");
300							geoloc_btn.attr('data-toggle', 'tooltip').attr('title', geoloc_btn_title).tooltip('show');
301						break;
302					}
303				}, 
304				{ enableHighAccuracy: true } );
305		}
306		// Géolocalisation navigateur inactive
307		else {
308			if( typeof(btn) != "undefined" ) {
309				geoloc_btn.removeClass('active');
310				//btn.addClass("error-tooltip").tooltip().attr("data-original-title", _.labels.geoLocDenied).tooltip("show");
311			}
312		}
313	});
314	// Accordion magasins à + de "param.rayon_recherche"
315	$(".eresa_slq_modal .open_mag_collapsed").off("click").on("click", function(){ 
316		var mag = $(this).parents(".mag_collapsed"),
317			mag_infos = $(".eresa_slq_infos_mag", mag),
318			mag_infos_height = 0;
319		$(".ico_slq", $(this)).toggleClass("open");
320		$(".eresa_slq_infos_mag > div", mag).each( function(){
321			if( $(this).outerHeight() > mag_infos_height ) mag_infos_height = $(this).outerHeight(); 
322		})
323		if( mag_infos.height() == 0 ) mag_infos.stop().animate({ height: mag_infos_height }, 300);
324		else mag_infos.stop().animate({ height: 0 }, 300);
325	});
326	// Supprimer le produit
327	delete_prod();
328	// Gestion de la map
329	if (jQuery("#eresa_slq_map").length > 0) {
330
331		var mapCont = jQuery("#eresa_slq_map"), magCodeDisplay, magCode, magLt, magLg, magIcon, magInfos, cpt;
332		var map;
333		var gmarkers = [];
334		
335		// Initialisation
336		var LandLMapType = new google.maps.StyledMapType();
337		var myLatlng = new google.maps.LatLng(46.3682428,3.048961);
338		
339		var myOptions = {
340			zoom: 15,
341			center: myLatlng,
342			mapTypeControl:false,
343			panControl:false,
344			rotateControl:false,
345			zoomControl: true,
346			streetViewControl: false,
347			scaleControl:false
348		};
349		
350		map = new google.maps.Map(document.getElementById("eresa_slq_map"), myOptions);
351		map.mapTypes.set("Solusquare", LandLMapType);
352		map.setMapTypeId("Solusquare");
353		
354		// Ajout des markers
355		$(".eresa_slq_modal .eresa_slq_mags .eresa_slq_list_mags .eresa_slq_mag").each(function (i) {
356			
357			var parent = $(this),
358				magCode = parent.attr("data-mag_id"),
359				magLt = parent.attr("data-mag_lat"),
360				magLg = parent.attr("data-mag_long"),
361				map_ico = parent.attr("data-maps_ico");
362				
363			if (i == 0) magCodeDisplay = magCode;
364
365			var marker = new google.maps.Marker({
366				icon: pageURL + "eresa/img/picto_gmaps_" + map_ico + ".png",
367				position: new google.maps.LatLng(magLt, magLg),
368				animation: google.maps.Animation.DROP
369			});
370			gmarkers[magCode]= marker;
371			marker.setMap(map);
372			
373			// Action au clique sur le picto gmaps
374			google.maps.event.addListener(marker, "click", function(  ) {
375				// Scroll de la liste vers le magasin
376				$(".eresa_slq_list_mags").scrollTop(0);
377				var mag = $(".eresa_slq_list_mags [data-mag_id='" + magCode + "']"),
378					mag_list_top = $(".eresa_slq_list_mags").offset().top,
379					mag_top = mag.offset().top,
380					mag_relative_top = mag_top - mag_list_top;
381				$(".eresa_slq_list_mags").scrollTop(mag_relative_top);
382				$(".eresa_slq_list_mags .eresa_slq_mag").removeClass("selected");
383				mag.addClass("highlight selected");
384				setTimeout( function(){ mag.removeClass("highlight"); },600);
385			});
386		});
387		
388		// Ajustement de la map sur les magasins
389		var LatLng = new google.maps.LatLng(gmarkers[magCodeDisplay].position.lat(), gmarkers[magCodeDisplay].position.lng())
390		map.setZoom(8);
391		map.setCenter(LatLng);
392	}
393	// Voir sur la carte
394	$(".eresa_slq_modal .eresa_slq_mags .eresa_slq_list_mags .eresa_slq_mag .show_mag_map").off("
394click").on("click", function(e) {
395		var LatLng = new google.maps.LatLng(gmarkers[ $(this).attr("data-magid") ].position.lat(), gmarkers[ $(this).attr("data-magid") ].position.lng()),
396			mag = $(this).parents(".eresa_slq_mag"),
397			mag_id = $(this).attr("data-magID");
398		$(".eresa_slq_list_mags .eresa_slq_mag").removeClass("selected");
399		mag.addClass("highlight selected");
400		setTimeout( function(){ mag.removeClass("highlight"); },600);
401		/* Version mobile*/
402		if( $("#_responsive").width() == 2 ) {
403			$("#eresa_slq_map_content").removeClass("show");
404			if( $("#eresa_slq_map_content").length == 0 ) {
405				$("body").append("<div id='eresa_slq_map_content'></div>");
406				$("#eresa_slq_map_content").addClass("show");
407				$(".eresa_slq_modal .map").appendTo( $("#eresa_slq_map_content") );
408			} else $("#eresa_slq_map_content").addClass("show");
409			$("#eresa_slq_map_content .hide_mag_map").off("click").on("click", function(){
410				$("#eresa_slq_map_content").removeClass("show");
411			});
412		}
413		
414		map.setZoom(15);
415		map.setCenter(LatLng);
416	});
417
418	// Bouton etape suivante
419	$(".eresa_slq_modal .eresa_slq_mags .submit").off("click").on("click", function(){
420		var btn = $(this),
421			mag_id = btn.attr("data-magid"), 
422			action = btn.attr("data-action");
423		$("[name='store']").val( btn.attr("data-magid") );
424		if( action == "regroupe" || action == "transfere" ) {
425			var from = btn.attr("data-from"),
426				to = btn.attr("data-to");
427			
428			if( action == "transfere" ) {
429				// Remplacement des noms de magasin
430				var old_msg = $(".eresa_slq_transfert_conf .msg > p").html(),
431					new_msg = old_msg.replace("{from}", from).replace("{to}", to);
432				$(".eresa_slq_transfert_conf .msg > p").html( new_msg );
433				// Afficher la confirmation
434				var eresa_slq_modal_offset_top = $('.eresa_slq_modal .modal-dialog').offset().top,
435					eresa_slq_modal_offset_left = $('.eresa_slq_modal .modal-dialog').offset().left;
436				$(".eresa_slq_modal").addClass("conf transfert_conf");
437				$(".eresa_slq_modal.conf .eresa_slq_transfert_conf").css({ height: $(window).height(), width: $(window).width(), top: -eresa_slq_modal_offset_top, left: -eresa_slq_modal_offset_left });
438			} else if( action == "regroupe" ) {
439				// Remplacement des noms de magasin
440				var old_msg = $(".eresa_slq_regroup_conf .msg > p").html(),
441					new_msg = old_msg.replace("{from}", from).replace("{to}", to);
442				$(".eresa_slq_regroup_conf .msg > p").html( new_msg );
443				// Afficher la confirmation
444				var eresa_slq_modal_offset_top = $('.eresa_slq_modal .modal-dialog').offset().top,
445					eresa_slq_modal_offset_left = $('.eresa_slq_modal .modal-dialog').offset().left;
446				$(".eresa_slq_modal").addClass("conf regroup_conf");
447				$(".eresa_slq_modal.conf .eresa_slq_regroup_conf").css({ height: $(window).height(), width: $(window).width(), top: -eresa_slq_modal_offset_top, left: -eresa_slq_modal_offset_left });
448			}
449				
450			// Confirmer
451			$(".eresa_slq_modal .eresa_slq_conf .ok").off("click").on("click", function() {
452				$("[name='act']").val( action );
453				$(".eresa_slq_modal").removeClass("conf transfert_conf regroup_conf");
454				step_loader(true);
455				$.ajax({
456					xhrFields: {
457						withCredentials: true
458					},
459					type: "POST",
460					url: $("[name='mags']").attr("action"),
461					data: $("[name='mags']").serialize(),
462					dataType: "html",
463					success: function(data_success_step_2){
464						$(".eresa_slq_modal .content").html("");
465						$(".eresa_slq_modal .content").html(data_success_step_2);
466						step_loader(false);
467						if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
468						else init_step_1(); 
469					}
470				});
471				get_dispo( false );
472			});
473			// Annuler
474			$(".eresa_slq_modal .eresa_slq_conf .cancel").off("click").on("click", function(){
475				$(".eresa_slq_modal").removeClass("conf transfert_conf regroup_conf");
476			});
477			
478		} else {
479			$("[name='act']").val( action );
480			step_loader(true);
481			$.ajax({
482				xhrFields: {
483					withCredentials: true
484				},
485				type: "POST",
486				url: $("[name='mags']").attr("action"),
487				data: $("[name='mags']").serialize(),
488				dataType: "html",
489				success: function(data_success_step_2){
490					$(".eresa_slq_modal .content").html("");
491					$(".eresa_slq_modal .content").html(data_success_step_2);
492					step_loader(false);
493					if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
494					else init_step_1(); 
495				}
496			});
497			get_dispo( false );
498		}
499	});
500}
501/* Coordonnées */
502function init_step_2() {
503	vertical_align_popin();
504	init_accordions();
505	// Modification de la quantité
506	$(".eresa_slq_modal .eresa_slq_prod .more").off("click").on("click", function(){
507		var current_qty = Number($(".eresa_slq_modal [name='quantite_ui']").val()),
508			new_qty = eval(current_qty + 1),
509			qte_mag_max = $(".eresa_slq_modal [name='quantite_ui']").attr("data-qte_mag_max"),
510			qte_edg_max= $(".eresa_slq_modal [name='quantite_ui']").attr("data-qte_edg_max"),
511			qte_max = $(".eresa_slq_modal [name='quantite_ui']").attr("data-qte_max"),
512			dispo_msg_mag = $(".eresa_slq_modal .eresa_slq_dispo").attr("data-msg_mag"),
513			dispo_msg_edg = $(".eresa_slq_modal .eresa_slq_dispo").attr("data-msg_edg"),
514			unit_price = Number($(".eresa_slq_modal .eresa_slq_prod_price").attr("data-value")),
515			order_total = Number($(".eresa_slq_modal .eresa_slq_prod_total").attr("data-value"));
516		if( new_qty <= qte_mag_max && new_qty <= qte_max || new_qty <= qte_edg_max && new_qty <= qte_max ) {
517			$(".eresa_slq_modal [name='quantite_ui'], .eresa_slq_modal [name='quantite']").val( new_qty );
518			$(".eresa_slq_modal .eresa_slq_prod_qty .less").removeClass("disabled");
519			if( new_qty >= qte_mag_max && new_qty >= qte_max || new_qty >= qte_edg_max && new_qty >= qte_max ) $(".eresa_slq_modal .eresa_slq_prod_qty .more").addClass("disabled");
520			// MAJ du prix total
521			var total = (order_total + (unit_price * new_qty)).toFixed(2);
522			$(".eresa_slq_modal .eresa_slq_prod_total > span").html( total.replace(".",",") );
523			// MAJ de la disponibilité
524			$(".eresa_slq_modal .eresa_slq_prod .eresa_slq_prod_qty").removeClass("mag edg");
525			if( new_qty <= qte_mag_max ) {
526				$(".eresa_slq_modal .eresa_slq_prod .eresa_slq_prod_qty").addClass("mag");
527				$(".eresa_slq_modal .eresa_slq_dispo").html( dispo_msg_mag );
528			}
529			// MAJ de la quantité
530			if( new_qty <= qte_edg_max && new_qty > qte_mag_max ) {
531				$(".eresa_slq_modal .eresa_slq_prod .eresa_slq_prod_qty").addClass("edg");
532				$(".eresa_slq_modal .eresa_slq_dispo").html( dispo_msg_edg );
533			}
534		}
535	});
536	$(".eresa_slq_modal .eresa_slq_prod .less").off("click").on("click", function(){
537		var current_qty = Number($(".eresa_slq_modal [name='quantite_ui']").val()),
538			new_qty = eval(current_qty - 1),
539			qte_mag_max = $(".eresa_slq_modal [name='quantite_ui']").attr("data-qte_mag_max"),
540			qte_edg_max= $(".eresa_slq_modal [name='quantite_ui']").attr("data-qte_edg_max"),
541			qte_max = $(".eresa_slq_modal [name='quantite_ui']").attr("data-qte_max"),
542			dispo_msg_mag = $(".eresa_slq_modal .eresa_slq_dispo").attr("data-msg_mag"),
543			dispo_msg_edg = $(".eresa_slq_modal .eresa_slq_dispo").attr("data-msg_edg"),
544			unit_price = Number($(".eresa_slq_modal .eresa_slq_prod_price").attr("data-value")),
545			order_total = Number($(".eresa_slq_modal .eresa_slq_prod_total").attr("data-value"));
546		if( new_qty != 0 ) {
547			$(".eresa_slq_modal [name='quantite_ui'], .eresa_slq_modal [name='quantite']").val( new_qty );
548			$(".eresa_slq_modal .eresa_slq_prod_qty .more").removeClass("disabled");
549			if( new_qty == 1 ) $(".eresa_slq_modal .eresa_slq_prod_qty .less").addClass("disabled");
550			// MAJ du prix total
551			var total = (order_total + (unit_price * new_qty)).toFixed(2);
552			$(".eresa_slq_modal .eresa_slq_prod_total > span").html( total.replace(".",",") );
553			// MAJ de la disponibilité
554			$(".eresa_slq_modal .eresa_slq_prod .eresa_slq_prod_qty").removeClass("mag edg");
555			if( new_qty <= qte_mag_max ) {
556				$(".eresa_slq_modal .eresa_slq_prod .eresa_slq_prod_qty").addClass("mag");
557				$(".eresa_slq_modal .eresa_slq_dispo").html( dispo_msg_mag );
558			}
559			if( new_qty <= qte_edg_max && new_qty > qte_mag_max ) {
560				$(".eresa_slq_modal .eresa_slq_prod .eresa_slq_prod_qty").addClass("edg");
561				$(".eresa_slq_modal .eresa_slq_dispo").html( dispo_msg_edg );
562			}
563		} 
564	});
565	// Modifier le produit
566	$(".eresa_slq_modal .eresa_slq_prod .eresa_slq_edit_prod").off("
566click").on("click", function(){
567		$("#eresa_modal").modal("hide");
568	});
569	// Supprimer le produit
570	delete_prod();
571	
572	// Modifier le magasin
573	$(".eresa_slq_modal .eresa_slq_edit_mag").off("click").on("click", function(){
574		step_loader(true);
575		$.ajax({
576			xhrFields: {
577				withCredentials: true
578			},
579			type: "GET",
580			url: pageURL + "eresa/ereservation.cfm?step=1&change_magasin=true" + "&code_enseigne=" + slq.vars.code_enseigne + window.param_url,
581			dataType: "html",
582			success: function(data_get_step_1){
583				$(".eresa_slq_modal .content").html("");
584				$(".eresa_slq_modal .content").html(data_get_step_1);
585				if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
586				else init_step_1(); 
587				step_loader(false);
588			}
589		});
590	});
591	// Modifier les coordonnées
592	$(".eresa_slq_modal .eresa_slq_edit_coord").off("click").on("click", function() {
593		$(this).remove();
594		$(".eresa_slq_modal .eresa_slq_recap_coord").remove();
595		$(".eresa_slq_modal .eresa_slq_infos_client form .off").removeClass("off");
596		$(".eresa_slq_modal .eresa_slq_infos_client form .customer_logged").addClass("off");
597	});
598	
599	// CGV
600	$(".eresa_slq_modal .cgv > span").off("click").on("click", function(){
601		$("#eresa_slq").addClass("cgv");
602		$("#eresa_slq").scrollTop ({ scrollTop: 0 }, 10);
603		$(".eresa_slq_modal .eresa_slq_cgv .close").off("click").on("click", function(){
604			$("#eresa_slq").removeClass("cgv");	
605		});
606	});
607	// Bouton etape suivante
608	$(".eresa_slq_modal [name='eresa_slq_coordonnees'] .submit").off("click").on("click", function(){
609		if( !check_form() ) {
610			step_loader(true);
611			$.ajax({
612				xhrFields: {
613					withCredentials: true
614				},
615				type: "POST",
616				url: $("[name='eresa_slq_coordonnees']").attr("action"),
617				data: $("[name='eresa_slq_coordonnees']").serialize(),
618				dataType: "html",
619				success: function(data_success_step_3){
620					$(".eresa_slq_modal .content").html("");
621					$(".eresa_slq_modal .content").html(data_success_step_3);
622					step_loader(false);
623					if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
624					else init_step_1(); 
625				}
626			});
627		}
628	});
629	$(".eresa_slq_modal [name='eresa_slq_coordonnees'] input").on({
630		keydown: function(e) {
631			if(e.keyCode == 13) e.preventDefault();
632		},
633		keyup: function(){
634			var val = $(this).val(),
635				name = $(this).attr("name");
636			
637			if( val == "" ) {
638				$(this).addClass("error");
639			} else {
640				check_form( name )
641			}
642		},
643		blur: function(){
644			var val = $(this).val();
645			if( val == "" ) {
646				$(this).addClass("error");
647			} 
648		}
649	});
650	$(".eresa_slq_modal .cgv [type='checkbox']").on("change", function(){
651		if( $(".eresa_slq_modal .cgv [type='checkbox']").prop("checked") ) {
652			$(".eresa_slq_modal .cgv").removeClass("error").addClass("checked");
653		} else {
654			$(".eresa_slq_modal .cgv").addClass("error").removeClass("checked");
655		}
656	})
657}
658function check_form( input_name ){
659	var error_step_2 = false;
660	$(".eresa_slq_modal [name='eresa_slq_coordonnees'] input:not([type='submit']):visible").each( function(){
661		var input_simple = ( typeof(input_name) == "undefined" ) ? false : true,
662			input = ( input_simple ) ? $("[name='" + input_name + "']") : $(this),
663			val = input.val(),
664			name = ( input_simple ) ? input_name : input.attr("name"),
665			regex_alpha = /^[a-zA-Z-,' \.\u00E0-\u00EF\u00F0-\u00F6\u00F9-\u00FC]+$/,
666			regex_mail = /^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/,
667			regex_mobile = /^((06)|(07))[0-9]{8}$/;
668
669		if( !input_simple && val == "" ) {
670			error_step_2 = true;
671			input.addClass("error");
672		} 
673		if( val != "" && (name == "nom" || name == "prenom") ) {
674			if( !val.match(regex_alpha) ) {
675				error_step_2 = true;
676				input.addClass("error");	
677			} else input.removeClass("error");
678		}				
679		if( val != "" && name == "mail" ) {
680			if( !val.match(regex_mail) ) {
681				error_step_2 = true;
682				input.addClass("error");
683			} else input.removeClass("error");
684		}
685		
686		if( val != "" && name == "numero_tel" ) {
687			input.removeClass("error");
688		}
689		
690		if( input_simple && error_step_2 ) {
691			return false;
692		}
693		if( !input_simple ) {
694			if( $(".eresa_slq_modal .cgv [type='checkbox']").prop("checked") ) {
695				if( !error_step_2 ) error_step_2 = false;
696				$(".eresa_slq_modal .cgv").removeClass("error");
697			} else {
698				error_step_2 = true;
699				$(".eresa_slq_modal .cgv").addClass("error");			
700			}
701		}
702	});
703	
704	return(error_step_2);
705}
706
707// Gestion du loader
708function step_loader( display ) {
709	if( display ) {
710		if( $("#eresa_slq_step_loader").length == 0 ) $(".eresa_slq_modal .modal-body").append("<div id='eresa_slq_step_loader'></div>")
711		$("#eresa_slq_step_loader").addClass("show");
712	} else $("#eresa_slq_step_loader").removeClass("show");
713}
714// Accordions
715function init_accordions() {
716	$(".eresa_slq_modal .eresa_slq_accordion .head").off("click").on("click", function(){
717		var accordion = $(this).parents(".eresa_slq_accordion"),
718			accordion_content_height = $(".content", accordion).outerHeight();
719		accordion.toggleClass("open");
720		if( accordion.hasClass("open") ) $(".body", accordion).stop().animate( { height: accordion_content_height }, 300 );
721		else $(".body", accordion).stop().animate( { height: 0 }, 300 );
722	});
723}
724// Suppression d'un produit
725function delete_prod() {
726
727	$(".eresa_slq_modal .delete").off("click").on("click", function(){
728		var delete_id = $(this).attr("data-delete_id"),
729			step = $(this).attr("data-step");
730			
731		// Afficher la confirmation de suppression
732		var eresa_slq_modal_offset_top = $('.eresa_slq_modal .modal-dialog').offset().top,
733			eresa_slq_modal_offset_left = $('.eresa_slq_modal .modal-dialog').offset().left;
734		$(".eresa_slq_modal.conf .eresa_slq_delete_conf").css({ height: $(window).height(), width: $(window).width(), top: -eresa_slq_modal_offset_top, left: -eresa_slq_modal_offset_left });
735		$(".eresa_slq_modal").addClass("conf del_conf");
736		
737		// Confirmer
738		$(".eresa_slq_modal .eresa_slq_delete_conf .ok").off("click").on("click", function(){
739			step_loader(true);
740			$.ajax({
741				xhrFields: {
742					withCredentials: true
743				},
744				type: "GET",
745				url: pageURL + "eresa/ereservation.cfm?step=" + step + "&did=" + delete_id + "&code_enseigne=" + slq.vars.code_enseigne + window.param_url,
746				dataType: "html",
747				success: function(data_get_step_2){
748					$(".eresa_slq_modal .content").html("");
749					$(".eresa_slq_modal .content").html(data_get_step_2);
750					if( $(".eresa_slq_step_2").length > 0 ) init_step_2();
751					else init_step_1(); 
752					step_loader(false);
753					$(".eresa_slq_modal").removeClass("conf");
754				}
755			});
756		});
757		// Annuler
758		$(".eresa_slq_modal .eresa_slq_delete_conf .cancel").off("click").on("click", function(){
759			$(".eresa_slq_modal").removeClass("conf del_conf");
760		});
761	});
762}

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.