| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/regencytours.in/public/js/ |
Upload File : |
(function ($) {
$(document).ready(function () {
// var PkgSysId = $("#hiddenPkgSysId").val();
// var PackageType = $('#packagetype_' + PkgSysId).val();
// var GTXPkgId = $('#gtxpackage_' + PkgSysId).val();
// var hotelcategoryid = $('#hotelcategoryid_' + PkgSysId).val();
// var packagetpid = $('#packagetpid_' + PkgSysId).val();
// var tourtype = $('#tourtype_' + PkgSysId).val();
// var packagenamemodal = $('#packagename_' + PkgSysId).val();
// var mealplantype = $('#mealplantype_' + PkgSysId).val();
// // $('.msg').hide().html('');
// // $("#leadsend").val('0');
// // $('#expandsave').hide();
// $('#packagesys_id').val(PkgSysId);
// $('#packagetype_id').val(PackageType);
// $('#package_sid').val(GTXPkgId);
// $('#package_hotelcategoryid').val(hotelcategoryid);
// $('#package_mealplantypeid').val(mealplantype);
// $('#package_tpid').val(packagetpid);
// $('#package_tourtype_id').val(tourtype);
// $('#packagenamemodal').html(packagenamemodal);
// $('#mpackage_name').val(packagenamemodal);
// $('#displaySendEnquiryForm').show();
// $('.hidebutton').find('.sending').show().html('Send Enquiry').attr('disabled', false);
// $('.package_enquiry #displaySendEnquiryThanks, .package_enquiry #tableCost, .class-modify-enquiry').hide();
//
// $('.package_enquiry').find('.en_customerfromdestination, .from_destination_id, .en_customertripdate').val('').attr('disabled', false);
// $('.package_enquiry .smsg').html('');
// $('.inserted-room-row').remove();
// $('.addmore').show();
// $('.package_enquiry #traveler_adult_1').val(1);
// $('.package_enquiry #traveler_kids_1 , .package_enquiry #traveler_infant_1').val(0);
// $('#itinerary_inputs').val(1);
// $('#itinerary_rooms').val(2);
// $('.hidebutton').find('.class-modify-enquiry').hide();
$(".sending1").on('click', function (e) {
var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
e.preventDefault();
var data = $(".package_rate_enquiry").serialize();
var leadsend = $("#leadsends").val();
if ($('.package_rate_enquiry input[name="email"]').val() == '') {
$('.msgs').show().html('Please enter your email address').fadeIn().delay(2000).fadeOut();
$('.package_rate_enquiry input[name="email"]').focus();
return false;
}
if (!EmailReg.test($('.package_rate_enquiry input[name="email"]').val())) {
$('.msgs').show().html('Please enter valid email address!!!').fadeIn().delay(2000).fadeOut();
$('.package_rate_enquiry input[name="email"]').focus();
return false;
}
if ($('.package_rate_enquiry input[name="mobile"]').val() == '') {
$('.msgs').show().html('Please enter your mobile number').fadeIn().delay(2000).fadeOut();
$('.package_rate_enquiry input[name="mobile"]').focus();
return false;
}
// if ($('.package_rate_enquiry input[name="mobile"]').val().length != '10') {
// $('.msgs').show().html('Mobile should be 10 digit?').fadeIn().delay(2000).fadeOut();
// $('.package_rate_enquiry input[name="mobile"]').focus();
// return false;
// }
if (!$.isNumeric($('.package_rate_enquiry input[name="mobile"]').val())) {
$('.msgs').show().html('Mobile should be numeric!!').fadeIn().delay(2000).fadeOut();
$('.package_rate_enquiry input[name="mobile"]').focus();
return false;
}
// if ($('.package_rate_enquiry input[name="from_destination_id"]').val() == '') {
// $('.msgs').show().html('Please enter traveling from');
// $('.package_rate_enquiry input[name="from_destination_name"]').focus();
// return false;
// }
if ($('.package_rate_enquiry input[name="dates"]').val() == '') {
$('.msgs').show().html('Please enter travel date');
$('.package_rate_enquiry input[name="dates"]').focus();
return false;
}
if (leadsend == '0') {
$.ajax({
url: SITEURL + 'gtxwebservices/send-enquiry/post', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
$('.sending1').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...').attr('disabled', 'disabled');
}, success: function (result) {
if ((result.status == 'success') && (result.availability == true)) {
$('.package_rate_enquiry .smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
var priceTax = result.addtional['GSTAmount']; // Tax
var sumRoomWise = result.addtional['MyCost']; // TotalPrice
var priceGT = result.addtional['AmountWithGST']; // GrandTotal
if (priceTax == 0) {
$('#totalBasicCostTR , #totalTaxCostTR,#totalGrandCostTR').hide();
$('#GSTI').show().html('GST (Included)');
} else {
$('#totalBasicCostTR , #totalTaxCostTR , #totalGrandCostTR').show();
$('#GSTI').hide().html('');
}
var priceTaxFormatted, priceBCFormatted, priceGTFormatted = '';
priceTaxFormatted = ptMoneyFormatINR(priceTax, 2, null);
priceBCFormatted = ptMoneyFormatINR(sumRoomWise, 2, null);
priceGTFormatted = ptMoneyFormatINR((priceGT), 2, null);
$('#totalBasicCost').html(priceBCFormatted);
$('#totalTaxCost').html(priceTaxFormatted);
$('#totalGrandCost').html(priceGTFormatted);
$('#tableCost').slideDown();
if (result.IsBooking == true && result.url != '') {
$('.class-book-now-btn').show().attr('href', result.url);
}
} else if ((result.status == 'success') && (result.availability == "false")) {
$('.smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
} else if ((result.status == false) && (result.availability == "false")) {
$('.package_rate_enquiry .smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});
} else {
$('.smsg1').show().html('Thanks! Your enquiry submitted successfully.\n\ We will revert back with suitable suggestions.').css({'color': '#5cb85c'});
}
$('.sending1').html('Send Enquiry').hide();
$('.class-modify-enquiry-btn').show();
$('.perperson-priceBtn').show();
}, error: function (result) {
$('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#ff0000'});
$('.sending1').html('Send Enquiry').hide();
$('.class-modify-enquiry-btn').show();
}
});
}
});
$(".sending2").on('click', function (e) {
//debugger;
var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
e.preventDefault();
var dataSending2 = $(".package_rate_enquiry_pop").serialize();
var leadsend = $("#leadsends").val();
if ($('.package_rate_enquiry_pop #salutation').val() == '') {
$('.msgs').show().html('Please select Title');
$('.package_rate_enquiry_pop #salutation').focus();
return false;
}
if ($('.package_rate_enquiry_pop input[name="fname"]').val() == '') {
$('.msgs').show().html('Please enter your first name');
$('.package_rate_enquiry_pop input[name="fname"]').focus();
return false;
}
if ($('.package_rate_enquiry_pop input[name="lname"]').val() == '') {
$('.msgs').show().html('Please enter your last name');
$('.package_rate_enquiry_pop input[name="lname"]').focus();
return false;
}
if ($('.package_rate_enquiry_pop input[name="stdcode"]').val() == '') {
$('.msgs').show().html('Please enter country code');
$('.package_rate_enquiry_pop input[name="stdcode"]').focus();
return false;
}
if ($('.package_rate_enquiry_pop input[name="mobile"]').val() == '') {
$('.msgs').show().html('Please enter your mobile number');
$('.package_rate_enquiry_pop input[name="mobile"]').focus();
return false;
}
if ($('.package_rate_enquiry_pop input[name="mobile"]').val().length != '10') {
$('.msgs').show().html('Mobile should be 10 digit?');
$('.package_rate_enquiry_pop input[name="mobile"]').focus();
return false;
}
if (!$.isNumeric($('.package_rate_enquiry_pop input[name="mobile"]').val())) {
$('.msgs').show().html('Mobile should be numeric!!');
$('.package_rate_enquiry_pop input[name="mobile"]').focus();
return false;
}
if ($('.package_rate_enquiry_pop input[name="email"]').val() == '') {
$('.msgs').show().html('Please enter your email address');
$('.package_rate_enquiry_pop input[name="email"]').focus();
return false;
}
if (!EmailReg.test($('.package_rate_enquiry_pop input[name="email"]').val())) {
$('.msgs').show().html('Please enter valid email address!!!');
$('.package_rate_enquiry_pop input[name="email"]').focus();
return false;
}
if ($("#travelerDatePickerdetail").val() == '') {
$('.msgs').show().html('Please enter travel date');
$('#travelerDatePickerdetail').focus();
return false;
}
// alert(dataSending2);
$.ajax({
url: SITEURL + 'gtxwebservices/send-enquiry/post', type: 'POST', data: dataSending2, dataType: 'json', beforeSend: function () {
// debugger;
$('.sending2').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...');
}, success: function (result) {
if ((result.status == 'success') && (result.availability == true)) {
$('.package_rate_enquiry_pop .smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
var priceTax = result.addtional['GSTAmount']; // Tax
var sumRoomWise = result.addtional['MyCost']; // TotalPrice
var priceGT = result.addtional['AmountWithGST']; // GrandTotal
if (priceTax == 0) {
$('#totalBasicCostTR , #totalTaxCostTR').hide();
$('#GSTI').show().html('GST (Included)');
} else {
$('#totalBasicCostTR , #totalTaxCostTR').show();
$('#GSTI').hide().html('');
}
var priceTaxFormatted, priceBCFormatted, priceGTFormatted = '';
priceTaxFormatted = ptMoneyFormatINR(priceTax, 2, null);
priceBCFormatted = ptMoneyFormatINR(sumRoomWise, 2, null);
priceGTFormatted = ptMoneyFormatINR((priceGT), 2, null);
$('#totalBasicCost').html(priceBCFormatted);
$('#totalTaxCost').html(priceTaxFormatted);
$('#totalGrandCost').html(priceGTFormatted);
$('#tableCost').slideDown();
$('.sending2').html('Continue to Book').attr('disabled', false);
if (result.IsBooking == true && result.url != '') {
$('.class-book-now-btn').show().attr('href', result.url);
$('.class-modify-enquiry').show();
$('.addmorePop').hide();
}
} else if ((result.status == 'success') && (result.availability == "false")) {
$('.smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
$('.addmorePop').hide();
} else if ((result.status == false) && (result.availability == "false")) {
$('.package_rate_enquiry_pop .smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});
$('.addmorePop').hide();
} else if ((result.status == false) && (result.redirect == true)) {
$('.smsg1').show().html("You are not login.").css({'color': '#5cb85c'});
window.location.href = SITEURL;
} else {
$('.smsg1').show().html('Thanks! Your enquiry submitted successfully.\n\ We will revert back with suitable suggestions.').css({'color': '#5cb85c'});
}
$('.sending2').html('Continue to Book').attr('disabled', false);
$('.hidebutton').find('.sending2').hide();
$('.class-modify').hide();
$('.addmorePop').hide();
}, error: function (result) {
$('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
$('.sending2').hide();
$('.hidebutton').find('.sending2').hide();
$('.hidebutton').find('.class-modify-enquiry').show();
}
});
});
$('.class-modify-enquiry').hide();
$('.class-book-now-btn').hide();
$('.class-modify-enquiry').click(
function () {
$('.addmorePop').show();
}
);
$(document).on('click', '.sendRateEnuiryform', function () {
$('#inquiryfromdate').html('<input type="text" name="traveldate" placeholder="Travel Date " class="" id="inquirydatefrom" placeholder="Travel Date" aria-label="Travel Date" maxlength="10" value="" />');
$('#inquirydatefrom').datepicker({
dateFormat: 'dd/mm/yy',
minDate: 0,
beforeShow: function (input, inst) {
var rect = input.getBoundingClientRect();
setTimeout(function () {
inst.dpDiv.css({ top: rect.top + 40, left: rect.left + 0 });
}, 0);
}
});
});
$('#datefromdetail').datepicker({
dateFormat: 'dd/mm/yy',
minDate: 0,
});
$(document).on('click', '.sendRateEnuiryPackagetour', function () {
var PkgSysId = $(this).attr('data-rvs');
var PackageType = $('#packagetype_' + PkgSysId).val();
var GTXPkgId = $('#gtxpackage_' + PkgSysId).val();
var hotelcategoryid = $('#hotelcategoryid_' + PkgSysId).val();
var packagetpid = $('#packagetpid_' + PkgSysId).val();
var tourtype = $('#tourtype_' + PkgSysId).val();
var packagenamemodal = $('#packagename_' + PkgSysId).val();
var mealplantype = $('#mealplantype_' + PkgSysId).val();
var packagedesname = $('#packagedesname_' + PkgSysId).val();
var currencyType = $('#currencyType_' + PkgSysId).val();
var packageurl = $('#packageurl_' + PkgSysId).val();
var estinamtebtnid = $(this).text();
if(estinamtebtnid == "Get offer"){
$('a#Send_Enquiry').text('Send Enquiry');
}
else if(estinamtebtnid == "Get Offer"){
$('a#Send_Enquiry').text('Send Enquiry');
}else if(estinamtebtnid == "Send Enquiry"){
$('a#Send_Enquiry').text('Send Enquiry');
}else{
$('a#Send_Enquiry').text('Continue to Book');
}
//var Send_Enquiry = $('#Send_Enquiry' + PkgSysId).val();
var isFixedDeparturesPackage = $('#isFixedDeparturesPackage_' + GTXPkgId).val();
if (isFixedDeparturesPackage == 1) {
$('#putFixedDeparturesDateDiv').html($('#isFixedDeparturesDateDiv_' + GTXPkgId).html());
} else {
$('#putFixedDeparturesDateDiv').html('<input type="text" name="date" placeholder="Travel Date" class="" id="travelerDatePickerdetail" placeholder="Travel Date" aria-label="Travel Date" maxlength="10" value="" />');
}
$('#travelerDatePickerdetail').datepicker({
dateFormat: 'dd/mm/yy',
minDate: 0,
beforeShow: function (input, inst) {
var rect = input.getBoundingClientRect();
setTimeout(function () {
inst.dpDiv.css({ top: rect.top + 40, left: rect.left + 0 });
}, 0);
}
});
// $('.packName').html(packagenamemodal);
$('.msgs').hide().html('');
$('.smsg1').hide().html('');
$("#leadsends").val('0');
//$('#expandsave').hide();
// $('#isFixedDeparturesPackage').val(isFixedDepartures);
$('#packagesys_ids').val(PkgSysId);
$('#packagetype_ids').val(PackageType);
$('#package_sids').val(GTXPkgId);
$('#package_hotelcategoryids').val(hotelcategoryid);
$('#package_mealplantypeids').val(mealplantype);
$('#package_tpids').val(packagetpid);
$('#package_tourtype_ids').val(tourtype);
$('#packagenamemodal').html(packagenamemodal);
$('#mpackage_name').val(packagenamemodal);
$('#packagedesname').val(packagedesname);
$('.WebRupeeHtml').html(currencyType);
$('#packageurl').val(packageurl_);
$('#displaySendRateEnquiryForm').show();
// $('.hidebutton').find('.sending1').show().html('Check Rate & Send Enquiry').attr('disabled', false);
//$('.hidebutton').find('.sending2').show().html('Send Enquiry').attr('disabled', false).css('color', '#fff');
$('.package_rate_enquiry #tableCost, .class-modify-enquiry').hide();
$('.package_rate_enquiry .smsg1').html('');
$('.inserted-room-row').remove();
$('.addmore').show();
$('.package_rate_enquiry #traveler_adult_1').val(1);
$('.package_rate_enquiry #traveler_kids_1 , .package_rate_enquiry #traveler_infant_1').val(0);
$('#itinerary_inputs').val(1);
$('#itinerary_rooms').val(2);
$('.hidebutton').find('.class-modify-enquiry').hide();
$('.sending2').show();
$('#tableCost').hide();
if ($('#check_TravelAgent').val() == 1) {
$('#Send_Enquiry').click();
}
});
$(document).on('click', '.sendRateEnuiryPackage', function () {
var PkgSysId = $(this).attr('data-rvs');
var PackageType = $('#packagetype_' + PkgSysId).val();
var GTXPkgId = $('#gtxpackage_' + PkgSysId).val();
var hotelcategoryid = $('#hotelcategoryid_' + PkgSysId).val();
var packagetpid = $('#packagetpid_' + PkgSysId).val();
var tourtype = $('#tourtype_' + PkgSysId).val();
var packagenamemodal = $('#packagename_' + PkgSysId).val();
var mealplantype = $('#mealplantype_' + PkgSysId).val();
var packagedesname = $('#packagedesname_' + PkgSysId).val();
$('.msgs').hide().html('');
$('.smsg1').hide().html('');
$("#leadsends").val('0');
//$('#expandsave').hide();
$('#packagesys_ids').val(PkgSysId);
$('#packagetype_ids').val(PackageType);
$('#package_sids').val(GTXPkgId);
$('#package_hotelcategoryids').val(hotelcategoryid);
$('#package_mealplantypeids').val(mealplantype);
$('#package_tpids').val(packagetpid);
$('#package_tourtype_ids').val(tourtype);
$('#packagenamemodal').html(packagenamemodal);
$('#mpackage_name').val(packagenamemodal);
$('#packagedesname').val(packagedesname);
$('#displaySendRateEnquiryForm').show();
// $('.hidebutton').find('.sending1').show().html('Check Rate & Send Enquiry').attr('disabled', false);
$('.hidebutton').find('.sending1').show().html('Send Enquiry').attr('disabled', false).css('color', '#fff');
$('.package_rate_enquiry #tableCost, .class-modify-enquiry').hide();
$('.package_rate_enquiry .smsg1').html('');
$('.inserted-room-row').remove();
$('.addmore').show();
$('.package_rate_enquiry #traveler_adult_1').val(1);
$('.package_rate_enquiry #traveler_kids_1 , .package_rate_enquiry #traveler_infant_1').val(0);
$('#itinerary_inputs').val(1);
$('#itinerary_rooms').val(2);
$('.hidebutton').find('.class-modify-enquiry').hide();
if ($('#check_TravelAgent').val() == 1) {
$('#Send_Enquiry').click();
}
});
});
})(jQuery);
$(".sendingrequest").on('click', function (e) {
var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
e.preventDefault();
var data = $(".sendingrequestCallback").serialize();
if ($('.sendingrequestCallback input[name="email"]').val() == '') {
$('.msgrequest').show().html('Please enter your email id').css('color', 'red').fadeIn().delay(5000).fadeOut();
$('.sendingrequestCallback input[name="email"]').focus();
return false;
}
if (!EmailReg.test($('.sendingrequestCallback input[name="email"]').val())) {
$('.msgrequest').show().html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(5000).fadeOut();
$('.sendingrequestCallback input[name="email"]').focus();
return false;
}
if ($('.sendingrequestCallback input[name="mobile"]').val() == '') {
$('.msgrequest').show().html('Please enter your Mobile').css('color', 'red').fadeIn().delay(5000).fadeOut();
$('.sendingrequestCallback input[name="mobile"]').focus();
return false;
}
if (!$.isNumeric($('.sendingrequestCallback input[name="mobile"]').val())) {
$('.msgrequest').show().html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(5000).fadeOut();
$('.sendingrequestCallback input[name="mobile"]').focus();
return false;
}
// if ($('.sendingrequestCallback input[name="mobile"]').val().length != '10') {
// $('.msgrequest').show().html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(5000).fadeOut();
// $('.sendingrequestCallback input[name="mobile"]').focus();
// return false;
// }
$('.msgrequest').html('');
$('.sendingrequest').attr('disabled', true);
$.ajax({
url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
$('.sendingrequest').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...');
}, success: function (result) {
if (result.status) {
$('.sendingrequest').html('Request a callback');
$('.msgrequest').html(result.message).css({'color': '#5cb85c'});
} else {
$('.sendingrequest').html('Request a callback');
$('.msgrequest').html(result.message);
}
}, error: function (result) {
$('.sendingrequest').html('Request a callback').attr('disabled', false);
alert('Some error occured.');
}
});
});
$(".sendEnquiry").on('submit', function (e) {
$('.enqmsg').html('');
e.preventDefault();
var data = $(this).serialize();
var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
if ($('.sendEnquiry input[name="name"]').val() == '') {
$('.enqmsg').html('Please enter your name').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiry input[name="name"]').focus();
return false;
}
if ($('.sendEnquiry input[name="mobile"]').val() == '') {
$('.enqmsg').html('Please enter your Mobile').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiry input[name="mobile"]').focus();
return false;
}
if (!$.isNumeric($('.sendEnquiry input[name="mobile"]').val())) {
$('.enqmsg').html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiry input[name="mobile"]').focus();
return false;
}
// if ($('.sendEnquiry input[name="mobile"]').val().length != '10') {
// $('.enqmsg').html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(2000).fadeOut();
// $('.sendEnquiry input[name="mobile"]').focus();
// return false;
// }
if ($('.sendEnquiry input[name="email"]').val() == '') {
$('.enqmsg').html('Please enter your email id').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiry input[name="email"]').focus();
return false;
}
if (!EmailReg.test($('.sendEnquiry input[name="email"]').val())) {
$('.enqmsg').html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiry input[name="email"]').focus();
return false;
}
$('.enqmsg').html('');
$('.sendEnquirySubmit').attr('disabled', 'disabled');
$.ajax({
url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
$('.sendEnquirySubmit').val('Sending...');
}, success: function (result) {
if (result.status) {
$('.sendEnquirySubmit').val('Send Enquiry');
$('.enqmsg').html(result.message).css('color', 'green');
} else {
$('.sendEnquirySubmit').val('Send Enquiry');
$('.enqmsg').html(result.message)
}
}, error: function (result) {
$('.sendEnquirySubmit').val('Send Enquiry');
alert('Some error occured.');
}
});
});
$(".sendEnquiryServices").on('submit', function (e) {
$('.msgrequest').html('');
e.preventDefault();
var data = $(this).serialize();
var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
if ($('.sendEnquiryServices input[name="fname"]').val() == '') {
$('.msgrequest').html('Please enter your name').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiryServices input[name="fname"]').focus();
return false;
}
// if ($('.sendEnquiry input[name="mobile"]').val().length != '10') {
// $('.enqmsg').html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(2000).fadeOut();
// $('.sendEnquiry input[name="mobile"]').focus();
// return false;
// }
if ($('.sendEnquiryServices input[name="email"]').val() == '') {
$('.msgrequest').html('Please enter your email id').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiryServices input[name="email"]').focus();
return false;
}
if (!EmailReg.test($('.sendEnquiryServices input[name="email"]').val())) {
$('.msgrequest').html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiryServices input[name="email"]').focus();
return false;
}
if ($('.sendEnquiryServices input[name="mobile"]').val() == '') {
$('.msgrequest').html('Please enter your Mobile').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiryServices input[name="mobile"]').focus();
return false;
}
if (!$.isNumeric($('.sendEnquiryServices input[name="mobile"]').val())) {
$('.msgrequest').html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
$('.sendEnquiryServices input[name="mobile"]').focus();
return false;
}
$('.sendEnquiryServicesBtn').attr('disabled', 'disabled');
$.ajax({
url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
$('.sendEnquiryServicesBtn').val('Sending...');
}, success: function (result) {
if (result.status) {
$('.sendEnquiryServicesBtn').val('Send Enquiry');
$('.msgrequest').html(result.message).show().css('color', 'green');
} else {
$('.sendEnquiryServicesBtn').val('Send Enquiry');
$('.msgrequest').html(result.message).show();
}
}, error: function (result) {
$('.sendEnquiryServicesBtn').val('Send Enquiry');
alert('Some error occured.');
}
});
});
//Added by Piyush on 22 Aug 2018 start
$("#travelers").on("click", function () {
var checkClass = $(".roomBoxMain").hasClass('myCustomClass');
if (checkClass == false) {
$(".roomBoxMain").toggle('myCustomClass');
$(".roomBoxMain").css('display', 'block');
$('#adultgroup_1 select').val(2);
} else {
$(".roomBoxMain").css('display', 'none');
}
});
function checkTravellers(that, rownumber) {
var div = $(that).closest('.room-rows-container');
var totalpax = 0;
var adults = div.find('#traveler_adult_' + rownumber).val();
var kids = div.find('#traveler_kids_' + rownumber).val();
var infant = div.find('#traveler_infant_' + rownumber).val();
totalpax = parseInt(adults) + parseInt(kids) + parseInt(infant);
if (parseInt(totalpax) > 4) {
alert("Total pax can not be more than 4 in a room. Please modify travellers in room " + rownumber);
if ($(that).hasClass('traveler_adult'))
$(that).val(1); // reset the current value
else
$(that).val(0); // reset the current value
return false;
} else {
if (parseInt(adults) == 3) {
div.find('#room-row-adult-bedtype-' + rownumber).show();
div.find('#room-row-adult-bedtype-' + rownumber + ' select').val('extrabed');
} else {
div.find('#room-row-adult-bedtype-' + rownumber).hide();
div.find('#room-row-adult-bedtype-' + rownumber + ' select').val('');
}
div.find('.room-row-child-bedtype-' + rownumber).hide(); // hide all select box
if (parseInt(kids) > 0) {
for (var i = 1; i <= parseInt(kids); i++) {
div.find('#room-row-child-bedtype-' + rownumber + "-" + i).show();
div.find('#room-row-child-bedtype-' + rownumber + "-" + i + ' select').val('extrabed');
}
}
}
}
function tottraveller() {
var totaladult = '0';
var totalchild = '0';
var totalinfant = '0';
var Group = $('.Group').is(":checked");
var roomlp = $("#roomlp").val();
if (Group === true) {
var adult_1 = $("#adult_1").val();
var child_1 = $("#child_1").val();
if (adult_1 === '') {
alert('Please enter total adults');
$("#adult_1").focus();
return false;
}
if (child_1 === '') {
alert('Please enter total children');
$("#child_1").focus();
return false;
}
}
var childrenbed = [];
for (j = 1; j <= roomlp; j++) {
totaladult = parseFloat(totaladult) + parseFloat($("#adult_" + j).val());
totalchild = parseFloat(totalchild) + parseFloat($("#child_" + j).val());
totalinfant = parseFloat(totalinfant) + parseFloat($("#infant_" + j).val());
var extraBed = $('#extrabed_' + j + ':checked').val();
childrenbed.push(extraBed);
}
var totaltraveller = parseInt(totaladult) + parseInt(totalchild) + parseInt(totalinfant);
var MaxPax = parseInt(roomlp) * 4;
if (Group === false) {
if (totaltraveller > MaxPax) {
alert('Only 4 pax are allowed in each room. Please modify travelers');
return false;
}
}
$("#totadlt").val(totaladult);
$("#totchld").val(totalchild);
$("#totinfnt").val(totalchild);
$("#numberofroom").html(roomlp);
$("#roomguest").html(totaltraveller);
$("#totaltravelers").val(totaltraveller);
$(".roomBoxMain").hide();
var roominfojson = '[{"totalRoom" : ' + roomlp + '},{"totalTraveler" : ' + totaltraveller + '},{"totaladult" : ' + totaladult + '},{"totalchild" : ' + totalchild + '},{"totalinfant" : ' + totalinfant + '}]'
$("#roominfojson").val(roominfojson);
$(".roomBoxMain").hide();
}
function tottravelerInRoom(roomno) {
// alert(roomno);
var adult = $("#adult_" + roomno).val();
var child = $("#child_" + roomno).val();
var infant = $("#infant_" + roomno).val();
var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(infant);
var Group = $('.Group').is(":checked");
if (Group === false) {
if (totalPaxInRoom >= 5) {
alert('Only 4 pax are allowed in each room. Please modify travelers in Room no. ' + roomno);
return false;
}
}
}
function addroom() {
var roomlp = $("#roomlp").val();
var showroom = parseInt(roomlp) + 1;
if (showroom === 11) {
alert('Only 10 rooms are allowed.');
return false;
// $('.addroom').hide();
}
$("#roomlp").val(showroom);
$("#rmres_" + showroom).show();
$('.disproom').hide();
$('.disproom_' + showroom).show();
$("#adult_" + showroom).focus();
}
function delroom(id) {
var showroom = parseInt(id) - 1;
$('.addroom').show();
$("#roomlp").val(showroom);
$("#rmres_" + id).hide();
$('.disproom').hide();
$('.disproom_' + showroom).show();
}
function showchildagebox(id) {
var childrencount = $("#child_" + id).val();
// alert(childrencount+'___'+id);
var j;
$(".childcl_" + id).show();
$(".childage_" + id).hide();
if (childrencount === '0') {
$(".childcl_" + id).hide();
return false;
}
for (j = 1; j <= childrencount; j++) {
$("#child_" + id + "_" + j).show();
}
//var showroom = parseInt(roomlp)+parseInt(roomlp);
//$("#rmres_"+showroom).show();adult_ child_ roomBoxMain
tottravelerInRoom(id);
}
function showextrabedchildagebox(id) {
var childrencount = $("#child_" + id).val();
// alert(childrencount+'___'+id);
var j;
$(".childage_" + id).hide();
for (j = 1; j <= childrencount; j++) {
$("#childcl_" + id + "_" + j).show();
$("#childcl_" + id + "_" + j + ' select').val('extrabed');
}
tottravelerInRoom(id);
}
function showextrabedbox(roomno) {
var adult = $("#adult_" + roomno).val();
if (adult == 3) {
$(".adultcl_" + roomno + '_3').show();
} else {
$(".adultcl_" + roomno + '_3').hide();
}
tottravelerInRoom(roomno);
}
$("#selectDestination").autocomplete({
source: function (request, response) {
var query = $("#selectDestination").val();
var countryId = '';
$.getJSON("/index/autosuggest", {query: query, countryId: countryId},
response);
},
minLength: 2,
autoFocus: true,
select: function (event, ui) {
var CityId = ui.item.CityId;
var CityName = ui.item.CityName;
$("#hidden_selected_hotel_cityid").val(CityId);
$("#hidden_selected_city_name").val(CityName);
}
});
$(document).on('click', '.removeit', function () {
var count = $('#itinerary_inputs').val();
var rooms = $('#itinerary_rooms').val();
if (count == 1) {
return false;
}
$('#itinerary_inputs').val(parseInt(count) - 1);
$('#itinerary_rooms').val(parseInt(rooms) - 1);
$('.room-rows-container').find('.inserted-room-row:last').remove();
});
$('.addmorePop').click(function () {
var count = 1;
var room = 2;
count = parseInt($('#itinerary_inputs').val());
room = parseInt($('#itinerary_rooms').val());
CONST_PACKAGE_TRAVELER_MAX_ROOM = parseInt(CONST_PACKAGE_TRAVELER_MAX_ROOM);
if (room > CONST_PACKAGE_TRAVELER_MAX_ROOM) {
alert("Can not add more than " + CONST_PACKAGE_TRAVELER_MAX_ROOM + " rooms.");
return false;
}
$('.room-rows-container').append('<div class="row borderrow" style="border: 0px solid #fff;margin-bottom: 0;">' + '<div class="col-lg-12 room-box room-row inserted-room-row">' + '<div class="row">' + '<div class="col-md-12 colspan-booking">' + '<div class="table-bordered"></div>' + '<label >Room ' + room + ' </label><button style="right:15px;" type="button" class="pull-right rounded text-danger removeit" aria-hidden="true" title="Remove Room">x</button>' + ' <input type="hidden" name="room[]" value="' + room + '" />' + '</div>' + ' <div class="cl"></div>' + '<div class="col-md-3 form-group1">' + '' + '<select name="adult[]" id="traveler_adult_' + room + '" class="traveler_adult form-control" onchange="checkTravellers(this ,' + room + ');">' + '<option value="1">Adults(+12Yrs)</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '<option value="3"> 3</option>' + '</select>' + ' </div>' + '<div class="col-md-3 form-group1" style="display: none" id="room-row-adult-bedtype-' + room + '"><select name="adult_bed_type[]" class="traveler_child form-control" onchange="checkAdultBedType(this);"><option value="">Adult Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option></select></div><div class="col-md-3 form-group1">' + '' + '<select name="child[]" class="traveler_child form-control" id="traveler_kids_' + room + '" onchange="checkTravellers(this,' + room + ');">' + '<option value="0">Kids(2 - 12Yrs)</option>' + '<option value="0">0</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '</select>' + ' </div>' + '<div class="col-md-3 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-1"><select name="child1_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-1" onchange="checkAdultBedType(this);"><option value="">Child 1 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div><div class="col-md-3 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-2"><select name="child2_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-2" onchange="checkAdultBedType(this);"><option value="">Child 2 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div> <div class="col-md-3 form-group1">' + '' + '<select name="infant[]" class="traveler_infant form-control" id="traveler_infant_' + room + '" onchange="checkTravellers(this,' + room + ');">' + '<option value="0">Infant(0 - 2Yrs)</option>' + '<option value="0">0</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '<option value="3"> 3</option>' + '<option value="4"> 4</option>' + '</select>' + '</div>' + '</div>' + '</div>');
$('#itinerary_inputs').val(parseInt(count) + 1);
$('#itinerary_rooms').val(parseInt(room) + 1);
});
function modify_enquiry(that) {
$(that).hide();
if ($('#check_TravelAgent').val() == 1) {
$('.sending1').html('Check Rate & Get Proposal').show();
$('.sending2').html('Check Rate & Get Proposal').show();
} else {
$('.sending1').html('View Offers & Send Enquiry').show();
$('.sending2').html('View Offers & Send Enquiry').show();
$('#tableCost').hide();
}
$('.class-book-now-btn').hide();
$('.sending1').html('View Offers & Send Enquiry').attr('disabled', false);
$('.sending2').html('View Offers & Send Enquiry').attr('disabled', false);
$('.smsg1').html('');
}
function modify_enquiry_btn(that) {
$(that).hide();
if ($('#check_TravelAgent').val() == 1) {
$('.sending1').html('Check Rate & Get Proposal').show();
$('.sending2').html('Check Rate & Get Proposal').show();
} else {
$('.sending1').html('View Offers & Send Enquiry').show();
$('.sending2').html('View Offers & Send Enquiry').show();
$('#tableCost').hide();
}
$('#leadsends').val(0);
$('.class-book-now-btn').hide();
$('.sending1').html('View Offers & Send Enquiry').attr('disabled', false);
$('.sending2').html('View Offers & Send Enquiry').attr('disabled', false);
$('.smsg1').html('');
}
function checkAdultBedType(that) {
if ($(that).val() == '') {
alert('Please select bed type');
$(that).val('extrabed');
return false;
}
}
function ptMoneyFormatINR(n, prec, currSign) {
if (prec == null)
prec = 2;
var n = ('' + parseFloat(n).toFixed(prec).toString()).split('.');
var num = n[0];
var dec = n[1];
var r, s, t;
if (num.length > 3) {
s = num.length % 3;
if (s) {
t = num.substring(0, s);
num = t + num.substring(s).replace(/(\d{3})/g, ",$1");
} else {
num = num.substring(s).replace(/(\d{3})/g, ",$1").substring(1);
}
}
// return(currSign == null ? "" : currSign + "") + num + '.' + dec;
return (currSign == null ? "" : currSign + "") + num;
}
function changeContentByCategory(cname, desname, packageId, catId, gtxId, tourType, mp) {
var catIdVal = $(catId).val();
if (catIdVal == undefined) {
var catIdVal = catId;
}
// alert(catIdVal);
// var data = SITEURL + 'detail/'+cname+'/'+desname+'-'+packageId+'-'+catId+'-'+gtxId+'-'+tourType+'-'+mp+'.html';
var countryname = cname;
var name = desname + '-' + packageId + '-' + catIdVal + '-' + gtxId + '-' + tourType + '-' + mp + '.html';
// alert(name);
// alert("work");
$.ajax({
url: SITEURL + 'detail/index/index-ajax-data',
type: 'POST',
data: {countryname: countryname, name: name},
dataType: 'html',
beforeSend: function () {
// alert("hello");
},
success: function (result) {
$('#changeContentByajax').html('');
$('#changeContentByajax').html(result);
$('#downloadBroucherData').attr('href', SITEURL + 'detail/index/download-package-pdf/gtxid/' + gtxId + '/pkgid/' + packageId + '/catid/' + catIdVal);
copyPriceFunction(packageId, parseInt(catIdVal));
return false;
},
error: function () {
alert('Oops unable to connect with server!!');
return false;
}
});
}
changeContentBytabCategoryFunc = function(that, tab){
if(that=='Budget'){
that = '1';
}
else if(that=='Standard'){
that = '2';
}
else if(that=='Deluxe'){
that = '3';
}
else if(that=='Luxury'){
that = '4';
}
else if(that=='Premium'){
that = '5';
}else{
that = that;
}
var packageId = $(that).attr('PkgSysId');
var catId = $(that).val();
var gtxId = $('#gtxpackage_' + packageId).val();
var desname = $('#citytxtval_' + packageId).val();
var cname = $('#package_location_' + packageId).val();
$('#hotelcategoryid_' + packageId).val(catId);
var tourType = $('#tourtype_' + packageId).val();
var mp = $('#mealplantype_' + packageId).val();
var hotel_type = $('.categorySelect_' + parseInt(packageId)+ ' option:selected').attr('categoryName');
changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
changeContentByCategory(cname, desname, packageId, catId, gtxId, tourType, mp)
}
changeContentBytabCategoryFunc3 = function(that, packageId){
if(that=='Budget'){
that = '1';
}
else if(that=='Standard'){
that = '2';
}
else if(that=='Deluxe'){
that = '3';
}
else if(that=='Luxury'){
that = '4';
}
else if(that=='Premium'){
that = '5';
}else{
that = that;
}
var tab = 'Hotelstab';
var packageId = packageId;
var catId = that;
var gtxId = $('#gtxpackage_' + packageId).val();
var desname = $('#citytxtval_' + packageId).val();
var cname = $('#package_location_' + packageId).val();
$('#hotelcategoryid_' + packageId).val(catId);
var tourType = $('#tourtype_' + packageId).val();
var mp = $('#mealplantype_' + packageId).val();
var hotel_type = $('.categorySelect_' + parseInt(packageId)+ ' option:selected').attr('categoryName');
changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
changeContentByCategory(cname, desname, packageId, catId, gtxId, tourType, mp)
}
//function changeContentBytabFunc(PkgSysId, tab) {
// //var hotel = $('#hotelTypeElement_' + packageId).val();
//
// var packageId = PkgSysId;
// var gtxId = $('#gtxpackage_' + packageId).val();
// var desname = $('#citytxtval_' + packageId).val();
// var cname = $('#package_location_' + packageId).val();
// var catId = $('#hotelcategoryid_' + packageId).val();
// var tourType = $('#tourtype_' + packageId).val();
// var mp = $('#mealplantype_' + packageId).val();
// var hotel_type = document.getElementById("hotelType_" + packageId).value;
// changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
// //alert(hotel_type);
//
//}
changeFlightDestination = function (that,page) {
var PkgSysId = $(that).attr('PkgSysId');
var destinationName = $(that).val();
if(page == 1){
$('#hotelType_'+parseInt(PkgSysId)).click();
}else{
var packageId = $(that).attr('PkgSysId');
var gtxId = $('#gtxpackage_' + packageId).val();
var desname = $('#citytxtval_' + packageId).val();
var cname = $('#package_location_' + packageId).val();
var catId = $('#hotelcategoryid_' + packageId).val();
var tourType = $('#tourtype_' + packageId).val();
var mp = $('#mealplantype_' + packageId).val();
var hotel_type = $("hotelType_" + packageId).val();
var tab = 'Flighttab';
changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
var hotel_type = $('.categorySelect_' + parseInt(packageId)+ ' option:selected').attr('categoryName');
changeHotelCategoryAndPrice(hotel_type,packageId);
$("#changeContentByajax_" + packageId).show();
}
};
changeContentBytabFunc = function (that, tab) {
var packageId = $(that).attr('PkgSysId');
var gtxId = $('#gtxpackage_' + packageId).val();
var desname = $('#citytxtval_' + packageId).val();
var cname = $('#package_location_' + packageId).val();
var catId = $('#hotelcategoryid_' + packageId).val();
var tourType = $('#tourtype_' + packageId).val();
var mp = $('#mealplantype_' + packageId).val();
var hotel_type = $("hotelType_" + packageId).val();
if(tab=='Hotelstab2'){
$("#package_box_main_review").show();
}
if(tab=='Flighttab'){
$("#package_box_main_review").hide();
}
changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
};
function changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type) {
var catIdVal = $(catId).val();
if (catIdVal == undefined) {
var catIdVal = catId;
}
if (desname == '') {
var desname = mp;
}
if (catId == '') {
var catId = mp;
}
if (tourType == '') {
var tourType = 1;
}
if (catIdVal == '') {
var catIdVal = 1;
}
// var data = SITEURL + 'detail/'+cname+'/'+desname+'-'+packageId+'-'+catId+'-'+gtxId+'-'+tourType+'-'+mp+'.html';
var countryname = cname;
var tab = tab;
var hotel_type = hotel_type;
var name = desname + '-' + packageId + '-' + catIdVal + '-' + gtxId + '-' + tourType + '-' + mp + '.html';
var fixdestinations = $('.fixdeparture-destinations' + packageId).val();
$.ajax({
url: SITEURL + 'detail/index/index-ajax-tab',
type: 'POST',
data: {countryname: countryname, name: name, tab: tab, hotel_type: hotel_type,fixdestinations:fixdestinations},
dataType: 'html',
async : false,
beforeSend: function () {
$('#changeContentByajax_' + packageId).html('<div class="loadertab"></div>');
},
success: function (result) {
$('#changeContentByajax_' + packageId).html(result);
var CategoryWiseTPId = $('.CategoryWiseTPId_' + parseInt(packageId)+ parseInt(catIdVal)).val();
$('#packagetpid_' + packageId).val(CategoryWiseTPId);
return false;
},
error: function () {
alert('Oops unable to connect with server!!');
return false;
}
});
}
function copyPriceFunction(PkgSysId, catIdVal) {
var pkgprice_copy = $('.priceByCategory').val();
var pkgprice_copyNoformat = $('.priceByCategoryNoFormat').val();
var PackageType = $('#mpackagetpid_' + PkgSysId).val();
$('#pkgprice_paste1').html(pkgprice_copy);
$('#pkgprice_paste2').html(pkgprice_copy);
$('#pkgprice_paste3').html(pkgprice_copy);
$('#original_pkgprice_' + parseInt(PkgSysId)).val(pkgprice_copyNoformat);
$('#updated_pkgprice_' + parseInt(PkgSysId)).val(pkgprice_copyNoformat);
$('#package_tpid').val(PackageType);
$('#package_hotelcategoryid').val(catIdVal);
}
function viewPerPersonPrice() {
var data = $(".package_rate_enquiry").serialize();
$.ajax({
url: SITEURL + 'gtxwebservices/send-enquiry/get-per-person-price',
type: 'POST',
data: data,
dataType: 'html',
beforeSend: function () { },
success: function (result) {
$('#myModa1PerPersonPrice').modal('show');
$('#myModa1PerPersonPriceHtml').html(result);
},
error: function (result) {
}
});
}
function moreless(type, e) {
if (type == null) {
$(e).parent().find('a.limore').toggleClass("hidee");
} else if (type == 'li') {
$(e).parent().parent().find('li.limore').toggleClass("hidee")
}
$(e).html(($(e).text() == '-') ? '+' : '-');
}
function resetfilter() {
$('.filtercheckbox').each(function () {
console.log('reset');
var isChecked = $(this).is(':checked');
if (isChecked == true) {
$(this).trigger('click');
}
});
}
$(document).on('click', '.iamplusminus', function () {
if ($(this).hasClass('expand')) {
$(this).html('<i class="icon-plus"></i>').addClass('collepse').removeClass('expand').attr('title', 'More...');
$(this).parent().css({'height': '180px'});
} else {
$(this).html('<i class="icon-minus"></i>').addClass('expand').removeClass('collepse').attr('title', 'Less...');
;
$(this).parent().css({'height': 'auto'});
}
});
$(".activity_enquiry").on('submit', function (e) {
var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
e.preventDefault();
var data = $(this).serialize();
var leadsend = $("#leadsend_act").val();
if ($('.activity_enquiry input[name="name"]').val() == '') {
$('.msg').show().html('Please enter your name');
$('.activity_enquiry input[name="name"]').focus();
return false;
}
if ($('.activity_enquiry input[name="email"]').val() == '') {
$('.msg').show().html('Please enter your email address');
$('.activity_enquiry input[name="email"]').focus();
return false;
}
if (!EmailReg.test($('.activity_enquiry input[name="email"]').val())) {
$('.msg').show().html('Please enter valid email address!!!');
$('.activity_enquiry input[name="email"]').focus();
return false;
}
if ($('.activity_enquiry input[name="mobile"]').val() == '') {
$('.msg').show().html('Please enter your mobile number');
$('.activity_enquiry input[name="mobile"]').focus();
return false;
}
// if ($('.activity_enquiry input[name="mobile"]').val().length != '10') {
// $('.msg').show().html('Mobile should be 10 digit?');
// $('.activity_enquiry input[name="mobile"]').focus();
// return false;
// }
if (!$.isNumeric($('.activity_enquiry input[name="mobile"]').val())) {
$('.msg').show().html('Mobile should be numeric!!');
$('.activity_enquiry input[name="mobile"]').focus();
return false;
}
if (leadsend == '0') {
$.ajax({
url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
$('.activity_enquiry .msg').hide().html('');
$('.activity_enquiry .sending').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...').attr('disabled', 'disabled');
}, success: function (result) {
$(".activity_enquiry #leadsend_act").val('1');
$('.activity_enquiry .sending').html('Calculate Cost & Send Enquiry').attr('disabled', false);
$('.activity_enquiry .expandsave').show();
$('.activity_enquiry').submit();
}, error: function (result) {
$('.activity_enquiry .smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
}
});
} else {
if ($('.activity_enquiry input[name="date"]').val() == '') {
$('.activity_enquiry .msg').show().html('Please enter travel date');
$('.activity_enquiry input[name="date"]').focus();
return false;
}
$('.activity_enquiry .msg').hide().html('');
$.ajax({
url: SITEURL + 'gtxwebservices/send-enquiry-activity/post', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
$('.activity_enquiry .sending').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...').attr('disabled', 'disabled');
}, success: function (result) {
// console.log(result);
if ((result.status == 'success') && (result.availability == true)) {
$('.smsg').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
var priceTax = result.addtional['GSTAmount']; // Tax
var sumRoomWise = result.addtional['MyCost']; // TotalPrice
var priceGT = result.addtional['AmountWithGST']; // GrandTotal
if (priceTax == 0) {
$('.totalBasicCostTR , .activity_enquiry .totalTaxCostTR').hide();
$('.GSTI').show().html('GST (Included)');
} else {
$('.totalBasicCostTR , .activity_enquiry .totalTaxCostTR').show();
$('.GSTI').hide().html('');
}
var priceTaxFormatted, priceBCFormatted, priceGTFormatted = '';
priceTaxFormatted = rvMoneyFormatINR(priceTax, 2, null);
priceBCFormatted = rvMoneyFormatINR(sumRoomWise, 2, null);
priceGTFormatted = rvMoneyFormatINR((priceGT), 2, null);
$('.totalBasicCost').html(priceBCFormatted);
$('.totalTaxCost').html(priceTaxFormatted);
$('.totalGrandCost').html(priceGTFormatted);
$('.activity_enquiry .tableCost').show();
if (result.url != '') {
$('.bookingButtonHtml').html('<a href="' + result.url + '" class="btn btn-success">Continue to pay</a>');
}
//alert()
// $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
} else if ((result.status == 'success') && (result.availability == "false")) {
$('.smsg').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
// $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
$('.sending').hide();
} else if ((result.status == false) && (result.availability == "false")) {
$('.smsg').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});
// $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
$('.sending').hide();
} else {
$('.smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
$('.sending').hide();
}
$('.activity_enquiry .sending').html('Book Now');
$('.hidebutton').find('.sending').hide();
}, error: function (result) {
$('.activity_enquiry .smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
$('.activity_enquiry .sending').hide();
}
});
}
});
function rvMoneyFormatINR(n, prec, currSign) {
if (prec == null)
prec = 2;
var n = ('' + parseFloat(n).toFixed(prec).toString()).split('.');
var num = n[0];
var dec = n[1];
var r, s, t;
if (num.length > 3) {
s = num.length % 3;
if (s) {
t = num.substring(0, s);
num = t + num.substring(s).replace(/(\d{3})/g, ",$1");
} else {
num = num.substring(s).replace(/(\d{3})/g, ",$1").substring(1);
}
}
// return(currSign == null ? "" : currSign + "") + num + '.' + dec;
return (currSign == null ? "" : currSign + "") + num;
}
function vivreadMore(actionId) {
var styleread = {
'-webkit-line-clamp': 'inherit',
'height': 'auto'
};
$("#content_" + actionId).removeClass("show_wrap_less");
$(".readMore_" + actionId).hide();
$(".readLess_" + actionId).show();
$(".show_hide111").addClass("showlwssbtn");
$("#content_overview").css(styleread);
$("#content_" + actionId).css(styleread);
}
;
function BrowserVal(opt){
//alert(opt);
var ht = {
'-webkit-line-clamp': '3',
'height': '70px'
};
if (navigator.userAgent.search("MSIE") >= 0) {
}
else if (navigator.userAgent.search("Chrome") >= 0) {
ht = {
'-webkit-line-clamp': '3',
'height': '66px'
};
}
else if (navigator.userAgent.search("Firefox") >= 0) {
ht = {
'-webkit-line-clamp': '3',
'height': '67px'
};
}
else if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) {
}
else if (navigator.userAgent.search("Opera") >= 0) {
}
else
{
}
if(BrowserVal==1) {
return ht;
}
else
{
return ht;//for other conditions
}
}
function vivreadLess(actionId) {
var styleread1= BrowserVal(1);
$("#content_" + actionId).addClass("show_wrap_less");
$(".readLess_" + actionId).hide();
$(".readMore_" + actionId).show();
$(".show_hide111").removeClass("showlwssbtn");
$("#content_" + actionId).css(styleread1);
}
function openWhatsappWindow(that) {
var PkgSysId = $(that).attr('PkgSysId');
var whatsappHtmlHidden = $('#whatsappHtmlHidden' + parseInt(PkgSysId)).val();
var whatsappnumber = $('#whatsappnumber').val();
window.open('whatsapp://send?text=' + whatsappHtmlHidden + '&phone=' + whatsappnumber, '_blank');
}
function showfilterCountDiv() {
$('.filter-box').show();
$('#filterCountDiv').focus();
}
function rvSanitizeForUrl( str ) {
str = str.replace( /\s\s+/g, ' ' ).toLowerCase();
str = str.replace(/#|(|)|,|\/|_| +/g, '');
str = str.split(',').join('-');
str = str.split(' ').join('-');
return str.replace('--', '-');
}
function changeHotelCategoryAndPrice(catVal,PkgSysId) {
//alert(catVal);
if(catVal=='1'){
catVal = 'Budget';
}
else if(catVal=='2'){
catVal = 'Standard';
}
else if(catVal=='3'){
catVal = 'Deluxe';
}
else if(catVal=='4'){
catVal = 'Luxury';
}
else if(catVal=='5'){
catVal = 'Premium';
}else{
catVal = catVal;
}
// $('.HotelstabDiv').hide();
//$('.HotelstabDiv' + catVal).show();
var price = $('.getPriceByCategory' + catVal).val();
var price = $('.getPriceByCategory' + catVal).val();
if (price != '0') {
$('.changedPrice_' + PkgSysId).html(price);
} else {
$('.changedPrice').text('Price on request');
}
var categoryName = document.getElementById("hotelType_" + PkgSysId).value;
//alert(categoryName);
var temp, pType, packageName, gtxid, catid, newurl, tourtype, Countries, mp = '';
pType = parseInt($('input[name="tType_' + PkgSysId + '"]').val());
categoryId = conf.CATEGORY[catVal];
packageName = $('#packagename_' + PkgSysId).val();
Countries = $('#package_location_' + PkgSysId).val();
catid = $("#hotelcategoryid_" + PkgSysId).val();
gtxid = $("#GTX_package_id_" + PkgSysId).val();
tourtype = $("#tourtype_" + PkgSysId).val();
mp = $('#mealplantype_' + PkgSysId).val();
newurl = conf.SITEURL + 'detail/tour-package-for-' + this.rvSanitizeForUrl(Countries) + '/' + this.rvSanitizeForUrl(packageName) + '-' + PkgSysId + '-' + categoryId + '-' + gtxid + '-' + tourtype ;
newurl += (mp) ? ( "-"+mp) : "";
newurl += ".html";
$('.detail_link_' + PkgSysId).attr('href', newurl);
$('#hotelcategoryid_' + PkgSysId).val(categoryId);
// $('.hotelTypeElement_' + PkgSysId).val(catVal).change();
$('#hotelType_' + PkgSysId).val(catVal).change();
// $('.hotelTypeElement_' + pkgid).html(catVal);
// alert(catVal);
}
if($(window).innerWidth() < 992) {
$(document).ready(function(){
$('.footer-nav-title').next('.links').css('display', 'none');
$('.footer-nav-title').click(function(){
$(this).next('.links').slideToggle();
$(this).toggleClass('footer-nav-toggle');
});
});
}