1jQuery(function($){ 2 3 // Custom javascript code here 4 5 var ajaxurl = localize_data.ajax_url; 6 7 var siteurl = localize_data.site_url; 8 9 var directoryurl = localize_data.directory_url; 10 11 incdec(); 12 reviewloadmore(ajaxurl,siteurl); 13 contactValidate(ajaxurl,siteurl); 14 tripplanValidate(ajaxurl,siteurl); 15 clientinfoValidate(ajaxurl,siteurl); 16 enquiryValidate(ajaxurl,siteurl); 17 destination_package(ajaxurl,siteurl); 18 //tripplan(); 19 clientinfo(); 20 readMoreExp(); 21 bookingValidate(ajaxurl); 22 teamtab(); 23 teamcontent() 24 blogcategorylist(); 25 bookingpaxchange(); 26 depositpercentchange(); 27 extraservice(); 28 paymentbooking(); 29 sameflightonchange(); 30 31 departureyearprev(ajaxurl,siteurl); 32 departureyearnext(ajaxurl,siteurl); 33 departturemonthchange(ajaxurl,siteurl); 34 smoothscroll(); 35 customizeValidate(ajaxurl,siteurl); 36 enquirytripname(); 37 cloaseteam(); 38 dealyearsel(); 39 couponcode(ajaxurl); 40 headermenu(); 41 departuredateselectyear(ajaxurl,siteurl); 42 extraserviceselect(); 43 singlebookenquiry(); 44 calenderselect(); 45 detailslider(); 46 lowerflighthide(); 47 businessform(ajaxurl,siteurl); 48 customizeValidate(ajaxurl,siteurl); 49 couponValidate(ajaxurl,siteurl); 50 promobannerform(ajaxurl, siteurl); 51 pdfdownloadform(ajaxurl, siteurl); 52 53 const countries = [ 54 { name: "Afghanistan", code: "AF", dial_code: "+93" }, 55 { name: "Albania", code: "AL", dial_code: "+355" }, 56 { name: "Algeria", code: "DZ", dial_code: "+213" }, 57 { name: "Andorra", code: "AD", dial_code: "+376" }, 58 { name: "Angola", code: "AO", dial_code: "+244" }, 59 { name: "Argentina", code: "AR", dial_code: "+54" }, 60 { name: "Australia", code: "AU", dial_code: "+61" },
61 { name: "Austria", code: "AT", dial_code: "+43" }, 62 { name: "Bangladesh", code: "BD", dial_code: "+880" }, 63 { name: "Belgium", code: "BE", dial_code: "+32" }, 64 { name: "Brazil", code: "BR", dial_code: "+55" }, 65 { name: "Canada", code: "CA", dial_code: "+1" }, 66 { name: "China", code: "CN", dial_code: "+86" }, 67 { name: "Denmark", code: "DK", dial_code: "+45" }, 68 { name: "Egypt", code: "EG", dial_code: "+20" }, 69 { name: "France", code: "FR", dial_code: "+33" }, 70 { name: "Germany", code: "DE", dial_code: "+49" }, 71 { name: "India", code: "IN", dial_code: "+91" }, 72 { name: "Indonesia", code: "ID", dial_code: "+62" }, 73 { name: "Italy", code: "IT", dial_code: "+39" }, 74 { name: "Japan", code: "JP", dial_code: "+81" }, 75 { name: "Mexico", code: "MX", dial_code: "+52" }, 76 { name: "Nepal", code: "NP", dial_code: "+977" }, 77 { name: "Netherlands", code: "NL", dial_code: "+31" }, 78 { name: "Nigeria", code: "NG", dial_code: "+234" }, 79 { name: "Pakistan", code: "PK", dial_code: "+92" }, 80 { name: "Russia", code: "RU", dial_code: "+7" }, 81 { name: "Saudi Arabia", code: "SA", dial_code: "+966" }, 82 { name: "South Africa", code: "ZA", dial_code: "+27" }, 83 { name: "Spain", code: "ES", dial_code: "+34" }, 84 { name: "Sweden", code: "SE", dial_code: "+46" }, 85 { name: "Switzerland", code: "CH", dial_code: "+41" }, 86 { name: "Turkey", code: "TR", dial_code: "+90" }, 87 { name: "United Arab Emirates", code: "AE", dial_code: "+971" }, 88 { name: "United Kingdom", code: "GB", dial_code: "+44" }, 89 { name: "United States", code: "US", dial_code: "+1" }, 90 { name: "Vietnam", code: "VN", dial_code: "+84" } 91 ]; 92 93 const select = document.getElementById("country-select"); 94 95 countries.forEach(country => { 96 const option = document.createElement("option"); 97 option.value = country.dial_code; 98 option.textContent = `${country.name} (${country.dial_code})`; 99 option.style.backgroundImage = `url(https://flagcdn.com/20x15/${country.code.toLowerCase()}.png)`; 100 //select.appendChild(option); 101 }); 102 $(".openCollapse").on('click', function () { 103 $(this).closest('.trip__faq-item').toggleClass('faqitem-active'); 104 $(this).siblings('.trip__faq--detail').slideToggle(); 105 }); 106 107 $('.promobannerHolder').on('click', function (e) { 108 if (!$(e.target).closest('.promoBannerWrapper').length) { 109 $(this).hide(); 110 } 111 }); 112 $('.closePromo').on('click', function () { 113 $(this).closest('.promobannerHolder').hide(); 114}); 115 116 $('.promoBannerWrapper').slick({ 117 dots: false, 118 infinite: false, 119 speed: 300, 120 slidesToShow: 2, 121 slidesToScroll: 2, 122 arrows: false, 123 124 responsive: [ 125 { 126 breakpoint: 1024, 127 settings: { 128 slidesToShow: 2, 129 slidesToScroll: 2, 130 infinite: false, 131 132 dots: false, 133 } 134 }, 135 { 136 breakpoint: 760, 137 settings: { 138 slidesToShow: 1, 139 slidesToScroll: 1, 140 arrows: true, 141 infinite: false, 142 dots: false, 143 } 144 }, 145 { 146 breakpoint: 480, 147 settings: { 148 slidesToShow: 1, 149 slidesToScroll: 1, 150 slidesToScroll: 1, 151 arrows: true, 152 infinite: false, 153 dots: false, 154 } 155 } 156 // You can unslick at a given breakpoint now by adding: 157 // settings: "unslick" 158 // instead of a settings object 159 ] 160}); 161 162 163}); 164 165 166$('.input-group input, .input-group textarea').on('focus', function () { 167 me = $(this); 168 $("label[for='" + me.attr('id') + "']").addClass("animate-label"); 169 $("label[for='" + me.attr('id') + "']").parent('.input-group').addClass("selBox"); 170 $("label[for='" + me.attr('id') + "']").siblings('label.form-error').fadeOut(); 171}); 172$('.input-group input, .input-group textarea').on('blur', function () { 173 me = $(this); 174 if (me.val() == "") { 175 $("label[for='" + me.attr('id') + "']").removeClass("animate-label"); 176 $("label[for='" + me.attr('id') + "']").parent('.input-group').removeClass("selBox"); 177 } 178}); 179 180 181 182 183/*---------------------------- Validate Contact Post -----------------------------------------*/ 184
185function contactValidate(ajaxurl,siteurl){ 186 187 $("#contactForm").validate({ 188 189 ignore: [], 190 191 errorElement: "label", 192 193 errorClass: 'form-error', 194 195 rules: { 196 197 contactName:{ 198 199 required:true 200 201 }, 202 203 contactEmail:{ 204 205 required:true, 206 207 email:true, 208 209 }, 210 contactCountry:{ 211 212 required:true, 213 214 }, 215 contactPhone:{ 216 217 required:true, 218 219 }, 220 contactMessage:{ 221 222 required:true, 223 224 }, 225 226 }, 227 228 messages:{ 229 230 contactEmail: 231 232 { 233 234 email:"Invalid email format", 235 236 }, 237 238 }, 239 240 highlight: function(element) { 241 242 $(element).addClass('form-error'); 243 244 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 245 246 }, 247 248 unhighlight: function(element) { 249 250 $(element).removeClass('form-error'); 251 252 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 253 254 }, 255 256 submitHandler:function(form){ 257 258 $('#submiterror').hide(); 259 260 // FRONTEND: ensure reCAPTCHA is completed 261 var captchaResponse = grecaptcha.getResponse(); 262 if(captchaResponse.length === 0){ 263 $('#contactForm').append('<div class="alert alert-error" style="margin-top:10px;">Please complete the captcha.</div>'); 264 setTimeout(function(){ 265 $('.alert-error').remove(); 266 },5000); 267 return false; // stop form submission 268 } 269 270 271 var form_details = $('#contactForm').serialize()+ '&g-recaptcha-response=' + captchaResponse;; 272 273 $.ajax({ 274 275 url: ajaxurl, 276 277 type: 'POST', 278 279 data:form_details+'&action=contact_ajax', 280 281 beforeSend:function() 282 283 { 284 285 $('#submiterror').hide(); 286 287 //$('#contactForm #loader').show(); 288 289 $('#contactForm #contact_submit').attr('type','button'); 290 291 $('#contactForm #contact_submit').html('Please wait...'); 292 293 } 294 295 }) 296 297 .done(function(msg) { 298 299 msg = JSON.parse(msg); 300 301 if(msg.result==='success') 302 303 { 304 305 306 307 window.location.href = siteurl+"thank-you/"; 308 309 } 310 311 else 312 313 { 314 315 $('#contactForm').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 316 317 setTimeout(function(){ 318 319 $('.alert-error').remove(); 320 321 },5000); 322 323 $('#submiterror').show(); 324 325 $('#contactForm')[0].reset(); 326 327 $('#contactForm #contact_submit').attr('type','submit'); 328 329 $('#contactForm #contact_submit').html('Send a message'); 330 331 } 332 grecaptcha.reset(); // reset reCAPTCHA after submission 333 return false; 334 335 }) 336 337 .fail(function() { 338 339 console.log("error"); 340 grecaptcha.reset(); 341 342 }) 343 344 .always(function() { 345 346 console.log("complete"); 347 348 }); 349 350 // });//captcha 351 352 // }); //captcha 353 354 } 355 356}); 357 358} 359 360/*---------------------------- Validate trip plan Post -----------------------------------------*/ 361 362function tripplanValidate(ajaxurl,siteurl){ 363 364 365$.validator.addMethod("requiredIfChecked", function (val, ele, arg) { 366 if ($("#plnCtcEmail").is(":checked") && ($.trim(val) == '')) { return false; } 367 return true; 368}, "This field is required."); 369$.validator.addMethod("requiredChecked", function (val, ele, arg) { 370 if ($("#plnCtcNo").is(":checked") && ($.trim(val) == '')) { return false; } 371 return true; 372}, "This field is required."); 373 374 $("#tripplanForm").validate({ 375 376 ignore: [], 377 378 errorElement: "label", 379 380 errorClass: 'form-error', 381 382 rules: { 383
384 plnTvlDate:{ 385 386 required:true 387 388 }, 389 plnTrip:{ 390 391 required:true 392 393 }, 394 plnFullName:{ 395 396 required:true 397 398 }, 399 400 plnDestination:{ 401 402 required:true, 403 404 }, 405 emailaddress: { requiredIfChecked: true }, 406 Whatsapp: { requiredChecked: true }, 407 408 requirements:{ 409 410 required:true, 411 412 }, 413 414 }, 415 416 messages:{ 417 418 emailaddress: 419 420 { 421 422 email:"Invalid email format", 423 424 }, 425 426 }, 427 428 highlight: function(element) { 429 430 $(element).addClass('form-error'); 431 432 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 433 434 }, 435 436 unhighlight: function(element) { 437 438 $(element).removeClass('form-error'); 439 440 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 441 442 }, 443 444 submitHandler:function(form){ 445 446 $('#submiterror').hide(); 447 448 // FRONTEND: ensure reCAPTCHA is completed 449 var captchaResponse = grecaptcha.getResponse(); 450 if(captchaResponse.length === 0){ 451 $('#tripplanForm').append('<div class="alert alert-error" style="margin-top:10px;">Please complete the captcha.</div>'); 452 setTimeout(function(){ 453 $('.alert-error').remove(); 454 },5000); 455 return false; // stop form submission 456 } 457 458 459 var form_details = $('#tripplanForm').serialize()+ '&g-recaptcha-response=' + captchaResponse; 460 461 $.ajax({ 462 463 url: ajaxurl, 464 465 type: 'POST', 466 467 data:form_details+'&action=tripplan_ajax', 468 469 beforeSend:function() 470 471 { 472 473 $('#submiterror').hide(); 474 475 //$('#contactForm #loader').show(); 476 477 $('#tripplanForm #trip_submit').attr('type','button'); 478 479 $('#tripplanForm #trip_submit').attr('value','Please wait...'); 480 481 } 482 483 }) 484 485 .done(function(msg) { 486 487 msg = JSON.parse(msg); 488 489 if(msg.result==='success') 490 491 { 492 493 /*$('#contactForm').append('<div class="alert alert-success">Thank you for contacting us! We will get back to you soon.</div>'); 494 495 setTimeout(function(){ 496 497 $('.alert-success').remove(); 498 499 },5000); 500 501 $('#contactForm #loader').hide(); 502 503 $('#contactForm')[0].reset();*/ 504 505 window.location.href = siteurl+"thank-you-for-trip-plan/"; 506 507 } 508 509 else 510 511 { 512 513 $('#tripplanForm').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 514 515 setTimeout(function(){ 516 517 $('.alert-error').remove(); 518 519 },5000); 520 521 $('#submiterror').show(); 522 523 $('#tripplanForm')[0].reset(); 524 525 $('#tripplanForm #trip_submit').attr('type','submit'); 526 527 $('#tripplanForm #trip_submit').attr('value','Submit'); 528 529 } 530 grecaptcha.reset(); // reset reCAPTCHA after submission 531 return false; 532 533 }) 534 535 .fail(function() { 536 grecaptcha.reset(); 537 console.log("error"); 538 539 }) 540 541 .always(function() { 542 543 console.log("complete"); 544 545 }); 546 547 } 548 549}); 550 551} 552 553 554/*---------------------------- Validate client info Post -----------------------------------------*/ 555
556function clientinfoValidate(ajaxurl,siteurl){ 557 558 $("#clientinfoForm").validate({ 559 560 ignore: [], 561 562 errorElement: "label", 563 564 errorClass: 'form-error', 565 566 rules: { 567 ciTripName:{ 568 required:true 569 }, 570 ciLeaderName:{ 571 required:true 572 }, 573 ciEmail:{ 574 required:true, 575 email:true, 576 }, 577 ciPhone:{ 578 required:true 579 }, 580 cileadnation:{ 581 required:true 582 }, 583 cileademername:{ 584 required:true 585 }, 586 cileademernumber:{ 587 required:true 588 }, 589 ciTripStartDt:{ 590 required:true 591 }, 592 ciTripEndDt:{ 593 required:true 594 }, 595 ciTripTravellerNo:{ 596 required:true 597 }, 598 /* ciTripAirlines:{ 599 required:true 600 }, 601 ciTripFlightNo:{ 602 required:true 603 }, 604 ciTripFlightArrival:{ 605 required:true 606 }, 607 ciTripFlightDeparture:{ 608 required:true 609 },*/ 610 /*ciClientPhotos: { 611 accept: "image/jpeg, image/png" // Allow only JPG and PNG files 612 }*/ 613 }, 614 615 messages:{ 616 617 ciEmail: 618 619 { 620 621 email:"Invalid email format", 622 623 }, 624 //ciClientPhotos: "Only JPG and PNG files are allowed" 625 626 }, 627 628 highlight: function(element) { 629 630 $(element).addClass('form-error'); 631 632 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 633 634 }, 635 636 unhighlight: function(element) { 637 638 $(element).removeClass('form-error'); 639 640 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 641 642 }, 643 644 submitHandler:function(form){ 645 646 $('#submiterror').hide(); 647 648 // grecaptcha.ready(function() { 649 650 // grecaptcha.execute('6Lf4t_QjAAAAAF6nd-4zfdgwco00RqlxHnf1SpFd', {action: 'contactsubmit'}).then(function(token) { 651 // Before submitting, update all .flagPhone fields with full international numbers 652 $('.flagPhone').each(function () { 653 const input = this; 654 const iti = window.intlTelInputGlobals.getInstance(input); 655 //console.log("=this is"+iti); 656 //const fullNumber = iti.getNumber(); 657 //console.log("=hi"+iti.getNumber()); 658 if (iti ) { 659 const fullNumber = iti.getNumber(); // E.164 format 660 input.value = fullNumber; // Replace input value with formatted number 661 }// else { 662 // console.warn('Invalid phone number:', input); 663 //} 664 }); 665 //console.log(token); 666 //$("#recaptchaResponse").val(token); 667 // var form_details = $('#clientinfoForm').serialize(); 668 let valid = true; 669 let allowedExtensions = ["jpg", "jpeg", "png", "pdf"]; 670 let maxFileSize = 500 * 1024; // 500KB in bytes 671 672 // Validate all file inputs 673 $(':file').each(function() { 674 let fileInput = this; 675 if (fileInput.files.length > 0) { 676 let file = fileInput.files[0]; // Get the uploaded file 677 let fileName = file.name; 678 let fileExtension = fileName.split(".").pop().toLowerCase(); 679 let fileSize = file.size; 680 681 // Validate file type 682 if ($.inArray(fileExtension, allowedExtensions) === -1) { 683 alert(`Only JPG, PNG and PDF files are allowed: ${fileName}`); 684 valid = false; 685 return false; // Exit loop if invalid 686 } 687 688 // Validate file size 689 if (fileSize > maxFileSize) { 690 alert(`File size for ${fileName} must not exceed 500KB.`); 691 valid = false; 692 return false; // Exit loop if invalid 693 } 694 } 695 }); 696 697 if (!valid) { 698 return false; // Stop form submission if validation fails 699 } 700 // end extra validation 701 var formData = new FormData(form); // Create FormData object 702 703 formData.append('action', 'clientinfo_ajax'); // Add AJAX action 704 705 $.ajax({ 706 707 url: ajaxurl, 708 709 type: 'POST', 710 data: formData, 711 contentType: false, 712 processData: false, 713 714 // data:form_details+'&action=clientinfo_ajax', 715 716 beforeSend:function() 717 718 { 719 720 $('#submiterror').hide(); 721 722 //$('#contactForm #loader').show(); 723 724 $('#clientinfoForm #clientinfo_submit').attr('type','button'); 725 726 $('#clientinfoForm #clientinfo_submit').attr('value','Please wait...'); 727 728 } 729 730 }) 731 732 .done(function(msg) { 733 734 msg = JSON.parse(msg); 735 736 if(msg.result==='success') 737 738 { 739 740 741 742 window.location.href = siteurl+"/thank-you-for-client-info/"; 743 744 } 745 746 else 747 748 { 749 750 $('#clientinfoForm').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 751 752 setTimeout(function(){ 753 754 $('.alert-error').remove(); 755 756 },5000); 757 758 $('#submiterror').show(); 759 760 $('#clientinfoForm')[0].reset(); 761 762 $('#clientinfoForm #clientinfo_submit').attr('type','
762submit'); 763 764 $('#clientinfoForm #clientinfo_submit').attr('value','Submit'); 765 766 } 767 768 return false; 769 770 }) 771 772 .fail(function() { 773 774 console.log("error"); 775 776 }) 777 778 .always(function() { 779 780 console.log("complete"); 781 782 }); 783 784 // });//captcha 785 786 // }); //captcha 787 788 } 789 790}); 791 792} 793 794 795 796/*---------------------------- Validate Inquiry Post -----------------------------------------*/ 797 798function enquiryValidate(ajaxurl,siteurl){ 799 800 $("#enquiryForm").validate({ 801 802 ignore: [], 803 804 errorElement: "label", 805 806 errorClass: 'form-error', 807 808 rules: { 809 810 Fname:{ 811 812 required:true 813 814 }, 815 816 Email:{ 817 818 required:true, 819 820 email:true, 821 822 }, 823 824 contactnumber:{ 825 826 required:true, 827 828 }, 829 830 Message:{ 831 832 required:true, 833 834 }, 835 836 }, 837 838 messages:{ 839 840 Email: 841 842 { 843 844 email:"Invalid email format", 845 846 }, 847 848 }, 849 850 highlight: function(element) { 851 852 $(element).addClass('form-error'); 853 854 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 855 856 }, 857 858 unhighlight: function(element) { 859 860 $(element).removeClass('form-error'); 861 862 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 863 864 }, 865 866 submitHandler:function(form){ 867 868 // FRONTEND: ensure reCAPTCHA is completed 869 var captchaResponse = grecaptcha.getResponse(); 870 /* if(captchaResponse.length === 0){ 871 $('#enquiryForm').append('<div class="alert alert-error" style="margin-top:10px;">Please complete the captcha.</div>'); 872 setTimeout(function(){ 873 $('.alert-error').remove(); 874 },5000); 875 return false; // stop form submission 876 }*/ 877 878 var form_details = $('#enquiryForm').serialize()+ '&g-recaptcha-response=' + captchaResponse; 879 880 $.ajax({ 881 882 url: ajaxurl, 883 884 type: 'POST', 885 886 data:form_details+'&action=inquiry_ajax', 887 888 beforeSend:function() 889 890 { 891 892 $('#submiterror').hide(); 893 894 //$('#contactForm #loader').show(); 895 896 $('#enquiryForm #inquiry_submit').attr('type','button'); 897 898 $('#enquiryForm #inquiry_submit').attr('value','Please wait...'); 899 900 } 901 902 }) 903 904 .done(function(msg) { 905 906 msg = JSON.parse(msg); 907 908 if(msg.result==='success') 909 910 { 911 912 913 914 915 window.location.href = siteurl+"/thank-you"; 916 917 918 } 919 920 else 921 922 { 923 924 $('#enquiryForm').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 925 926 setTimeout(function(){ 927 928 $('.alert-error').remove(); 929 930 },5000); 931 932 $('#submiterror').show(); 933 934 $('#enquiryForm')[0].reset(); 935 936 $('#enquiryForm #inquiry_submit').attr('type','submit'); 937 938 $('#enquiryForm #inquiry_submit').attr('value','Submit'); 939 940 } 941 grecaptcha.reset(); // reset reCAPTCHA after submission 942 return false; 943 944 }) 945 946 .fail(function() { 947 console.log("error"); 948 grecaptcha.reset(); // reset reCAPTCHA after submission 949 950 }) 951 952 .always(function() { 953 954 console.log("complete"); 955 956 }); 957 958 //});//captcha 959 960 //}); //captcha 961 962 } 963 964}); 965 966} 967 968/*---------------------------- Validate Booking From and Send Mail-----------------------------------------*/ 969 970 971 972function bookingValidate(ajaxurl){ 973 $("#booking_form").validate({ 974 ignore: [], 975 errorElement: "label", 976 errorClass: 'form-error', 977 rules: { 978 bkPax:{ 979 required:true 980 }, 981 bkPaxPrice:{ 982 required:true 983 }, 984 fname:{ 985 required:true 986 }, 987 email:{ 988 required:true, 989 email:true, 990 }, 991 telno:{ 992 required:true 993 }, 994 city:{ 995 required:true 996 }, 997 country:{ 998 required: true, 999 }, 1000 bkDepositAmt:{ 1001 required: true, 1002 }, 1003 bkChkTrms:{ 1004 required:true, 1005 } 1006 }, 1007 messages:{ 1008 email: 1009 { 1010 email:"Invalid email format", 1011 } 1012 }, 1013 highlight: function(element) { 1014 $(element).addClass('form-error'); 1015 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 1016 }, 1017 unhighlight: function(element) { 1018 $(element).removeClass('form-error'); 1019 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 1020 }, 1021 1022 submitHandler:function(form){ 1023 $('#submiterror').hide(); 1024 1025 var captchaResponse = grecaptcha.getResponse(); 1026 if(captchaResponse.length === 0){ 1027 $('#booking_form').append('<div class="alert alert-error" style="margin-top:10px;">Please complete the captcha.</div>'); 1028 setTimeout(function(){ 1029 $('.alert-error').remove(); 1030 },5000); 1031 return false; // stop form submission 1032 } 1033 1034 var booking_details = $('#booking_form').serialize()+ '&g-recaptcha-response=' + captchaResponse; 1035 $.ajax({ 1036 url: ajaxurl, 1037 type: 'POST', 1038 data:booking_details+'&action=booking_ajax', 1039 beforeSend:function() 1040 { 1041 1042 $('#submiterror').hide(); 1043 $('#booking_form #submitbutton').attr('type','button'); 1044 $('#booking_form #submitbutton').attr('value','Please wait...'); 1045 } 1046 }) 1047 .done(function(msg) { 1048 msg = JSON.parse(msg); 1049 if(msg.result==='success') 1050 { 1051 window.location.href = msg.message; 1052 } 1053 else 1054 { 1055 1056 $('#booking_form').append('<div class="alert alert-error" style="margin-top:15px;">'+msg.message+'</div>'); 1057 setTimeout(function(){ 1058 $('.alert-error').remove(); 1059 },5000); 1060 $('#submiterror').show(); 1061 $('#booking_form')[0].reset(); 1062 $('#booking_form #submitbutton').attr('type','
1062submit'); 1063 $('#booking_form #submitbutton').attr('value','Confirm Booking'); 1064 } 1065 return false; 1066 }) 1067 .fail(function() { 1068 console.log("error"); 1069 }) 1070 1071 .always(function() { 1072 console.log("complete"); 1073 }); 1074 1075 // });//captcha 1076 // }); //captcha 1077 } 1078 }); 1079} 1080 1081var price,pax,total_amount,deposit_amount,deposit_percentage,processsingfee,per; 1082 1083 function changedeposite_percenage(){ 1084 1085 if(per==100){ 1086 1087 // $("#payPayingAmount").html(price); 1088 1089 // deposit_amount = $("#payPayingAmount").html(); 1090 1091 //processsingfee = deposit_amount*5/100; 1092 1093 // total_amount = parseFloat(processsingfee,2) + parseFloat(deposit_amount,2); 1094 1095 //$("#payFee").html(processsingfee); 1096 1097 // $("#payTotal").html(total_amount); 1098 1099 // $('#amount_hidden').val(lpadAmount(total_amount,12,'0')); 1100 1101 $("#bookInitialAmt").val(price); 1102 1103 }else{ 1104 1105 deposit_percentage = price * per / 100; 1106 1107 $("#bookInitialAmt").val(parseFloat(deposit_percentage,2)); 1108 1109 //console.log(deposit_percentage); 1110 1111 //$("#payPayingAmount").html(deposit_percentage); 1112 1113 // console.log(); 1114 1115 //deposit_amount = $("#payPayingAmount").html(); 1116 1117 //processsingfee = (deposit_amount*5)/100; 1118 1119 // console.log(processsingfee); 1120 1121 // total_amount = parseFloat(processsingfee,2) + parseFloat(deposit_amount,2); 1122 1123 1124 1125 //$("#payFee").text(processsingfee); 1126 1127 // $("#payTotal").text(total_amount); 1128 1129 // $('#amount_hidden').val(lpadAmount(total_amount,12,'0')); 1130 1131 } 1132 1133 } 1134 1135function perchnage(){ 1136 1137 //deopsit percentage change 1138 1139 jQuery(document).on('change',"#bkInitial", function(event){ 1140 1141 price = jQuery('#payPkgAmount').val(); 1142 1143 per = $(this).val(); 1144 1145 changedeposite_percenage(); 1146 1147 }); 1148 1149} 1150 1151 1152 1153function isbookPax(grp) { 1154 1155 1156 1157 return grp.pax === $("#bookPax").val(); 1158 1159 1160 1161} 1162 1163 1164 1165function finder(doc) { 1166 1167 1168 1169 1170 1171 1172 1173 return doc.pax == this.id; 1174 1175 1176 1177} 1178 1179 1180 1181function paxPriceBooking(){ 1182 1183 1184 1185 1186 1187 1188 1189 jQuery(document).on('keyup',"#bookPax", function(event){ 1190 1191 1192 1193 var grparray = $("#bookgrp__array").html(); 1194 1195 1196 1197 var countNum = $(this).val(); 1198 1199 1200 1201 var countRate; 1202 1203 1204 1205 if(grparray){ var obj = JSON.parse(grparray);} 1206 1207 1208 1209 if(obj){ var arr = obj.find(isbookPax); } 1210 1211 1212 1213 if(typeof arr!= "undefined"){ 1214 1215 1216 1217 countRate = arr.price; 1218 1219 1220 1221 }else{ 1222 1223 1224 1225 if(obj){ 1226 1227 1228 1229 let pax = countNum; 1230 1231 1232 1233 for(pax; pax>0; pax--){ 1234 1235 1236 1237 var matchedItem = obj.find(finder, {id: pax}); 1238 1239 1240 1241 if(typeof matchedItem!= "undefined"){ 1242 1243 1244 1245 countRate = matchedItem.price; 1246 1247 1248 1249 break; 1250 1251 1252 1253 }else if(pax==1){ 1254 1255 countRate = $("#trip__rate").html(); 1256 1257 } 1258 1259 1260 1261 } 1262 1263 1264 1265 }else{ 1266 1267 countRate = $("#trip__rate").html(); 1268 1269 console.log(countRate); 1270 1271 1272 1273 } 1274 1275 1276 1277 } 1278 1279 1280 1281 var tot = countRate*countNum; 1282 1283 1284 1285 $("#payPkgAmount").val(tot); 1286 1287 $("#bookTotalAmt").val(tot); 1288 1289 var persel= $("#bkInitial").val(); 1290 1291 if(persel==30){ 1292 1293 var initial_deposit= (30/100) * tot; 1294 1295 }else{var initial_deposit=tot;} 1296 1297 1298 1299 //initial_deposit = initial_deposit + ((initial_deposit*4)/100); 1300 1301 1302 1303 $("#bookInitialAmt").val(parseFloat(initial_deposit,2)); 1304 1305 1306 1307 }); 1308 1309 1310 1311} 1312 1313function groudis(){ 1314 1315 $("#grpdiscount__click").on("click",function(){ 1316 1317 $("#group__offer").toggle(); 1318 1319 }); 1320 1321} 1322 1323 1324 1325/*---------------------------- Validate Customize Post -----------------------------------------*/ 1326 1327function customizeValidate(ajaxurl,siteurl){ 1328 1329 $("#customizeForm").validate({ 1330 1331 ignore: [], 1332 1333 errorElement: "label", 1334 1335 errorClass: 'form-error', 1336 1337 rules: { 1338 1339 Fname:{ 1340 1341 required:true 1342 1343 }, 1344 1345 Email:{ 1346 1347 required:true, 1348 1349 email:true, 1350 1351 }, 1352 1353 Phone:{ 1354 1355 required:true, 1356 1357 }, 1358 1359 Message:{ 1360 1361 required:true, 1362 1363 }, 1364 1365 }, 1366 1367 messages:{ 1368 1369 Email: 1370 1371 { 1372 1373 email:"Invalid email format", 1374 1375 }, 1376 1377 }, 1378 1379 highlight: function(element) { 1380 1381 $(element).addClass('form-error'); 1382 1383 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 1384 1385 }, 1386 1387 unhighlight: function(element) { 1388 1389 $(element).removeClass('form-error'); 1390 1391 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 1392 1393 }, 1394 1395 submitHandler:function(form){ 1396 1397 // $('#submiterror').hide(); 1398 1399 // FRONTEND: ensure reCAPTCHA is completed 1400 var captchaResponse = grecaptcha.getResponse(); 1401 alert(111); 1402 if(captchaResponse.length === 0){ 1403 $('#customizeForm').append('<div class="alert alert-error" style="margin-top:10px;">Please complete the captcha.</div>'); 1404 setTimeout(function(){ 1405 $('.alert-error').remove(); 1406 },5000); 1407 return false; // stop form submission 1408 } 1409 1410 var form_details = $('#customizeForm').serialize()+ '&g-recaptcha-response=' + captchaResponse; 1411 1412 $.ajax({ 1413 1414 url: ajaxurl, 1415 1416 type: 'POST', 1417 1418 data:form_details+'&action=customize_ajax', 1419 1420 beforeSend:function() 1421 1422 { 1423 1424 $('#submiterror').hide(); 1425 1426 //$('#contactForm #loader').show(); 1427 1428 $('#customizeForm #inquiry_submit').attr('type','button'); 1429 1430 $('#customizeForm #inquiry_submit').attr('value','Please wait...'); 1431 1432 } 1433 1434 }) 1435 1436 .done(function(msg) { 1437 1438 msg = JSON.parse(msg); 1439 1440 if(msg.result==='success') 1441 1442 { 1443 1444 1445 1446 window.location.href = siteurl+"thank-you/"; 1447 1448 } 1449 1450 else 1451 1452 { 1453 1454 $('#customizeForm').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 1455 1456 setTimeout(function(){ 1457 1458 $('.alert-error').remove(); 1459 1460 },5000); 1461 1462 $('#submiterror').show(); 1463 1464 $('#customizeForm')[0].reset(); 1465 1466 $('#customizeForm #inquiry_submit').attr('type','
1466submit'); 1467 1468 $('#customizeForm #inquiry_submit').attr('value','Submit'); 1469 1470 } 1471 grecaptcha.reset(); 1472 return false; 1473 1474 }) 1475 1476 .fail(function() { 1477 1478 console.log("error"); 1479 grecaptcha.reset(); 1480 1481 }) 1482 1483 .always(function() { 1484 1485 console.log("complete"); 1486 1487 }); 1488 1489 //});//captcha 1490 1491 //}); //captcha 1492 1493 } 1494 1495}); 1496 1497} 1498 1499/*---------------------------- Validate payment HBL -----------------------------------------*/ 1500 1501function paymentValidate(ajaxurl,siteurl){ 1502 1503 $("#paymentForm").validate({ 1504 1505 ignore: [], 1506 1507 errorElement: "label", 1508 1509 errorClass: 'form-error', 1510 1511 rules: { 1512 1513 userDefined1:{ 1514 1515 required:true 1516 1517 }, 1518 1519 userDefined2:{ 1520 1521 required:true, 1522 1523 email:true, 1524 1525 }, 1526 1527 userDefined3:{ 1528 1529 required:true, 1530 1531 }, 1532 1533 userDefined4:{ 1534 1535 required:true, 1536 1537 }, 1538 1539 depositAmount:{ 1540 1541 required:true, 1542 1543 }, 1544 1545 }, 1546 1547 messages:{ 1548 1549 userDefined2: 1550 1551 { 1552 1553 email:"Invalid email format", 1554 1555 }, 1556 1557 }, 1558 1559 highlight: function(element) { 1560 1561 $(element).addClass('form-error'); 1562 1563 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 1564 1565 }, 1566 1567 unhighlight: function(element) { 1568 1569 $(element).removeClass('form-error'); 1570 1571 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 1572 1573 }, 1574 1575 submitHandler:function(form){ 1576 1577 $('#submiterror').hide(); 1578 1579 //$('#contactForm #loader').show(); 1580 1581 $('#paymentForm #submitbutton').attr('type','button'); 1582 1583 $('#paymentForm #submitbutton').attr('value','Please wait...'); 1584 1585 form.submit(); 1586 1587 } 1588 1589}); 1590 1591} 1592 1593//loadmorereview 1594function reviewloadmore(ajaxurl,siteurl){ 1595 1596 //trip advisor 1597 jQuery(document).on('click',"#trip_load", function(event){ 1598 var postid = $(this).attr("data-packid"); 1599 var pagenum = $(this).attr("data-page"); 1600 var datadisplayed = $(this).attr("data-displayed"); 1601 1602 $.ajax({ 1603 1604 url: ajaxurl, 1605 type: 'POST', 1606 data:'action=trip_loadmore&postid='+postid+'&pagenum='+pagenum+'&datadisplayed='+datadisplayed, 1607 beforeSend:function() 1608 { 1609 $(".trip_loading").show(); 1610 } 1611 1612 }) 1613 1614 .done(function(msg) { 1615 msg = JSON.parse(msg); 1616 $(".trip_loading").before(msg.data_value); 1617 $("#trip_load").attr('data-page',msg.pageno); 1618 $(".trip_loading").hide(); 1619 if(msg.totlepage<msg.pageno){ 1620 $("#trip_load").hide(); 1621 } 1622 return false; 1623 }) 1624 1625 .fail(function() { 1626 console.log("error"); 1627 }) 1628 1629 .always(function() { 1630 console.log("complete"); 1631 }); 1632 1633 });//jQuery(document) 1634 1635 //facebook 1636 jQuery(document).on('click',"#face_load", function(event){ 1637 var postid = $(this).attr("data-packid"); 1638 var pagenum = $(this).attr("data-page"); 1639 var datadisplayed = $(this).attr("data-displayed"); 1640 1641 $.ajax({ 1642 1643 url: ajaxurl, 1644 type: 'POST', 1645 data:'action=face_loadmore&postid='+postid+'&pagenum='+pagenum+'&datadisplayed='+datadisplayed, 1646 beforeSend:function() 1647 { 1648 $(".fb_loading").show(); 1649 } 1650 1651 }) 1652 1653 .done(function(msg) { 1654 msg = JSON.parse(msg); 1655 $(".fb_loading").before(msg.data_value); 1656 $("#face_load").attr('data-page',msg.pageno); 1657 $(".fb_loading").hide(); 1658 if(msg.totlepage<msg.pageno){ 1659 $("#face_load").hide(); 1660 } 1661 return false; 1662 }) 1663 1664 .fail(function() { 1665 console.log("error"); 1666 }) 1667 1668 .always(function() { 1669 console.log("complete"); 1670 }); 1671 1672 });//jQuery(document) 1673 1674 //google 1675 jQuery(document).on('click',"#gog_load", function(event){
1676 var postid = $(this).attr("data-packid"); 1677 var pagenum = $(this).attr("data-page"); 1678 var datadisplayed = $(this).attr("data-displayed"); 1679 1680 $.ajax({ 1681 1682 url: ajaxurl, 1683 type: 'POST', 1684 data:'action=gog_loadmore&postid='+postid+'&pagenum='+pagenum+'&datadisplayed='+datadisplayed, 1685 beforeSend:function() 1686 { 1687 $(".google_loading").show(); 1688 } 1689 1690 }) 1691 1692 .done(function(msg) { 1693 msg = JSON.parse(msg); 1694 $(".google_loading").before(msg.data_value); 1695 $("#gog_load").attr('data-page',msg.pageno); 1696 $(".google_loading").hide(); 1697 if(msg.totlepage<msg.pageno){ 1698 $("#gog_load").hide(); 1699 } 1700 return false; 1701 }) 1702 1703 .fail(function() { 1704 console.log("error"); 1705 }) 1706 1707 .always(function() { 1708 console.log("complete"); 1709 }); 1710 1711 });//jQuery(document) 1712 1713 //trust pilot 1714 jQuery(document).on('click',"#trust_load", function(event){ 1715 var postid = $(this).attr("data-packid"); 1716 var pagenum = $(this).attr("data-page"); 1717 var datadisplayed = $(this).attr("data-displayed"); 1718 1719 $.ajax({ 1720 1721 url: ajaxurl, 1722 type: 'POST', 1723 data:'action=trust_loadmore&postid='+postid+'&pagenum='+pagenum+'&datadisplayed='+datadisplayed, 1724 beforeSend:function() 1725 { 1726 $(".trust_loading").show(); 1727 } 1728 1729 }) 1730 1731 .done(function(msg) { 1732 msg = JSON.parse(msg); 1733 $(".trust_loading").before(msg.data_value); 1734 $("#trust_load").attr('data-page',msg.pageno); 1735 $(".trust_loading").hide(); 1736 if(msg.totlepage<msg.pageno){ 1737 $("#trust_load").hide(); 1738 } 1739 return false; 1740 }) 1741 1742 .fail(function() { 1743 console.log("error"); 1744 }) 1745 1746 .always(function() { 1747 console.log("complete"); 1748 }); 1749 1750 });//jQuery(document) 1751 1752 1753 //site 1754 jQuery(document).on('click',"#site_load", function(event){ 1755 var postid = $(this).attr("data-packid"); 1756 var pagenum = $(this).attr("data-page"); 1757 var datadisplayed = $(this).attr("data-displayed"); 1758 1759 $.ajax({ 1760 1761 url: ajaxurl, 1762 type: 'POST', 1763 data:'action=site_loadmore&postid='+postid+'&pagenum='+pagenum+'&datadisplayed='+datadisplayed, 1764 beforeSend:function() 1765 { 1766 $(".site_loading").show(); 1767 } 1768 1769 }) 1770 1771 .done(function(msg) { 1772 msg = JSON.parse(msg); 1773 $(".site_loading").before(msg.data_value); 1774 $("#site_load").attr('data-page',msg.pageno); 1775 $(".site_loading").hide(); 1776 if(msg.totlepage<msg.pageno){ 1777 $("#site_load").hide(); 1778 } 1779 return false; 1780 }) 1781 1782 .fail(function() { 1783 console.log("error"); 1784 }) 1785 1786 .always(function() { 1787 console.log("complete"); 1788 }); 1789 1790 });//jQuery(document) 1791} 1792 1793function teamtab(){ 1794 jQuery(document).on('click',".tabset__nav li a", function(event){ 1795 var tabclass = $(this).attr("class"); 1796 $(".tabset__nav li").removeClass("active"); 1797 $(this).parent().addClass("active"); 1798 $(".tabset__content").hide(); 1799 $("#"+tabclass).show(); 1800 1801 }); 1802} 1803 1804function teamcontent(){ 1805 $(".team__member").on('click',function() { 1806 var datacount = $(this).attr("data-count"); 1807 var datacontentid = $(this).attr("data-contentid"); 1808 const datacontent = $("#"+datacontentid).html(); 1809 const obj = JSON.parse(datacontent); 1810 var con = datacontentid+datacount; 1811 const formattedData1 = obj[con].replace(/\n/g, '<br>'); 1812 var htmlContent = formattedData1.replace(/</g, "<").replace(/>/g, ">"); 1813 $(".team__glide").html('<button type="button" class="jsxTeamClose tclose">×</button>'+htmlContent); 1814 }); 1815} 1816 1817 function destination_package(ajaxurl,siteurl){ 1818 jQuery(document).on('change',"#plnDestination", function(event){
1819 var destination = $(this).val(); 1820 // console.log(destination); 1821 $.ajax({ 1822 1823 url: ajaxurl, 1824 type: 'POST', 1825 data:'action=destination_package&destination='+destination, 1826 beforeSend:function() 1827 { 1828 //$(".site_loading").show(); 1829 } 1830 1831 }) 1832 1833 .done(function(msg) { 1834 msg = JSON.parse(msg); 1835 $("#plnTrip").html(msg.data_value); 1836 return false; 1837 }) 1838 1839 .fail(function() { 1840 console.log("error"); 1841 }) 1842 1843 .always(function() { 1844 console.log("complete"); 1845 }); 1846 }); 1847} 1848 1849function tripplan(){ 1850 $('input#plnCtcNo').on('click', function () { 1851 if ($(this).prop('checked')) { 1852 $('#whatsappcheck').fadeIn(); 1853 } else { 1854 $('#whatsappcheck').hide(); 1855 } 1856 }); 1857 1858 $('input#plnCtcEmail').on('click', function () { 1859 if ($(this).prop('checked')) { 1860 $('#emailcheck').fadeIn(); 1861 } else { 1862 $('#emailcheck').hide(); 1863 } 1864 }); 1865} 1866 1867function blogcategorylist(){ 1868 $('.blog--filter select').on('change', function (e) { 1869 var optionSelected = $("option:selected", this); 1870 var valueSelected = this.value; 1871 window.location.replace(valueSelected); 1872 1873 }); 1874} 1875 1876function clientinfo(){ 1877 $('input#ciTripTravellerNo').on('input', function () { 1878 var number = $(this).val(); 1879 // console.log(number); 1880 for( i=2; i<=number; i++){ 1881 // console.log(i); 1882 $(".block"+i).show(); 1883 } 1884 for(j=(number+1); j<=15; j++){ 1885 $(".block"+j).hide(); 1886 clear_form_elements(j); 1887 } 1888 areyoutravelingonsameflight(); 1889 }); 1890} 1891 1892function clear_form_elements(id) { 1893 $(".block"+id).find(':input').each(function() { 1894 switch(this.type) { 1895 case 'password': 1896 case 'text': 1897 case 'textarea': 1898 case 'file': 1899 // case 'select-one': 1900 //case 'select-multiple': 1901 case 'date': 1902 case 'number': 1903 case 'tel': 1904 case 'email': 1905 jQuery(this).val(''); 1906 break; 1907 case 'checkbox': 1908 case 'radio': 1909 this.checked = false; 1910 break; 1911 } 1912 }); 1913} 1914 1915/* booking calculation start */ 1916 1917function isPax(grp) { 1918 return grp.pax === $('input#bkPax').val(); 1919} 1920 1921function bookingpaxchange(){ 1922 $('input#bkPax').on('input', function () { 1923 // 1924 $("#bkTPkgCoupon").val(""); 1925 $("#bkTPkgCoupon").trigger("change"); 1926 // 1927 var number = $(this).val(); 1928 var orgi = $("#bkorgiPrice").val(); 1929 var tot = number*orgi; 1930 // group dscount start 1931 var grparray = $("#grp__array").html(); 1932 1933 if(grparray){ var obj = JSON.parse(grparray); 1934 if(obj){ var arr = obj.find(isPax); } 1935 if(typeof arr!= "undefined"){ 1936 $("#groupdiscountprice").val(arr.price); 1937 var orgi = arr.price; 1938 $("#bkPaxPrice").val("$"+arr.price); 1939 }else{ 1940 let nearestLowerPaxPrice = findNearestLowerPaxPrice(grparray, number); 1941 if (nearestLowerPaxPrice !== null) { 1942 $("#groupdiscountprice").val(nearestLowerPaxPrice['price']); 1943 orgi = nearestLowerPaxPrice['price']; 1944 $("#bkPaxPrice").val("$"+nearestLowerPaxPrice['price']); 1945 } else { 1946 $("#groupdiscountprice").val(0); 1947 $("#bkPaxPrice").val("$"+orgi); 1948 } 1949 } 1950 tot = number*orgi; 1951 } 1952 // group discount end 1953 $("#bktotalPrice").val(tot); 1954 $("#bkTPkgPrice").val("$"+tot); 1955 $("#tripmultiplyprice").html("$"+tot); 1956 depositpercent(tot); 1957 }); 1958} 1959 1960function depositpercentchange(){ 1961 $('input[type=radio][name=bkDeposit]').change(function() { 1962 var bktotalPrice = $("#bktotalPrice").val(); 1963 var perbook = $(this).val(); 1964 $("#depaynow").html(perbook); 1965 depositpercent(bktotalPrice); 1966 }); 1967} 1968 1969function depositpercent(price){ 1970 var percentage = $('input[type=radio][name=bkDeposit]:checked').val(); 1971 cal = (percentage/100)*price; 1972 var roundedNumber = Math.round(cal * 100) / 100; // to round two decimal digits 1973 $("#bkDepositAmt").val("$"+roundedNumber); 1974 $("#depositamt").val(roundedNumber); 1975 var pax = $("input#bkPax").val(); 1976 var groupdiscountprice = $("#groupdiscountprice").val(); 1977 var perperson =$("#bkorgiPrice").val(); 1978 if(groupdiscountprice>0){ 1979 perperson = groupdiscountprice; 1980 } 1981 // var pricedisply = pax+"X$"+perperson; 1982 var pricedisply = "US$ "+ perperson +" * "+pax+" Travellers"; 1983 $("#trippricedisplay").html(pricedisply); 1984 //$("#tripmultiplyprice").html("$"+price); 1985 $("#tripgrossamount").html("$"+price); 1986 $("#tripnetamount").html("$"+roundedNumber); 1987 //let balanceamount = Number(price)-Number(roundedNumber); 1988 1989 //$("#tripbalanceamount").html("$"+balanceamount); 1990 caltotwithservice(); 1991} 1992 1993function findNearestLowerPaxPrice(jsonString, targetPax) { 1994 let array = JSON.parse(jsonString); 1995 let nearestLowerPaxPrice = null; 1996 1997 array.forEach(function(subarray) { 1998 let currentPax = parseInt(subarray['pax']); 1999 let currentPrice = parseInt(subarray['price']); 2000 2001 // Check if the current pax is less than or equal to the targetPax 2002 if (currentPax <= targetPax) { 2003 // If the nearestLowerPaxPrice is null or the current price is greater than the nearestLowerPaxPrice 2004 // update the nearestLowerPaxPrice 2005 if (nearestLowerPaxPrice === null || currentPax > nearestLowerPaxPrice['pax']) { 2006 nearestLowerPaxPrice = subarray; 2007 } 2008 } 2009 }); 2010 2011 return nearestLowerPaxPrice; 2012} 2013 2014function extraservice(){ 2015 const extraarray = []; 2016 $('.extraser').on('change', function () { 2017 var data ; 2018 let extranum = $(this).val(); 2019 var extraid = $(this).attr("data-extraid"); 2020 var extratitle = $(this).attr("data-extratitle"); 2021 let extraprice = $(this).attr("data-extraprice"); 2022 let calulateprice = extraprice*extranum; 2023 let existingtotal = $("#extraserviceprice").val(); 2024 if(extraarray.includes(extraid)){ 2025 let existingprice = $("#sidextraid"+extraid+" .calprice").attr("data-extraamount"); 2026 existingtotal = existingtotal-existingprice;//remove old total 2027 if(extranum==0){ 2028 $("#sidextraid"+extraid).remove(); 2029 extraarray[extraid]=0; 2030 } 2031 else{ 2032 existingtotal = Number(existingtotal)+Number(calulateprice);// add new total 2033 data = '<dt><span class="lbl">'+extratitle+'</span><small>'+extranum+'x$'+extraprice+'</small></dt><dd class="calprice" data-extraamount="'+calulateprice+'">$'+calulateprice+'</dd></dl>'; 2034 $("#sidextraid"+extraid).html(data); 2035 2036 } 2037 }else{ 2038 data = '<dl id="sidextraid'+extraid+'"><dt><span class="lbl">'+extratitle+'</span><small>'+extranum+'x$'+extraprice+'</small></dt><dd class="calprice" data-extraamount="'+calulateprice+'">$'+calulateprice+'</dd></dl>'; 2039 $("#grossamounttrip").before(data); 2040 extraarray[extraid]=extraid; 2041 existingtotal = Number(existingtotal)+Number(calulateprice); 2042 $("#extraserviceprice").val(calulateprice); 2043 } 2044 $("#extraserviceprice").val(existingtotal); 2045 caltotwithservice(); 2046 }); 2047} 2048 2049function caltotwithservice(){ 2050 let existingtotal = $("#extraserviceprice").val(); 2051 let grosspackageprice = $("#bktotalPrice").val(); 2052 let depostiamt = $("#depositamt").val(); 2053 let grosstotal = Number(existingtotal)+Number(grosspackageprice); 2054 let nettotal = Number(existingtotal)+Number(depostiamt); 2055 $("#actualamttobepaid").val(grosstotal); 2056 $("#tripgrossamount").html("$"+grosstotal); 2057 $("#tripnetamount").html("$"+nettotal); 2058 balancetotal(grosstotal,nettotal); 2059} 2060 2061function balancetotal(grosstotal,nettotal){ 2062 let total = Number(grosstotal)-Number(nettotal); 2063 $("#tripbalanceamount").html("$"+total); 2064} 2065 2066function paymentbooking(){ 2067 $("#bokingssinglebutton").on('click',function(){ 2068 $(this).val("Please wait..."); 2069 $('#paymentFormsingle').submit(); 2070 }); 2071 2072 $("#pasubmitbutton").on('click',function (e){ 2073 //$(this).val("Please wait..."); 2074 //$('#paymentForm').submit(); 2075 e.preventDefault(); // Prevent default behavior 2076 2077 const form = document.getElementById('paymentForm'); // Get the form element 2078 2079 if (form.checkValidity()) { 2080 // Form is valid 2081 $(this).val("Please wait..."); // Change button text and disable it 2082 form.submit(); // Submit the form 2083 } else {
2084 // Form is invalid 2085 form.reportValidity(); // Show validation messages 2086 } 2087 }); 2088 2089} 2090 2091function areyoutravelingonsameflight(){ 2092 var sameflight = $("#ciTripTravel").val(); 2093 var pax = $("#ciTripTravellerNo").val(); 2094 console.log(sameflight+"=="+pax); 2095 2096 if(sameflight=="Yes"){ 2097 flightchangeyes(); 2098 for(var i =2;i<=pax;i++){ 2099 $(".flightblock"+i).hide(); 2100 $(".flightblock"+i).find(':input').each(function() { 2101 switch(this.type) { 2102 case 'password': 2103 case 'text': 2104 case 'textarea': 2105 case 'file': 2106 // case 'select-one': 2107 //case 'select-multiple': 2108 case 'date': 2109 case 'number': 2110 case 'tel': 2111 case 'email': 2112 jQuery(this).val(''); 2113 break; 2114 case 'checkbox': 2115 case 'radio': 2116 this.checked = false; 2117 break; 2118 } 2119 }); 2120 } 2121 }else{ 2122 for(var i =2;i<=pax;i++){ 2123 $(".flightblock"+i).show(); 2124 } 2125 flightchangeno(); 2126 } 2127 2128} 2129 2130function sameflightonchange(){ 2131 $("#ciTripTravel").on("change",function(){ 2132 areyoutravelingonsameflight(); 2133 }); 2134} 2135 2136function departureyearprev(ajaxurl,siteurl){ 2137 $(".control-action.prev").on("click",function(){ 2138 let year = $("#departureyear").html(); 2139 year = Number(year)-1; 2140 $("#departureyear").html(year); 2141 departturedatedisplay(ajaxurl,siteurl); 2142 }); 2143} 2144 2145function departureyearnext(ajaxurl,siteurl){ 2146 $(".control-action.next").on("click",function(){ 2147 let year = $("#departureyear").html(); 2148 year = Number(year)+1; 2149 $("#departureyear").html(year); 2150 departturedatedisplay(ajaxurl,siteurl); 2151 2152 }); 2153} 2154function departuredateselectyear(ajaxurl,siteurl){ 2155 $('#chooseyear').change(function() { 2156 var selectedYear = $(this).val(); 2157 $("#departureyear").html(selectedYear); 2158 departturedatedisplay(ajaxurl,siteurl); 2159 }); 2160} 2161 2162function departturedatedisplay(ajaxurl,siteurl){ 2163 var datejson = $("#datejson").html(); 2164 console.log(datejson); 2165 var year = $("#departureyear").html(); 2166 var month = $(".month--list .colorsel").attr("data-id"); 2167 $(".placement").html(""); 2168 $.ajax({ 2169 url: ajaxurl, 2170 type: 'POST', 2171 data:'monthsel='+month+'&action=detaildeparture_ajax&depart__dates='+datejson+'&yearsel='+year, 2172 beforeSend:function() 2173 { 2174 $(".placement").html("Loading..."); 2175 } 2176 }) 2177 .done(function(msg) { 2178 msg = JSON.parse(msg); 2179 $(".placement").html(msg.message); 2180 return false; 2181 }) 2182 .fail(function() { 2183 console.log("error"); 2184 }) 2185 .always(function() { 2186 console.log("complete"); 2187 }); 2188} 2189 2190function departturemonthchange(ajaxurl,siteurl){ 2191 $(".tgr").on("click",function(){ 2192 //let monthsele = $(this).attr("data-id"); 2193 $(".tgr").removeClass("colorsel"); 2194 $(this).addClass("colorsel"); 2195 departturedatedisplay(ajaxurl,siteurl); 2196 }); 2197} 2198 2199function smoothscroll() { 2200 // Cache selectors 2201 var lastId=0, 2202 topMenu = jQuery(".jscrll"), 2203 topMenuHeight = -6, 2204 // All list items 2205 menuItems = topMenu.find("a.mapscrll"), 2206 // Anchors corresponding to menu items 2207 scrollItems = menuItems.map(function(){ 2208 // var item = $($(this).attr("href")); 2209 // if (item.length) { return item; } 2210 var hrefattr; 2211 hrefattr = $(this).attr("href"); 2212 if(hrefattr.indexOf('#') > -1) { 2213 var item = $($(this).attr("href")); 2214 if (item.length) { return item; } 2215 } 2216 }); 2217 2218 // Bind click handler to menu items 2219 // so we can get a fancy scroll animation 2220 menuItems.click(function(e){ 2221 var href = $(this).attr("href"), 2222 offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1; 2223 $('html, body').stop().animate({ 2224 scrollTop: offsetTop 2225 }, 800); 2226 e.preventDefault(); 2227 }); 2228 2229 // Bind to scroll 2230 $(window).scroll(function(){ 2231 // Get container scroll position 2232 var fromTop = $(this).scrollTop()+topMenuHeight; 2233 2234 // Get id of current scroll item 2235 var cur = scrollItems.map(function(){ 2236 if ($(this).offset().top < fromTop) 2237 return this; 2238 }); 2239 // Get the id of the current element 2240 cur = cur[cur.length-1]; 2241 var id = cur && cur.length ? cur[0].id : ""; 2242 2243 if (lastId !== id) { 2244 lastId = id; 2245 // Set/remove active class 2246 menuItems 2247 .parent().removeClass("scractive") 2248 .end().filter("[href='#"+id+"']").parent().addClass("scractive"); 2249 // var sclbl = menuItems.filter("[href='#"+id+"']").html(); 2250 // jQuery('.jsxScroller').html(sclbl); 2251 } 2252 }); 2253} 2254 2255/*---------------------------- Validate Customize Post -----------------------------------------*/ 2256
2257function customizeValidate(ajaxurl,siteurl){ 2258 2259 $("#customizeForm").validate({ 2260 2261 ignore: [], 2262 2263 errorElement: "label", 2264 2265 errorClass: 'form-error', 2266 2267 rules: { 2268 2269 cusFname:{ 2270 2271 required:true 2272 2273 }, 2274 2275 cusEmail:{ 2276 2277 required:true, 2278 2279 email:true, 2280 2281 }, 2282 2283 cusContact:{ 2284 2285 required:true, 2286 2287 }, 2288 2289 cusMessage:{ 2290 2291 required:true, 2292 2293 }, 2294 cusAgree:{ 2295 2296 required:true, 2297 2298 }, 2299 2300 }, 2301 2302 messages:{ 2303 2304 cusEmail: 2305 2306 { 2307 2308 email:"Invalid email format", 2309 2310 }, 2311 2312 }, 2313 2314 highlight: function(element) { 2315 2316 $(element).addClass('form-error'); 2317 2318 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 2319 2320 }, 2321 2322 unhighlight: function(element) { 2323 2324 $(element).removeClass('form-error'); 2325 2326 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 2327 2328 }, 2329 2330 submitHandler:function(form){ 2331 2332 // $('#submiterror').hide(); 2333 2334 2335 // FRONTEND: ensure reCAPTCHA is completed 2336 var captchaResponse = grecaptcha.getResponse(); 2337 if(captchaResponse.length === 0){ 2338 $('#customizeForm').append('<div class="alert alert-error" style="margin-top:10px;">Please complete the captcha.</div>'); 2339 setTimeout(function(){ 2340 $('.alert-error').remove(); 2341 },5000); 2342 return false; // stop form submission 2343 } 2344 var form_details = $('#customizeForm').serialize()+ '&g-recaptcha-response=' + captchaResponse; 2345 2346 $.ajax({ 2347 2348 url: ajaxurl, 2349 2350 type: 'POST', 2351 2352 data:form_details+'&action=customize_ajax', 2353 2354 beforeSend:function() 2355 2356 { 2357 2358 $('#submiterror').hide(); 2359 2360 //$('#contactForm #loader').show(); 2361 2362 $('#customizeForm #cussubmit').attr('type','button'); 2363 2364 $('#customizeForm #cussubmit').attr('value','Please wait...'); 2365 2366 } 2367 2368 }) 2369 2370 .done(function(msg) { 2371 2372 msg = JSON.parse(msg); 2373 2374 if(msg.result==='success') 2375 2376 { 2377 2378 2379 2380 window.location.href = siteurl+"/thank-you"; 2381 2382 } 2383 2384 else 2385 2386 { 2387 2388 $('#customizeForm').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 2389 2390 setTimeout(function(){ 2391 2392 $('.alert-error').remove(); 2393 2394 },5000); 2395 2396 $('#submiterror').show(); 2397 2398 $('#customizeForm')[0].reset(); 2399 2400 $('#customizeForm #cussubmit').attr('type','submit'); 2401 2402 $('#customizeForm #cussubmit').attr('value','Submit'); 2403 2404 } 2405 grecaptcha.reset(); 2406 return false; 2407 2408 }) 2409 2410 .fail(function() { 2411 2412 console.log("error"); grecaptcha.reset(); 2413 2414 }) 2415 2416 .always(function() { 2417 2418 console.log("complete"); 2419 2420 }); 2421 2422 //});//captcha 2423 2424 //}); //captcha 2425 2426 } 2427 2428}); 2429 2430} 2431 2432function enquirytripname(){ 2433 $(".inquireclick").on('click',function(){ 2434 var tripname = $(this).attr("data-tripname"); 2435 $("#enquirepackageName").val(tripname); 2436 $("#enquiretripname").html(tripname); 2437 }); 2438 2439 $(".couponclick").on('click',function(){ 2440 2441 var tripname = $(this).data("tripname"); 2442 console.log(tripname); 2443 $("#couponpackageName").val(tripname); 2444 $("#coupontripname").html(tripname); 2445 }); 2446} 2447function cloaseteam(){ 2448jQuery(document).on('click', '.tclose', function() { 2449 jQuery('.team__member').removeClass('hover'); 2450 2451 }); 2452} 2453 2454document.addEventListener("DOMContentLoaded", function() { 2455 var replyLinks = document.querySelectorAll('.reply-link'); 2456 replyLinks.forEach(function(link) { 2457 link.style.display = 'none'; 2458 }); 2459}); 2460 2461 2462function dealyearsel(){ 2463 $('select#deal__year').on('change', function (e) { 2464 var optionSelected = $("option:selected", this); 2465 var valueSelected = this.value; 2466 window.location.replace(valueSelected); 2467 2468 }); 2469} 2470 2471function readMoreExp(){ 2472 $('.readMoreExpand').on('click',function(){ 2473 $(this).siblings('.desc_cutoff').toggleClass('desc_cutoff'); 2474 $(this).hide(); 2475 }) 2476} 2477 2478function couponcode(ajaxurl){ 2479 $("#bkTPkgCoupon").on('change',function(){ 2480 var coupon = $(this).val(); 2481 var numpax = $("#bkPax").val(); 2482 if(numpax<=0 || numpax==""){numpax=1;} 2483 var totalcost = $("#bkTPkgPrice").val(); 2484 if (coupon!="") { 2485 //var totalcost = $("#bkTPkgPrice").val();
2486 validateCouponCode(coupon,totalcost,numpax,ajaxurl); 2487 }else{ 2488 var numericValue = parseFloat(totalcost.replace(/^\$/, '')); 2489 $("#bktotalPrice").val(numericValue); 2490 $("#coupondiscount").html("$"+0); 2491 depositpercent(numericValue); 2492 } 2493 }); 2494} 2495 2496function validateCouponCode(code,totalprice,numpax,ajaxurl) { 2497 $.ajax({ 2498 type: "POST", 2499 url: ajaxurl, 2500 data: { 2501 action: 'validate_coupon_code', 2502 couponCode: code, 2503 totalprice: totalprice, 2504 numpax:numpax 2505 }, 2506 success: function(response) { 2507 if (response.success) { 2508 // Access nested data 2509 var isValid = response.data.isValid; 2510 var amount = response.data.amount; 2511 var discount = response.data.discount; 2512 //console.log(isValid+" === "+amount); 2513 if (isValid) { 2514 $("#bktotalPrice").val(amount); 2515 $("#coupondiscount").html("$"+discount); 2516 depositpercent(amount); 2517 } else { 2518 alert("Invalid coupon code."); 2519 } 2520 } 2521 else { 2522 alert("Error processing request."); 2523 } 2524 2525 } 2526 }); 2527} 2528 2529function headermenu(){ 2530 $("span.navMarker").css('display', 'none'); 2531 $('.site__nav li a').hover( 2532 function() { 2533 // Mouse enters the element 2534 $("span.navMarker").css('display', 'block'); 2535 }, 2536 function() { 2537 // Mouse leaves the element 2538 $("span.navMarker").css('display', 'none'); 2539 } 2540 ); 2541} 2542 2543function extraserviceselect(){ 2544 $('.extraser').on('change', function() { 2545 2546 const selectedValue = parseInt($(this).val()); 2547 const formSegment = $(this).closest('.form-segment'); 2548 if (selectedValue > 0) { 2549 formSegment.addClass('selectedBlock'); 2550 } else { 2551 formSegment.removeClass('selectedBlock'); 2552 } 2553 }); 2554} 2555function singlebookenquiry(){ 2556 $('#singbook').on('click', function(e) { 2557 e.preventDefault(); 2558 var selectedDate = $('#tripdatesidebar').val(); 2559 //alert(selectedDate); 2560 if (selectedDate!="") { 2561 var timestamp = new Date(selectedDate).getTime() / 1000; 2562 var currentUrl = $(this).attr('href'); 2563 var newUrl = new URL(currentUrl, window.location.origin); 2564 newUrl.searchParams.set('trip__start', timestamp); 2565 $(this).attr('href', newUrl.toString()); 2566 //alert(newUrl.toString()); 2567 } 2568 window.location.href = $(this).attr('href'); 2569 }); 2570 $('.enquirebutonsi').on('click', function() { 2571 var tripDate = $('#tripdatesidebar').val(); 2572 if (tripDate!="") { 2573 $('#kitdate').val(tripDate); 2574 } 2575 }); 2576} 2577function calenderselect(){ 2578 const dateInputs = document.querySelectorAll('.caldate'); 2579 2580 // Add a click event to each date input field to trigger the calendar 2581 dateInputs.forEach(function(dateInput) { 2582 dateInput.addEventListener('click', function() { 2583 // Open the date picker 2584 dateInput.showPicker(); 2585 }); 2586 }); 2587} 2588 2589function detailslider(){ 2590 if(jQuery(".slideSlide").length) { 2591 jQuery('.slideSlide').slick({ 2592 mobileFirst: true, 2593 slidesToShow: 1, 2594 slidesToScroll: 1, 2595 arrows: false, 2596 dots: false, 2597 fade: true, 2598 cssEase: 'linear', 2599 pauseOnHover: true, 2600 autoplay: true, 2601 autoplaySpeed: 5000 2602 }); 2603 } 2604} 2605 2606/* client info flight detail upper and lower start */ 2607function flightchangeno(){ 2608 $(".upperflight").fadeOut(); 2609 $(".lowerflight").fadeIn(); 2610 var arrivaltime= $("#ciTripFlightArrivalu").val(); 2611 var arrivalflight = $("#ciTripAirlinesu").val(); 2612 var arrivalnumber =$("#ciTripFlightNou").val(); 2613 var deptime = $("#ciTripFlightDepartureu").val(); 2614 var depflight = $("#ciTripdepAirlinesu").val(); 2615 var depnumber = $("#ciTripdepFlightNou").val(); 2616 2617 $("#ciTripFlightArrival").val(arrivaltime); 2618 $("#ciTripAirlines").val(arrivalflight); 2619 $("#ciTripFlightNo").val(arrivalnumber); 2620 $("#ciTripFlightDeparture").val(deptime); 2621 $("#ciTripdepAirlines").val(depflight); 2622 $("#ciTripdepFlightNo").val(depnumber); 2623 2624 $("#ciTripFlightArrivalu").val(""); 2625 $("#ciTripAirlinesu").val(""); 2626 $("#ciTripFlightNou").val(""); 2627 $("#ciTripFlightDepartureu").val(""); 2628 $("#ciTripdepAirlinesu").val(""); 2629 $("#ciTripdepFlightNou").val(""); 2630 2631 2632} 2633function flightchangeyes(){ 2634 $(".upperflight").fadeIn(); 2635 $(".lowerflight").fadeOut(); 2636 $("#ciTripFlightArrival").val(""); 2637 $("#ciTripAirlines").val(""); 2638 $("#ciTripFlightNo").val(""); 2639 $("#ciTripFlightDeparture").val(""); 2640 $("#ciTripdepAirlines").val(""); 2641 $("#ciTripdepFlightNo").val(""); 2642} 2643/* client info flight detail upper and lower end */ 2644 2645function lowerflighthide(){ 2646 $(".lowerflight").hide(); 2647} 2648 2649function businessform(ajaxurl,siteurl){ 2650 $("#businessform").validate({ 2651 2652 ignore: [], 2653 2654 errorElement: "label", 2655 2656 errorClass: 'form-error', 2657 2658 rules: { 2659 fullname:{ 2660 required:true 2661 }, 2662 2663 email: { required: true }, 2664 2665 2666 country:{ 2667 2668 required:true, 2669 2670 }, 2671 mobile:{ 2672 2673 required:true, 2674 2675 }, 2676 2677 }, 2678 2679 messages:{ 2680 2681 email: 2682 { 2683 email:"Invalid email format", 2684 2685 }, 2686 }, 2687 2688 highlight: function(element) { 2689 2690 $(element).addClass('form-error'); 2691 2692 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 2693 2694 }, 2695 2696 unhighlight: function(element) { 2697 2698 $(element).removeClass('form-error'); 2699 2700 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 2701 2702 }, 2703 2704 submitHandler:function(form){ 2705 2706 $('#submiterror').hide(); 2707 2708 // grecaptcha.ready(function() { 2709 2710 // grecaptcha.execute('6Lf4t_QjAAAAAF6nd-4zfdgwco00RqlxHnf1SpFd', {action: 'contactsubmit'}).then(function(token) { 2711 2712 //console.log(token); 2713 2714 //$("#recaptchaResponse").val(token); 2715 2716 var form_details = $('#businessform').serialize(); 2717 2718 $.ajax({ 2719 2720 url: ajaxurl, 2721 2722 type: 'POST', 2723 2724 data:form_details+'&action=business_ajax', 2725 2726 beforeSend:function() 2727 2728 { 2729 2730 $('#submiterror').hide(); 2731 2732 $('#businessform #trip_submit').attr('type','button'); 2733 2734 $('#businessform #trip_submit').html('Please wait...'); 2735 2736 } 2737 2738 }) 2739 2740 .done(function(msg) { 2741 2742 msg = JSON.parse(msg); 2743 2744 if(msg.result==='success') 2745 2746 { console.log("Done"); 2747 window.location.href = siteurl+"thank-you/"; 2748 2749 } 2750 2751 else 2752 2753 { 2754 $('#businessform').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 2755 2756 setTimeout(function(){ 2757 $('.alert-error').remove(); 2758 },5000); 2759 $('#submiterror').show(); 2760 $('#businessform')[0].reset(); 2761 $('#businessform #trip_submit').attr('type','
2761submit'); 2762 2763 $('#businessform #trip_submit').html('Send Inquiry'); 2764 2765 } 2766 return false; 2767 }) 2768 .fail(function() { 2769 console.log("error"); 2770 }) 2771 .always(function() { 2772 console.log("complete business"); 2773 }); 2774 // });//captcha 2775 // }); //captcha 2776 } 2777 }); 2778} 2779 2780/** get coupon formblog start ***/ 2781function couponValidate(ajaxurl,siteurl){ 2782 2783 $("#couponForm").validate({ 2784 2785 ignore: [], 2786 2787 errorElement: "label", 2788 2789 errorClass: 'form-error', 2790 2791 rules: { 2792 2793 Fname:{ 2794 2795 required:true 2796 2797 }, 2798 2799 Email:{ 2800 2801 required:true, 2802 2803 email:true, 2804 2805 }, 2806 2807 ciPhone1:{ 2808 2809 required:true, 2810 2811 }, 2812 2813 Message:{ 2814 2815 required:true, 2816 2817 }, 2818 inquireAgree:{ 2819 2820 required:true, 2821 2822 }, 2823 2824 }, 2825 2826 messages:{ 2827 2828 Email: 2829 2830 { 2831 2832 email:"Invalid email format", 2833 2834 }, 2835 2836 }, 2837 2838 highlight: function(element) { 2839 2840 $(element).addClass('form-error'); 2841 2842 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 2843 2844 }, 2845 2846 unhighlight: function(element) { 2847 2848 $(element).removeClass('form-error'); 2849 2850 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 2851 2852 }, 2853 2854 submitHandler:function(form){ 2855 2856 // $('#submiterror').hide(); 2857 2858 // grecaptcha.ready(function() { 2859 2860 //grecaptcha.execute('6Lf4t_QjAAAAAF6nd-4zfdgwco00RqlxHnf1SpFd', {action: 'inquiry_submit'}).then(function(token) { 2861 2862 //console.log(token); 2863 2864 // $("#recaptchaResponse").val(token); 2865 2866 var form_details = $('#couponForm').serialize(); 2867 2868 $.ajax({ 2869 2870 url: ajaxurl, 2871 2872 type: 'POST', 2873 2874 data:form_details+'&action=coupon_ajax', 2875 2876 beforeSend:function() 2877 2878 { 2879 2880 $('#submiterror').hide(); 2881 2882 //$('#contactForm #loader').show(); 2883 2884 $('#couponForm #coupon_submit').attr('type','button'); 2885 2886 $('#couponForm #coupon_submit').attr('value','Please wait...'); 2887 2888 } 2889 2890 }) 2891 2892 .done(function(msg) { 2893 2894 msg = JSON.parse(msg); 2895 2896 if(msg.result==='success') 2897 2898 { 2899 2900 2901 2902 2903 window.location.href = siteurl+"/thank-you"; 2904 2905 2906 } 2907 2908 else 2909 2910 { 2911 2912 $('#couponForm').append('<div class="alert alert-error" style="margin-top:10px;">'+msg.message+'</div>'); 2913 2914 setTimeout(function(){ 2915 2916 $('.alert-error').remove(); 2917 2918 },5000); 2919 2920 $('#submiterror').show(); 2921 2922 $('#couponForm')[0].reset(); 2923 2924 $('#couponForm #coupon_submit').attr('type','submit'); 2925 2926 $('#couponForm #coupon_submit').attr('value','Submit'); 2927 2928 } 2929 2930 return false; 2931 2932 }) 2933 2934 .fail(function() { 2935 2936 console.log("error"); 2937 2938 }) 2939 2940 .always(function() { 2941 2942 console.log("complete"); 2943 2944 }); 2945 2946 //});//captcha 2947 2948 //}); //captcha 2949 2950 } 2951 2952}); 2953 2954} 2955/** end coupon form **/ 2956// booking extraservice incresae descreasr 2957function incdec(){ 2958 // Increment button 2959 $(document).on('click', '.increment', function () { 2960 console.log("hello"); 2961 const input = $(this).siblings('input.extraser'); 2962 let val = parseInt(input.val()) || 0; 2963 let max = parseInt(input.attr('max')) || 999; 2964 2965 if (val < max) { 2966 // input.val(val + 1).trigger('change'); 2967 input.val(val).trigger('change'); 2968 } 2969 }); 2970 2971 // Decrement button 2972 $(document).on('click', '.decrement', function () { 2973 const input = $(this).siblings('input.extraser'); 2974 let val = parseInt(input.val()) || 0; 2975 let min = parseInt(input.attr('min')) || 0; 2976 2977 if (val > min) { 2978 //input.val(val - 1).trigger('change'); 2979 input.val(val).trigger('change'); 2980 } 2981 }); 2982 2983} 2984function promobannerform(ajaxurl, siteurl) { 2985 $("#promobannerform").validate({ 2986 ignore: [], 2987 errorElement: "label", 2988 errorClass: 'form-error', 2989 rules: { 2990 fullname: { 2991 required: true 2992 }, 2993 mobile: { 2994 required: true, 2995 }, 2996 email: { required: true }, 2997 country: { 2998 required: true, 2999 }, 3000 3001 }, 3002 messages: { 3003 email: 3004 { 3005 email: "Invalid email format", 3006 3007 }, 3008 }, 3009 3010 highlight: function (element) { 3011 3012 $(element).addClass('form-error'); 3013 3014 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 3015 3016 }, 3017 3018 unhighlight: function (element) { 3019 3020 $(element).removeClass('form-error'); 3021 3022 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 3023 3024 }, 3025 3026 submitHandler: function (form) { 3027 3028 $('#submiterror').hide(); 3029 3030 // grecaptcha.ready(function() { 3031 3032 // grecaptcha.execute('6Lf4t_QjAAAAAF6nd-4zfdgwco00RqlxHnf1SpFd', {action: 'contactsubmit'}).then(function(token) { 3033 3034 //console.log(token); 3035 3036 //$("#recaptchaResponse").val(token); 3037 3038 var form_details = $('#promobannerform').serialize(); 3039 3040 $.ajax({ 3041 3042 url: ajaxurl, 3043 3044 type: 'POST', 3045 3046 data: form_details + '&action=promo_ajax', 3047 3048 beforeSend: function () { 3049 3050 $('#submiterror').hide(); 3051 3052 $('#promobannerform #trip_submit').attr('type', 'button'); 3053 3054 $('#promobannerform #trip_submit').html('Please wait...'); 3055 3056 } 3057 3058 }) 3059 3060 .done(function (msg) { 3061 3062 msg = JSON.parse(msg); 3063 3064 if (msg.result === 'success') { 3065 console.log("Done"); 3066 window.location.href = siteurl + "thank-you/"; 3067 3068 } 3069 3070 else { 3071 $('#promobannerform').append('<div class="alert alert-error" style="margin-top:10px;">' + msg.message + '</div>'); 3072 3073 setTimeout(function () { 3074 $('.alert-error').remove(); 3075 }, 5000); 3076 $('#submiterror').show(); 3077 $('#promobannerform')[0].reset(); 3078 $('#promobannerform #trip_submit').attr('type', 'submit'); 3079 3080 $('#promobannerform #trip_submit').html('Send Inquiry'); 3081 3082 } 3083 return false;
3084 }) 3085 .fail(function () { 3086 console.log("error"); 3087 }) 3088 .always(function () { 3089 console.log("complete business"); 3090 }); 3091 // });//captcha 3092 // }); //captcha 3093 } 3094 }); 3095} 3096 3097function pdfdownloadform(ajaxurl, siteurl) { 3098 $("#pdfdownload").validate({ 3099 ignore: [], 3100 errorElement: "label", 3101 errorClass: 'form-error', 3102 rules: { 3103 bkName: { 3104 required: true 3105 }, 3106 bkEmailaddress: { required: true }, 3107 bkpackage: { 3108 required: true, 3109 }, 3110 bkPhone: { 3111 required: true, 3112 }, 3113 3114 }, 3115 messages: { 3116 bkEmailaddress: 3117 { 3118 email: "Invalid email format", 3119 3120 }, 3121 }, 3122 3123 highlight: function (element) { 3124 3125 $(element).addClass('form-error'); 3126 3127 $(element).parents('div.form-module').addClass('required').addClass('form-error'); 3128 3129 }, 3130 3131 unhighlight: function (element) { 3132 3133 $(element).removeClass('form-error'); 3134 3135 $(element).parents('div.form-module').removeClass('required').removeClass('form-error'); 3136 3137 }, 3138 3139 submitHandler: function (form) { 3140 3141 $('#submiterror').hide(); 3142 3143 // grecaptcha.ready(function() { 3144 3145 // grecaptcha.execute('6Lf4t_QjAAAAAF6nd-4zfdgwco00RqlxHnf1SpFd', {action: 'contactsubmit'}).then(function(token) { 3146 3147 //console.log(token); 3148 3149 //$("#recaptchaResponse").val(token); 3150 3151 var form_details = $('#pdfdownload').serialize(); 3152 3153 $.ajax({ 3154 3155 url: ajaxurl, 3156 3157 type: 'POST', 3158 3159 data: form_details + '&action=pdfdownload_ajax', 3160 3161 beforeSend: function () { 3162 3163 $('#submiterror').hide(); 3164 3165 $('#pdfdownload #trip_submit').attr('type', 'button'); 3166 3167 $('#pdfdownload #trip_submit').html('Please wait...'); 3168 3169 } 3170 3171 }) 3172 3173 .done(function (msg) { 3174 3175 msg = JSON.parse(msg); 3176 3177 if (msg.result === 'success') { 3178 console.log("Done"); 3179 window.location.href = siteurl + "thank-you/"; 3180 3181 } 3182 3183 else { 3184 $('#pdfdownload').append('<div class="alert alert-error" style="margin-top:10px;">' + msg.message + '</div>'); 3185 3186 setTimeout(function () { 3187 $('.alert-error').remove(); 3188 }, 5000); 3189 $('#submiterror').show(); 3190 $('#pdfdownload')[0].reset(); 3191 $('#pdfdownload #trip_submit').attr('type', 'submit'); 3192 3193 $('#pdfdownload #trip_submit').html('Send Inquiry'); 3194 3195 } 3196 return false; 3197 }) 3198 .fail(function () { 3199 console.log("error"); 3200 }) 3201 .always(function () { 3202 console.log("complete business"); 3203 }); 3204 // });//captcha 3205 // }); //captcha 3206 } 3207 }); 3208}
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.