1$(document).ready(function() { 2 const MOBILE_BOOKING_BAR_SHOW_WIDTH = 767; 3 4 var topofDiv = $("#mobile-booking-bar").offset().top; //gets offset of header 5 var height = $("#mobile-booking-bar").outerHeight(); //gets height of header 6 7 checkShowBookHeader(); 8 9 10 $(window).scroll(function(){ 11 checkShowBookHeader(); 12 }); 13 14 function checkShowBookHeader(){ 15 if($(window).width() <= MOBILE_BOOKING_BAR_SHOW_WIDTH){ 16 if($(window).scrollTop() > (topofDiv + height)){ 17 $(".book-header").removeClass("d-none"); 18 } 19 else{ 20 $(".book-header").addClass("d-none"); 21 } 22 } 23 } 24 25 $("#searchholiday").click(function(){ 26 window.location.href="#mobile-booking-bar"; 27 }) 28 29 $(".booking_bar [name='destination']").on('keyup', function(ev) { 30 if(ev.key === 'Enter') { 31 DesktopSearch(); 32 } 33 }); 34 35 $(".desktop-booking-bar .search-btn").on('click', function(){ 36 DesktopSearch(); 37 }) 38 39 function DesktopSearch(){ 40 let start_date = $('.booking_bar input[name="dates"]').data('daterangepicker').startDate; 41 let end_date = $('.booking_bar input[name="dates"]').data('daterangepicker').endDate; 42 let destination_input = $(".booking_bar [name='destination']").val(); 43 let group = { 44 adults: getSearchbarAdults(), 45 children: getSearchbarChildren(), 46 dogs: getSearchbarDogs() 47 } 48 Search(start_date, end_date, destination_input, group); 49 } 50 51 $(".mobile-booking-bar .search-btn").on('click', function(){ 52 let start_date = $('.mobile-booking-bar .booking_bar input[name="dates"]').data('daterangepicker').startDate; 53 let end_date = $('.mobile-booking-bar .booking_bar input[name="dates"]').data('daterangepicker').endDate; 54 let destination_input = $(".mobile-booking-bar .booking_bar [name='destination']").val(); 55 let group = { 56 adults: getSearchbarAdults(), 57 children: getSearchbarChildren(), 58 dogs: getSearchbarDogs() 59 } 60 Search(start_date, end_date, destination_input, group); 61 }) 62 63 async function Search(start_date, end_date, destination, group){ 64 if(start_date.diff(new moment().startOf("day"), "days") < 1){ 65 Swal.fire( 66 'Error', 67 `Start date too early, you must book at least 1 day ahead`, 68 'error' 69 ) 70 return 71 } else if (end_date.diff(start_date, "days") >28){ 72 Swal.fire( 73 'Error', 74 `Max search duration is 28 days`, 75 'error' 76 ) 77 return 78 }else if (end_date.diff(start_date, "days") <= 0){ 79 Swal.fire( 80 'Error', 81 `Must select duration of at least 1 night`, 82 'error' 83 ) 84 return 85 } 86 87 const total_guests = group.adults + group.children; 88 if(total_guests > 4){ 89 let result = await Swal.fire({ 90 title: 'Large group detected', 91 text: `Would you like the whole party(${total_guests}) to be accommodated within the same cabin?`, 92 icon: 'question', 93 showCancelButton: true, 94 confirmButtonColor: '#67bb89', 95 cancelButtonColor: '#dcdcdc', 96 confirmButtonText: "Yes", 97 cancelButtonText: 'No' 98 }); 99 100 if (result.isConfirmed) { 101 CompleteSearch(start_date, end_date, destination, group, min_occupancy=total_guests) 102 }else { 103 CompleteSearch(start_date, end_date, destination, group) 104 } 105 106 }else{ 107 CompleteSearch(start_date, end_date, destination, group) 108 } 109 110 111 } 112 113 function CompleteSearch(start_date, end_date, destination, group, min_occupancy=null){ 114 Swal.fire({ 115 title: 'Searching for your next holiday', 116 html: '', 117 didOpen: () => { 118 Swal.showLoading() 119 } 120 }) 121 const updated_session = { 122 start_date: start_date.format('YYYY-MM-DD'), 123 end_date: end_date.format('YYYY-MM-DD'), 124 destination: destination, 125 group: group 126 } 127 128 $.ajax({ 129 type: 'POST', 130 url: `/session`, 131 data: JSON.stringify(updated_session), 132 datatype: "json", 133 headers: { 134 "Content-Type": "application/json" 135 }, 136 success: function(response) { 137 let bookonline_url = `/bookonline` 138 if(min_occupancy){ 139 bookonline_url += `/large-group?mo=${min_occupancy}`; 140 } 141 window.location.href = bookonline_url; 142 } 143 }); 144 } 145})
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.