PageSourceSearch

https://doctor4africa.com/wp-content/plugins/listeo-core/assets/js/bookings.js?ver=1.8.50

js doctor4africa.com collected 2026-10-02 13:02:56 UTC 44,019 bytes, 1,499 lines download raw bytes

1/* ----------------- Start Document ----------------- */
2(function($){
3"use strict";
4
5$(document).ready(function(){
6
7	var inputClicked = false;
8/*----------------------------------------------------*/
9	/*  Booking widget and confirmation form
10	/*----------------------------------------------------*/
11	$('a.booking-confirmation-btn').on('click', function(e){
12
13		e.preventDefault();
14		var bookingForm = $('#booking-confirmation');
15		if (bookingForm[0].checkValidity()) {
16			var button = $(this);
17			button.addClass('loading');
18			$('#booking-confirmation').submit();
19		}
20		
21	});
22
23
24	// reload states based on country
25
26$("#billing_country").change(function () {
27  var country = $(this).val();
28  
29  $.ajax({
30    url: listeo.ajaxurl, // WordPress AJAX
31    type: "POST",
32    data: {
33      action: "listeo_get_booking_states",
34      country: country,
35    },
36    success: function (response) {
37		var select = $("#billing_state");
38      var states = response.data;
39	  
40	  if (states) {
41		
42		select.find("option:not(:first)").remove();
43		$.each(states, function (key, value) {
44			
45			select.append('<option value="' + key + '">' + value + "</option>");
46		});
47		} else {
48			select.find("option:not(:first)").remove();
49			// remove required attribute
50			select.removeAttr('required');
51		}
52    },
53  });
54});
55	$(document).bind('change', function(e){
56		if( $(e.target).is(':invalid') ){
57			$(e.target).parent().addClass('invalid');
58		} else {
59			$(e.target).parent().removeClass('invalid');
60		}
61	});
62
63	$('#listeo-coupon-link').on('click', function(e){
64		e.preventDefault();
65		$('.coupon-form').toggle();
66	});
67
68	function validate_coupon(listing_id,price) {
69
70		var current_codes = $('#coupon_code').val();
71		if(current_codes){
72			var codes = current_codes.split(',');
73			$.each(codes, function(index, item) {
74				console.log(item);
75			    var ajax_data = {
76					'listing_id' : 	listing_id,
77					'coupon' : 	item,
78					'coupons' : codes,
79					'price' : 	price,
80					'action' : 'listeo_validate_coupon'	
81				};
82				$.ajax({
83		            type: 'POST', 
84		            dataType: 'json',
85					url: listeo.ajaxurl,
86					data: ajax_data,
87					
88		            success: function(data){
89						
90						if(data.success){
91					
92							
93							
94						} else {
95
96							
97							$('#coupon-widget-wrapper-output div.error').html(data.message).show();
98							$('#coupon-widget-wrapper-applied-coupons span[data-coupon="'+item+'"] i').trigger('click');
99							$('#apply_new_coupon').val('');
100							$("#coupon-widget-wrapper-output .error").delay(3500).hide(500);
101						
102						}
103						$('a.listeo-booking-widget-apply_new_coupon').removeClass('active');
104		            }
105		        });
106			});
107		}
108		
109			
110
111	}
112
113	// Apply new coupon
114	$('a.listeo-booking-widget-apply_new_coupon').on('click', function(e){
115		
116		e.preventDefault();
117		$(this).addClass('active');
118		$('#coupon-widget-wrapper-output div').hide();
119		
120		var ajax_data = {
121			'listing_id' : 	$('#listing_id').val(),
122			'coupon' : 	$('#apply_new_coupon').val(),
123			'price' : 	$('.booking-estimated-cost').data('price'),
124			'action' : 'listeo_validate_coupon'	
125		};
126
127		//check if it was already addd
128		
129		var current_codes = $('#coupon_code').val();
130		var result = current_codes.split(',');
131		var arraycontainscoupon = (result.indexOf($('#apply_new_coupon').val()) > -1);
132		
133		$('#coupon-widget-wrapper-output div').hide();
134		if(arraycontainscoupon) {
135			$(this).removeClass('active');
136			$('input#apply_new_coupon').removeClass('bounce').addClass('bounce');
137			return;			
138		}
139		$.ajax({
140            type: 'POST', 
141            dataType: 'json',
142			url: listeo.ajaxurl,
143			data: ajax_data,
144			
145            success: function(data){
146				
147				if(data.success){
148			
149					if(current_codes.length>0){
150						$('#coupon_code').val(current_codes + ',' + data.coupon);	
151					} else {
152						$('#coupon_code').val(data.coupon);	
153					}
154					$('#apply_new_coupon').val('');
155					$('#coupon-widget-wrapper-applied-coupons').append("<span data-coupon="+data.coupon+">"+data.coupon+"<i class='fa fa-times'></i></span>")
156					$('#coupon-widget-wrapper-output .success').show();
157					if($('#booking-confirmation-summary').length>0){
158						calculate_booking_form_price();
159					} else {
160						if($("#form-booking").hasClass('form-booking-event')){
161							calculate_price();
162						} else {
163							check_booking();	
164						}
165						
166					}
167					$("#coupon-widget-wrapper-output .success").delay(3500).hide(500);
168					
169				} else {
170
171					$('input#apply_new_coupon').removeClass('bounce').addClass('bounce');
172					$('#coupon-widget-wrapper-output div.error').html(data.message).show();
173					
174					$('#apply_new_coupon').val('');
175					$("#coupon-widget-wrapper-output .error").delay(3500).hide(500);
176				
177				}
178				$('a.listeo-booking-widget-apply_new_coupon').removeClass('active');
179            }
180        });
181	});
182
183
184	// Remove coupon from widget and calculate price again
185	$('#coupon-widget-wrapper-applied-coupons').on('click', 'span i', function(e){
186
187		var coupon = $(this).parent().data('coupon');
188		
189
190		var coupons = $('#coupon_code').val();	
191		var coupons_array = coupons.split(',');
192		coupons_array = coupons_array.filter(function(item) {
193			console.log(item);
194			console.log(coupon);
195		    return item !== coupon
196		})
197		
198		$('#coupon_code').val(coupons_array.join(","));	
199		$(this).parent().remove();
200		if($('#booking-confirmation-summary').length>0){
201			calculate_booking_form_price();
202		} else {
203			check_booking();
204			calculate_price();
205			
206		}
207	});
208
209
210
211	//Book now button
212	$('.listing-widget').on('click', 'a.book-now', function(e){
213		
214		var button = $(this);
215
216		if($('#date-picker').val()){
217			inputClicked = true;
218			
219
220			if ($(".time-picker").length && !$(".time-picker").val()) {
221				inputClicked = false;
222				
223			}
224			if ($("#slot").length && !$("#slot").val()) {
225				inputClicked = false;
226				
227			}
228			if(inputClicked){
229				check_booking();
230			}
231			
232		
233		}
234		console.log(inputClicked);
235		
236		if(inputClicked == false){
237			$('.time-picker,.time-slots-dropdown,.date-picker-listing-rental').addClass('bounce');
238		} else {
239				button.addClass('loading');
240		}
241		e.preventDefault();
242
243		var freeplaces = button.data('freeplaces');
244		
245		  
246        // var checked = $(".bookable-services input[type=checkbox]:checked").length;
247
248		// if (!checked) {
249		// 	alert("You must select at least one extra service.");
250		// 	return false;
251		// }
252       
253
254	
255		setTimeout(function() {
256			  button.removeClass('loading');
257			  $('.time-picker,.time-slots-dropdown,.date-picker-listing-rental').removeClass('bounce');
258			  
259		}, 3000);
260
261		try {
262			if ( freeplaces > 0 ) 
263			{
264
265					// preparing data for ajax
266					var startDataSql = moment( $('#date-picker').data('daterangepicker').startDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
267					var endDataSql = moment( $('#date-picker').data('daterangepicker').endDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
268			
269					var ajax_data = {
270						'listing_type' : $('#listing_type').val(),
271						'listing_id' : 	$('#listing_id').val()
272						//'nonce': nonce		
273					};
274					var invalid = false;
275					if ( startDataSql ) ajax_data.date_start = startDataSql;
276					if ( endDataSql ) ajax_data.date_end = endDataSql;
277					if ( $('input#slot').val() ) ajax_data.slot = $('input#slot').val();
278					if ( $('.time-picker#_hour').val() ) ajax_data._hour = $('.time-picker#_hour').val();
279					if ( $('.time-picker#_hour_end').val() ) ajax_data._hour_end = $('.time-picker#_hour_end').val();
280					if ( $('.adults').val() ) ajax_data.adults = $('.adults').val();
281					if ( $('.childrens').val() ) ajax_data.childrens = $('.childrens').val();
282					if ( $('#tickets').val() ) ajax_data.tickets = $('#tickets').val();
283					if ( $('#coupon_code').val() ) ajax_data.coupon = $('#coupon_code').val();
284
285					if ( $('#listing_type').val() == 'service' ) {
286						
287						if( $('input#slot').val() == undefined || $('input#slot').val() == '' ) {
288							inputClicked = false;
289							invalid = true;
290						}
291						if( $('.time-picker').length  ) {
292							
293							invalid = false;
294						}
295					}
296					
297					if(invalid == false) {
298
299						var services = [];
300	 					// $.each($("input[name='_service[]']:checked"), function(){            
301	      //           		services.push($(this).val());
302	      //       		});
303	            		$.each($("input.bookable-service-checkbox:checked"), function(){   
304							var quantity = $(this).parent().find('input.bookable-service-quantity').val();
305				    		services.push({"service" : $(this).val(), "value" : quantity});
306						});
307	            		ajax_data.services = services;
308						$('input#booking').val( JSON.stringify( ajax_data ) );
309						$('#form-booking').submit();
310					
311
312					}
313
314			} 
315		} catch (e) {
316			console.log(e);
317		}
318
319		if ( $('#listing_type').val() == 'event' )
320		{
321			
322			var ajax_data = {
323				'listing_type' : $('#listing_type').val(),
324				'listing_id' : 	$('#listing_id').val(),
325				'date_start' : $('.booking-event-date span').html(),
326				'date_end' : $('.booking-event-date span').html(),
327				//'nonce': nonce		
328			};
329			if ( $('#coupon_code').val() ) ajax_data.coupon = $('#coupon_code').val();
330			var services = [];
331			$.each($("input.bookable-service-checkbox:checked"), function(){   
332				var quantity = $(this).parent().find('input.bookable-service-quantity').val();
333	    		services.push({"service" : $(this).val(), "value" : quantity});
334			});
335    		ajax_data.services = services;
336			
337			// converent data
338			ajax_data['date_start'] = moment(ajax_data['date_start'], wordpress_date_format.date).format('YYYY-MM-DD');
339			ajax_data['date_end'] = moment(ajax_data['date_end'], wordpress_date_format.date).format('YYYY-MM-DD');
340			if ( $('#tickets').val() ) ajax_data.tickets = $('#tickets').val();
341			$('input#booking').val( JSON.stringify( ajax_data ) );
342			
343			$('#form-booking').submit();
344			
345		}
346		
347	});
348
349	if(Boolean(listeo_core.clockformat)){
350		var dateformat_even = wordpress_date_format.date+' HH:mm';
351	} else {
352		var dateformat_even = wordpress_date_format.date+' hh:mm A';
353	}
354
355
356	function updateCounter() {
357	    var len = $(".bookable-services input[type='checkbox']:checked").length;
358	    if(len>0){
359	    	$(".booking-services span.services-counter").text(''+len+'');
360	    	$(".booking-services span.services-counter").addClass('counter-visible');
361	    } else{
362	    	$(".booking-services span.services-counter").removeClass('counter-visible');
363	    	$(".booking-services span.services-counter").text('0');
364	    }
365	}
366
367	$('.single-service').on('click', function() {
368		updateCounter();
369		$(".booking-services span.services-counter").addClass("rotate-x");
370
371		setTimeout(function() {
372			$(".booking-services span.services-counter").removeClass("rotate-x");
373		}, 300);
374	});
375	
376
377	// $( ".input-datetime" ).each(function( index ) {
378	// 	var $this = $(this);
379	// 	var input = $(this).next('input');
380	//   	var date =  parseInt(input.val());	
381	//   	if(date){
382	// 	  	var a = new Date(date);
383	// 		var timestamp = moment(a);
384	// 		$this.val(timestamp.format(dateformat_even));	
385	//   	}
386		
387	// });
388	
389	//$('#_event_date').val(timestamp.format(dateformat_even));
390	
391	// there are two fields with id _event_date and _event_date_end, make sure the event_date_end is not before event_date
392	// $('#_event_date_end').on('change', function() {
393	// 	alert('test');
394	// 	var start_date = $('#_event_date').val();
395	// 	var end_date = $('#_event_date_end').val();
396	// 	if(end_date < start_date){
397	// 		$('#_event_date_end').val(start_date);
398	// 	}
399	// });
400
401	$('.input-datetime').daterangepicker({
402		"opens": "left",
403		// checking attribute listing type and set type of calendar
404		singleDatePicker: true, 
405		timePicker: true,
406		autoUpdateInput: false,
407		timePicker24Hour: Boolean(listeo_core.clockformat),
408		minDate: moment().subtract(0, 'days'),
409		
410		locale: {
411			format 			: dateformat_even,
412
413			"firstDay"		: parseInt(wordpress_date_format.day),
414			"applyLabel"	: listeo_core.applyLabel,
415	        "cancelLabel"	: listeo_core.cancelLabel,
416	        "fromLabel"		: listeo_core.fromLabel,
417	        "toLabel"		: listeo_core.toLabel,
418	        "customRangeLabel": listeo_core.customRangeLabel,
419	        "daysOfWeek": [
420		            listeo_core.day_short_su,
421		            listeo_core.day_short_mo,
422		            listeo_core.day_short_tu,
423		            listeo_core.day_short_we,
424		            listeo_core.day_short_th,
425		            listeo_core.day_short_fr,
426		            listeo_core.day_short_sa
427	        ],
428	        "monthNames": [
429	            listeo_core.january,
430	            listeo_core.february,
431	            listeo_core.march,
432	            listeo_core.april,
433	            listeo_core.may,
434	            listeo_core.june,
435	            listeo_core.july,
436	            listeo_core.august,
437	            listeo_core.september,
438	            listeo_core.october,
439	            listeo_core.november,
440	            listeo_core.december,
441	        ],
442	  	},
443	  
444	  	
445	});
446
447	$('.input-datetime').on('apply.daterangepicker', function(ev, picker) {
448    	$(this).val(picker.startDate.format(dateformat_even));
449		var end_date = $("#_event_date_end").length;
450		if(end_date){
451		$(".input-datetime#_event_date_end").data("daterangepicker").setMinDate(picker.startDate.format(dateformat_even));
452		}
453	
454  });
455
456	$('.input-datetime').on('cancel.daterangepicker', function(ev, picker) {
457	    $(this).val('');
458	});
459
460	
461	$('.input-date').daterangepicker({
462		"opens": "left",
463		// checking attribute listing type and set type of calendar
464		singleDatePicker: true, 
465		timePicker: false,
466		autoUpdateInput: false,
467		
468		minDate: moment().subtract(0, 'days'),
469		
470		locale: {
471			format 			: dateformat_even,
472			"firstDay"		: parseInt(wordpress_date_format.day),
473			"applyLabel"	: listeo_core.applyLabel,
474	        "cancelLabel"	: listeo_core.cancelLabel,
475	        "fromLabel"		: listeo_core.fromLabel,
476	        "toLabel"		: listeo_core.toLabel,
477	        "customRangeLabel": listeo_core.customRangeLabel,
478	        "daysOfWeek": [
479		            listeo_core.day_short_su,
480		            listeo_core.day_short_mo,
481		            listeo_core.day_short_tu,
482		            listeo_core.day_short_we,
483		            listeo_core.day_short_th,
484		            listeo_core.day_short_fr,
485		            listeo_core.day_short_sa
486	        ],
487	        "monthNames": [
488	            listeo_core.january,
489	            listeo_core.february,
490	            listeo_core.march,
491	            listeo_core.april,
492	            listeo_core.may,
493	            listeo_core.june,
494	            listeo_core.july,
495	            listeo_core.august,
496	            listeo_core.september,
497	            listeo_core.october,
498	            listeo_core.november,
499	            listeo_core.december,
500	        ],
501	  	},
502	  
503	  	
504	});
505
506	$('.input-date').on('apply.daterangepicker', function(ev, picker) {
507      	$(this).val(picker.startDate.format('YYYY-MM-DD'));
508	});
509
510	$('.input-date').on('cancel.daterangepicker', function(ev, picker) {
511	    $(this).val('');
512	});
513	// $('.input-datetime').on( 'apply.daterangepicker', function(){
514		
515	// 	var picked_date = $(this).val();
516	// 	var input = $(this).next('input');
517	// 	input.val(moment(picked_date,dateformat_even).format('YYYY-MM-DD HH:MM:SS'));
518	// } );
519
520	function wpkGetThisDateSlots( date ) {
521
522		var slots = {
523			isFirstSlotTaken: false,
524			isSecondSlotTaken: false
525		}
526		
527		if ( $( '#listing_type' ).val() == 'event' )
528			return slots;
529		
530		if ( typeof disabledDates !== 'undefined' ) {
531			if ( wpkIsDateInArray( date, disabledDates ) ) {
532				slots.isFirstSlotTaken = slots.isSecondSlotTaken = true;
533				return slots;
534			}
535		}
536
537		if ( typeof wpkStartDates != 'undefined' && typeof wpkEndDates != 'undefined' ) {
538			slots.isSecondSlotTaken = wpkIsDateInArray( date, wpkStartDates );
539			slots.isFirstSlotTaken = wpkIsDateInArray( date, wpkEndDates );
540		}
541		//console.log(slots);
542		return slots;
543
544	}
545
546	function wpkIsDateInArray( date, array ) {
547		return jQuery.inArray( date.format("YYYY-MM-DD"), array ) !== -1;
548	}
549
550let startDate = Cookies.get("listeo_rental_startdate");
551let endDate = Cookies.get("listeo_rental_enddate");
552let minSpan = $("#date-picker").data("minspan");
553let maxSpan = $("#date-picker").data("maxspan");
554
555let daterangepicker_options = {
556    opens: "left",
557    // checking attribute listing type and set type of calendar
558    singleDatePicker:
559      $("#date-picker").data("listing_type") == "rental" ? false : true,
560    timePicker: false,
561    minDate: moment().subtract(0, "days"),
562    minSpan: { days: minSpan },
563    startDate: startDate ? startDate : moment(),
564    endDate: endDate ? endDate : moment().add(minSpan, "days"),
565    locale: {
566      format: wordpress_date_format.date,
567      firstDay: parseInt(wordpress_date_format.day),
568      applyLabel: listeo_core.applyLabel,
569      cancelLabel: listeo_core.cancelLabel,
570      fromLabel: listeo_core.fromLabel,
571      toLabel: listeo_core.toLabel,
572      customRangeLabel: listeo_core.customRangeLabel,
573      daysOfWeek: [
574        listeo_core.day_short_su,
575        listeo_core.day_short_mo,
576        listeo_core.day_short_tu,
577        listeo_core.day_short_we,
578        listeo_core.day_short_th,
579        listeo_core.day_short_fr,
580        listeo_core.day_short_sa,
581      ],
582      monthNames: [
583        listeo_core.january,
584        listeo_core.february,
585        listeo_core.march,
586        listeo_core.april,
587        listeo_core.may,
588        listeo_core.june,
589        listeo_core.july,
590        listeo_core.august,
591        listeo_core.september,
592        listeo_core.october,
593        listeo_core.november,
594        listeo_core.december,
595      ],
596    },
597
598    isCustomDate: function (date) {
599      var slots = wpkGetThisDateSlots(date);
600
601      if (!slots.isFirstSlotTaken && !slots.isSecondSlotTaken) return [];
602
603      if (slots.isFirstSlotTaken && !slots.isSecondSlotTaken) {
604        return ["first-slot-taken"];
605      }
606
607      if (slots.isSecondSlotTaken && !slots.isFirstSlotTaken) {
608        return ["second-slot-taken"];
609      }
610    },
611
612    isInvalidDate: function (date) {
613      // working only for rental
614
615      if ($("#listing_type").val() == "event") return false;
616      if (
617        $("#listing_type").val() == "service" &&
618        typeof disabledDates != "undefined"
619      ) {
620        if (jQuery.inArray(date.format("YYYY-MM-DD"), disabledDates) !== -1)
621          return true;
622      }
623
624      if ($(".time-slots-dropdown").length) {
625        var timeslotdays = $(".time-slots-dropdown")
626          .data("slots-days")
627          .toString();
628
629        var timeslotdaysArray = timeslotdays.split(",");
630        // O is sunday in moment, monday in slot
631        if (timeslotdaysArray.includes(moment(date).day().toString())) {
632        
633          return false;
634        } else {
635          
636          return true;
637        }
638      }
639
640      if ($("#listing_type").val() == "rental") {
641        var slots = wpkGetThisDateSlots(date);
642
643        return slots.isFirstSlotTaken && slots.isSecondSlotTaken;
644      }
645    },
646  };
647  
648 
649  
650	$("#date-picker").daterangepicker(daterangepicker_options);
651
652	$('#date-picker').on('show.daterangepicker', function(ev, picker) {
653
654        $('.daterangepicker').addClass('calendar-visible calendar-animated');
655        $('.daterangepicker').removeClass('calendar-hidden');
656    });
657    $('#date-picker').on('hide.daterangepicker', function(ev, picker) {
658    	
659        $('.daterangepicker').removeClass('calendar-visible');
660        $('.daterangepicker').addClass('calendar-hidden');
661	});
662
663	function calculate_price(){
664		
665		var ajax_data = {
666			'action': 'calculate_price', 
667			'listing_type' : $('#date-picker').data('listing_type'),
668			'listing_id' : 	$('input#listing_id').val(),
669			'tickets' : 	$('input#tickets').val(),
670			'coupon' : 	$('input#coupon_code').val(),
671			//'nonce': nonce		
672		};
673		var services = [];
674
675		$.each($("input.bookable-service-checkbox:checked"), function(){   
676			var quantity = $(this).parent().find('input.bookable-service-quantity').val();
677    		services.push({"service" : $(this).val(), "value" : quantity});
678		});
679		ajax_data.services = services;
680		$.ajax({
681            type: 'POST', dataType: 'json',
682			url: listeo.ajaxurl,
683			data: ajax_data,
684			
685            success: function(data){
686
687						$('#negative-feedback').fadeOut();
688						$('a.book-now').removeClass('inactive');
689						if(data.data.price) {
690							if(listeo_core.currency_position=='before'){
691								$('.booking-estimated-cost span').html(listeo_core.currency_symbol+' '+data.data.price);	
692								
693							} else {
694								$('.booking-estimated-cost span').html(data.data.price+' '+listeo_core.currency_symbol);	
695							}
696							$('.booking-estimated-cost').data('price',data.data.price)
697							$('.booking-estimated-cost').fadeIn();
698						}
699						if(data.data.price_discount) {
700							if(listeo_core.currency_position=='before'){
701								$('.booking-estimated-discount-cost span').html(listeo_core.currency_symbol+' '+data.data.price_discount);	
702							} else {
703								$('.booking-estimated-discount-cost span').html(data.data.price_discount+' '+listeo_core.currency_symbol);	
704							}
705							$('.booking-estimated-cost').addClass('estimated-with-discount');
706							$('.booking-estimated-discount-cost').fadeIn();
707
708						} else {
709							$('.booking-estimated-cost').removeClass('estimated-with-discount');
710							$('.booking-estimated-discount-cost').fadeOut();
711						}
712            }
713        });
714	}
715
716	function calculate_booking_form_price() {
717		var ajax_data = {
718			'action'		:   'listeo_calculate_booking_form_price', 
719			'coupon' 		: 	$('input#coupon_code').val(),
720			'price' 		: 	$('li.total-costs').data('price'),
721		}
722
723		$.ajax({
724            type: 'POST', dataType: 'json',
725			url: listeo.ajaxurl,
726			data: ajax_data,
727			
728            success: function(data){
729						
730						if(data.price >= 0) {
731							
732							if(listeo_core.currency_position=='before'){
733								$('.total-discounted_costs span').html(listeo_core.currency_symbol+' '+data.price);	
734							} else {
735								$('.total-discounted_costs span').html(data.price+' '+listeo_core.currency_symbol);	
736							}
737							
738							$('.total-discounted_costs').fadeIn();
739							$('.total-costs').addClass('estimated-with-discount');
740
741						} else {
742							$('.total-discounted_costs ').fadeOut();
743							$('.total-costs').removeClass('estimated-with-discount');
744						}
745            }
746        });
747
748	};
749	
750	// function when checking booking by widget
751	function check_booking() 
752	{
753		inputClicked = true;
754		if ( is_open === false ) return 0;
755		
756		// if we not deal with services with slots or opening hours
757		if ( $('#date-picker').data('listing_type') == 'service' && 
758		! $('input#slot').val() && ! $('.time-picker').val() ) 
759		{
760			$('#negative-feedback').fadeIn();
761			
762			return;
763		}
764		
765		Cookies.set('listeo_rental_startdate', $('#date-picker').data('daterangepicker').startDate.format(wordpress_date_format.date));
766        Cookies.set('listeo_rental_enddate',  $('#date-picker').data('daterangepicker').endDate.format(wordpress_date_format.date));
767
768		var startDataSql = moment( $('#date-picker').data('daterangepicker').startDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
769		var endDataSql = moment( $('#date-picker').data('daterangepicker').endDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
770		
771		//console.log($('#date-picker').data('daterangepicker').startDate);
772		
773		// preparing data for ajax
774		var ajax_data = {
775			'action': 'check_avaliabity', 
776			'listing_type' : $('#date-picker').data('listing_type'),
777			'listing_id' : 	$('input#listing_id').val(),
778			'coupon' : 	$('input#coupon_code').val(),
779			'date_start' : startDataSql,
780			'date_end' : endDataSql,
781			//'nonce': nonce		
782		};
783		var services = [];
784		// $.each($("input.bookable-service-checkbox:checked"), function(){            
785  //   		services.push($(this).val());
786		// });
787		// $.each($("input.bookable-service-quantity"), function(){            
788  //   		services.push($(this).val());
789		// });
790		$.each($("input.bookable-service-checkbox:checked"), function(){   
791			var quantity = $(this).parent().find('input.bookable-service-quantity').val();
792    		services.push({"service" : $(this).val(), "value" : quantity});
793		});
794	
795		ajax_data.services = services;
796		
797		if ( $('input#slot').val() ) ajax_data.slot = $('input#slot').val();
798		if ( $('input.adults').val() ) ajax_data.adults = $('input.adults').val();
799		if ( $('.time-picker').val() ) ajax_data.hour = $('.time-picker').val();
800		if ( $(".time-picker-end-hour").val()) ajax_data.end_hour = $(".time-picker-end-hour").val();
801		
802
803		// loader class
804		$('a.book-now').addClass('loading');
805		$('a.book-now-notloggedin').addClass('loading');
806
807		$.ajax({
808            type: 'POST', dataType: 'json',
809			url: listeo.ajaxurl,
810			data: ajax_data,
811			
812            success: function(data){
813
814				// loader clas
815				if (data.success == true && ( ! $(".time-picker").length || is_open != false ) ) {
816                   if ( data.data.free_places > 0) {
817                   		$('a.book-now,a.book-now-notloggedin').data('freeplaces',data.data.free_places);
818						$('.booking-error-message').fadeOut();
819						$('a.book-now').removeClass('inactive');
820						if(data.data.price) {
821							if(listeo_core.currency_position=='before'){
822								$('.booking-estimated-cost span').html(listeo_core.currency_symbol+' '+data.data.price);	
823							} else {
824								$('.booking-estimated-cost span').html(data.data.price+' '+listeo_core.currency_symbol);	
825							}
826							$('.booking-estimated-cost').data('price',data.data.price)
827							$('.booking-estimated-cost').fadeIn();
828						} else {
829							$('.booking-estimated-cost span').html( '0 '+listeo_core.currency_symbol);	
830							$('.booking-estimated-cost').fadeOut();
831						}
832						if(data.data.price_discount) {
833							if(listeo_core.currency_position=='before'){
834								$('.booking-estimated-discount-cost span').html(listeo_core.currency_symbol+' '+data.data.price_discount);	
835							} else {
836								$('.booking-estimated-discount-cost span').html(data.data.price_discount+' '+listeo_core.currency_symbol);	
837							}
838							$('.booking-estimated-cost').addClass('estimated-with-discount');
839							$('.booking-estimated-discount-cost').fadeIn();
840
841						} else {
842							$('.booking-estimated-cost').removeClass('estimated-with-discount');
843							$('.booking-estimated-discount-cost').fadeOut();
844						}
845						validate_coupon($('input#listing_id').val(),data.data.price);
846						$('.coupon-widget-wrapper').fadeIn();
847				   } else {
848				   		$('a.book-now,a.book-now-notloggedin').data('freeplaces',0);
849						$('.booking-error-message').fadeIn();
850						
851						$('.booking-estimated-cost').fadeOut();
852
853						$('.booking-estimated-cost span').html('');
854
855					}
856                } else {
857                	$('a.book-now,a.book-now-notloggedin').data('freeplaces',0);
858					$('.booking-error-message').fadeIn();
859					
860					$('.booking-estimated-cost').fadeOut();
861		   		}
862		   		$('a.book-now').removeClass('loading');
863		   		$('a.book-now-notloggedin').removeClass('loading');
864            }
865		});
866
867	}
868
869	var is_open = true;
870	var lastDayOfWeek;
871
872
873
874
875	// update slots and check hours setted to this day
876	function update_booking_widget () 
877	{
878
879		// function only for services
880		if ( $('#date-picker').data('listing_type') != 'service') return;
881		
882		$('a.book-now').addClass('loading');
883		$('a.book-now-notloggedin').addClass('loading');
884		// get day of week
885		
886		var date = $('#date-picker').data('daterangepicker').endDate._d;
887		var dayOfWeek = date.getDay() - 1;
888		
889	
890		if(date.getDay() == 0){
891			dayOfWeek = 6;
892		}
893		
894
895		var startDataSql = moment( $('#date-picker').data('daterangepicker').startDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
896		var endDataSql = moment( $('#date-picker').data('daterangepicker').endDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
897			
898		var ajax_data = {
899			'action'		: 'update_slots', 
900			'listing_id' 	: $('input#listing_id').val(),
901			'date_start' 	: startDataSql,
902			'date_end' 		: endDataSql,
903			'slot'			: dayOfWeek
904			//'nonce': nonce		
905		};
906
907		$.ajax({
908            type: 'POST', dataType: 'json',
909			url: listeo.ajaxurl,
910			data: ajax_data,
911			
912			
913            success: function(data){
914            	
915				$('.time-slots-dropdown .panel-dropdown-scrollable').html(data.data);
916
917				// reset values of slot selector
918				if ( dayOfWeek != lastDayOfWeek)
919				{
920				
921					$( '.panel-dropdown-scrollable .time-slot input' ).prop("checked", false);
922					
923					$('.panel-dropdown.time-slots-dropdown input#slot').val('');
924					$('.panel-dropdown.time-slots-dropdown a').html( $('.panel-dropdown.time-slots-dropdown a').attr('placeholder') );
925					$(' .booking-estimated-cost span').html(' ');
926
927				}
928
929				lastDayOfWeek = dayOfWeek;
930	
931				if ( ! $( '.panel-dropdown-scrollable .time-slot[day=\'' + dayOfWeek + '\']' ).length ) 
932				{
933					
934					$( '.no-slots-information' ).show();
935					$('.panel-dropdown.time-slots-dropdown a').html( $( '.no-slots-information' ).html() );
936
937				}
938					else  
939				{
940					
941					// when we dont have slots for this day reset cost and show no slots
942					$( '.no-slots-information' ).hide();
943					$('.panel-dropdown.time-slots-dropdown a').html( $('.panel-dropdown.time-slots-dropdown a').attr('placeholder') );
944					$(' .booking-estimated-cost span').html(' ');
945					
946
947				}
948				// show only slots for this day
949				$( '.panel-dropdown-scrollable .time-slot' ).hide( );
950				
951				$( '.panel-dropdown-scrollable .time-slot[day=\'' + dayOfWeek + '\']' ).show( );
952				$(".time-slot").each(function() {
953					var timeSlot = $(this);
954					$(this).find('input').on('change',function() {
955						
956						var timeSlotVal = timeSlot.find("strong").text();
957						var slotArray = [timeSlot.find("strong").text(), timeSlot.find("input").val()];
958						
959						
960						$('.panel-dropdown.time-slots-dropdown input#slot').val( JSON.stringify( slotArray ) );
961				
962						$('.panel-dropdown.time-slots-dropdown a').html(timeSlotVal);
963						
964							$(".panel-dropdown").removeClass("active");
965
966						check_booking();
967					});
968				});
969				$('a.book-now').removeClass('loading');
970				$('a.book-now-notloggedin').removeClass('loading');
971            }
972        });
973		
974
975		// check if opening days are active
976		if ( $(".time-picker").length ) {
977			if(availableDays){
978
979
980				if ( availableDays[dayOfWeek].opening == 'Closed' || availableDays[dayOfWeek].closing == 'Closed') 
981				{
982
983					$('#negative-feedback').fadeIn();
984
985					//$('a.book-now').css('background-color','grey');
986					
987					is_open = false;
988					//console.log('zamkniete tego dnia' + dayOfWeek);
989					return;
990				}
991
992				// converent hours to 24h format
993				var opening_hour = moment( availableDays[dayOfWeek].opening, ["h:mm A"]).format("HH:mm");
994				var closing_hour = moment( availableDays[dayOfWeek].closing, ["h:mm A"]).format("HH:mm");
995
996
997				// get hour in 24 format
998				var current_hour = $('.time-picker').val();
999
1000
1001				// check if currer hour bar is open
1002				if ( current_hour >= opening_hour && current_hour <= closing_hour) 
1003				{
1004
1005					is_open = true;
1006					$('#negative-feedback').fadeOut();
1007					$('a.book-now').attr('href','#').css('background-color','#f30c0c');
1008					check_booking()
1009					//console.log('otwarte' + dayOfWeek);
1010					
1011
1012				} else {
1013					
1014					is_open = false;
1015					$('#negative-feedback').fadeIn();
1016					//$('a.book-now').attr('href','#').css('background-color','grey');
1017					$('.booking-estimated-cost span').html('');
1018					//console.log('zamkniete');
1019
1020				}
1021			}
1022		}
1023	}
1024
1025	// if slots exist update them
1026	if ( $( '.time-slot' ).length ) { update_booking_widget(); }
1027	
1028	// show only services for actual day from datapicker
1029	$( '#date-picker' ).on( 'apply.daterangepicker', update_booking_widget );
1030	$( '#date-picker' ).on( 'change', function(){
1031		check_booking();
1032	//	update_booking_widget();
1033	});
1034
1035
1036	// when slot is selected check if there are avalible bookings
1037	$( '#date-picker' ).on( 'apply.daterangepicker', check_booking );
1038	$( '#date-picker' ).on( 'cancel.daterangepicker', check_booking );
1039	
1040	$(document).on("change", 'input#slot,input.adults, input.bookable-service-quantity, .form-booking-service input.bookable-service-checkbox,.form-booking-rental input.bookable-service-checkbox', function(event) {
1041		check_booking();
1042	}); 
1043	//$('input#slot').on( 'change', check_booking );
1044	
1045	$('input#tickets,.form-booking-event input.bookable-service-checkbox').on('change',function(e){
1046		//check_booking();
1047		calculate_price();
1048	});
1049
1050
1051	// hours picker
1052	if ( $(".time-picker").length ) {
1053		var time24 = false;
1054		
1055		if(listeo_core.clockformat){
1056			time24 = true;
1057		}
1058		const calendars = $(".time-picker").flatpickr({
1059			enableTime: true,
1060			noCalendar: true,
1061			dateFormat: "H:i",
1062			time_24hr: time24,
1063 			disableMobile: "true",
1064 			
1065
1066			// check if there are free days on change and calculate price
1067			onClose: function(selectedDates, dateStr, instance) {
1068				update_booking_widget();
1069				check_booking();
1070			},
1071
1072		});
1073		
1074		if($('#_hour_end').length) {
1075			calendars[0].config.onClose = [() => {
1076			  setTimeout(() => calendars[1].open(), 1);
1077			}];
1078
1079			calendars[0].config.onChange = [(selDates) => {
1080			  calendars[1].set("minDate", selDates[0]);
1081			}];
1082	// 		 calendars[0].config.onChange = [
1083    //      (selDates) => {
1084    //        if (selDates[0]) {
1085    //          let minEndDate = new Date(selDates[0]);
1086    //          minEndDate.setHours(minEndDate.getHours() + 4);
1087    //          calendars[1].set("minDate", minEndDate);
1088    //        }
1089    //      },
1090    //    ];
1091
1092			calendars[1].config.onChange = [(selDates) => {
1093			  calendars[0].set("maxDate", selDates[0]);
1094			}]
1095		}	 
1096	};
1097	
1098
1099	
1100/*----------------------------------------------------*/
1101/*  Bookings Dashboard Script
1102/*----------------------------------------------------*/
1103$(".booking-services").on("click", '.qtyInc', function() {
1104	  var $button = $(this);
1105
1106      var oldValue = $button.parent().find("input").val();
1107      //console.log(oldValue);
1108      if(oldValue == 2) {
1109      	//$button.parents('.single-service').find('label').trigger('click');
1110      	$button.parents('.single-service').find('input.bookable-service-checkbox').prop("checked",true);
1111      	updateCounter();
1112      }
1113     	if($("#form-booking").hasClass('form-booking-event')){
1114			calculate_price();
1115		} else {
1116			check_booking();	
1117		}
1118      //calculate_price();
1119});
1120
1121
1122if ( $( "#booking-date-range" ).length ) {
1123
1124	// to update view with bookin
1125
1126	var bookingsOffset = 0;
1127
1128	// here we can set how many bookings per page
1129	var bookingsLimit = 5;
1130
1131	// function when checking booking by widget
1132	function listeo_bookings_manage(page) 
1133	{
1134		
1135		if($('#booking-date-range').data('daterangepicker')){
1136			var startDataSql = moment( $('#booking-date-range').data('daterangepicker').startDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
1137			var endDataSql = moment( $('#booking-date-range').data('daterangepicker').endDate, ["MM/DD/YYYY"]).format("YYYY-MM-DD");
1138	
1139		} else {
1140			var startDataSql = '';
1141			var endDataSql = '';
1142		}
1143		if(!page) { page = 1 }
1144		if (page == "prev") {
1145		var current = $("div.pagination-container li.current").data("paged");
1146		page = current-1;
1147		}
1148		if (page == "next") {
1149		var current = $("div.pagination-container li.current").data("paged");
1150		page = current+1;
1151		}
1152			
1153		
1154		// preparing data for ajax
1155		var ajax_data = {
1156			'action': 'listeo_bookings_manage', 
1157			'date_start' : startDataSql,
1158			'date_end' : endDataSql,
1159			'listing_id' : $('#listing_id').val(),
1160			'listing_status' : $('#listing_status').val(),
1161			'booking_author' : $('#booking_author').val(),
1162			'dashboard_type' : $('#dashboard_type').val(),
1163			'limit' : bookingsLimit,
1164			'offset' : bookingsOffset,
1165			'page' : page,
1166			//'nonce': nonce		
1167		};
1168
1169		
1170		// display loader class
1171		$(".dashboard-list-box").addClass('loading');
1172
1173		$.ajax({
1174            type: 'POST', dataType: 'json',
1175			url: listeo.ajaxurl,
1176			data: ajax_data,
1177			
1178            success: function(data){
1179
1180				
1181				// display loader class
1182				$(".dashboard-list-box").removeClass('loading');
1183
1184				if(data.data.html){
1185					$('#no-bookings-information').hide();
1186					$( "ul#booking-requests" ).html(data.data.html);	
1187					$( ".pagination-container" ).html(data.data.pagination);	
1188				} else {
1189					$( "ul#booking-requests" ).empty();
1190					$( ".pagination-container" ).empty();
1191					$('#no-bookings-information').show();
1192				}
1193				
1194            }
1195		});
1196
1197	}
1198
1199	     $( '#dashboard-booking-author-search' ).autocomplete({
1200	                
1201	                source: function(req, response){
1202	                    $.getJSON(
1203                        listeo_core.ajax_url +
1204                          "?callback=?&action=listeo_core_incremental_listing_suggest",
1205                        req,
1206                        response
1207                      );
1208	                },
1209	                select: function(event, ui) {
1210	                    window.location.href=ui.item.link;
1211	                },
1212	                minLength: 3,
1213	            }); 
1214
1215	// hooks for get bookings into view
1216	 $( '#booking-date-range' ).on( 'apply.daterangepicker', function(e){
1217		listeo_bookings_manage();
1218	 });
1219	 $( '#listing_id' ).on( 'change', function(e){
1220		listeo_bookings_manage();
1221	 });
1222	$( '#listing_status' ).on( 'change', function(e){
1223		listeo_bookings_manage();
1224	 });
1225	$("#booking_author").on("change", function (e) {
1226    listeo_bookings_manage();
1227  });
1228
1229	$( 'div.pagination-container').on( 'click', 'a', function(e) {
1230		e.preventDefault();
1231		
1232		var page   = $(this).parent().data('paged');
1233
1234		listeo_bookings_manage(page);
1235
1236		$( 'body, html' ).animate({
1237			scrollTop: $(".dashboard-list-box").offset().top
1238		}, 600 );
1239
1240		return false;
1241	} );
1242
1243
1244	$(document).on('click','.reject, .cancel',function(e) {
1245		e.preventDefault();
1246		if (window.confirm(listeo_core.areyousure)) {
1247			var $this = $(this);
1248			$this.parents('li').addClass('loading');
1249			var status = 'confirmed';
1250			if ( $(this).hasClass('reject' ) ) status = 'cancelled';
1251			if ( $(this).hasClass('cancel' ) ) status = 'cancelled';
1252
1253			// preparing data for ajax
1254			var ajax_data = {
1255				'action': 'listeo_bookings_manage', 
1256				'booking_id' : $(this).data('booking_id'),
1257				'status' : status,
1258				//'nonce': nonce		
1259			};
1260			$.ajax({
1261	            type: 'POST', dataType: 'json',
1262				url: listeo.ajaxurl,
1263				data: ajax_data,
1264				
1265	            success: function(data){
1266						
1267					// display loader class
1268					$this.parents('li').removeClass('loading');
1269
1270					listeo_bookings_manage();
1271					
1272	            }
1273			});
1274		}
1275	});
1276
1277	$(document).on('click','.delete',function(e) {
1278		e.preventDefault();
1279		if (window.confirm(listeo_core.areyousure)) {
1280			var $this = $(this);
1281			$this.parents('li').addClass('loading');
1282			var status = 'deleted';
1283			
1284			// preparing data for ajax
1285			var ajax_data = {
1286				'action': 'listeo_bookings_manage', 
1287				'booking_id' : $(this).data('booking_id'),
1288				'status' : status,
1289				//'nonce': nonce		
1290			};
1291			$.ajax({
1292	            type: 'POST', dataType: 'json',
1293				url: listeo.ajaxurl,
1294				data: ajax_data,
1295				
1296	            success: function(data){
1297						
1298					// display loader class
1299					$this.parents('li').removeClass('loading');
1300
1301					listeo_bookings_manage();
1302					
1303	            }
1304			});
1305		}
1306	});
1307
1308	$(document).on('click','.renew_booking',function(e) {
1309		e.preventDefault();
1310		if (window.confirm(listeo_core.areyousure)) {
1311			var $this = $(this);
1312			$this.parents('li').addClass('loading');
1313			
1314			
1315			// preparing data for ajax
1316			var ajax_data = {
1317				'action': 'listeo_bookings_renew_booking', 
1318				'booking_id' : $(this).data('booking_id'),
1319				//'nonce': nonce		
1320			};
1321			$.ajax({
1322	            type: 'POST', dataType: 'json',
1323				url: listeo.ajaxurl,
1324				data: ajax_data,
1325				
1326	            success: function(data){
1327					if(data.success) {
1328
1329					} else {
1330						alert(listeo_core.booked_dates);
1331					}
1332					// display loader class
1333					$this.parents('li').removeClass('loading');
1334
1335					listeo_bookings_manage();
1336					
1337	            }
1338			});
1339		}
1340	});
1341
1342	
1343	$(document).on('click','.approve',function(e) {
1344		e.preventDefault();
1345		var $this = $(this);
1346		$this.parents('li').addClass('loading');
1347		var status = 'confirmed';
1348		if ( $(this).hasClass('reject' ) ) status = 'cancelled';
1349		if ( $(this).hasClass('cancel' ) ) status = 'cancelled';
1350
1351		// preparing data for ajax
1352		var ajax_data = {
1353			'action': 'listeo_bookings_manage', 
1354			'booking_id' : $(this).data('booking_id'),
1355			'status' : status,
1356			//'nonce': nonce		
1357		};
1358		$.ajax({
1359            type: 'POST', dataType: 'json',
1360			url: listeo.ajaxurl,
1361			data: ajax_data,
1362			
1363            success: function(data){
1364					
1365				// display loader class
1366				$this.parents('li').removeClass('loading');
1367
1368				listeo_bookings_manage();
1369				
1370            }
1371		});
1372
1373	});
1374	$(document).on('click','.mark-as-paid',function(e) {
1375		e.preventDefault();
1376		var $this = $(this);
1377		$this.parents('li').addClass('loading');
1378		var status = 'paid';
1379		
1380		// preparing data for ajax
1381		var ajax_data = {
1382			'action': 'listeo_bookings_manage', 
1383			'booking_id' : $(this).data('booking_id'),
1384			'status' : status,
1385			//'nonce': nonce		
1386		};
1387		$.ajax({
1388            type: 'POST', dataType: 'json',
1389			url: listeo.ajaxurl,
1390			data: ajax_data,
1391			
1392            success: function(data){
1393					
1394				// display loader class
1395				$this.parents('li').removeClass('loading');
1396
1397				listeo_bookings_manage();
1398				
1399            }
1400		});
1401
1402	});
1403
1404
1405	var start = moment().subtract(30, 'days');
1406    var end = moment();
1407
1408    function cb(start, end) {
1409        $("#booking-date-range span,#chart-date-range span").html(
1410          start.format("MMMM D, YYYY") + " - " + end.format("MMMM D, YYYY")
1411        );
1412    }
1413    
1414	var ranges = new Object();
1415	ranges[listeo_core.today] = [moment().subtract(1, "days"), moment()];
1416	ranges[listeo_core.yesterday] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
1417	ranges[listeo_core.last_7_days] = [moment().subtract(6, 'days'), moment()];
1418	ranges[listeo_core.last_30_days] = [moment().subtract(29, 'days'), moment()];
1419	ranges[listeo_core.this_month] = [moment().startOf('month'), moment().endOf('month')];
1420	ranges[listeo_core.last_month] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
1421
1422    var today = listeo_core.today;
1423	
1424    $('#booking-date-range-enabler').on('click',function(e){
1425		
1426    	e.preventDefault();
1427    	$(this).hide();
1428    	cb(start, end);
1429	    $('#booking-date-range,#chart-date-range').show().daterangepicker({
1430	    	"opens": "left",
1431		    "autoUpdateInput": false,
1432		    "alwaysShowCalendars": true,
1433	        startDate: start,
1434	        endDate: end,
1435	        ranges: ranges,
1436			locale: {
1437				format: wordpress_date_format.date,
1438				"firstDay": parseInt(wordpress_date_format.day),
1439				"applyLabel"	: listeo_core.applyLabel,
1440		        "cancelLabel"	: listeo_core.cancelLabel,
1441		        "fromLabel"		: listeo_core.fromLabel,
1442		        "toLabel"		: listeo_core.toLabel,
1443		        "customRangeLabel": listeo_core.customRangeLabel,
1444		        "daysOfWeek": [
1445		            listeo_core.day_short_su,
1446		            listeo_core.day_short_mo,
1447		            listeo_core.day_short_tu,
1448		            listeo_core.day_short_we,
1449		            listeo_core.day_short_th,
1450		            listeo_core.day_short_fr,
1451		            listeo_core.day_short_sa
1452		        ],
1453		        "monthNames": [
1454		            listeo_core.january,
1455		            listeo_core.february,
1456		            listeo_core.march,
1457		            listeo_core.april,
1458		            listeo_core.may,
1459		            listeo_core.june,
1460		            listeo_core.july,
1461		            listeo_core.august,
1462		            listeo_core.september,
1463		            listeo_core.october,
1464		            listeo_core.november,
1465		            listeo_core.december,
1466		        ],
1467		  	}
1468	    }, cb).trigger('click');
1469	    cb(start, end);
1470    })
1471   
1472
1473    
1474
1475
1476    // Calendar animation and visual settings
1477    $('#booking-date-range').on('show.daterangepicker', function(ev, picker) {
1478
1479        $('.daterangepicker').addClass('calendar-visible calendar-animated bordered-style');
1480        $('.daterangepicker').removeClass('calendar-hidden');
1481    });
1482    $('#booking-date-range').on('hide.daterangepicker', function(ev, picker) {
1483    	
1484        $('.daterangepicker').removeClass('calendar-visible');
1485        $('.daterangepicker').addClass('calendar-hidden');
1486	});
1487	
1488} // end if dashboard booking
1489
1490   
1491
1492	// $('a.reject').on('click', function() {
1493		
1494	// 	console.log(picker);
1495	
1496	// });
1497	});
1498
1499})(this.jQuery);

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.