PageSourceSearch

https://bookings.bunkersuk.com/assets/js/include-bookingbar.js?v=12

js bunkersuk.com collected 2026-09-26 16:04:03 UTC 27,835 bytes, 646 lines download raw bytes

1	//alert();
2	allActivities = "";
3    let sysMinQty = 0;
4    let sysMaxQty = 0;
5    let sysMandatory = [];
6    
7	$(document).ready(function() {     
8		getActivities("bookingBarStep1");
9		$('#prodQtyNew').click(function(){
10			event.preventDefault();
11			$('#errorMessage').removeClass('d-none');
12		});
13	});
14	$("#prodSubmit").click(function(){
15		setQty();
16		$("#quickBookForm").submit();
17	});
18	
19	
20	function getActivities(bookingBarStep){
21		$("#"+bookingBarStep).html("<option>Loading...</option>");
22		html = "";
23		// DD - 26/5/23 - If you need to force a refresh of categories, just add the following to the data object below: ', 'force_update': 1'
24		$.ajax({
25			url: "/ajax.php",
26			type: "POST",
27			data: { 'getActivities': 1},
28			dataType: "json",
29			success: function(data) {
30				console.log("data", data);
31				allActivities = data;
32				if (data.success == "true") {
33					$("#"+bookingBarStep).html("");
34					productList = "<option selected disabled>Where</option>";
35					if (data.hasOwnProperty("categories")){
36						var categories = data.categories;
37
38						var selected = "";
39						if (bookingBarStep == "bookingBarStep1"){
40							$.each(categories, function( key, category ) {
41								if(booking_locationId == category.locationid){
42									selected = "selected";
43								}else{
44									selected = "";
45								}
46								if (category.hasOwnProperty("href")){
47									productList += "<option value=\""+category.href+"\" data-href=\"1\" "+selected+">"+category.name+"</option>";
48								}else{
49									productList += "<option value=\""+category.id+"\" data-locationid=\""+category.locationid+"\" "+selected+">"+category.name+"</option>";
50								}
51								
52							});
53						}
54					}
55					$("#"+bookingBarStep).html(productList);
56					console.log(productList)
57					//$('#showBookingBarButton').addClass("slideUp");
58					//$('#bookingBar').addClass("slideUp");
59					if(booking_locationId > 0 && bookingBarStep == "bookingBarStep1"){
60						bookingBarStepOne();
61					}
62				} else {
63					
64				}
65			}
66		}, 'json');
67	}
68	
69	function bookingBarStepOne(){
70        var catId = $('#bookingBarStep1').val();
71		var locationData = $("#bookingBarStep1").find(':selected').data('locationid');
72		
73		
74		if (locationData == 24){
75			$('#quickBookDatePicker').datepicker("setDate", new Date(2023,10,09))
76			$('#quickBookDatePicker').datepicker( "option", "minDate", new Date(2023,10,09))
77			$('#selectedDatePlaceholder').val("9/11/2023");
78		}else{
79			$('#quickBookDatePicker').datepicker( "option", "maxDate", null)
80			$('#quickBookDatePicker').datepicker("setDate", new Date())
81			$('#quickBookDatePicker').datepicker( "option", "minDate", new Date())
82			$('#selectedDatePlaceholder').val(new Date().toLocaleDateString('en-GB').slice(0,10).replace(/-/g, "/"));
83		}
84	
85									
86		var href = $("#bookingBarStep1").find(':selected').data('href');
87		$(".bookingBarStep3Wrap, .bookingBarStep4Wrap").addClass("disabled");
88		$("#quickBookButtonOverlay").removeClass("d-none");
89        
90        //Hide products
91        $('#productsRow').fadeOut();
92        //Reset the date
93        $('#bookingBarStep3').prop('selectedIndex',0);
94        //Hide error messages
95        $('#sysQtyMessage').addClass('d-none');
96        $('#mandatoryError').addClass('d-none');
97		
98		if (href == 1){
99			$("#bookingBarStep2Wrap, #bookingBarStep3Wrap , #quickBookButtonOverlay").addClass("d-none");
100			$("#prodSubmit").html("Please wait... <div class=\"spinner-border  spinner-border-sm ml-3 \" role=\"status\"><span class=\"sr-only\">Loading...</span></div>");
101			
102			
103			window.location.href = catId;
104			return;
105		}
106		var categorySelected = [];
107		
108		$.each(allActivities.categories, function( key, category ) {
109			//console.log(category.id + " - "+ catId);
110			if (category.id == catId){
111				categorySelected = category;
112				//console.log("match found");
113				//console.log(category);
114			}
115		});
116		 
117        if (!isEmpty(categorySelected)){
118			$(".bookingBarStep2Wrap").removeClass("disabled");
119			$("#bookingBarStep2").html("<option>Loading...</option>");
120			
121            activities = categorySelected;
122            
123			productList = "<option selected>Choose an activity...</option>";
124			
125            if (activities.hasOwnProperty("grouped_products") && activities.grouped_products == 1){
126				// Grouped!!
127			}
128			
129			if (activities.hasOwnProperty("children")){
130				$.each(activities.children, function( key, category ) {
131					if (category.hasOwnProperty("children")){
132						$.each(category.children, function( childKey, childCat ) {
133							if (childCat.hasOwnProperty("children")){
134								$.each(childCat.children, function( childChildKey, childChildCat ) {
135									if (childChildCat.group_products == 1){
136										//productList += "<option data-group_products=\""+childChildCat.group_products+"\">"+childChildCat.name+"*</option>";
137									}
138								});
139							}
140	
141							if (childCat.group_products == 1){
142								productList += "<option data-group_products=\""+childCat.group_products+"\" data-group_products_arr=\""+encodeURIComponent(JSON.stringify(childCat.group_products_arr))+"\">"+childCat.name+"</option>";
143							}
144						});
145						
146					}
147					if (category.group_products == 1){
148						category.minimumBookingQty = category.minimumBookingQty == 0 ? "" : category.minimumBookingQty;
149						category.maximumBookingQty = category.maximumBookingQty == 0 ? "" : category.maximumBookingQty;
150						productList += "<option data-mandatoryprods=\""+category.mandatoryProducts+"\" data-sysmin=\""+category.minimumBookingQty+"\" data-sysmax=\""+category.maximumBookingQty+"\" data-group_products=\""+category.group_products+"\" data-group_products_arr=\""+encodeURIComponent(JSON.stringify(category.group_products_arr))+"\" data-categoryid=\""+category.id+"\">"+category.name+"</option>";
151					}else{
152						//If it is not a grouped product we don't want to show it here.
153						//console.log("here 5");
154						return;
155					}
156				});
157				console.log(productList);
158			}
159
160			$("#bookingBarStep2").html(productList);
161		}
162		else{
163			console.log("uh oh");
164		}
165		
166	}
167	function isEmpty(obj) {
168	  for(var prop in obj) {
169		if(obj.hasOwnProperty(prop)) {
170		  return false;
171		}
172	  }
173	
174	  return JSON.stringify(obj) === JSON.stringify({});
175	}
176	function bookingBarStepTwo(){
177		selected =  $("#bookingBarStep2").find(':selected');
178		canProceed = false;
179
180		console.log(selected.data("categoryid"));
181		// AT - Bristol opens on 24/6 so start calendar from this date. However for the Lanche Par Tee only show date for 23rd 
182        //Hide products
183        $('#productsRow').fadeOut();
184        //Reset the date
185        $('#bookingBarStep3').prop('selectedIndex',1);
186        //Hide error messages
187        $('#sysQtyMessage, #mandatoryError').addClass('d-none');
188        
189		/*if (selected.data('categoryid') == 343){
190			window.location.href = "https://bookings.mrmulligan.com/Bookings/BookSession.aspx?site=4&group=4&date=20201208";
191		}else if  (selected.data('categoryid') == 317 || selected.data('categoryid') == 318){
192			window.location.href = "https://bookings.mrmulligan.com/Bookings/BookSession.aspx?site=4&group=2&date=20201208";*/
193		if (selected.data('group_products') == 1){
194			canProceed = true;
195			$('#bookingBarBtn').attr("data-products", selected.data("group_products_arr"));
196			$("#bookingBarBtnGrouped").removeClass("d-none");
197			$("#bookingBarBtnProduct").addClass("d-none");
198		}else if (selected.data('productid') > 0){
199			canProceed = true;
200			$("#bookingBarBtnGrouped").addClass("d-none");
201			$("#bookingBarBtnProduct").removeClass("d-none");
202		}
203
204		// SM - start - show calendar before selecting products
205		$('#quickBookDatePicker').removeClass('d-none');
206		$("#productsRow").addClass("d-none");
207		$(".bookingBarStep3Wrap").addClass("disabled");
208		// SM - end
209		
210		if (canProceed){
211			$(".bookingBarStep3Wrap").removeClass("disabled");
212		}
213		
214		//if ($("#bookingBarStep3").find(':selected') != ""){
215		//	$(".bookingBarStep4Wrap").removeClass("disabled");
216		////	$("#quickBookButtonOverlay").addClass("d-none");
217		//}
218		
219		bookingBarStepThree();
220		setQty();
221	}
222	function bookingBarStepThree(){
223		buildProducts();
224		
225	}
226    
227    function buildProducts(){
228		var selected 	= $("#bookingBarStep2").find(':selected');
229        //sysMandatory   = selected.data('mandatoryprods') > 0 ? [selected.data('mandatoryprods')] : '';
230        sysMandatory   = selected.data('mandatoryprods') ? selected.data('mandatoryprods').split(',') : [];
231		locationId 		= $("#bookingBarStep1").find(':selected').data('locationid');
232		//selectedDate 	= $("#bookingBarStep3").find(':selected').val();
233		selectedDate 	= $("#quickBookSelectedDate").val();
234
235		html = "";
236		//var modal = $(this);
237		html += '<div id="errorMessage" class="w-100 d-none text-center"><p class="font-weight-bold text-danger">Please select a quantity</p></div>';
238        
239        //html +='<div class="row justify-content-center">';
240
241        //console.log(mandProds);
242		
243		if (selected.data("group_products") == 1){ // grouped products
244			var productsArr = JSON.parse(decodeURIComponent(selected.data('group_products_arr')));
245			products =  productsArr.results;
246			console.log(products);
247				
248			$.each( products, function( key, product ) {
249				prodId = product.id;
250				productName = product.name.replace(/\+/g, " ");
251				
252				categoryName = $("#bookingBarStep2").find(':selected').text();
253				categoryName = categoryName.replace(/\+/g, " ");
254				
255                let isMandatory = 0;
256                        
257				if (productName.indexOf( ' - ' ) >= 0){
258					productName = productName.split(' - ');
259                    productName = productName[0];
260				}
261				
262				
263				if (product.extra.hasOwnProperty("locations") && (product.extra.locations.hasOwnProperty(locationId) && product.extra.locations[locationId].minPrice > 0)){
264					price = product.extra.locations[locationId].minPrice;
265					priceWithoutOnlineDiscount = product.extra.locations[locationId].minPrice;
266				}
267				else if (product.extra.minprice == ""){
268					price = 0;
269					priceWithoutOnlineDiscount = 0;
270				}else{
271					price = product.extra.minprice;
272					priceWithoutOnlineDiscount = price;
273				}
274
275				if (product.extra.hasOwnProperty("locations") && (product.extra.locations.hasOwnProperty(locationId) && product.extra.locations[locationId].maxQty > 0)){
276					//console.log(product.extra.locations[locationId]);
277					maxqty = product.extra.locations[locationId].maxQty;
278					minqty = product.extra.locations[locationId].minQty;
279					console.log("Min QTY: "+ minqty +" Max QTY: "+maxqty);
280				}else{
281					maxqty = product.extra.maxqty;
282					minqty = product.extra.minqty;
283					console.log("Min QTY2: "+ minqty +" Max QTY: "+maxqty);
284				}
285
286				var numOfPeople = 1;
287				if (product.extra.hasOwnProperty('numpeople') && product.extra.numpeople > 1) {
288					numOfPeople = product.extra.numpeople;
289				}
290                
291                //console.log(prodId);
292				
293                if(jQuery.inArray(prodId, sysMandatory) !== -1){
294                    //console.log(prodId);
295                    isMandatory = 1;
296                    productName = productName+'*';
297                }
298                
299                //console.log("IS MANDATORY " + isMandatory);
300                
301                /*
302                html += '<div class="col-12 col-md-5">';
303				html +=     '<input type="hidden" name="'+prodId+'[name]" value="'+productName+'">';
304				html +=     '<input type="hidden" name="'+prodId+'[prodid]" value="'+prodId+'">';
305				html +=     '<input type="hidden" name="'+prodId+'[locationid]" value="'+locationId+'" />';
306				html +=     '<input type="hidden" name="'+prodId+'[selectedDate]" value="'+selectedDate+'" />';
307                html +=     '<div class="form-group row mb-2 mb-md-3">';
308                html +=         '<div class="col-12">';
309                html +=             '<select class="form-control bookingbar__prodSelector qty__select--'+prodId+' pl-3" name="'+prodId+'[qty]" data-ismandatory="'+isMandatory+'" onchange="setQty('+prodId+');">';
310                html +=                 '<option selected disabled value="0">'+productName+'</option>';
311                                        for(x = minqty; x <= maxqty; x++){
312                html +=                     '<option value='+x+'>'+x+' x '+productName+'</option>';
313                                        }
314                html +=             '</select>';
315                html +=         '</div>';
316                html +=     '</div>';
317                html += '</div>';
318				*/
319				
320				html += "<input type=\"hidden\" name=\""+prodId+"[name]\" value=\""+productName+"\">";
321				html += "<input type=\"hidden\" name=\""+prodId+"[prodid]\" value=\""+prodId+"\">";
322				html += "<input type=\"hidden\" name=\""+prodId+"[locationid]\" value=\""+locationId+"\" />";
323				html += "<input type=\"hidden\" name=\""+prodId+"[category]\" value=\""+categoryName+"\">";
324				html += "<input type=\"hidden\" name=\""+prodId+"[code]\" value=\""+product.code+"\">";
325				html += "<input type=\"hidden\" class=\"productSelectedDate\" name=\""+prodId+"[selectedDate]\" value=\""+selectedDate+"\" />";
326				 
327				
328				if (product.extra.hasOwnProperty("locations")) {
329					locationVals = Object.values(product.extra.locations);
330				}else{
331					locationVals = {};
332					locationVals[0] = "";
333				}
334				
335				//console.log("PRODUCT DESC ", product.description);
336				//console.log("prod ",  product);
337				
338
339				html += '<div class="form-group row justify-content-between align-items-center mb-2 mb-md-3 bookingBarProdItem" data-ismandatory="'+isMandatory+'">';
340				//html += '		<div class="col-form-label col-12 col-md-5">'+productName+'</div>';
341				html += '		<div class="col-form-label col-5 col-md-7">'+productName+' <small class="d-block font-percent75 prod-desc my-1">'+product.description.replace(/\+/g, ' ')+'</small></div>';
342				//html += '		<div class="col-7 col-sm-6 col-md-4">';
343				html += '		<div class="col-7 col-md-5">';
344				html += '			<div class="input-group">';
345				html += '				<div class="input-group-prepend"><input type="button" value="-" class="qtyminus btn btn-primary btn-disabled" field="quantity" onclick="decreaseQuantityNew('+prodId+');return false;"></div>';
346				html += '					<input type="number" data-clicksent="false" data-name="'+product.name+'" data-price="'+locationVals[0].minPrice+'" data-brand="" data-category="'+categoryName+'" data-variant="" data-position="'+(key+1)+'" id="qty'+prodId+'" name="'+prodId+'[qty]" value="
3460" class="form-control qty extraqtyinput text-center" min="0" data-minqty="'+minqty+'" max="'+maxqty+'" rel="'+maxqty+'" data-numpeople="'+numOfPeople+'" onfocus="this.blur()">';
347				html += '				<div class="input-group-append"><input type="button" value="+" class="qtyplus btn btn-primary" field="quantity" onclick="increaseQuantityNew('+prodId+');return false;"></div>';
348				html += '			</div>';
349				html += '		</div>';
350				//html += '		<div class="col-3 col-sm-6 col-md-3 text-right d-flex flex-column flex-sm-row align-items-end align-items-sm-center justify-content-end">';
351				//html += '			<span class="catPrice">£'+parseFloat(price).toFixed(2)+'</span>';
352				//html += '		</div>';
353				html += '	</div>';
354		
355			
356				
357				
358			});
359
360		}else if (selected.data('productid') > 0){
361			var minqty 		= $("#bookingBarStep2").find(':selected').data('minqty');
362			var maxqty 		= $("#bookingBarStep2").find(':selected').data('maxqty');
363			var prodId 		= $("#bookingBarStep2").find(':selected').data('productid');
364			var price 		= $("#bookingBarStep2").find(':selected').data('price');
365         
366			for (var n = minqty; n < maxqty; ++ n){
367				//console.log("Value ="+n);
368				//html += "<option value=\""+n+"\">"+n+"</option>";
369			}
370			
371            productName = selected.text();
372			
373			/*
374            html += '<div class="col-12 col-md-3">';
375			html +=     '<input type="hidden" name="'+prodId+'[name]" value="'+productName+'">';
376			html +=     '<input type="hidden" name="'+prodId+'[prodid]" value="'+prodId+'">';
377			html +=     '<input type="hidden" name="'+prodId+'[locationid]" value="'+locationId+'" />';
378			html +=     '<input type="hidden" name="'+prodId+'[selectedDate]" value="'+selectedDate+'" />';
379            html +=     '<div class="form-group row mb-2 mb-md-3">';
380            html +=         '<div class="col-12">';
381            html +=             '<select class="form-control qty__select--'+prodId+'" name="'+prodId+'[qty]" onchange="setQty('+prodId+');">';
382            html +=                 '<option selected disabled value="0">'+productName+'</option>';
383                                    for(x = minqty; x <= maxqty; x++){
384            html +=                     '<option value='+x+'>'+x+'</option>';
385                                    }
386            html +=             '</select>';
387            html +=         '</div>';
388            html +=     '</div>';
389            html += '</div>';
390            */
391            
392            console.log("Here 3 ", product);
393			
394			//SM - 16/03/2020 - Dev task #029439 - if needed back in, columns will need changing
395			html += "<input type=\"hidden\" name=\""+prodId+"[name]\" value=\""+productName+"\">";
396			html += "<input type=\"hidden\" name=\""+prodId+"[prodid]\" value=\""+prodId+"\">";
397			html += "<input type=\"hidden\" name=\""+prodId+"[locationid]\" value=\""+locationId+"\" />";
398			//html += '<div class="form-group row justify-content-between align-items-center">';
399			html += '<div class="form-group row justify-content-between align-items-center">';
400			html += '	<div class="col-form-label col-sm-5 col-md-7 here">Qty</div>';
401			html += '	<div class="col-12 col-sm-7 col-md-5">';
402			html += '		<div class="input-group">';
403			html += '			<div class="input-group-prepend"><input type="button" value="-" class="qtyminus btn btn-primary btn-disabled" field="quantity" onclick="decreaseQuantityNew('+prodId+');return false;"></div>';
404			html += '				<input type="number" id="qty'+prodId+'" data-clicksent="false" data-prodinfo="" name="'+prodId+'[qty]" value="'+minqty+'"  class="form-control qty extraqtyinput text-center" min="'+minqty+'" max="'+maxqty+'" rel="'+minqty+'" data-numpeople="'+numOfPeople+'" onfocus="this.blur()">';
405			html += '			<div class="input-group-append"><input type="button" value="+" class="qtyplus btn btn-primary" field="quantity" onclick="increaseQuantityNew('+prodId+');return false;"></div>';
406			html += '		</div>';
407			html += '	</div>';
408			//html += '	<div class="col-3 text-right">';
409			//html += '		£'+parseFloat(price).toFixed(2)+'';
410			//html += '	</div>';
411			//html += '</div>';
412			html += '</div>';
413		}
414
415		//html += '</div>';
416		$('#productsRow').removeClass("d-none");
417		console.log("remove class");
418		$('#productsRow').html(html).fadeIn();
419        
420    }
421
422	
423	function bookingBarStepFour(){
424		alert("Ooops. I'm not quite ready yet! It won't be long!"); 
425		//alert("Step 4 - Book Now");
426	}
427    
428    function setQty(prodId) {
429        sysMinQty = $('#bookingBarStep2').find(':selected').data('sysmin') || 1;
430        sysMaxQty = $('#bookingBarStep2').find(':selected').data('sysmax');
431        let totalQty  = 0;
432        let canProceed = true;
433        
434		count = 0;
435        $('.bookingBarProdItem').each(function(){
436			count++;
437			//console.log($(this).find('.qty').val());  
438			totalQty += parseInt($(this).find('.qty').val()) * parseInt($(this).find('.qty').attr('data-numpeople'));
439		});
440		
441		if (count == 0){
442			totalQty = parseInt($("#productsRow").find('.qty').val());
443		}
444		//console.log('---');
445
446		//console.log(totalQty);
447
448		if (sysMinQty || sysMaxQty) {
449			if (sysMinQty && sysMaxQty) {
450				if (totalQty < parseInt(sysMinQty) || totalQty > parseInt(sysMaxQty)) {
451					$('#sysQtyMessage').html('<p class="text-danger font-weight-bold m-0">You have to select between <b>'+sysMinQty+'</b> and <b>'+sysMaxQty+'</b> tickets. You currently have '+totalQty+' selected.').removeClass('d-none');
452					canProceed = false;
453				} else {
454					$('#sysQtyMessage').html('').addClass('d-none');
455					canProceed = true;
456				}
457			} else if (sysMinQty && !sysMaxQty) {
458				if (totalQty < parseInt(sysMinQty)) {
459					$('#sysQtyMessage').html('<p class="text-danger font-weight-bold m-0">You have to select at least <b>'+sysMinQty+'</b> tickets. You currently have '+totalQty+' selected.').removeClass('d-none');
460					canProceed = false;
461					console.log('cond 3');
462				} else {
463					$('#sysQtyMessage').html('').addClass('d-none');
464					canProceed = true;
465				}
466			} else if (!sysMinQty && sysMaxQty) {
467				if (totalQty > parseInt(sysMaxQty)) {
468					$('#sysQtyMessage').html('<p class="text-danger font-weight-bold m-0">You can select up to <b>'+sysMaxQty+'</b> tickets. You currently have '+totalQty+' selected.').removeClass('d-none');
469					canProceed = false;
470				} else {
471					$('#sysQtyMessage').html('').addClass('d-none');
472					canProceed = true;
473				}
474			}
475		}
476        
477        // if (sysMinQty != "" || sysMaxQty != "") {
478        //     //if min and max qty entered check the total is no more than the maxqty
479        //     if (totalQty > sysMaxQty && sysMinQty != 0 && sysMaxQty != 0) {
480		// 		console.log('cond1');
481        //         $('#sysQtyMessage').html('<p class="text-danger font-weight-bold px-4">You have to select between '+sysMinQty+' & '+sysMaxQty+' tickets. You currently have '+totalQty+' selected.</p>').removeClass('d-none');
482        //         canProceed = false
483        //     }
484        //     //check the total qty is more than the min qty
485        //     else if (totalQty < sysMinQty) {
486		// 		console.log('cond2');
487        //         $('#sysQtyMessage').html('<p class="text-danger font-weight-bold px-4">You have to select at least '+sysMinQty+' tickets. You currently have '+totalQty+' selected.</p>').removeClass('d-none');
488        //         canProceed = false;
489        //     }
490        //     //total qty is not more than maxqty
491        //     else if (totalQty < sysMaxQty && sysMinQty == 0 || totalQty > sysMaxQty && sysMinQty == 0) {
492		// 		console.log('cond3');
493        //         $('#sysQtyMessage').html('<p class="text-danger font-weight-bold px-4">You can select up to '+sysMaxQty+' tickets. You currently have '+totalQty+' selected.</p>').removeClass('d-none');
494        //         canProceed = false;
495        //     }
496        //     //if none of these conditions are met then we can continue with the booking
497        //     else{
498        //         $('#sysQtyMessage').addClass('d-none');
499        //     }
500        // }
501        
502        if (sysMandatory.length > 0) {
503			const mandatorySelected = checkMandatoryProduct();
504			
505//console.log(mandatorySelected);
506
507            if (mandatorySelected !== true) {
508                $('#mandatoryError').html('<p class="text-danger font-weight-bold">Your booking must contain at least one mandatory product</p>').removeClass('d-none');
509                
510                $('.bookingbar__prodSelector').each(function(){
511                    $(this).data('ismandatory') == 1 ? $(this).css('border', '3px solid red') : '';
512                });
513                
514                canProceed = false;
515            }else{
516                
517                $('.bookingbar__prodSelector').each(function(){
518                    $(this).data('ismandatory') == 1 ? $(this).css('border', '') : '';
519                });
520                
521                $('#mandatoryError').addClass('d-none');
522            }
523        }
524        
525		if (totalQty == 0){
526			$(".bookingBarStep4Wrap").addClass("disabled");
527			$("#quickBookButtonOverlay").removeClass("d-none");
528		
529            $('#prodSubmit').addClass('d-none');
530		}
531        
532        if (canProceed === true) {
533			//alert("can proceed");
534			$(".bookingBarStep4Wrap").removeClass("disabled");
535			$("#quickBookButtonOverlay").addClass("d-none");
536		
537            $('#prodSubmit').removeClass('d-none');
538        }else{
539			//alert("can't proceed");
540			$(".bookingBarStep4Wrap").addClass("disabled");
541			$("#quickBookButtonOverlay").removeClass("d-none");
542		
543            $('#prodSubmit').addClass('d-none');
544			
545        }
546    }
547    
548    function checkMandatoryProduct(){
549        let mandatoryProductSelected = false;
550        //console.log( $('.bookingBarProdItem'));
551        $('.bookingBarProdItem').each(function() {
552            if ($(this).data('ismandatory') == 1 && $(this).find('.qty').val() > 0) {
553				//console.log($(this));
554            	mandatoryProductSelected = true;
555            }
556        });
557
558        return mandatoryProductSelected;
559    }
560    
561	
562	function increaseQuantityNew(productid){
563		$('#prodSubmit').removeClass('d-none');
564		$('#prodQtyNew').addClass('d-none');
565		$('#errorMessage').addClass('d-none');
566		var qty = parseInt(parseInt($('#qty'+productid).val()) + 1);
567		var minqty = parseInt($('#qty'+productid).attr('data-minqty'));
568		var maxqty = $('#qty'+productid).attr('rel');
569		var dataSent = $('#qty'+productid).attr('data-clicksent');
570        
571        console.log("here ", productid, "dataSent ", dataSent);
572        
573        if (dataSent === 'false') {
574            sendGaData(productid, dataSent);
575        }else{
576            $('#qty'+productid).attr('data-clicksent', 'true');
577        }
578        
579		if (qty > 0 && qty < minqty){
580			qty = minqty;
581		}
582       	console.log("3 - "+minqty)
583		console.log("3. - "+qty);
584		console.log("3-- - "+maxqty);
585		if (qty <= maxqty){
586			console.log("AT.");
587			 $('#qty'+productid).val(qty);
588			 
589		}
590		setQty(productid);
591	}
592
593	function decreaseQuantityNew(productid){
594		var qty = parseInt(parseInt($('#qty'+productid).val()) - 1);
595		var minqty = $('#qty'+productid).attr('data-minqty');
596
597		if (qty > 0 && qty < minqty){
598			qty = 0;
599		}
600
601		if (qty >= minqty || qty == 0){
602			$('#qty'+productid).val(qty);	
603		}
604		 setQty(productid);
605	}
606    
607    /**
608    * Call this function when a user clicks on a product link. This function uses the event
609    * callback datalayer variable to handle navigation after the ecommerce data has been sent
610    * to Google Analytics.
611    * @param {Object} productObj An object representing a product.
612    */
613    function sendGaData(productid, dataSent) {
614        //console.log("here data sent ",dataSent, productid);
615        
616        const name = $('#qty'+productid).data('name');
617        const price = $('#qty'+productid).data('price');
618        const brand = $("#bookingBarStep1").find(':selected').text();
619        const category = $('#qty'+productid).data('category');
620        const variant = $('#qty'+productid).data('variant');
621        const position = $('#qty'+productid).data('position');
622        
623        //console.log(name, price, brand, category, variant, position);
624        
625        dataLayer.push({
626            'event': 'productClick',
627            'ecommerce': {
628                'click': {
629                    'actionField': {'list': 'Quick Book'},      // Optional list property.
630                    'products': [{
631                        'name': name,                      // Name or ID is required.
632                        'id': productid,
633                        'price': price,
634                        'brand': brand,
635                        'category': category,
636                        'variant': variant,
637                        'position': position
638                    }]
639                }
640            }
641            //,
642            //'eventCallback': function() {
643            //document.location = productObj.url
644            //}
645        });
646    }

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.