1 2function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 3 4jQuery(document).ready(function ($) { 5 $is_booking_end_date_clicked = false; 6 $is_booking_end_date_calendar_open = false; 7 $ph_date_from_previous_value = ''; 8 /* 9 * js for jamaica 1 to 7 july disable for rides 10 */ 11 $("#terms_jamaica").click(function($) { 12 if(this.checked) { 13 jQuery(".single_add_to_cart_button").removeClass("disabled"); 14 }else{ 15 jQuery(".single_add_to_cart_button").addClass("disabled"); 16 } 17 }); 18 function generate_booking_info_text(from, to, cost, custom_messages, result) { 19 $('.display_time_from').val(from); 20 $('.display_time_to').val(to); 21 if ($('#calender_type').val() == 'date' && $('#charge_per_night').length && $('#charge_per_night').val() == 'yes') { 22 from_text = phive_booking_ajax.checkin; 23 to_text = phive_booking_ajax.checkout; 24 } else { 25 from_text = phive_booking_ajax.booking; 26 to_text = phive_booking_ajax.to; 27 } 28 if (from !== to && phive_booking_ajax.display_end_time) { 29 from_date = new Date(result.org_from_date); 30 to_date = new Date(result.org_to_date); 31 if ($('#calender_type').val() != 'date' && $('#calender_type').val() != 'month' && from_date.getMonth() == to_date.getMonth() && from_date.getFullYear() == to_date.getFullYear() && from_date.getDate() == to_date.getDate()) { 32 var wp_date_format = jQuery("#ph_booking_wp_time_format").val(); 33 var hours = to_date.getHours(); 34 var ampm = hours >= 12 ? 'pm' : 'am'; 35 to_time = ph_convert_time_to_wp_time_format(wp_date_format, to_date, ampm); 36 date_html = "<b>" + from_text + ":</b> " + from + " <b>" + to_text + "</b> " + to_time; 37 } 38 else { 39 date_html = "<b>" + from_text + ":</b> " + from + " <b>" + to_text + "</b> " + to; 40 } 41 42 } else { 43 date_html = "<b>" + phive_booking_ajax.booking + ":</b> " + from; 44 } //for Addon 45 46 47 jQuery('.from_text').val(from_text); 48 jQuery('.to_text').val(to_text).trigger('change'); 49 if (custom_messages == '') 50 return '<p id="booking_info_text">' + date_html + '</p> <p id="booking_price_text"> <b>' + phive_booking_ajax.booking_cost + ': </b>' + cost + '</p><p id="booking_discount_text">'+phive_booking_ajax.discount_text+'</p>'; 51 else 52 return '<p id="booking_info_text">' + date_html + '</p> <p id="booking_price_text"> <b>' + phive_booking_ajax.booking_cost + ': </b>' + cost + '</p> <p id="booking_custom_text"> ' + custom_messages + '</p>'; 53 } 54 function timezoneOffset(date_string) { 55 // passing default parameter value doesn't work in safari 56 if (date_string === undefined || !date_string) { 57 date_string = ''; 58 } 59 let date = new Date(date_string), 60 timezoneOffset = date.getTimezoneOffset(), 61 hours = ('00' + Math.floor(Math.abs(timezoneOffset / 60))).slice(-2), 62 minutes = ('00' + Math.abs(timezoneOffset % 60)).slice(-2), 63 string = (timezoneOffset >= 0 ? '-' : '+') + hours + ':' + minutes; 64 return string; 65 } 66 function ph_convert_date_to_wp_date_format(wp_format, date) { 67 68 months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
68November", "December"]; 69 new_date = new Date(date + 'T' + '00:00' + timezoneOffset(date)); 70 71 month = ("0" + (new_date.getMonth() + 1)).slice(-2); 72 date = ("0" + new_date.getDate()).slice(-2); 73 switch (wp_format) { 74 case 'j F Y': display_date = date + ' ' + phive_booking_ajax.months[new_date.getMonth()] + ' ' + new_date.getFullYear(); 75 break; 76 case 'F j, Y': display_date = phive_booking_ajax.months[new_date.getMonth()] + ' ' + date + ', ' + new_date.getFullYear(); 77 break; 78 case 'Y-m-d': display_date = new_date.getFullYear() + '-' + month + '-' + date; 79 break; 80 case 'm/d/Y': display_date = month + '/' + date + '/' + new_date.getFullYear(); 81 break; 82 case 'd/m/Y': display_date = date + '/' + month + '/' + new_date.getFullYear(); 83 break; 84 default: display_date = new_date.getFullYear() + '-' + month + '-' + date; 85 break; 86 87 } 88 return display_date; 89 } 90 function ph_convert_time_to_wp_time_format(wp_format, date, am_pm) { 91 var hours = date.getHours(); 92 var minutes = date.getMinutes(); 93 wp_format = wp_format + ""; 94 switch (wp_format) { 95 case "g:i a": 96 hours = hours % 12; 97 hours = hours ? hours : 12; // the hour '0' should be '12' 98 minutes = minutes < 10 ? '0' + minutes : minutes; 99 display_time = hours + ':' + minutes + ' ' + am_pm.toLowerCase(); 100 break; 101 case "g:i A": 102 hours = hours % 12; 103 hours = hours ? hours : 12; // the hour '0' should be '12' 104 minutes = minutes < 10 ? '0' + minutes : minutes; 105 display_time = hours + ':' + minutes + ' ' + am_pm.toUpperCase(); 106 break; 107 case "H:i": 108 hours = hours.toString().padStart(2, 0); 109 minutes = minutes.toString().padStart(2, 0); 110 display_time = hours + ':' + minutes; 111 break; 112 case "G \\h i \\m\\i\\n": 113 display_time = hours + ' h ' + minutes + ' min'; 114 break; 115 default: 116 hours = hours % 12; 117 hours = hours ? hours : 12; // the hour '0' should be '12' 118 minutes = minutes < 10 ? '0' + minutes : minutes; 119 display_time = hours + ':' + minutes + ' ' + am_pm.toUpperCase(); 120 break; 121 122 } 123 return display_time; 124 } 125 function resetSelection(fullReset) { 126 fullReset = fullReset || 'yes'; 127 date_from = ''; 128 date_to = ''; 129 click = 0; 130 $(".single_add_to_cart_button").addClass("disabled"); 131 $(".selected-date").each(function () { 132 $(this).removeClass("selected-date"); 133 }); 134 135 136 $(".ph-date-from").val(""); 137 $(".ph-date-to").val(""); 138 $('.element_from').val(""); 139 $('.element_to').val(""); 140 $('.element_from_date').val(""); 141 $('.element_from_time').val(""); 142 $('.element_to_date').val(""); 143 $('.element_to_time').val(""); 144 145 if (fullReset == 'yes') { 146 $(".booking-info-wraper").html(""); 147 } 148 149 if ($(".not-startable").length) { 150 $(".not-startable").removeClass("hide-not-startable"); 151 } 152 } 153 /*function formate_date( input_date ){ 154 var date = new Date( input_date.replace(/-/g, "/") ); //Safari bowser will accept only with seprator '/' 155 156 var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 157 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][date.getMonth()]; 158 var strDate = date.getDate() + '-' + month + '-' + date.getFullYear(); 159 if( $("#calender_type").val() =='time' ){ 160 strDate += " "; 161 strDate += date.getHours()<10 ? "0"+date.getHours() : date.getHours(); 162 strDate += ":" 163 strDate += date.getMinutes()<10 ? "0"+date.getMinutes() : date.getMinutes(); 164 } 165 return strDate; 166 }*/ 167 // Calculate the booking price. 168 169 /* On click Checkbox for private guide */ 170 jQuery(document).on('click', "#private_guide_click", function () { 171 console.log($(this).is(":checked")); 172 if($(this).is(":checked")){ 173 $('#private_guide').val(1); 174 from = jQuery(".ph-date-from").val(); 175 if (from != '') { 176 calculate_booking_price(); 177 } 178 }else{ 179 $('#private_guide').val(0); 180 from = jQuery(".ph-date-from").val(); 181 if (from != '') { 182 calculate_booking_price(); 183 } 184 } 185}); 186 187 jQuery(document).on('change', ".ph-date-to", function () { 188 calculate_booking_price(); 189 }); 190 jQuery(document).on('change', ".addon,.wc-pao-addon-field,.ph-addons", function () { 191 from = jQuery(".ph-date-from").val(); 192 193 if (from != '') { 194 calculate_booking_price(); 195 } 196 }); 197 198 function calculate_booking_price() { 199 if ($('.input-disabled').length || !jQuery(".ph-date-from").length) { 200 return; 201 } 202 203 /* Remove Resources when backend date not match */ 204 if($("#hide-resources").val()){ 205 var hide_resources = $("#hide-resources").val(); 206 if(hide_resources == 'yes'){ 207 var backend_resources_date_set = $("#show-resources-date").val(); 208 var selected_date = $('.timepicker-selected-date .callender-full-date').val(); 209 if(backend_resources_date_set.indexOf(selected_date) != -1){ 210 $('#want_to_display_resources_hide_or_show').show(); 211 }else{ 212 $('#want_to_display_resources_hide_or_show').hide(); 213 $('select[name="phive_book_resources_"]').val(''); 214 } 215 } 216 } 217 218 $(".shipping-price-related").addClass('input-disabled'); 219 $(".shipping-price-related").attr("disabled", true); 220 221 var loding_ico_url = $("#plugin_dir_url").val() + "/resources/icons/loading2.gif"; 222 223 $(".booking-info-wraper").html('<img class="loading-ico" align="middle" src="' + loding_ico_url + '">'); 224 $(".single_add_to_cart_button").addClass("disabled"); 225 var from = jQuery(".ph-date-from").val(); 226 var to = jQuery(".ph-date-to").val();
227 /***** Coding for hide Transportation */ 228 if($('#_phive_booking_single_resources_transport_disable_the_day_before').val() == 1){ 229 230 /* current day disable transport */ 231 var fullDate = new Date(); 232 var twoDigitMonth = ((fullDate.getMonth().length+1) === 1)? (fullDate.getMonth()+1) : '0' + (fullDate.getMonth()+1); 233 var currentDate = fullDate.getFullYear() + "-" + twoDigitMonth + "-" + ("0" + (fullDate.getDate() )).slice(-2); 234 var currentTime = fullDate.getHours()+ ":" + fullDate.getMinutes()+ ":" +fullDate.getSeconds(); 235 /* next day disable transport before 5 pm jamaica*/ 236 var fullDatejamaica = new Date(Date.UTC(fullDate.getFullYear(), fullDate.getMonth(), fullDate.getDate(), fullDate.getHours(), fullDate.getMinutes(), fullDate.getSeconds())); 237 var aryIannaTimeZones = [ 238 'America/Jamaica', 239 ]; 240 241 let date = new Date; 242 243 aryIannaTimeZones.forEach((timeZone) => { 244 245 let jamaicastrTime = date.toLocaleString("en-US", { 246 timeZone: `${timeZone}` 247 }); 248 249 jamaicastrTime = jamaicastrTime.replace(",", ""); 250 var jamaicastrTimecurrt = new Date(jamaicastrTime); 251 252 var endTime = $('#close_transport_booking_time').val(); 253 254 if(endTime){ 255 endTime = "16:30:00"; 256 } 257 if( jQuery('body').hasClass('iphone')){ 258 var jamaicastrTimeExp = new Date(fullDate.getFullYear(), fullDate.getMonth(), ("0" + (fullDate.getDate() )).slice(-2), 16, 00, 00); 259 console.log("loading for iphone only "+ jamaicastrTimeExp); 260 }else{ 261 var jamaicastrTimeExp = new Date(currentDate +" " + endTime); //24 july 12 am 262 } 263 264 var today = new Date(); 265 var tomorrow = new Date(); 266 tomorrow.setDate(today.getDate() + 1); 267 268 var tomorrowmonth = tomorrow.getMonth() + 1; 269 tomorrowmonth = tomorrowmonth < 10 ? '0' + tomorrowmonth : '' + tomorrowmonth; 270 271 var tomorrowdate = tomorrow.getDate(); 272 tomorrowdate = tomorrowdate < 10 ? '0' + tomorrowdate : '' + tomorrowdate; 273 274 var selecttomorrow =tomorrow.getFullYear() + '-' + tomorrowmonth + '-' + tomorrowdate; 275 276 // current time jamaica 277 if ((jamaicastrTimecurrt > jamaicastrTimeExp) && to == selecttomorrow){ 278 // next day trasport disable 279 $('.transfer-with-extra-main-wrapper').hide(); 280 $(".multi-option-transport option").prop("selected", false); 281 }else if(currentDate == to){ 282 // current day trasport disable. 283 $('.transfer-with-extra-main-wrapper').hide(); 284 $(".multi-option-transport option").prop("selected", false); 285 }else{ 286 // open transport for rest day. 287 $('.transfer-with-extra-main-wrapper').show(); 288 } 289 }); 290 } 291 292 /***** End Coding for hide Transportation */ 293 var person_details = []; 294 $('.input-person').each(function () { 295 if ($(this).val() != '') person_details.push(parseInt($(this).val())); else person_details.push(0); 296 }); // for range values select min available slot 297 298 var available_slots = $('.selected-date').map(function () { 299 var attr = $(this).attr('data-title'); 300 301 if (_typeof(attr) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined)) && attr !== false) { 302 return parseInt($(this).attr('data-title')); 303 } else { 304 if ($(this).text() == '' || ($(".selected-date").last().find('.callender-full-date').val() == $(this).find('.callender-full-date').val() && $('#charge_per_night').val() == 'yes')) return; // If try to book between months or per night booking and Consider each participant as booking is marked 305 return 0; 306 } 307 }).get(); 308 var available_slot = Math.min.apply(Math, available_slots); // for range values select min available slot 309 310 var available_slots_to_displays = $('.selected-date').map(function () { 311 var attr = $(this).attr('data-max'); 312 313 if (_typeof(attr) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined)) && attr !== false) { 314 return parseInt($(this).attr('data-max')); 315 } else { 316 if ($(this).text() == '') return; // If try to book between months and Consider each participant as booking is marked 317 318 return 0; 319 } 320 }).get(); 321 var available_slots_to_display = Math.min.apply(Math, available_slots_to_displays); 322 var persons_as_booking = $('#persons_as_booking').val(); 323 324 if (persons_as_booking == 'yes') { 325 person_details_count = person_details.reduce(function (a, b) { 326 return a + b; 327 }, 0); 328 329 if (person_details_count > available_slot) { 330 var message = phive_booking_ajax.available_slot_message; 331 message = message.replace('%available_slot', available_slots_to_display); 332 $('.booking-info-wraper').html('<p id="booking_info_text"><span class="not-available-msg">' + message + '</span></p>'); 333 $(".shipping-price-related").removeClass('input-disabled'); 334 $(".shipping-price-related").removeAttr("disabled"); 335 return false;
336 } 337 } 338 339 var total_numer_persons = 0; 340 $('.input-person').each(function () { 341 // total_numer_persons += parseInt($(this).val()); 342 Number.isInteger = Number.isInteger || function (value) { 343 return typeof value === 'number' && 344 isFinite(value) && 345 Math.floor(value) === value; 346 }; 347 if (Number.isInteger(parseInt($(this).val()))) { 348 total_numer_persons += parseInt($(this).val()); 349 } 350 }); 351 352 if (persons_as_booking != 'yes' && total_numer_persons > parseInt($('#phive_booking_maximum_number_of_allowed_participant').val()) && parseInt($('#phive_booking_maximum_number_of_allowed_participant').val()) != 'NaN') { 353 var message = phive_booking_ajax.maximum_participant_warning; 354 message = message.replace('%total', total_numer_persons); 355 message = message.replace('%max', parseInt($('#phive_booking_maximum_number_of_allowed_participant').val())); 356 $('.booking-info-wraper').html('<p id="booking_info_text"><span class="not-available-msg">' + message + '</span></p>'); 357 $(".shipping-price-related").removeClass('input-disabled'); 358 $(".shipping-price-related").removeAttr("disabled"); 359 return false; 360 } 361 362 // if (persons_as_booking != 'yes' && total_numer_persons < parseInt($ 363 if (total_numer_persons < parseInt($('#phive_booking_minimum_number_of_required_participant').val()) && parseInt($('#phive_booking_minimum_number_of_required_participant').val()) != 'NaN') { 364 var message = phive_booking_ajax.minimum_participant_warning; 365 // message = message.replace('%total', total_numer_persons); 366 message = message.replace('%min', parseInt($('#phive_booking_minimum_number_of_required_participant').val())); 367 $('.booking-info-wraper').html('<p id="booking_info_text"><span class="not-available-msg">' + message + '</span></p>'); 368 $(".shipping-price-related").removeClass('input-disabled'); 369 $(".shipping-price-related").removeAttr("disabled"); 370 return false; 371 } 372 if($('#phive_booking_minimum_number_of_required_transport').val() == 1){ 373 if($('.multi-option-transport').val() == ''){ 374 var message = "Transfer required for a booking"; 375 // message = message.replace('%total', total_numer_persons); 376 // message = message.replace('%min', parseInt($('#phive_booking_minimum_number_of_required_transport').val())); 377 $('.booking-info-wraper').html('<p id="booking_info_text"><span class="not-available-msg">' + message + '</span></p>'); 378 // console.log("select transfer"); 379 $(".shipping-price-related").removeClass('input-disabled'); 380 $(".shipping-price-related").removeAttr("disabled"); 381 return false; 382 } 383 } 384 resources_type = $('.resources_type').val(); 385 if (resources_type == 'single') { 386 resources_details = []; 387 selected_resources = $('.phive_book_resources').val(); 388 $(".phive_book_resources option").each(function (i) { 389 if ($(this).val() == '') 390 return true; 391 val = 'no'; 392 if (selected_resources == $(this).val()) { 393 val = 'yes'; 394 } 395 resources_details.push(val); 396 }); 397 }else if (resources_type == 'multiple-extra') { // transport 398 resources_details = []; 399 $('.input-resources').each(function () { 400 val = $(this).is(":checked") ? 'yes' : 'no'; 401 resources_details.push(val); 402 }); 403 // /* extra with plus-minus */ 404 /* aamir */ 405 var total_numer_rec = ''; 406 $('.input-resources-extra-plus-minus').each(function () { 407 /* if atv found and remain stock zero */ 408 if($('#atv_stock').val() || $('#atv_stock').val() == 0 ){ 409 var atv_stock = $('#atv_stock').val(); 410 if(atv_stock == 0 || atv_stock < 0 ){ 411 // console.log("stock remaing zero"); 412 $('#atv_ride_option').val('0'); 413 } 414 } 415 416 Number.isInteger = Number.isInteger || function (value) { 417 return typeof value === 'number' && 418 isFinite(value) && 419 Math.floor(value) === value; 420 }; 421 if (Number.isInteger(parseInt($(this).val()))) { 422 total_numer_rec += parseInt($(this).val()); 423 } 424 resources_details.push($(this).val()); 425 }); 426 selected_resources = $('.multi-option-transport').val(); 427 $(".multi-option-transport option").each(function (i) { 428 // console.log($(this).val()); 429 if ($(this).val() == '') 430 return true; 431 val = 'no'; 432 if (selected_resources == $(this).val()) { 433 val = 'yes'; 434 } 435 resources_details.push(val); 436 }); 437 }// transport-ends; 438 else { 439 resources_details = []; 440 $('.input-resources').each(function () { 441 val = $(this).is(":checked") ? 'yes' : 'no'; 442 resources_details.push(val); 443 }); 444 } 445 446 product_id = jQuery("#phive_product_id").val(); 447 448 current_product_id = product_id; 449 450 // WPML Compatibility 451 if(jQuery("#product-addons-total")) 452 { 453 current_product_id = jQuery("#product-addons-total").attr('data-product-id'); 454 // console.log('current product id : ', current_product_id); 455 } 456 457 if (from.length === 0 || to.length === 0) { 458 return; 459 } 460 461 $(".ph_booking_addon_data").val(); 462 addon_data = jQuery('.addon').serialize(); 463 if (parseInt($(".wc-pao-addon-field").length) > 0) { 464 addon_data = jQuery('.wc-pao-addon-field').serialize(); 465 } 466 product_addon_data = ''; 467 if (parseInt($(".phive-addon-field").length) > 0) { 468 product_addon_data = jQuery('.phive-addon-field').serialize(); 469 } 470 custom_time_period = ''; 471 if ($(".cutome_time_period").length > 0) { 472 custom_time_period = $(".cutome_time_period").find(':selected').val(); 473 } 474 /* IF has transport fields selected */ 475 var transport_fields = ''; 476 if(jQuery('#has_transport_has_fields').val() == 1){ 477 transport_fields = jQuery('#name_of_hotel').val(); 478 } 479 var catID = jQuery('#catID').val(); 480 481 // 482 let atv_pilot_added = ""; 483 if(jQuery('#atv_ride_option').length > 0){ 484 atv_pilot_added = jQuery('#atv_ride_option').val(); 485 } 486 487 var data = { 488 action: 'phive_get_booked_price', 489 // security : phive_booking_ajax.security, 490 product_id: product_id, 491 book_from: from, 492 book_to: to, 493 catID:catID, 494 person_details: person_details, 495 resources_details: resources_details, 496 atv_pilot_added:atv_pilot_added, 497 addon_data: addon_data, 498 product_addon_data: product_addon_data, 499 transport_fields:transport_fields, 500 asset: $(".input-assets").val(), 501 custom_fields: $(".custom_fields").val(), 502 custom_time_period: custom_time_period, 503 current_product_id: current_product_id 504 }; 505 jQuery(".ph-calendar-date").prop('disabled', true); 506 $.post(phive_booking_ajax.ajaxurl, data, function (res) { 507 result = jQuery.parseJSON(res); 508 jQuery(".ph-calendar-date").prop('disabled', false); // Confirm the response of last request. 509 // The price should updated only for last request incase another request send immediately 510 511 $(".shipping-price-related").removeClass('input-disabled'); 512 $(".shipping-price-related").removeAttr("disabled"); 513 $(".single_add_to_cart_button").removeClass("disabled"); 514 $(".callender-msg").html(''); 515 516 if (result.error_msg) { 517 if ($('#calendar_design').val() != '3') { 518 resetSelection(); 519 } 520 $('.booking-info-wraper').html(result.error_msg); 521 // $("#phive_booked_price").val(''); 522 $(".phive_booked_price").val(''); 523 // $(".phive_book_assets").val(asset); 524 } else { 525 if (to != '') { 526 var to_date_obj = new Date(to); 527 var from_date_obj = new Date(from); 528 529 //support for customise booking interval addon 530 if(custom_time_period && result.org_to_date_customise_booking_interval) 531 { 532 if(result.org_to_date_customise_booking_interval != '') 533 { 534 $('.ph-date-to').val(result.org_to_date_customise_booking_interval); 535 } 536 } 537 538 if (from_date_obj.getTime() > to_date_obj.getTime()) { 539 resetSelection(); 540 $('.booking-info-wraper').html('<p id="booking_info_text"><span class="not-available-msg">Booking start date cannot be higher than end date.</span></p>'); 541 // $("#phive_booked_price").val(''); 542 $(".phive_booked_price").val(''); 543 $(".phive_book_assets").val(''); 544 } else { 545 // $(".price").html( result.price_html ); //to change the main product price 546 // $("#phive_booked_price").val(result.price); 547 $(".phive_booked_price").val(result.price); 548 $(".phive_book_assets").val(result.asset_id); //in the case of monthpicker, take last date of 'TO' month 549 var custom_messages = ''; 550 if (result.custom_messages) { 551 custom_messages = result.custom_messages; 552 } 553 554 if (result.product_addon_data) { 555 $(".ph_booking_product_addon_data").val(result.product_addon_data); 556 } 557 558 if (result.addon_data) { 559 $(".ph_booking_addon_data").val(result.addon_data); 560 } 561 /*if( (to.match(new RegExp("-", "g")) || []).length < 2 ){ 562 var date = new Date( to.replace(/-/g, "/") ); //Safari bowser will accept only with separator '/' 563 var LastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0); 564 to = to+"-"+LastDay.getDate(); 565 }*/ 566 567 booking_info_text = generate_booking_info_text(result.from_date, result.to_date, result.price_html, custom_messages, result); 568 $('.booking-info-wraper').html(booking_info_text).trigger('change'); 569 /* restiction date for jamaica park */ 570 if(result.restrited_date == true){ 571 $(".single_add_to_cart_button").addClass("disabled"); 572 $('.booking-notice-wrapper').show(); 573 $("#terms_jamaica").prop('checked', false); 574 } 575 if(result.restrited_date == false){ 576 $('.booking-notice-wrapper').hide(); 577 } 578 // Price Get Blank 579 if(result.price == null){ 580 $(".single_add_to_cart_button").addClass("disabled"); 581 } 582 /* if found atv aviable then.. */ 583 /* result.atv_booked -> Atv booked by user on selected date. Int 584 * result.atv_system -> check true or false for check atv stock system aviable (bool) 585 * result.atv_stock -> get remain stock per day which user has selected date. 586 */ 587 // if stock is greater than zero 588 if(result.atv_system == true && result.atv_stock > 0){ 589 $('.has_atv_note').show(); 590 $('.atv_ride_option').show(); 591 $('.atv_ride_heading').show(); 592 // $('#atv_ride_option').val('0'); 593 $('#atv_stock').val(result.atv_stock); 594 $('#atv_booked').val(result.atv_booked); 595 $('#atv_trigger').val('true'); 596 if( jQuery('#atv_ride_option').val() > 0){ 597 jQuery('#payatpark input').attr('disabled', true); 598 jQuery('#payatpark input').removeAttr('checked'); 599 jQuery("#paywithcard input").prop('checked', true); 600 jQuery('#payatpark').addClass('disabled'); 601 jQuery('#payatpark_limt_error').remove(); 602 jQuery('#payatpark').append( "<div id='payatpark_limt_error'>Pay at park option is not available for the booking with Atv Slot.</div>" ); 603 }else{ 604 jQuery('#payatpark input').attr('disabled', false); 605 jQuery('#payatpark').removeClass('disabled'); 606 jQuery('#payatpark_limt_error').remove(); 607 } 608 $('.remain_stock').remove(); 609 $('.atv_ride_option .label-person').append('<div class="remain_stock"> Remaining slots per person available: '+ result.atv_stock+'</div>'); 610 $('#atv_ride_option').attr('max',result.atv_stock); 611 } 612 /* if found atv Not aviable then.. */ 613 let atv_stock_blank_per_date = false;
614 if(result.atv_system == true && result.atv_stock == 0){ 615 $('.atv_ride_option').hide(); 616 $('.atv_ride_heading').hide(); 617 atv_stock_blank_per_date = true; 618 $('.atv_ride_option_pillon').hide(); 619 $('.has_atv_note').hide(); 620 $('#atv_ride_option').val('0'); 621 $('#atv_stock').val(result.atv_stock); 622 $('#atv_booked').val(result.atv_booked); 623 if($('#atv_trigger').val() == 'true'){ 624 $('#atv_trigger').val('false'); 625 calculate_booking_price(); 626 } 627 } 628 /** if atv have more than avibale **/ 629 if(result.atv_system == true && result.atv_stock > $('#atv_ride_option').val() ){ 630 jQuery('.atv_ride_option .input-person-plus').attr('disabled', false); 631 jQuery('.atv_ride_option .input-person-plus').css('opacity', 1); 632 } 633 // /** if atv have smaller than avibale **/ 634 if(result.atv_system == true && result.atv_stock < $('#atv_ride_option').val() ){ 635 $('#atv_stock').val(result.atv_stock); 636 637 $('#atv_booked').val(result.atv_booked); 638 $('#atv_ride_option').val(result.atv_stock); 639 640 jQuery('.atv_ride_option .input-person-plus').attr('disabled', false); 641 jQuery('.atv_ride_option .input-person-plus').css('opacity', 1); 642 if($('#atv_trigger').val() == 'true'){ 643 $('#atv_trigger').val('false'); 644 calculate_booking_price(); 645 } 646 } 647 // /* if found atv Not aviable then.. */ 648 if(result.atv_system == false && result.atv_stock <= 0){ 649 650 $('.has_atv_note').hide(); 651 $('.atv_ride_heading').hide(); 652 $('.atv_ride_option').hide(); 653 $('.atv_ride_option_pillon').hide(); 654 $('#atv_ride_option').val('0'); 655 $('#atv_stock').val('0'); 656 $('#atv_booked').val(result.atv_booked); 657 if($('#atv_trigger').val() == 'true'){ 658 $('#atv_trigger').val('false'); 659 calculate_booking_price(); 660 } 661 } 662 /* End Here */ 663 /* Atv with pilot and pillion system */ 664 if(result.atv_system == true && result.atv_system_with_pilot == true){ 665 $('.atv_ride_option_pillon').show(); 666 $('#atv_ride_option_pillon').attr('max',atv_pilot_added); 667 if($('#atv_ride_option_pillon').val() > atv_pilot_added){ 668 $('#atv_ride_option_pillon').val(atv_pilot_added); 669 calculate_booking_price(); 670 } 671 if($('#atv_ride_option_pillon').val() < atv_pilot_added){ 672 jQuery('.atv_ride_option_pillon .input-person-plus').css('opacity', 1); 673 } 674 675 } 676 if(result.atv_system == true && result.atv_system_pilot_on == true && atv_pilot_added == 0){ 677 if(atv_stock_blank_per_date == true){ 678 $('.atv_ride_option_pillon').hide(); 679 }else{ 680 $('.atv_ride_option_pillon').show(); 681 } 682 let atv_ride_option_pillon = $('#atv_ride_option_pillon').val(); 683 if(atv_ride_option_pillon != 0){ 684 $('#atv_ride_option_pillon').attr('max',atv_pilot_added); 685 $('#atv_ride_option_pillon').val(atv_pilot_added); 686 calculate_booking_price(); 687 } 688 } 689 } 690 } 691 } 692 }); 693 } 694 695 // $('.time-picker-wraper #ph-calendar-days').on("click", ".ph-calendar-date", function () { 696 $(document).on("click", ".time-picker-wraper .ph-ul-date .ph-calendar-date", function () { 697 var from = jQuery(".ph-date-from").val(); 698 var element_from_date = $('.element_from_date').val() 699 var to = jQuery(".ph-date-to").val(); 700 701 var loding_ico_url = $("#plugin_dir_url").val() + "/resources/icons/loading2.gif"; 702 $(".ph-ul-time").show(); 703 // $("#ph-calendar-time").html('<img class="loading-ico" align="middle" src="' + loding_ico_url + '">'); 704 $(".ph-ul-time").html('<img class="loading-ico" align="middle" src="' + loding_ico_url + '">'); 705 var product_id = jQuery("#phive_product_id").val(); 706 707 if ($is_booking_end_date_calendar_open && from != '') { 708 // When user clicks a To Date in Design 3 with all fields filled 709 $(".ph-calendar-overlay").show(); 710 from_date = convert_date_to_wp_format($('.timepicker-selected-date .callender-full-date').val()); 711 $('.element_to_date').val(from_date); 712 $is_booking_end_date_clicked = true; 713 $('.element_to_time').val(''); 714 } 715 else if ($is_booking_end_date_calendar_open && from == '') { 716 // When user clicks a To Date in Design 3 and the previous selection was invali
716d 717 $(".ph-date-from").val($ph_date_from_previous_value); 718 $(".ph-calendar-overlay").show(); 719 $is_booking_end_date_clicked = true; 720 $('.element_to_date').val(''); 721 $('.element_to_time').val(''); 722 var current_date = convert_date_to_wp_format($('.timepicker-selected-date .callender-full-date').val()); 723 $(".element_to_date").val(current_date); 724 $('.element_to_time').trigger('click'); 725 $('.element_to_time').focus(); 726 } 727 else if (from == '' || (from != '' && to != '')) { 728 $(".ph-calendar-overlay").show(); 729 from_date = convert_date_to_wp_format($('.timepicker-selected-date .callender-full-date').val()); 730 $('.element_from_date').val(from_date).change(); 731 $('.element_from_time').val(''); 732 $('.element_from_time').scrollTop(); 733 $('.element_from_time').trigger('click'); 734 $('.element_from_time').focus(); 735 $('.element_to_date').val(''); 736 $('.element_to_time').val(''); 737 } else { 738 $(".ph-calendar-overlay").show(); 739 to_date = convert_date_to_wp_format($('.timepicker-selected-date .callender-full-date').val()); 740 $('.element_to_date').val(to_date); 741 $('.element_to_time').val(''); 742 $('.element_to_time').scrollTop(); 743 $('.element_to_time').trigger('click'); 744 $('.element_to_time').focus(); 745 } 746 747 var data = { 748 action: 'phive_get_booked_datas_of_date', 749 product_id: product_id, 750 date: $('.timepicker-selected-date .callender-full-date').val(), 751 type: 'time-picker', 752 asset: $(".input-assets").val() 753 }; 754 // $is_booking_end_date_calendar_open = false; 755 756 jQuery(".ph-calendar-date").prop('disabled', true); 757 $.post(phive_booking_ajax.ajaxurl, data, function (res) { 758 $("#arrival-time").show(); 759 $("#arrival-time-note").show(); 760 $(".ph-calendar-overlay").hide(); 761 jQuery(".ph-calendar-date").prop('disabled', false); 762 // $("#ph-calendar-time").html(res).trigger('change'); 763 764 if ($('#calendar_design').val() == '3') { 765 $('.time-calendar-date-section').hide(); 766 $('.ph-calendar-container .time-picker').show(); 767 } 768 $(".ph-ul-time").html(res); 769 // change slot time as end time while showing time calendar for end time 770 if ($('#calendar_design').val() == '3') { 771 // if (from != '' && to == '') { 772 // This was inside IF earlier 773 if ($is_booking_end_date_calendar_open) { 774 $('.ph_calendar_time_start').hide(); 775 $('.ph_calendar_time_end').show(); 776 } 777 } 778 $('#ph-calendar-time').trigger('change'); 779 $(this).addClass("timepicker-selected-date"); 780 $(".booking-info-wraper").html(''); 781 $is_booking_end_date_calendar_open = false; 782 783 // Resources hide form backend then this work 784 if($("#hide-resources").val()){ 785 var hide_resources = $("#hide-resources").val(); 786 if(hide_resources == 'yes'){ 787 var backend_resources_date_set = $("#show-resources-date").val(); 788 var selected_date = $('.timepicker-selected-date .callender-full-date').val(); 789 if(backend_resources_date_set.indexOf(selected_date) != -1){ 790 console.log(selected_date + " found"); 791 $('#want_to_display_resources_hide_or_show').show(); 792 }else{ 793 $('#want_to_display_resources_hide_or_show').hide(); 794 $('select[name="phive_book_resources_"]').val(''); 795 } 796 } 797 } 798 799 }); 800 801 }); 802 803 function convert_date_to_wp_format(date) { 804 var wp_date_format = jQuery("#ph_booking_wp_date_format").val(); 805 date = ph_convert_date_to_wp_date_format(wp_date_format, date); 806 return date; 807 } 808});
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.