| 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/b2b.hellogtx.com/public/js/ |
Upload File : |
$('body').click(function(){
$(".msg").fadeOut(3000);
});
$('.msg').hide().html('');
function validDate(){
var startDateName = $('#startDate').val();
if( startDateName== ''){
$('.msg').show().html('Please select start date first');
$('#startDate').focus();
return false;
}
// alert($("ul.destination-rows-container").children().length);
if ($("ul.destination-rows-container").children().length > 5){
$('.msg').show().html('Limit Exceed ');
$('#selectDestinationCovered').val('');
return false;
}
}
$("#byo_enquiry").on('submit', function(e) {
var data = $("#byo_enquiry").serialize();
console.log(data);
if ($('.byo_enquiry input[name="startDate"]').val() == '') {
$('.msg').show().html('Please select start date');
$('.byo_enquiry input[name="startDate"]').focus();
return false;
}else if ($('.byo_enquiry input[name="startCity"]').val() == '') {
$('.msg').show().html('Please enter start city');
$('.byo_enquiry input[name="startCity"]').focus();
return false;
}else if ($('.byo_enquiry input[name="endCity"]').val() == '') {
$('.msg').show().html('Please enter end city');
$('.byo_enquiry input[name="endCity"]').focus();
return false;
}else if ($("ul.destination-rows-container").children().length < 1){
$('.msg').show().html('Please add destinations ');
$('#selectDestinationCovered').focus();
return false;
}else{
$.ajax({url: SITEURL + 'byo/index/save-search-result-data', type: 'POST', data: data, dataType: 'json', beforeSend: function() {
}, success: function(result) {
// console.log(result);
var TPSysIden = btoa(result.TPSysId);
var form = '';
form += '<input type="hidden" name="TPSysId" value="'+result.TPSysId+'">';
$('<form action="' + SITEURL + 'byo/index/search-results/id/'+TPSysIden+'" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
}
})
}
});
$('.datepicker_byo').datepicker({
dateFormat: 'dd/mm/yy',
minDate: 0
});
$("#selectStartCity").autocomplete({
source: function(request, response) {
var query = $("#selectStartCity").val();
var countryId = '';
$.getJSON("byo/index/get-citydata", { query: query, countryId: countryId},
response);
},
minLength: 2,
autoFocus: true,
select: function(event, ui){
var CityId = ui.item.CityId;
var CityName = ui.item.CityName;
$("#selectStartCity_hidden").val(CityId);
$('#selectEndCity').focus();
}
});
$("#selectEndCity").autocomplete({
source: function(request, response) {
var query = $("#selectEndCity").val();
var countryId = '';
$.getJSON("byo/index/get-citydata", { query: query, countryId: countryId},
response);
},
minLength: 2,
autoFocus: true,
select: function(event, ui){
var CityId = ui.item.CityId;
var CityName = ui.item.CityName;
$("#selectEndCity_hidden").val(CityId);
$('#selectDestinationCovered').focus();
}
});
$("#selectDestinationCovered").autocomplete({
source: function(request, response) {
var query = $("#selectDestinationCovered").val();
var countryId = '';
$.getJSON("byo/index/get-city-hoteldata", { 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_des_cityid").val(CityId);
$("#hidden_selected_city_name").val(CityName);
$('.addmoredes').click();
$(this).val("");
return false;
}
});
$('.addmoredes').click(function() {
var count = 1;
count = parseInt($('#count_inputs').val());
var destName = $("#hidden_selected_city_name").val();
var startDateName = $('#startDate').val();
var desId = $('#hidden_selected_des_cityid').val();
//console.log(desId);return false;
var someFormattedDate = '';
someFormattedDate = getDates(count);
if(count>1){
startDateName = $('.check_out_'+(parseInt(count) - 1)).val();
// startDateName = $('#check_out_'+(parseInt(count) - 1)).val();
}
var defaultNights = 2;
$('.destination-rows-container').append('<li class="inserted-destination-row'+count+'"> <div class="col-md-2 col-xs-4 desti-head ">'+destName+'</div><input type="hidden" id="destName'+count+'" class="destName'+count+'" name="destName[]" value="'+destName+'"/><input type="hidden" id="destIds'+count+'" class="destIds'+count+'" name="destIds[]" value="'+desId+'"/>'+
'<div class="col-md-5 col-xs-8">'+
' <div class="check-count-box">'+
' <div class="col-md-6">'+
'<span class="small-drag">Check in date</span><br>'+
'<h3><span id="check_inDate_'+count+'" class="check_inDate_'+count+'">'+startDateName+'</span></h3><input type="hidden" id="check_in_'+count+'" class="check_in_'+count+'" name="check_in[]" value="'+startDateName+'"/>'+
'</div>'+
'<div class="col-md-6"><span class="small-drag">Check out date</span>'+
'<h3><span id="check_outDate_'+count+'" class="check_outDate_'+count+'">'+someFormattedDate+'</span></h3><input type="hidden" id="check_out_'+count+'" class="check_out_'+count+'" name="check_out[]" value="'+someFormattedDate+'"/>'+
'</div>'+
'</div>'+
'</div>'+
'<div class="col-md-5 col-xs-12 no-padding ">'+
'<div class="col-md-8 col-xs-12 mobile-padd-tab">'+
'<label class="count-box-night col-md-6 col-xs-6">Nights</label> '+
'<div id="merge_new_nights'+count+'" class="form-control input-sm center merge-bottom-input col-md-8 col-xs-5 merge_new_nights'+count+'" name="second">'+defaultNights+'</div>'+
'<div class=" col-md-1 col-xs-1 count-box" role="group" aria-label="plus-minus"> <input type="hidden" id="default_nights'+count+'" class="default_nights'+count+'" name="nights[]" value="'+defaultNights+'"/>'+
'<button type="button" onclick="plusFunc(this);" data_index="'+count+'" id="plus-button_'+count+'" class="btn btn-sm btn-success plus-button_'+count+' merge-top-right-button col-md-12" ><span class="glyphicon glyphicon-plus"></span></button>'+
'<button type="button" onclick="minusFunc(this);" data_index="'+count+'" id="minus-button_'+count+'" class="btn btn-sm btn-danger minus-button_'+count+' merge-top-left-button col-md-12 "><span class="glyphicon glyphicon-minus"></span></button>'+
'</div>'+
'</div> '+
'<div class="col-md-4 col-xs-12 desti-link"> <a href="javascript://" class = "sortable sortable2"><i class="fa fa-arrows"></i></a> <a href="javascript://" class="removeit3" onclick="removeIt('+count+')"><i class="fa fa-times"></i></a></div> '+
'</div>'+
'<div class="clear"></div>'+
'</li>');
$('#count_inputs').val(parseInt(count) + 1);
});
function plusFunc(n){
var count = $(n).attr("data_index");
// $('.plus-button_'+count).click(function() {
var default_nights = $('.merge_new_nights'+count).html();
if(default_nights < 10){
default_nights++;
$('.merge_new_nights'+count).html(default_nights);
$('.default_nights'+count).val(default_nights);
for(var i=count;i<=6;i++){
var addDate = getDatesAdd(i);
$('.check_outDate_'+i).html(addDate);
$('.check_out_'+i).val(addDate);
$('.check_inDate_'+(parseInt(i) + 1)).html($('.check_outDate_'+i).html());
$('.check_in_'+(parseInt(i) + 1)).val($('.check_out_'+i).val());
}
}
//});
}
function minusFunc(n){
var count = $(n).attr("data_index");
//$('.minus-button_'+count).click(function() {
var default_nights = $('.merge_new_nights'+count).html();
if(default_nights > 1){
default_nights--;
$('.merge_new_nights'+count).html(default_nights);
$('.default_nights'+count).val(default_nights);
for(var i=count;i<=6;i++){
var subDate = getDatesSub(i);
$('.check_outDate_'+i).html(subDate);
$('.check_out_'+i).val(subDate);
$('.check_inDate_'+(parseInt(i) + 1)).html($('.check_outDate_'+i).html());
$('.check_in_'+(parseInt(i) + 1)).val($('.check_out_'+i).val());
}
}
//});
}
function getDates(count) {
// console.log(startDateName);
if(count == 1){
var check_out = $('#startDate').val();
}else{
// var check_in = $('#check_in_'+(parseInt(count) - 1)).val();
// var check_out = $('#check_out_'+(parseInt(count) - 1)).val();
var check_in = $('.check_in_'+(parseInt(count) - 1)).val();
var check_out = $('.check_out_'+(parseInt(count) - 1)).val();
}
// console.log(check_out);
var check_out1 = check_out.split('/');
var mDay = check_out1[0];
var mMonth = check_out1[1];
var mYear = check_out1[2];
var check_out = mMonth+'/'+mDay+'/'+mYear;
var newdate = new Date(check_out);
//console.log(check_out);
newdate.setDate(newdate.getDate() + 2);
var dd = newdate.getDate();
var mm = newdate.getMonth() + 1;
var y = newdate.getFullYear();
var someFormattedDate = dd + '/' + mm + '/' + y;
return someFormattedDate;
// console.log(someFormattedDate);
}
function updateCheckInClass(){
$("input[class^='check_in_']").each(function (i) {
$(this).removeAttr('class').addClass('check_in_'+(parseInt(i)+1));
});
}
function updateCheckOutClass(){
$("input[class^='check_out_']").each(function (i) {
$(this).removeAttr('class').addClass('check_out_'+(parseInt(i)+1));
});
}
function updateCheckInSpanClass(){
$("span[class^='check_inDate_']").each(function (i) {
$(this).removeAttr('class').addClass('check_inDate_'+(parseInt(i)+1));
});
}
function updateCheckOutSpanClass(){
$("span[class^='check_outDate_']").each(function (i) {
$(this).removeAttr('class').addClass('check_outDate_'+(parseInt(i)+1));
});
}
function updateNightDivClass(){
$("div[id^='merge_new_nights']").each(function (i) {
$(this).removeAttr('class').addClass('form-control input-sm center merge-bottom-input col-md-8 col-xs-5 merge_new_nights'+(parseInt(i)+1));
});
}
function updateNightInputClass(){
$("input[id^='default_nights']").each(function (i) {
$(this).removeAttr('class').addClass('default_nights'+(parseInt(i)+1));
});
}
function updatePlusDivClass(){
$("button[id^='plus-button_']").each(function (i) {
$(this).removeAttr('data_index').attr('data_index',(parseInt(i)+1));
});
}
function updateMinusDivClass(){
$("button[id^='minus-button_']").each(function (i) {
$(this).removeAttr('data_index').attr('data_index',(parseInt(i)+1));
});
}
function getDatesAddDrag(liCount) {
// console.log(startDateName);
for(var i = 1; liCount > i; i++){
if(i > 1) {
var check_out = $('.check_out_'+(parseInt(i)-1)).val();
} else {
var check_out = $('#startDate').val();
}
var li1 = $('.merge_new_nights'+parseInt(i)).html();
// var li2 = $('.merge_new_nights2').html();
var check_out1 = check_out.split('/');
var mDay = check_out1[0];
var mMonth = check_out1[1];
var mYear = check_out1[2];
var check_outNew = mMonth+'/'+mDay+'/'+mYear;
var newdate = new Date(check_outNew);
newdate.setDate(newdate.getDate() + parseInt(li1));
var dd = newdate.getDate();
var mm = newdate.getMonth() + 1;
var y = newdate.getFullYear();
var addDate = dd+ '/' + mm + '/' + y;
$('.check_outDate_'+i).html(addDate);
$('.check_out_'+i).val(addDate);
if(i > 1){
//alert("+++++1");
$('.check_inDate_'+(parseInt(i))).html($('.check_outDate_'+(parseInt(i)-1)).html());
$('.check_in_'+(parseInt(i))).val($('.check_out_'+(parseInt(i)-1)).val());
} else {
//alert("ek");
$('.check_inDate_'+(parseInt(i))).html(check_out);
$('.check_in_'+(parseInt(i))).val(check_out);
}
// return someFormattedDate;
// console.log(someFormattedDate);
}
}
function getDatesAdd(count) {
// console.log(startDateName);
var check_in = $('.check_in_'+(parseInt(count))).val();
var check_out = $('.check_out_'+(parseInt(count))).val();
var check_out1 = check_out.split('/');
var mDay = check_out1[0];
var mMonth = check_out1[1];
var mYear = check_out1[2];
var check_out = mMonth+'/'+mDay+'/'+mYear;
var newdate = new Date(check_out);
newdate.setDate(newdate.getDate() + 1);
var dd = newdate.getDate();
var mm = newdate.getMonth() + 1;
var y = newdate.getFullYear();
var someFormattedDate = dd+ '/' + mm + '/' + y;
return someFormattedDate;
console.log(someFormattedDate);
}
function getDatesSub(count) {
// console.log(startDateName);
var check_in = $('.check_in_'+(parseInt(count))).val();
var check_out = $('.check_out_'+(parseInt(count))).val();
var check_out1 = check_out.split('/');
var mDay = check_out1[0];
var mMonth = check_out1[1];
var mYear = check_out1[2];
var check_out = mMonth+'/'+mDay+'/'+mYear;
var newdate = new Date(check_out);
newdate.setDate(newdate.getDate() - 1);
var dd = newdate.getDate();
var mm = newdate.getMonth() + 1;
var y = newdate.getFullYear();
var someFormattedDate = dd + '/' + mm + '/' + y;
return someFormattedDate;
console.log(someFormattedDate);
}
function removeIt(countno){
var count = $('#count_inputs').val();
if (count == 1) {
return false;
}
$('.destination-rows-container').find('.inserted-destination-row'+countno).remove();
updateCheckInClass();
updateCheckOutClass();
updateCheckInSpanClass();
updateCheckOutSpanClass();
updateNightDivClass();
updateNightInputClass();
updatePlusDivClass();
updateMinusDivClass();
getDatesAddDrag(count);
$('#count_inputs').val(parseInt(count) - 1);
}
function getRemoveDatesAdd(count,countno){
// console.log(startDateName);
var check_in = $('.check_in_'+(parseInt(count))).val();
var check_out = $('.check_out_'+(parseInt(count))).val();
var check_out1 = check_out.split('/');
var mDay = check_out1[0];
var mMonth = check_out1[1];
var mYear = check_out1[2];
var check_out = mMonth+'/'+mDay+'/'+mYear;
var newdate = new Date(check_out);
newdate.setDate(newdate.getDate() + (parseInt(countno)-2));
var dd = newdate.getDate();
var mm = newdate.getMonth() + 1;
var y = newdate.getFullYear();
var someFormattedDate = dd+ '/' + mm + '/' + y;
return someFormattedDate;
console.log(someFormattedDate);
}
var mCount_travel = $('#mCount_travelPlanDesData').val();
if(mCount_travel > 0){
for(var m = 1; m <= mCount_travel;m++){
var mCount_CitySysId = $('#mCount_CitySysId'+parseInt(m)).val();
var mCount_destName = $('#mCount_destName'+parseInt(m)).val();
var mCount_NoDay = $('#mCount_NoDay'+parseInt(m)).val();
var mCount_check_inDate = $('#mCount_check_inDate_'+parseInt(m)).val();
var mCount_check_outDate = $('#mCount_check_outDate_'+parseInt(m)).val();
$("#hidden_selected_des_cityid").val(mCount_CitySysId);
$("#hidden_selected_city_name").val(mCount_destName);
$('.addmoredes').click();
$('.default_nights'+parseInt(m)).val(mCount_NoDay);
$('.merge_new_nights'+parseInt(m)).html(mCount_NoDay);
$('.check_inDate_'+parseInt(m)).html(mCount_check_inDate);
$('.check_in_'+parseInt(m)).val(mCount_check_inDate);
$('.check_outDate_'+parseInt(m)).html(mCount_check_outDate);
$('.check_out_'+parseInt(m)).val(mCount_check_outDate);
}
}
function changeDateAllDestinations(that){
var mstartDate = $(that).val();
$('.check_in_'+(parseInt(1))).val(mstartDate);
$('.check_inDate_'+(parseInt(1))).html(mstartDate);
var total_li= $("ul.destination-rows-container").children().length;
// alert(total_li);
for(var m =1;m<=total_li;m++){
var nights = $('.default_nights'+m).val();
// alert(nights);
var dateChange = getDatesOnchangeDate(m,mstartDate,nights);
$('.check_outDate_'+(parseInt(m))).html(dateChange);
$('.check_inDate_'+(parseInt(m)+1)).html(dateChange);
$('.check_out_'+(parseInt(m))).val(dateChange);
$('.check_in_'+(parseInt(m)+1)).val(dateChange);
}
$('#selectStartCity').focus();
}
function getDatesOnchangeDate(count,mstartDate,nights) {
// console.log(startDateName);
if(count == 1){
var check_out = mstartDate;
}else{
// var check_in = $('#check_in_'+(parseInt(count) - 1)).val();
// var check_out = $('#check_out_'+(parseInt(count) - 1)).val();
var check_in = $('.check_in_'+(parseInt(count) - 1)).val();
var check_out = $('.check_out_'+(parseInt(count) - 1)).val();
}
// console.log(check_out);
var check_out1 = check_out.split('/');
var mDay = check_out1[0];
var mMonth = check_out1[1];
var mYear = check_out1[2];
var check_out = mMonth+'/'+mDay+'/'+mYear;
var newdate = new Date(check_out);
//console.log(check_out);
newdate.setDate(newdate.getDate() + parseInt(nights));
var dd = newdate.getDate();
var mm = newdate.getMonth() + 1;
var y = newdate.getFullYear();
var someFormattedDate = dd + '/' + mm + '/' + y;
return someFormattedDate;
// console.log(someFormattedDate);
}