| 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/b2bsite.hellogtx.com/public/js/ |
Upload File : |
$('body').click(function () {
$(".msg").fadeOut(3000);
});
$('.msg').hide().html('');
function validDate() {
// alert("test");
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 > 15) {
$('.msg').show().html('Limit Exceed ');
$('#selectDestinationCovered').val('');
return false;
}
}
$("#byo_enquiry").on('submit', function (e) {
//var data = $("#byo_enquiry").serialize();
var data = new FormData($("#byo_enquiry")[0]);
$("input[id^='hotel_self']").each(function (i) {
var valueD = 0;
if($(this).prop('checked')){
valueD = 1;
}
data.append("hotel_self_checked[]", valueD);
});
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 {
$('.savebtnbyo').html('Please Wait...').attr('disabled',true);
$.ajax({url: SITEURL + 'byo/index/save-search-result-data',
type: 'POST',
data: data,
processData: false, // Important for FormData
contentType: false, // Important for FormData
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 + '">';
var BYOType = $('#BYOType').val();
if(result.Redirect != ''){
$('<form action="' + SITEURL + 'byo/index/'+result.Redirect+'/id/' + TPSysIden + '" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
}else{
$('<form action="' + SITEURL + 'byo/index/search-results/id/' + TPSysIden + '" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
}
$('.savebtnbyo').html('Save & Continue').attr('disabled',false);
}
})
}
});
// $('.datepicker_byo').datepicker({
// dateFormat: 'dd/mm/yy',
// minDate: 0
// });
// $("#startDate").datepicker({
// dateFormat: 'dd/mm/yy',
// autoclose: true,
// todayBtn: true,
// minDate:0,
// });
$("#selectStartCity").autocomplete({
source: function (request, response) {
var query = $("#selectStartCity").val();
var countryId = '';
$.getJSON("byo/index/get-transport-start-citydata", {query: query, countryId: countryId,type:1},
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();
autoSuggestTransportRoute();
}
});
$("#selectEndCity").autocomplete({
source: function (request, response) {
var query = $("#selectEndCity").val();
var countryId = '';
// $.getJSON("byo/index/get-citydata", {query: query, countryId: countryId},
$.getJSON("byo/index/get-transport-start-citydata", {query: query, countryId: countryId,type:2},
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();
autoSuggestTransportRoute();
}
});
$("#selectDestinationCovered").autocomplete({
source: function (request, response) {
var query = $("#selectDestinationCovered").val();
var BYOType = $("#BYOType").val();
var countryId = '';
var url = 'byo/index/get-city-hoteldata';
if(BYOType == 2){
url = 'byo/index/get-transport-start-citydata';
}
$.getJSON(url, {query: query, countryId: countryId,BYOType:BYOType},
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);
$("#hidden_selected_des_tableid").val(0);
$('.addmoredes').click();
$(this).val("");
return false;
}
});
function selectDestinationCoveredFunc(){
var startDateName = $('#startDate').val();
if (startDateName == '') {
$('.msg').show().html('Please select start date first');
$('#startDate').focus();
$('#selectDestinationCovered').val("");
return false;
}
var CityId = $('#selectDestinationCovered').val();
var CityName = $("#selectDestinationCovered option:selected").attr('CityName');
$("#hidden_selected_des_cityid").val(CityId);
$("#hidden_selected_des_tableid").val(0);
$("#hidden_selected_city_name").val(CityName);
$('.addmoredes').click();
$('#selectDestinationCovered').val("");
}
function selectDestinationFromToFunc(inputtype){
if(inputtype == 'StartCity'){
var CityId = $("#selectStartCity_id option:selected").val();
var CityName = $("#selectStartCity_id option:selected").attr('CityName');
$("#selectStartCity").val(CityName);
$("#selectEndCity_id").val(CityId);
selectDestinationFromToFunc('EndCity');
}else{
var CityName = $("#selectEndCity_id option:selected").attr('CityName');
$("#selectEndCity").val(CityName);
}
}
$('.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();
var destTableIds = $('#hidden_selected_des_tableid').val();
var BYOType = $('#BYOType').val();
if(desId == '' || desId == '0'){
return false;
}
//console.log(desId);return false;
var someFormattedDate = '';
someFormattedDate = getDates(count);
if (count > 1) {
startDateName = $('.check_out_' + (parseInt(count) - 1)).val();
if(BYOType == 2){
startDateName = getDatesAdd(parseInt(count) - 1);
}
}
var defaultNights = 2;
var NHtml = 'Nights';
var checkinHtml = 'Check in date';
var checkoutHtml = 'Check out date';
var displayNone = 'display:block;';
if(BYOType == 2){
NHtml = 'Days';
checkinHtml = 'Start date';
checkoutHtml = 'End date';
displayNone = 'display:none;';
}
$('.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 + '"/><input type="hidden" id="destTableIds' + count + '" class="destTableIds' + count + '" name="destTableIds[]" value="' + destTableIds + '"/>' +
'<div class="col-md-5 col-xs-8 no-padding">' +
' <div class="check-count-box">' +
' <div class="col-md-6 col-xs-6">' +
'<span class="small-drag">'+checkinHtml+'</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 col-xs-6"><span class="small-drag">'+checkoutHtml+'</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-7 col-xs-9 mobile-padd-tab padding_alignmbbyo count-box-night-row no-padding">' +
'<label class="count-box-night ">'+NHtml+'</label> ' +
'<div id="merge_new_nights' + count + '" class="form-control input-sm center merge-bottom-input merge_new_nights' + count + '" name="second">' + defaultNights + '</div>' +
'<div class=" count-box btnplus-width" 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-secondry plus-button_' + count + ' merge-top-right-button col-md-12 btnplus-width22"><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 btnplus-width22"><span class="glyphicon glyphicon-minus"></span></button>' +
'</div>' +
'</div><div><input type="hidden" name="destination_sequence[]" value="' + count + '"></div> ' +
'<div class="col-md-3 col-xs-3 hotel_self_div check-count-box text-center"><span class="small-drag" style="'+displayNone+'">Skip Hotel</span><span style="'+displayNone+'"><input type="checkbox" name="hotel_self[' + count + ']" id="hotel_self' + count + '" value="1" ></span> </div> ' +
'<div class="col-md-2 col-xs-3 desti-link no-padding"> <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");
var BYOType = $('#BYOType').val();
// $('.plus-button_'+count).click(function() {
var default_nights = $('.merge_new_nights' + count).html();
if (default_nights < 25) {
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);
if(BYOType == 2){
console.log('2-');
var addDate = getDatesAdd(i);
$('.check_inDate_' + (parseInt(i) + 1)).html(addDate);
$('.check_in_' + (parseInt(i) + 1)).val(addDate);
}else{
$('.check_inDate_' + (parseInt(i) + 1)).html($('.check_outDate_' + i).html());
$('.check_in_' + (parseInt(i) + 1)).val($('.check_out_' + i).val());
}
// $('.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");
var BYOType = $('#BYOType').val();
//$('.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);
if(BYOType == 2){
var addDate = getDatesAdd(i);
$('.check_inDate_' + (parseInt(i) + 1)).html(addDate);
$('.check_in_' + (parseInt(i) + 1)).val(addDate);
}else{
$('.check_inDate_' + (parseInt(i) + 1)).html($('.check_outDate_' + i).html());
$('.check_in_' + (parseInt(i) + 1)).val($('.check_out_' + i).val());
}
}
}
//});
}
function getDates(count) {
var BYOType = $('#BYOType').val();
var night = 2;
if (count == 1) {
var check_out = $('#startDate').val();
if(BYOType == 2){
night = 1;
}
} else {
var check_in = $('.check_in_' + (parseInt(count) - 1)).val();
var check_out = $('.check_out_' + (parseInt(count) - 1)).val();
}
console.log(count);
console.log(check_out);
var someFormattedDate = '';
if(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);
newdate.setDate(newdate.getDate() + night);
var dd = ("0" + newdate.getDate()).slice(-2);
var mm = ("0" + (newdate.getMonth() + 1)).slice(-2);
var y = newdate.getFullYear();
var someFormattedDate = dd + '/' + mm + '/' + y;
}
return 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) {
var BYOType = $('#BYOType').val();
for (var i = 1; liCount > i; i++) {
var li1 = $('.merge_new_nights' + parseInt(i)).html();
if (i > 1) {
var check_out = $('.check_out_' + (parseInt(i) - 1)).val();
} else {
var check_out = $('#startDate').val();
if(BYOType == 2){
li1--;
}
}
// 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 = ("0" + newdate.getDate()).slice(-2);
var mm = ("0" + (newdate.getMonth() + 1)).slice(-2);
var y = newdate.getFullYear();
var addDate = dd + '/' + mm + '/' + y;
$('.check_outDate_' + i).html(addDate);
$('.check_out_' + i).val(addDate);
if (i > 1) {
if(BYOType == 2){
var addDateN = getDatesAdd(parseInt(i) - 1);
$('.check_inDate_' + (parseInt(i))).html(addDateN);
$('.check_in_' + (parseInt(i))).val(addDateN);
}else{
$('.check_inDate_' + (parseInt(i))).html($('.check_outDate_' + (parseInt(i) - 1)).html());
$('.check_in_' + (parseInt(i))).val($('.check_out_' + (parseInt(i) - 1)).val());
}
} else {
$('.check_inDate_' + (parseInt(i))).html(check_out);
$('.check_in_' + (parseInt(i))).val(check_out);
}
// return someFormattedDate;
// console.log(someFormattedDate);
}
}
function getDatesAdd(count) {
console.log('A:'+count);
var check_in = $('.check_in_' + (parseInt(count))).val();
var check_out = $('.check_out_' + (parseInt(count))).val();
console.log('A:'+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);
newdate.setDate(newdate.getDate() + 1);
var dd = ("0" + newdate.getDate()).slice(-2);
var mm = ("0" + (newdate.getMonth() + 1)).slice(-2);
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 = ("0" + newdate.getDate()).slice(-2);
var mm = ("0" + (newdate.getMonth() + 1)).slice(-2);
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 = ("0" + newdate.getDate()).slice(-2);
var mm = ("0" + (newdate.getMonth() + 1)).slice(-2);
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_DesTableSysId = $('#mCount_DesTableSysId' + 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();
var mCount_HotelSelf = $('#mCount_HotelSelf_' + parseInt(m)).val();
$("#hidden_selected_des_cityid").val(mCount_CitySysId);
$("#hidden_selected_city_name").val(mCount_destName);
$("#hidden_selected_des_tableid").val(mCount_DesTableSysId);
$('.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);
if(mCount_HotelSelf == 1){
$('#hotel_self'+parseInt(m)).prop('checked',true);
}
}
}
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;
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 = ("0" + newdate.getDate()).slice(-2);
var mm = ("0" + (newdate.getMonth() + 1)).slice(-2);
var y = newdate.getFullYear();
var someFormattedDate = dd + '/' + mm + '/' + y;
return someFormattedDate;
// console.log(someFormattedDate);
}
/*Added for Auto Suggest Transport Route Start*/
function autoSuggestTransportRoute() {
var startCityName = $('#selectStartCity').val();
var endCityName = $('#selectEndCity').val();
var noofdays = $('#noofdays').val();
if (startCityName != '' && endCityName != '') {
var startCityId = $('#selectStartCity_hidden').val();
var endCityId = $('#selectEndCity_hidden').val();
$.ajax({
url: SITEURL + 'byo/index/get-autosuggest-transport',
type: 'POST',
data: {startCityId: startCityId, endCityId: endCityId, noofdays:noofdays},
beforeSend: function () {
},
success: function (result) {
console.log(result);
// alert(result);
// if(result != ''){
// alert('in');
// $('#suggested-transport-route').html('<h4 class="no-margin">Suggested Transport Route</h4>');
// }
$('#autosuggest-transport').html(result);
}
})
}
}
function autoAddHotelCities(id) {
$.ajax({
url: SITEURL + 'byo/index/get-autosuggest-transport-hotel-cities',
type: 'POST',
data: {id: id},
dataType: 'json',
beforeSend: function () {
},
success: function (result) {
$('.destination-rows-container').html(' ');
$('#count_inputs').val(1);
for (var m = 0; m < result.total; m++) {
$("#hidden_selected_city_name").val(result.data[m].CityName);
$("#hidden_selected_des_cityid").val(result.data[m].DestSysId);
$("#hidden_selected_des_tableid").val(0);
$('.addmoredes').click();
$('#merge_new_nights' + (parseInt(m) + 1)).html(result.data[m].nights);
$('#default_nights' + (parseInt(m) + 1)).val(result.data[m].nights);
}
var liCount = $("#count_inputs").val();
getDatesAddDrag(liCount);
}
})
}
/*Added for Auto Suggest Transport Route End*/
function getSightseeingPrice(that,i,count,type){
var gtxPkgId = $(that).val();
var gtxPkgIdSplit = gtxPkgId.split('_');
var gtxPkgIdSplitE = gtxPkgId.split('~~');
var TPSysId = $('#TPSysIdId').val();
$('.sightseeingVehicleDiv'+parseInt(i)+parseInt(count)).hide();
$.ajax({
url: SITEURL + 'byo/index/get-sightseeing-detail-by-id',
type: 'POST',
data: {'gtxPkgId': gtxPkgIdSplit[0],'index':i,'count':count,'type':type,'TPSysId':TPSysId},
dataType: 'html',
beforeSend: function () {
},
success: function (result) {
$('.transportTypeHtml'+parseInt(i)+parseInt(count)).show();
$('.transportTypeHtml'+parseInt(i)+parseInt(count)).html(result);
var transportType = $('#transportType'+parseInt(i)+parseInt(count)).val();
var priceCost = $('#TotalSightPriceCost'+parseInt(transportType) + parseInt(i) + parseInt(count)).val();
var price = $('#TotalSightPrice'+parseInt(transportType) + parseInt(i) + parseInt(count)).val();
var Markup = $('#TotalSightMarkup'+parseInt(transportType) + parseInt(i) + parseInt(count)).val();
var PPCost = $('#TotalSightPPCost'+parseInt(transportType) + parseInt(i) + parseInt(count)).val();
if(isNaN(price)){
price = 0;
}
if(isNaN(Markup)){
Markup = 0;
}
$('.SightseeingCostHtml'+parseInt(i)+parseInt(count)).html(parseFloat(priceCost));
$('#selectedSightseeingPrice'+parseInt(i)+parseInt(count)).val(price);
$('#selectedSightseeingMarkup'+parseInt(i)+parseInt(count)).val(Markup);
$('#selectedSightseeingPPCost'+parseInt(i)+parseInt(count)).val(PPCost);
if($('#transportType'+parseInt(i)+parseInt(count)).val() == 2){
$('#transportType'+parseInt(i)+parseInt(count)).change();
}
var SightseeingDetailDiv = $('.SightseeingDetailDiv'+gtxPkgIdSplitE[0]).html();
$('.SightseeingDetailDivShow'+parseInt(i)+'_'+parseInt(count)).html(SightseeingDetailDiv);
}
})
// var sightseeingPrice = $('#sightseeingPrice'+parseInt(gtxPkgId)+parseInt(count)).val();
// $('#price'+parseInt(i)+parseInt(count)).val(sightseeingPrice);
// $('.transportTypeHtml'+parseInt(i)+parseInt(count)).show();
}
function getShowTransportVehicle(that,i,id){
var vtype = $(that).attr('vtype');
var RouteSysId = $(that).val();
RouteSysId = RouteSysId.split('_');
RouteSysId = RouteSysId[0];
var TPSysId = $('#TPSysIdId').val();
$('.SightSeeingNameByDayCount_'+vtype+'_'+parseInt(i)+'_'+parseInt(id)).remove();
$.ajax({
url: SITEURL + 'byo/index/get-transport-vehicle',
type: 'POST',
data: {RouteSysId: RouteSysId,index:i,count:id,TPSysId:TPSysId},
dataType: 'html',
beforeSend: function () {
},
success: function (result) {
$('.appendVehicleDataHtml'+parseInt(i)+parseInt(id)).show();
$('.appendVehicleData'+parseInt(i)+parseInt(id)).html(result);
getTransferSightseeing(RouteSysId,i,id,vtype);
}
})
// $('.selectTransportDiv'+parseInt(i)+parseInt(id)).show();
// $('.RouteVechSysId'+parseInt(i)+parseInt(RouteSysId)+parseInt(id)).show();
}
function getTransferSightseeing(RouteSysId,i,id,vtype){
$.ajax({
url: SITEURL + 'byo/index/get-transport-sightseeing',
type: 'POST',
data: {RouteSysId: RouteSysId,index:i,count:id,vtype:vtype},
dataType: 'json',
beforeSend: function () {
},
success: function (result) {
var im = 0;
$('.SightSeeingNameByDayCount_'+vtype+'_'+parseInt(i)+'_'+parseInt(id)).remove();
for(var ii = i; ii< (parseInt(result.length)+i); ii++){
if(result[im].length>0){
$('.IncludedSightseeingsDiv'+parseInt(ii)+''+vtype).show();
var len = $('.IncludedSightseeingsDivHtml'+parseInt(ii)+''+vtype).children().length;
var htm = '';
if(len>0 ){
htm = ' | ';
}
$('.IncludedSightseeingsDivHtml'+parseInt(ii)+''+vtype).append(htm + result[im]);
}
im++;
}
}
})
}
function getChangedTransportRate(that,i,RouteSysId,id){
var RouteVechSysId = $(that).val();
RouteVechSysId = RouteVechSysId.split('_');
RouteVechSysId = RouteVechSysId[0];
var TransportCost = $('#TransportCost'+''+parseInt(i)+''+parseInt(RouteSysId)+''+parseInt(RouteVechSysId)+''+parseInt(id)).val();
$('#SelectedTransportCost'+parseInt(i)+parseInt(id)).val(TransportCost);
var routeNoofnights = $('#routeNoofnights'+parseInt(i)+parseInt(RouteSysId)+parseInt(id)).val();
if(routeNoofnights == 0){
routeNoofnights = 1;
}
var startTransportDate = $('#startTransportDate' + (parseInt(i))+ (parseInt(id))).val();
var startTransportDate1 = startTransportDate.split('/');
var mDay = startTransportDate1[0];
var mMonth = startTransportDate1[1];
var mYear = startTransportDate1[2];
var startTransportDate2 = mMonth + '/' + mDay + '/' + mYear;
var newdate = new Date(startTransportDate2);
newdate.setDate(newdate.getDate() + (parseInt(routeNoofnights)-1));
var dd = ("0" + newdate.getDate()).slice(-2);
var mm = ("0" + (newdate.getMonth() + 1)).slice(-2);
var y = newdate.getFullYear();
var someFormattedDate = dd + '/' + mm + '/' + y;
$('#endTransportDate' + (parseInt(i))+ (parseInt(id))).val(someFormattedDate);
var TransportCostPrice = JSON.parse(atob(TransportCost));
var Capacity = parseInt(TransportCostPrice.Capacity);
var TotalAdult = $('#transferAdult'+parseInt(i)+''+parseInt(id)).val();
var TotalChild = $('#transferChild'+parseInt(i)+''+parseInt(id)).val();
var TotalPax = parseInt(TotalAdult) + parseInt(TotalChild);
var QTYP = (TotalPax%Capacity);
var QTY = parseInt(TotalPax/Capacity);
if(QTYP >0 ){
QTY = QTY + 1;
}
var VehicleHtml = '';
for(var im = 1; im<= QTY; im++){
VehicleHtml += '<option value="'+im+'" >'+im+'</option>';
}
$('.VehicleQtyHtml'+parseInt(i)+parseInt(id)).html(VehicleHtml);
$('.VehicleQtyHtml'+parseInt(i)+parseInt(id)).val(QTY);
$('.VehicleCapacity'+parseInt(i)+parseInt(id)).val(Capacity);
var TransferCostHtml = TransportCostPrice.CostShow;
$('.TransferCostHtml'+parseInt(i)+parseInt(id)).html(parseInt(TransferCostHtml*QTY));
}
function getChangedTransportQty(that,i,id){
var TransportCost = $('#SelectedTransportCost'+i+id).val();
if(TransportCost != ''){
var TransportCostPrice = JSON.parse(atob(TransportCost));
var QTY = $(that).val();
var TransferCostHtml = TransportCostPrice.CostShow;
$('.TransferCostHtml'+parseInt(i)+parseInt(id)).html(parseInt(TransferCostHtml*QTY));
}
}
function removeTransportFun(i,id,vtype){
var countTransport = $('#countTransport'+parseInt(i)).val();
$('.removeTransportDiv'+parseInt(i)+parseInt(id)).remove();
$('#countTransport'+parseInt(i)).val(parseInt(countTransport)-1);
$('.SightSeeingNameByDayCount_'+vtype+'_'+parseInt(i)+'_'+parseInt(id)).html('');
}
function getPriceDataByTranportType(that,i,id,type){
var transType = $('#transportType'+parseInt(i)+parseInt(id)).val();
var priceCost = $('#TotalSightPriceCost'+parseInt(transType)+parseInt(i)+parseInt(id)).val();
if(priceCost == 0){
priceCost = '';
}
var price = $('#TotalSightPrice'+parseInt(transType)+parseInt(i)+parseInt(id)).val();
var Markup = $('#TotalSightMarkup'+parseInt(transType)+parseInt(i)+parseInt(id)).val();
var PPCost = $('#TotalSightPPCost'+parseInt(transType)+parseInt(i)+parseInt(id)).val();
$('.SightseeingCostHtml'+parseInt(i)+parseInt(id)).html(priceCost);
$('#selectedSightseeingPrice'+parseInt(i)+parseInt(id)).val(price);
$('#selectedSightseeingMarkup'+parseInt(i)+parseInt(id)).val(Markup);
$('#selectedSightseeingPPCost'+parseInt(i)+parseInt(id)).val(PPCost);
var sightseeing = $('#sightseeing'+parseInt(i)+parseInt(id)).val();
var gtxPkgIdSplit = sightseeing.split('~~');
var sightseeingVehicleAreaId = $('.sightseeingVehicleAreaId'+parseInt(i)+'_'+parseInt(id)).val();
var sightseeingVehicleId = $('.sightseeingVehicleId'+parseInt(i)+'_'+parseInt(id)).val();
if(type == 1){
$('.sightseeingVehicleDiv'+parseInt(i)+parseInt(id)).hide();
}
var TPSysId = $('#TPSysIdId').val();
if(transType == 2){
$.ajax({
url: SITEURL + 'byo/index/get-sightseeing-rate',
type: 'POST',
data: {'TPSysId':TPSysId ,'gtxPkgId': gtxPkgIdSplit[0],'type':type,'sightseeingVehicleAreaId':sightseeingVehicleAreaId,'sightseeingVehicleId':sightseeingVehicleId},
dataType: 'json',
beforeSend: function () {
},
success: function (result) {
if(result.AreaData.length>0 && result.VehicleData.length>0){
$('.sightseeingVehicleDiv'+parseInt(i)+parseInt(id)).show();
var html = '<select class="form-control sightseeingVehicleAreaId'+i+'_'+id+'" name="sightseeingVehicleAreaId'+i+'['+id+']" onchange="validateShowVehicleByArea(this,'+i+','+id+')">';
$.each(result.AreaData, function( index, value ) {
html += '<option value="'+value.AreaSysId+'">'+value.Area+'</option>';
});
html += '</select>';
$('.SightseeingAreaData'+parseInt(i)+parseInt(id)).html(html);
var html1 = '<select class="form-control sightseeingVehicleId'+i+'_'+id+'" name="sightseeingVehicleId'+i+'['+id+']" onchange="getPriceDataByTranportType(this,'+i+','+id+',2)">';
$.each(result.VehicleData, function( index, value ) {
html1 += '<option AreaSysId="'+value.AreaSysId+'" value="'+value.RouteVechSysId+'~~'+value.VehicleSysId+'" Capacity="'+value.Capacity+'">'+value.VehName+'</option>';
});
html1 += '</select>';
$('.SightseeingVehicleData'+parseInt(i)+parseInt(id)).html(html1);
var ZoneSysId = $('#ZoneSysId'+parseInt(i)).val();
if(parseInt(ZoneSysId)>0){
$('.sightseeingVehicleAreaId'+i+'_'+id).val(ZoneSysId).change();
}else{
$('.sightseeingVehicleAreaId'+parseInt(i)+'_'+parseInt(id)).change();
$('.sightseeingVehicleId'+parseInt(i)+'_'+parseInt(id)).change();
}
}else if(result.Cost1>0){
$('.SightseeingCostHtml'+parseInt(i)+parseInt(id)).html(parseFloat(result.Cost1));
$('#TotalSightPrice2'+parseInt(i)+parseInt(id)).val(parseFloat(result.Cost));
$('#TotalSightMarkup2'+parseInt(i)+parseInt(id)).val(0);
$('#TotalSightPriceCost2'+parseInt(i)+parseInt(id)).val(parseFloat(result.Cost1));
$('#selectedSightseeingPrice'+parseInt(i)+parseInt(id)).val(parseFloat(result.Cost));
$('#selectedSightseeingMarkup'+parseInt(i)+parseInt(id)).val(0);
$('#selectedSightseeingPPCost'+parseInt(i)+parseInt(id)).val(result.PP);
if(result.Qty > 0){
var hhtml = '';
for(var mi = 1; mi <= result.Qty; mi++){
hhtml += '<option value="'+mi+'" selected>Qty:'+mi+'</option>';
}
$('.sightseeingVehicleQty'+parseInt(i)+parseInt(id)).html(hhtml);
}
}
}
})
}
}
function validateShowVehicleByArea(that,i,id){
var TotalAdult = $('#TotalAdult').val();
var TotalChild = $('#TotalChild').val();
var Pax = parseInt(TotalAdult) + parseInt(TotalChild);
var AreaSysIdSel = $(that).val();
var sightseeingVehicleId = '';
console.log(Pax);
var selected = 0;
$('.sightseeingVehicleId'+parseInt(i)+'_'+parseInt(id)+' option').each(function (i) {
var AreaSysId = $(this).attr('AreaSysId');
var Capacity = $(this).attr('Capacity');
console.log(selected);
if(AreaSysId == AreaSysIdSel || AreaSysId == ''){
$(this).removeAttr('hidden');
if(Pax <= Capacity && selected == 0){
$(this).attr('selected' , 'selected');
sightseeingVehicleId = $(this).attr('value');
selected++;
}
}else{
$(this).attr('hidden',true).removeAttr('selected');
}
});
$('.sightseeingVehicleId'+parseInt(i)+'_'+parseInt(id)).val(sightseeingVehicleId).change();
$('.SightseeingCostHtml'+parseInt(i)+parseInt(id)).html('');
}
function iNeedTransportDiv(){
var isChecked = $('#INeedTransport').prop("checked");
if(isChecked == true) {
$('.INeedTransportDiv').show();
}else{
$('.INeedTransportDiv').hide();
}
}
function getMealsAreaOptionData(that,i,count,type){
var mealsCategory = $('#mealsCategory'+i+count).val();
var mealsType = $('#mealsType'+i+count).val();
var html = '<option value="">Meal Options</option>';
$('#mealsOptions'+i+count).html('<option value="">Please Wait..</option>');
if(mealsCategory != '' && mealsType != ''){
var startCityId = $('#StartCityId').val();
var endCityId = $('#EndCityId').val();
var destinationCityId = $('#destinationCityId'+parseInt(i)).val();
var TPSysId = $('#TPSysIdId').val();
var day = parseInt(i) + 1;
$.ajax({
url: 'byo/index/get-meal-area-data',
type: 'post',
data: { 'startCityId':startCityId,'endCityId':endCityId,'destinationCityId':destinationCityId,'mealsCategory':mealsCategory,'mealsType': mealsType, 'TPSysId':TPSysId, 'day':day },
dataType: 'json',
success: function (result) {
if(result.status == true){
if(result.data.length>0){
$.each(result.data, function( index, value ) {
html += '<option value="'+value.id+'~~'+value.meal_name+'">'+value.meal_name+'</option>';
});
}
$('#mealsOptions'+i+count).html(html);
}else{
$('#mealsOptions'+i+count).html(html);
return false;
}
}
});
}else{
$('#mealsOptions'+i+count).html(html);
}
}
function addMoreMeals(i){
var day = parseInt(i) +1;
var countMeals = $('#countMeals'+parseInt(i)).val();
var html = '<div class="col-md-11 no-padding removeMealsDiv'+parseInt(i)+parseInt(countMeals)+'"><div class="remove_box_mt">'+
'<div class="col-md-2 mobile-padd-tab "><div class="colspan-3">'+
'<div class=""><div class="inputBoxIn dropBg byo_txtmt_10 putMealDetail'+parseInt(i)+''+parseInt(countMeals)+'">'+
'<select class="form-control" name="mealsCategory['+i+'][]" id="mealsCategory'+parseInt(i)+parseInt(countMeals)+'" onchange="getMealsAreaOptionData(this, '+parseInt(i)+','+parseInt(countMeals)+',1)">'+
'<option value="">Select</option><option value="2">Lunch</option><option value="3">Dinner</option></select></div></div></div></div> '+
'<div class="col-md-2 mobile-padd-tab "><div class="colspan-3">'+
'<div class=""><div class="inputBoxIn dropBg byo_txtmt_10 putMealDetail'+parseInt(i)+''+parseInt(countMeals)+'">'+
'<select class="form-control" name="mealsType['+i+'][]" id="mealsType'+parseInt(i)+parseInt(countMeals)+'" onchange="getMealsAreaOptionData(this, '+parseInt(i)+','+parseInt(countMeals)+',2)">'+
'<option value="">select Meal</option><option value="1">Veg</option><option value="2">Non Veg</option><option value="3">AI</option></select></div></div></div></div> '+
'<div class="col-md-4 mobile-padd-tab "><div class="colspan-3">'+
'<div class=""><div class="inputBoxIn dropBg byo_txtmt_10 putMealDetail'+parseInt(i)+''+parseInt(countMeals)+'">'+
'<select class="form-control" name="mealsOptions['+i+'][]" id="mealsOptions'+parseInt(i)+parseInt(countMeals)+'" >'+
'<option value="">Select</option></select></div></div></div></div> '+
'<div class="col-md-1 no-padding mobile-padd-tab text_byocenter mbflt_alignbttn">'+
'<a class="btn btn-danger byomin_btn_2__" onclick="removeMealsDivFun('+parseInt(i)+','+parseInt(countMeals)+')"><i class="fa fa-minus"></i></a>'+
'</div><div class="clearfix"></div>'+
'</div></div>';
$('.addMoreMealsDiv'+parseInt(i)).append(html);
$('#countMeals'+parseInt(i)).val(parseInt(countMeals)+1);
}
function removeMealsDivFun(i,count){
$('.removeMealsDiv'+parseInt(i)+parseInt(count)).remove();
}
function addMoreitems(i){
var day = parseInt(i) +1;
alert(day);
var countItems = $('#countItems'+parseInt(i)).val();
var html = '<div class="col-md-11 removeItemsDiv'+parseInt(i)+parseInt(countItems)+'"><div class="remove_box_mt">'+
'<div class="col-md-2 mobile-padd-tab "><div class="colspan-3">'+
'<div class=""><div class="inputBoxIn dropBg byo_txtmt_10 putItemsDetail'+parseInt(i)+''+parseInt(countItems)+'">'+
'<select class="form-control" name="itemsCategory['+i+'][]" id="itemsCategory'+parseInt(i)+parseInt(countItems)+'" onchange="">'+
'<option value="">Select item</option><option value="1">option 1</option><option value="3">option 2</option></select></div></div></div></div> '+
'<div class="col-md-2 mobile-padd-tab "><div class="colspan-3">'+
'<div class=""><div class="inputBoxIn dropBg byo_txtmt_10 putItemDetail'+parseInt(i)+''+parseInt(countItems)+'">'+
'<select class="form-control" name="itemsType['+i+'][]" id="itemsType'+parseInt(i)+parseInt(countItems)+'" onchange="">'+
'<option value="">select item</option><option value="1">Type 1</option><option value="2">Type 2</option><option value="3">type 3</option></select></div></div></div></div> '+
'<div class="col-md-4 mobile-padd-tab "><div class="colspan-3">'+
'<div class=""><div class="inputBoxIn dropBg byo_txtmt_10 putItemDetail'+parseInt(i)+''+parseInt(countItems)+'">'+
'<select class="form-control" name="itemsOptions['+i+'][]" id="itemsOptions'+parseInt(i)+parseInt(countItems)+'" >'+
'<option value="">Select</option><option value="1~~option1">option 1</option><option value="2~~option2">option 2</option></select></div></div></div></div> '+
'<div class="col-md-1 mobile-padd-tab text_byocenter mbflt_alignbttn">'+
'<a class="btn btn-danger byomin_btn_2__" onclick="removeItemsDivFun('+parseInt(i)+','+parseInt(countItems)+')"><i class="fa fa-minus"></i></a>'+
'</div><div class="clearfix"></div>'+
'</div></div>';
$('.addMoreItemsDiv'+parseInt(i)).append(html);
$('#countItems'+parseInt(i)).val(parseInt(countItems)+1);
}
function removeItemsDivFun(i,count){
$('.removeItemsDiv'+parseInt(i)+parseInt(count)).remove();
}
var mCount_travelPlanDesData = $('#mCount_travelPlanDesData').val();
if(mCount_travelPlanDesData == 0){
$('.addmoredes').click();
}
function removeTravelPlanComponent(component,TPSysId,id){
if(!confirm('Are you sure you want to remove this '+ component)){
return false;
}
$.ajax({
url: SITEURL + 'byo/index/remove-travelplan-component',
type: 'POST',
data: {
'component' : component,
'TPSysId' : TPSysId,
'id' : id,
},
dataType: 'json',
beforeSend: function () {
},
success: function (result) {
if(component == 'sightseeing'){
$('.sightseeing_row_'+id).remove();
}else if(component == 'transfer'){
$('.transfer_row_'+id).remove();
}else if(component == 'meal'){
$('.meal_row_'+id).remove();
}
}
})
}
function showHideRoomsDetailList(cityId,option){
var linkText = $('.show_hide_rooms_detail_list_'+cityId+'_'+option).html();
if(linkText == 'View'){
$('.show_hide_rooms_detail_list_'+cityId+'_'+option).html('Hide');
}else{
$('.show_hide_rooms_detail_list_'+cityId+'_'+option).html('View');
}
$('.room_list_div_'+cityId+'_'+option).toggle('show');
}