| 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(){
// $(".msg1").fadeOut(7000);
//});
function addDiv(that) {
var adultsCheck = $('#adults').val();
var selected = '';
if (adultsCheck >= 2) {
selected = 'selected';
}
var totalA = 0;
var roomTypeId = $('#roomType2').val();
var roomType = $('#roomType2').html();
var mealPlanType = $('#mealPlanType2').html();
var count = 2;
count = parseInt($('#itinerary_rooms').val());
var selectedadult1 = $(".adults" + count).val();
var selectedadult2 = $(".adults_bed" + count).val();
var selectedchild1 = $(".chils_bed" + count).val();
var selectedchild2 = $(".chils_Nobed" + count).val();
var selectedinfant = $(".infant" + count).val();
var CurrencyTitle = $("#CurrencyTitle").val();
var IsShowComponentPrice = $("#IsShowComponentPrice").val();
var AllRoomFCAT = $(".AllRoomFCAT").val();
totalA = totalA + parseInt(selectedadult1) + parseInt(selectedadult2) + parseInt(selectedchild1) + parseInt(selectedchild2);
if (totalA > 4) {
$('.msg1').show().html('More than four travellers not allowed in one room');
return false;
} else {
var AllRoomTGuest = $('.AllRoomTGuest' + roomTypeId).val();
var AllRoomAdult = $('.AllRoomAdult' + roomTypeId).val();
var AllRoomMAdult = $('.AllRoomMAdult' + roomTypeId).val();
var AllRoomMChild = $('.AllRoomMChild' + roomTypeId).val();
var IsShowComponentPriceHtm = '<p ><b>Max Guest:<span class="TGuestHtml_' + (parseInt(count) + 1) + '">'+AllRoomTGuest+'</span> -:</b> <i class="fa fa-male fo-size" aria-hidden="true"></i>×<span class="MAdultHtml_' + (parseInt(count) + 1) + '">' + AllRoomMAdult + '</span> <i class="fa fa-male" aria-hidden="true"></i>×<span class="MChildHtml_' + (parseInt(count) + 1) + '">' + AllRoomMChild + '</span></p>';
if (IsShowComponentPrice == 1) {
IsShowComponentPriceHtm += '<span class=""><strong>Room Cost: ' + CurrencyTitle + ' <span class="RoomWiseCostHtml' + (parseInt(count) - 1) + '"></span></strong></span>';
}
var adultsOption = '';
var adultsExtraOption = '';
var childOption = '';
var selected = '';
for (var ai = 1; ai <= AllRoomAdult; ai++) {
selected = (AllRoomAdult == ai) ? 'selected' : '';
adultsOption += '<option value="' + ai + '" ' + selected + '>' + ai + '</option>';
}
for (var aei = 0; aei <= (parseInt(AllRoomMAdult) - parseInt(AllRoomAdult)); aei++) {
adultsExtraOption += '<option value="' + aei + '">' + aei + '</option>';
}
for (var ci = 0; ci <= (parseInt(AllRoomMChild)); ci++) {
childOption += '<option value="' + ci + '">' + ci + '</option>';
}
$('.appendDiv').append('<div class="modal-body mob-pad inserted-room-row"><div class="add-rooms"><div class="row"><div class="col-md-3 mobile-padd-tab"><div class=" form-group1">' +
' <label class="text-black22" for="name">Select <br>Room ' + (parseInt(count)) + '</label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select id="roomType' + (parseInt(count) + 1) + '" name ="roomType[]" onchange="changeMealPlanType(this,' + (parseInt(count) + 1) + ');">' + roomType + '</select>' +
'</div></div>' + IsShowComponentPriceHtm + '</div></div></div>' +
'<div class="col-md-1 mobile-padd-tab meal-padding-align"><div class=" form-group1">' +
'<label class="text-black22" for="name">Meal <br>Plan</label>' +
' <div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
' <select name="mealPlanType[]" id="mealPlanType' + (parseInt(count) + 1) + '" onchange="mealPlanTypeFun(this, ' + (parseInt(count)) + ')">' + mealPlanType + '</select>' +
' </div></div></div></div></div>' +
' <div class="col-md-8 mobile-padd-tab "><div class="row"><div class="col-md-2 mobile-padd-tab"><div class=" form-group1">' +
'<label class="text-black22" for="name"> <br>Adult(s)</label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="adults[]" class="adults' + (parseInt(count) + 1) + '" onchange="RoomWiseCost()">' + adultsOption + '</select>' +
'</div></div></div></div></div> ' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
'<label class="text-black22" for="name">Adult<br>Extra </label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="adult_extra[]" class="adults_bed' + (parseInt(count) + 1) + '" onchange="RoomWiseCost()">' + adultsExtraOption + '</select>' +
'</div></div> </div></div></div> ' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
'<label class="text-black22" for="name">Child <br><span class="adult-text">('+AllRoomFCAT+' - 12 Yrs)</span></label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="child_with[]" class="chils_bed' + (parseInt(count) + 1) + '" onchange="RoomWiseCost()">' + childOption + '</select>' +
'</div></div></div></div></div>' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
'<label class="text-black22" for="name">Child<br><span class="adult-text">(2 - '+(parseInt(AllRoomFCAT)-1)+' Yrs)</span></label>' +
'<div class="colspan-3"> <div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="child_without[]" class="chils_Nobed' + (parseInt(count) + 1) + '" onchange="RoomWiseCost()">' + childOption + '</select>' +
' </div></div> </div></div></div>' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
' <label class="text-black22" for="name">Infant<br> <span class="adult-text">(Below 2 Yrs)</span></label>' +
'<div class="colspan-3"><div class="inputBox"> <div class="inputBoxIn dropBg">' +
' <select name="infant[]" class="infant' + (parseInt(count) + 1) + '" onchange="RoomWiseCost()"><option value="0">0 </option><option value="1">1 </option><option value="2">2 </option><option value="3">3 </option></select>' +
' </div></div></div></div></div>' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class="add-mor-room">' +
'<a href="javascript://" data-toggle="tooltip" data-placement="top" title="Add Room" id="selectHotel_" onclick="addDiv(this);"> <i class="fa fa-plus"></i> </a>' +
'<a href="javascript://" data-toggle="tooltip" data-placement="top" title="" id="detailbtn1" class="closex1" data-original-title="Delete" onclick="removeItRoom(' + count + ');"><i class="fa fa-times"></i></a>' +
'</div></div></div></div></div></div><div class="cl"></div></div>');
$('#itinerary_rooms').val(parseInt(count) + 1);
}
RoomWiseCost();
}
function removeItRoom(countno) {
var count = $('#itinerary_rooms').val();
if (count == 1) {
return false;
}
$('.appendDiv').find('.inserted-room-row:last').remove();
$('#itinerary_rooms').val(parseInt(count) - 1);
}
function setHotel(hotelId, destId, ref, destIndex) {
var count_setHotel_val = 1;
count_setHotel_val = $('#count_setHotel_val').val();
if(gtxagencysysid == 37338 || gtxagencysysid == 14114){
var arrMealType = {"1": "HB", "2": "FB", "3": "AI", "4": "RO", "5": "BB", "6": "BB", "7": "HB", "8": "FB", "9": "RO"};
}else{
var arrMealType = {"1": "HB", "2": "FB", "3": "AI", "4": "RO", "5": "BB", "6": "CP", "7": "MAP", "8": "AP", "9": "EP"};
}
var checkHotelWithDesti = $("#check_hotel" + destIndex + "_" + destId + "_" + hotelId).val();
var checkVal = destIndex + '_' + destId + '_' + hotelId;
var mTotalCountId = $('#totalCountId').val();
if (mTotalCountId > 0) {
checkHotelWithDesti = 1;
checkVal = 2;
}
if (checkHotelWithDesti != checkVal) {
var countOp = $('#count_option').val();
var countHotel = $('#count_hotel').val();
var optionVal = $('#option_' + destId + '_' + destIndex).val();
var valuesRoomType = [];
var economyTypeTitleName = [];
$("select[name='roomType[]']").each(function () {
valuesRoomType.push($(this).val());
var AllRoomTypeId = $(this).val();
var AllRoomTypeName = $('.AllRoomTypeName' + AllRoomTypeId).val();
economyTypeTitleName.push(AllRoomTypeName);
});
var roomTypeid = '';
for (var g = 0; g < valuesRoomType.length; g++) {
roomTypeid += '<input type="hidden" name="roomType' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + valuesRoomType[g] + '" >';
roomTypeid += '<input type="hidden" name="roomTypeName' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + economyTypeTitleName[g] + '" >';
}
var valuesmealPlanType = [];
$("select[name='mealPlanType[]']").each(function () {
valuesmealPlanType.push($(this).val());
});
// console.log(valuesmealPlanType);
var mealPlanTypeid = '';
var mealPlanTitleName = [];
for (var g = 0; g < valuesmealPlanType.length; g++) {
for (var key in arrMealType)
{
if (valuesmealPlanType[g] == key) {
mealPlanTitleName.push(arrMealType[key]);
}
}
mealPlanTypeid += '<input type="hidden" name="mealPlanType' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + valuesmealPlanType[g] + '" >';
}
var valuesadult = [];
$("select[name='adults[]']").each(function () {
valuesadult.push($(this).val());
});
var adultid = '';
for (var g = 0; g < valuesadult.length; g++) {
adultid += '<input type="hidden" name="adult' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + valuesadult[g] + '" >';
}
var values_extra_adult = [];
$("select[name='adult_extra[]']").each(function () {
values_extra_adult.push($(this).val());
});
var extra_adultid = '';
for (var g = 0; g < values_extra_adult.length; g++) {
extra_adultid += '<input type="hidden" name="adult_extra' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + values_extra_adult[g] + '" >';
}
var values_child_with = [];
$("select[name='child_with[]']").each(function () {
values_child_with.push($(this).val());
});
var child_withid = '';
for (var g = 0; g < values_child_with.length; g++) {
child_withid += '<input type="hidden" name="child_with' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + values_child_with[g] + '" >';
}
var values_child_without = [];
$("select[name='child_without[]']").each(function () {
values_child_without.push($(this).val());
});
var child_withoutid = '';
for (var g = 0; g < values_child_without.length; g++) {
child_withoutid += '<input type="hidden" name="child_without' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + values_child_without[g] + '" >';
}
var values_infant = [];
$("select[name='infant[]']").each(function () {
values_infant.push($(this).val());
});
var infantid = '';
for (var g = 0; g < values_infant.length; g++) {
infantid += '<input type="hidden" name="infant' + (parseInt(countHotel)) + '_' + destId + '_' + hotelId + '[]" value="' + values_infant[g] + '" >';
}
var romm_meal = '';
for (var j = 0; j < economyTypeTitleName.length; j++) {
var adultpax = (valuesadult[j] != undefined) ? valuesadult[j] : 0;
var adultextrapax = (values_extra_adult[j] != undefined) ? values_extra_adult[j] : 0;
var childextrapax = (values_child_with[j] != undefined) ? values_child_with[j] : 0;
var childwithoutpax = (values_child_without[j] != undefined) ? values_child_without[j] : 0;
var infantpax = (values_infant[j] != undefined) ? values_infant[j] : 0;
var totalAdultPax = parseInt(adultpax) + parseInt(adultextrapax);
var totalChildPax = parseInt(childextrapax) + parseInt(childwithoutpax);
var totalExtraBed = parseInt(adultextrapax) + parseInt(childextrapax);
var paxhtml = '';
if(totalAdultPax > 1){
paxhtml += totalAdultPax+' Adults';
}else if(totalAdultPax > 0){
paxhtml += totalAdultPax+' Adult';
}
if(totalChildPax > 0){
paxhtml += ', ';
}
if(totalChildPax > 1){
paxhtml += totalChildPax+' Childs';
}else if(totalChildPax > 0){
paxhtml += totalChildPax+' Child';
}
if(infantpax > 0){
paxhtml += ', ';
}
if(infantpax > 1){
paxhtml += infantpax+' Infants';
}else if(infantpax > 0){
paxhtml += infantpax+' Infant';
}
if(totalExtraBed > 0){
paxhtml += ' with '+totalExtraBed+' Extra Bed';
}
romm_meal += 'Room Type ' + (parseInt(j) + 1) + ' : ' + economyTypeTitleName[j] + ' | ' + mealPlanTitleName[j] + ' ( ' + paxhtml + ' )<br>';
}
var hotel__count_no = $('#hotel__count_no').val();
var destSysId_no = $('#destSysId' + destId + '_' + destIndex).val();
// alert(destSysId_no);
// var deatIdName = '<input type="hidden" name="destSysId[]" value="'+destSysId_no+'" >';
var deatIdName = '<input type="hidden" name="destSysId[]" id="destSysId_' + destId + '_' + hotelId + '_' + destIndex + '" value="' + destSysId_no + '" >';
$(destId).css('display', 'hide');
$(destId).html('Selected').addClass('disabled');
var hotelName = $("#hotelName").val();
var hotelStars = $("#hotelStars").val();
var hotelStarsHtml = ' <span> ';
for (var mm = 1; mm < 6; mm++) {
if (hotelStars >= mm) {
hotelStarsHtml += '<img src="public/images/red-star.png">';
} else {
hotelStarsHtml += '<img src="public/images/gray-star.png">';
}
}
hotelStarsHtml += '</span>';
$("#proceed" + destId + '_' + destIndex).append('<div class="cartptro" id="selected_hotel_' + destIndex + '_' + destId + '_' + hotelId + '"><input type="hidden" name="count_hotel_seq[]" value="' + (parseInt(countHotel)) + '" ><input type="hidden" name="count_no' + destId + '[]" value="' + optionVal + '" ><input type="hidden" id="check_hotel' + destIndex + '_' + destId + '_' + hotelId + '" value="' + destIndex + '_' + destId + '_' + hotelId + '" ><input type="hidden" name="refId" value="' + ref + '" ><input type="hidden" name="hotelId[]" value="' + hotelId + '" ><input type="hidden" name="DestinationId[]" value="' + destId + '" >' + deatIdName +
'<div class="cartptroIn">' +
'<div class="closeEnquiry" onclick="closeDiv(' + hotelId + ',' + destId + ',' + destIndex + ');"></div>' +
'<div class="packageId packageId' + destId + '"><strong>Options <span id="opation_value' + destId + '_' + optionVal + '" class="opation_value' + destId + '_' + optionVal + '">' + (parseInt(optionVal)) + '</span></strong></div>' +
// '<div class="packageDay"><span>'+hotelName+'</span></div>'+
'<div class="packageDay"><span id="hotelName_html_' + hotelId + '_' + destId + '_' + destIndex + '">' + hotelName + hotelStarsHtml + '</span><input id="hotelName_val_' + hotelId + '_' + destId + '_' + destIndex + '" type="hidden" name="hotelName[]" value="' + hotelName + '"><input id="hotelStars_val_' + hotelId + '_' + destId + '_' + destIndex + '" type="hidden" name="hotelStars[]" value="' + hotelStars + '"></div>' +
'<div class="packagePrice">' + roomTypeid + mealPlanTypeid + adultid + extra_adultid + child_withid + child_withoutid + infantid + romm_meal +
// '<div class="packagePrice"><input type="text" name="'+destIndex+'_'+destId+'_'+hotelId+'" value="'+formData+'" ><input type="hidden" name="RoomTypeId[]" value="'+economyTypeTitle+'" ><input type="hidden" name="MealPlanId[]" value="'+mealPlanTitle+'" >'+economyTypeTitleName+' | '+mealPlanTitleName+'</div>'+
// '<div class="packagePrice">'+$("#economyTypeTitle"+hiddenId[2]).html()+' | '+$("#mealPlanTitle"+hiddenId[2]).html()+'</div>'+
'</div><div class="clear"></div>' +
'</div>' +
'</div>');
// $(".proceed_id").append();
$("#proceddData" + destId).append('<td class="insertedRowFinalData_' + hotelId + '_' + destId + '">' + hotelName + '(' + $("#economyTypeTitle" + hotelId).html() + ',' + $("#mealPlanTitle" + hotelId).html() + ')' + '</td>');
$("#proceddDataPrice" + destId).append('<td>' +
'<p>' + $("#roomPrice" + hotelId).html() + $("#proceddDataPrice" + destId).val() + '</p>' +
'<a href="#">Select</a>' +
'</td>');
$('#count_hotel').val(parseInt(countHotel) + 1);
$('#count_option').val(parseInt(countOp) + 1);
$('#option_' + destId + '_' + destIndex).val(parseInt(optionVal) + 1);
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).html("Room Selected");
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeClass('btn-secondry-light').addClass('btn-secondry');
var gethrefval = $("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).attr("href");
$("#hrefdata_" + hotelId + "_" + destIndex + "_" + destId).val(gethrefval);
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeAttr("href");
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeAttr("data-target");
var select_room_dest1 = $(".select_room_dest" + destIndex + "_" + destId).val();
// alert(select_room_dest);
$('.select_room_dest' + destIndex + "_" + destId).val(parseInt(select_room_dest1) + 1);
var select_room_dest2 = $(".select_room_dest" + destIndex + "_" + destId).val();
if (select_room_dest2 >= 1) {
$(".select_room_span" + destIndex + "_" + destId).html("Room Selected");
} else {
$(".select_room_span" + destIndex + "_" + destId).html("Select Room");
}
} else {
alert("This hotel already added.");
}
var disable_proceed_in = $('#disable_proceed_' + destId + '_' + destIndex).val();
$('#disable_proceed_' + destId + '_' + destIndex).val(parseInt(disable_proceed_in) + 1);
var destination_ids = [];
var destination_seq = [];
$("input[name='destination_ids[]']").each(function () {
destination_ids.push($(this).val());
destination_seq.push($(this).attr('seq'));
});
var disable_proceed = 0;
for (var m = 0; m < destination_ids.length; m++) {
var disable_p = $('#disable_proceed_' + destination_ids[m] + '_' + destination_seq[m]).val();
if (disable_p >= 1) {
disable_p = 1;
}
disable_proceed = parseInt(disable_proceed) + parseInt(disable_p);
}
if (disable_proceed == destination_ids.length) {
$(".proceedButton").show();
$(".goToNextTabBtn").hide();
}
$('#count_setHotel_val').val(parseInt(count_setHotel_val) + 1);
}
function closeDiv(hotelId, destId, destIndex) {
var resultsload = $('#resultsload'+destId+'-'+destIndex).val();
if(resultsload == 0){
$("#selected_hotel_" + destIndex + "_" + destId + "_" + hotelId).hide();
setTimeout(function() {
closeDiv1(hotelId, destId, destIndex);
}, 100);
}else{
closeDiv2(hotelId, destId, destIndex);
}
$('.TravelplanHotelDataDiv_'+hotelId+'_'+destId+'_'+destIndex).remove();
}
function closeDiv1(hotelId, destId, destIndex) {
var totalCountId = $('#totalCountId').val();
$('.searchResultsTab'+destIndex).click();
var gethrefval = $("#hrefdata_" + hotelId + "_" + destIndex + "_" + destId).val();
if(gethrefval == '' || gethrefval == undefined){
gethrefval = 'javascript://';
}
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).html("Select Room");
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeClass('btn-secondry').addClass('btn-secondry-light');
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).attr("href", gethrefval);
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).attr("data-target", "#myModalroomdetail");
$("#selected_hotel_" + destIndex + "_" + destId + "_" + hotelId).remove();
//$("#selectHotel_"+destinationName+"_"+id).removeClass('disabled').html('Select');
$('#totalCountId').val(parseInt(totalCountId)-1);
var select_room_dest1 = $(".select_room_dest" + destIndex + "_" + destId).val();
// alert(select_room_dest);
$('.select_room_dest' + destIndex + "_" + destId).val(parseInt(select_room_dest1) - 1);
var select_room_dest2 = $(".select_room_dest" + destIndex + "_" + destId).val();
if (select_room_dest2 >= 1) {
$(".select_room_span" + destIndex + "_" + destId).html("Room Selected");
} else {
$(".select_room_span" + destIndex + "_" + destId).html("Select Room");
}
var disable_proceed_in = $('#disable_proceed_' + destId + '_' + destIndex).val();
$('#disable_proceed_' + destId + '_' + destIndex).val(parseInt(disable_proceed_in) - 1);
var disable_proceed_in1 = $('#disable_proceed_' + destId + '_' + destIndex).val();
if (disable_proceed_in1 == 0) {
$(".proceedButton").hide();
$(".goToNextTabBtn").show();
}
var optionVal = $('#option_' + destId + '_' + destIndex).val();
$('#option_' + destId + '_' + destIndex).val(parseInt(optionVal) - 1);
for (var m = 1; m <= select_room_dest2; m++) {
$('.opation_value' + destId + '_' + (parseInt(m) + 1)).removeClass().addClass('opation_value' + destId + '_' + parseInt(m));
$('.opation_value' + destId + '_' + (parseInt(m))).html(m);
}
$('.errorMoreThanThree').html('');
}
function closeDiv2(hotelId, destId, destIndex) {
var totalCountId = $('#totalCountId').val();
var gethrefval = $("#hrefdata_" + hotelId + "_" + destIndex + "_" + destId).val();
if(gethrefval == ''){
gethrefval = 'javascript://';
}
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).html("Select Room");
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeClass('btn-secondry').addClass('btn-secondry-light');
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).attr("href", gethrefval);
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).attr("data-target", "#myModalroomdetail");
$("#selected_hotel_" + destIndex + "_" + destId + "_" + hotelId).remove();
//$("#selectHotel_"+destinationName+"_"+id).removeClass('disabled').html('Select');
$('#totalCountId').val(parseInt(totalCountId)-1);
var select_room_dest1 = $(".select_room_dest" + destIndex + "_" + destId).val();
// alert(select_room_dest);
$('.select_room_dest' + destIndex + "_" + destId).val(parseInt(select_room_dest1) - 1);
var select_room_dest2 = $(".select_room_dest" + destIndex + "_" + destId).val();
if (select_room_dest2 >= 1) {
$(".select_room_span" + destIndex + "_" + destId).html("Room Selected");
} else {
$(".select_room_span" + destIndex + "_" + destId).html("Select Room");
}
var disable_proceed_in = $('#disable_proceed_' + destId + '_' + destIndex).val();
$('#disable_proceed_' + destId + '_' + destIndex).val(parseInt(disable_proceed_in) - 1);
var disable_proceed_in1 = $('#disable_proceed_' + destId + '_' + destIndex).val();
if (disable_proceed_in1 == 0) {
$(".proceedButton").hide();
$(".goToNextTabBtn").show();
}
var optionVal = $('#option_' + destId + '_' + destIndex).val();
$('#option_' + destId + '_' + destIndex).val(parseInt(optionVal) - 1);
for (var m = 1; m <= select_room_dest2; m++) {
$('.opation_value' + destId + '_' + (parseInt(m) + 1)).removeClass().addClass('opation_value' + destId + '_' + parseInt(m));
$('.opation_value' + destId + '_' + (parseInt(m))).html(m);
}
$('.errorMoreThanThree').html('');
}
function validAdult(hotelId, destId, ref, destIndex) {
var count = $('#itinerary_rooms').val();
var mfirst_roomdata_count = $('#mfirst_roomdata_count').val();
var mfirst_data_div = '';
var adults = $('#adults').val();
var childs = $('#childs').val();
var infants = $('#infants').val();
var totaladult = 0;
var totalchild = 0;
var totalinfant = 0;
for (var i = 2; i <= count; i++) {
var selectedRoomType = $("#roomType" + i).val();
var selectedMealPlanType = $("#mealPlanType" + i).val();
var AllRoomTypeName = $(".AllRoomTypeName" + selectedRoomType).val();
var selectedadult1 = $(".adults" + i).val();
var selectedadult2 = $(".adults_bed" + i).val();
var roomWiseAdult = parseInt(selectedadult1) + parseInt(selectedadult2);
totaladult = totaladult + roomWiseAdult;
var selectedchild1 = $(".chils_bed" + i).val();
var selectedchild2 = $(".chils_Nobed" + i).val();
var roomWiseChild = parseInt(selectedchild1) + parseInt(selectedchild2);
totalchild = totalchild + roomWiseChild;
var selectedinfant = $(".infant" + i).val();
totalinfant = totalinfant + parseInt(selectedinfant);
var totalA = parseInt(selectedadult1) + parseInt(selectedadult2) + parseInt(selectedchild1) + parseInt(selectedchild2);
var AllRoomMAdult = $(".AllRoomMAdult" + selectedRoomType).val();
var AllRoomMChild = $(".AllRoomMChild" + selectedRoomType).val();
var AllRoomTGuest = $(".AllRoomTGuest" + selectedRoomType).val();
if(selectedMealPlanType == null || selectedMealPlanType == ''){
$('.msg1').show().html('Please select Meal Plan in room ' + parseInt(i - 1) + ' ');
return false;
}
if ((parseInt(roomWiseAdult)) > parseInt(AllRoomMAdult)) {
$('.msg1').show().html('More than ' + AllRoomMAdult + ' adult(s) not allowed in room ' + parseInt(i - 1));
return false;
}
if ((parseInt(roomWiseChild)) > parseInt(AllRoomMChild)) {
$('.msg1').show().html('More than ' + AllRoomMChild + ' child(s) not allowed in room ' + parseInt(i - 1));
return false;
}
if ((parseInt(roomWiseAdult) + parseInt(roomWiseChild)) > parseInt(AllRoomTGuest)) {
$('.msg1').show().html('More than ' + AllRoomTGuest + ' travellers not allowed in room ' + parseInt(i - 1));
return false;
}
/*for date which is selected on first hotel room start*/
if (mfirst_roomdata_count == 1) {
mfirst_data_div += '<input type="hidden" name="mRoomType[]" id="mRoomType' + i + '" value="' + selectedRoomType + '">' +
'<input type="hidden" name="mAllRoomTypeName[]" id="mAllRoomTypeName' + i + '" value="' + AllRoomTypeName + '">' +
'<input type="hidden" name="mMealPlanType[]" id="mMealPlanType' + i + '" value="' + selectedMealPlanType + '">' +
'<input type="hidden" name="mAdult[]" id="mAdult' + i + '" value="' + selectedadult1 + '">' +
'<input type="hidden" name="mAdult_bed[]" id="mAdult_bed' + i + '" value="' + selectedadult2 + '">' +
'<input type="hidden" name="mChild_bed[]" id="mChild_bed' + i + '" value="' + selectedchild1 + '">' +
'<input type="hidden" name="mChild_no_bed[]" id="mChild_no_bed' + i + '" value="' + selectedchild2 + '">' +
'<input type="hidden" name="mInfant[]" id="mInfant' + i + '" value="' + selectedinfant + '">';
}
/*for date which is selected on first hotel room end*/
}
if (mfirst_data_div != '') {
$("#mfirst_roomdata_div").html(mfirst_data_div);
$('#mfirst_roomdata_count').val(2);
$('#mfirst_roomdata_count_total').val(count);
}
if ((totaladult != adults) || (totalchild != childs) || (totalinfant != infants)) {
$('.msg1').show().html('Your previous and current member`s selection are different. Previous selection - (Adult : ' + adults + ', Child : ' + childs + ' , Infant : ' + infants + ' )');
$('#mfirst_roomdata_count').val(1);
return false;
} else {
setHotel(hotelId, destId, ref, destIndex);
$('.close').click();
}
}
$("#proceedButton_form").on('submit', function (e) {
var data = $("#proceedButton_form").serialize();
$.ajax({
url: SITEURL + 'byo/index/get-proceed-data',
type: 'POST',
data: data,
dataType: 'text',
beforeSend: function () {
$('.proceedButton').html('Please Wait..');
}, success: function (result) {
$('.proceedButton').html('Proceed');
$("#processPricedetail").html(result);
$('#myModalpricetable').modal('show');
}
})
});
function autosuggest_Itinerary(startCity, endCity, id) {
var selectItineraryCount = $("#selectItineraryCount" + id).val();
$("#selectItinerary" + id).autocomplete({
source: 'byo/index/get-itinerary-description-data/startCity/' + startCity + '/endCity/' + endCity,
minLength: 0,
autoFocus: true,
select: function (event, ui) {
if (ui.item.Description != '') {
$(".itenararyDescHtml" + id).show();
$("#selectItineraryId" + id).val(ui.item.GtxRefId);
$("#itenararyDesc_" + id).val(ui.item.Description);
$("#selectItineraryCount" + id).val(1);
}
}
}).focus(function() {
var selectItineraryCount = $("#selectItineraryCount" + id).val();
if(selectItineraryCount == 0){
$(this).autocomplete('search', '');
$("#selectItineraryCount" + id).val(1);
}
});
if(selectItineraryCount == 0){
setTimeout(function() {
$("#selectItinerary" + id).val(' ').focus();
}, 100);
}
}
$("#save_itinerary").on('submit', function (e) {
$('.transferTypeCat').attr('disabled', false);
$('.nodisabled,.showHideAllValue').attr('disabled', false);
var data = $("#save_itinerary").serialize();
var TotalNoofDays = $('#TotalNoofDays').val();
var TotalAdult = $('#TotalAdult').val();
var TotalChild = $('#TotalChild').val();
var TotalPax = parseInt(TotalAdult) + parseInt(TotalChild);
for(var im = 0; im < TotalNoofDays; im++){
var countTransport = $('#countTransport'+im).val();
var VehicleQty = 0;
var VehicleCapacity = 0;
for(var imm = 1; imm < countTransport; imm++){
var RouteVechSysId = $('.RouteVechSysId'+im+imm).val();
if(RouteVechSysId != '' && RouteVechSysId != '0'){
VehicleQty += parseInt($('.VehicleQtyHtml'+im+imm).val());
VehicleCapacity += parseInt($('.VehicleCapacity'+im+imm).val());
}
}
if(VehicleCapacity>0 && VehicleQty>0){
var TotalCapacityAdjust = parseInt(VehicleCapacity)*parseInt(VehicleQty);
if(TotalPax > TotalCapacityAdjust){
alert('Please select vehicle with more capacity or increse quantity for now total capacity is '+TotalCapacityAdjust+' in day '+(parseInt(im)+1));return false;
}
}
}
//return false;
// console.log(data);
$.ajax({url: SITEURL + 'byo/index/save-itinerary-detail-data', type: 'POST', data: data, dataType: 'json',
beforeSend: function () {
$('.save_itinerary_btn').html('Please Wait..').attr('disabled',true);
$('.proceed-button').html('Please Wait..').attr('disabled',true);
}, success: function (result) {
$('.proceed-button').html('Next').attr('disabled',false);
if (result.status == true) {
var TPSysIden = btoa(result.TPSysId);
var form = '';
// alert(result.TPSysId)
form += '<input type="hidden" name="TPSysId" value="' + result.TPSysId + '">';
// $('<form action="' + SITEURL + 'byo/index/choose-vehicle/id/'+TPSysIden+'" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
var pageaction = $('#pageaction').val();
if(pageaction == 'itinerary'){
if(result.BuildPackageTheme > 0){
$('<form action="' + SITEURL + 'byo/index/tour/id/' + TPSysIden + '" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
}else{
$('<form action="' + SITEURL + 'byo/index/addonitems/id/' + TPSysIden + '" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
}
}else{
$('<form action="' + SITEURL + 'byo/index/price-detail/id/' + TPSysIden + '" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
}
} else {
$('.save_itinerary_btn').html('Save & Continue').attr('disabled',false);
alert(result.message);
return false;
}
}
})
});
$("#save_addonitems").on('submit', function (e) {
$('.transferTypeCat').attr('disabled', false);
$('.nodisabled,.showHideAllValue').attr('disabled', false);
var data = $("#save_addonitems").serialize();
var TotalNoofDays = $('#TotalNoofDays').val();
var TotalAdult = $('#TotalAdult').val();
var TotalChild = $('#TotalChild').val();
var TotalPax = parseInt(TotalAdult) + parseInt(TotalChild);
for(var im = 0; im < TotalNoofDays; im++){
var countTransport = $('#countTransport'+im).val();
var VehicleQty = 0;
var VehicleCapacity = 0;
for(var imm = 1; imm < countTransport; imm++){
var RouteVechSysId = $('.RouteVechSysId'+im+imm).val();
if(RouteVechSysId != '' && RouteVechSysId != '0'){
VehicleQty += parseInt($('.VehicleQtyHtml'+im+imm).val());
VehicleCapacity += parseInt($('.VehicleCapacity'+im+imm).val());
}
}
if(VehicleCapacity>0 && VehicleQty>0){
var TotalCapacityAdjust = parseInt(VehicleCapacity)*parseInt(VehicleQty);
if(TotalPax > TotalCapacityAdjust){
alert('Please select vehicle with more capacity or increse quantity for now total capacity is '+TotalCapacityAdjust+' in day '+(parseInt(im)+1));return false;
}
}
}
$.ajax({url: SITEURL + 'byo/index/save-itinerary-addon-data', type: 'POST', data: data, dataType: 'json',
beforeSend: function () {
$('.save_itinerary_btn').html('Please Wait..').attr('disabled',true);
$('.proceed-button').html('Please Wait..').attr('disabled',true);
}, success: function (result) {
$('.proceed-button').html('Next').attr('disabled',false);
if (result.status == true) {
var TPSysIden = btoa(result.TPSysId);
var form = '';
form += '<input type="hidden" name="TPSysId" value="' + result.TPSysId + '">';
$('<form action="' + SITEURL + 'byo/index/price-detail/id/' + TPSysIden + '" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
} else {
$('.save_itinerary_btn').html('Save & Continue').attr('disabled',false);
alert(result.message);
return false;
}
}
})
});
function mGetPreFillData() {
var mfirst_roomdata_count = $('#mfirst_roomdata_count').val();
var count_total = $('#mfirst_roomdata_count_total').val();
if (mfirst_roomdata_count == 2) {
var selectedRoomTypeVal_first = $('#mRoomType' + (parseInt(2))).val();
var selectedMealPlanTypeVal_first = $('#mMealPlanType' + (parseInt(2))).val();
var mAdult_first = $('#mAdult' + (parseInt(2))).val();
var mAdult_bed_first = $('#mAdult_bed' + (parseInt(2))).val();
var mChild_bed_first = $('#mChild_bed' + (parseInt(2))).val();
var mChild_no_bed_first = $('#mChild_no_bed' + (parseInt(2))).val();
var mInfant_first = $('#mInfant' + (parseInt(2))).val();
var RoomTypeArr_first = [];
$("input[class^='AllRoomType2']").each(function (i) {
RoomTypeArr_first.push($(this).val());
})
if ($.inArray(selectedRoomTypeVal_first, RoomTypeArr_first) != '-1') {
$('#roomType' + (parseInt(2))).val(selectedRoomTypeVal_first);
}
var MealPlanTypeArr_first = [];
$("input[class^='mmealType']").each(function (i) {
MealPlanTypeArr_first.push($(this).val());
})
if ($.inArray(selectedMealPlanTypeVal_first, MealPlanTypeArr_first) != '-1') {
$('#mealPlanType' + (parseInt(2))).val(selectedMealPlanTypeVal_first);
}
$('.adults' + (parseInt(2))).val(mAdult_first);
$('.adults_bed' + (parseInt(2))).val(mAdult_bed_first);
$('.chils_bed' + (parseInt(2))).val(mChild_bed_first);
$('.chils_Nobed' + (parseInt(2))).val(mChild_no_bed_first);
$('.infant' + (parseInt(2))).val(mInfant_first);
// alert(count_total);
count_total = 2;
for (var m = 2; m < count_total; m++) {
// alert(mfirst_roomdata_count);
var count = $('#itinerary_rooms').val();
var roomTypeId = $('#roomType2').val();
var roomTypeVal = $('#roomType2').html();
var mealPlanTypeVal = $('#mealPlanType2').html();
var selectedRoomTypeVal = $('#mRoomType' + (parseInt(m) + 1)).val();
var selectedMealPlanTypeVal = $('#mMealPlanType' + (parseInt(m) + 1)).val();
// alert(selectedRoomTypeVal);
var mAdult = $('#mAdult' + (parseInt(m) + 1)).val();
var mAdult_bed = $('#mAdult_bed' + (parseInt(m) + 1)).val();
var mChild_bed = $('#mChild_bed' + (parseInt(m) + 1)).val();
var mChild_no_bed = $('#mChild_no_bed' + (parseInt(m) + 1)).val();
var mInfant = $('#mInfant' + (parseInt(m) + 1)).val();
$('#mangal').val(2);
var CurrencyTitle = $("#CurrencyTitle").val();
var AllRoomFCAT = $(".AllRoomFCAT").val();
var IsShowComponentPrice = $("#IsShowComponentPrice").val();
var AllRoomAdult = $('.AllRoomAdult' + roomTypeId).val();
var AllRoomMAdult = $('.AllRoomMAdult' + roomTypeId).val();
var AllRoomMChild = $('.AllRoomMChild' + roomTypeId).val();
var AllRoomTGuest = $('.AllRoomTGuest' + roomTypeId).val();
var IsShowComponentPriceHtm = '<p ><b>Max Guest:<span class="TGuestHtml_' + (parseInt(m) + 1) + '">'+AllRoomTGuest+'</span> -:</b> <i class="fa fa-male fo-size" aria-hidden="true"></i>×<span class="MAdultHtml_' + (parseInt(m) + 1) + '">' + AllRoomMAdult + '</span> <i class="fa fa-male" aria-hidden="true"></i>×<span class="MChildHtml_' + (parseInt(m) + 1) + '">' + AllRoomMChild + '</span></p>';
if (IsShowComponentPrice == 1) {
IsShowComponentPriceHtm += '<span class=""><strong>Room Cost: ' + CurrencyTitle + ' <span class="RoomWiseCostHtml' + (parseInt(count) - 1) + '"></span></strong></span>';
}
var adultsOption = '';
var adultsExtraOption = '';
var childOption = '';
var selected = '';
for (var ai = 1; ai <= AllRoomAdult; ai++) {
selected = (AllRoomAdult == ai) ? 'selected' : '';
adultsOption += '<option value="' + ai + '" ' + selected + '>' + ai + '</option>';
}
for (var aei = 0; aei <= (parseInt(AllRoomMAdult) - parseInt(AllRoomAdult)); aei++) {
adultsExtraOption += '<option value="' + aei + '">' + aei + '</option>';
}
for (var ci = 0; ci <= (parseInt(AllRoomMChild)); ci++) {
childOption += '<option value="' + ci + '">' + ci + '</option>';
}
$('.appendDiv').append('<div class="modal-body mob-pad inserted-room-row"><div class="add-rooms"><div class="row"><div class="col-md-3 mobile-padd-tab"><div class=" form-group1">' +
' <label for="name" class="text-black22">Select <br>Room ' + m + '<br></label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select id="roomType' + (parseInt(m) + 1) + '" name ="roomType[]" onchange="changeMealPlanType(this,' + (parseInt(m) + 1) + ');">' + roomTypeVal + '</select>' +
'</div></div>' + IsShowComponentPriceHtm + '</div></div></div>' +
'<div class="col-md-1 mobile-padd-tab meal-padding-align"><div class=" form-group1">' +
'<label for="name" class="text-black22">Meal Plan <br> <br></label>' +
' <div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
' <select name="mealPlanType[]" id="mealPlanType' + (parseInt(m) + 1) + '" onchange="mealPlanTypeFun(this,' + (parseInt(m) + 1) + ')">' + mealPlanTypeVal + '</select>' +
' </div></div></div></div></div>' +
' <div class="col-md-8 mobile-padd-tab "><div class="row"><div class="col-md-2 mobile-padd-tab"><div class=" form-group1">' +
'<label for="name" class="text-black22"><br>Adult</label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="adults[]" class="adults' + (parseInt(m) + 1) + '" onchange="RoomWiseCost()">'+adultsOption+'</select>' +
'</div></div></div></div></div> ' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
'<label for="name" class="text-black22">Adult <br>Extra</label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="adult_extra[]" class="adults_bed' + (parseInt(m) + 1) + '" onchange="RoomWiseCost()">'+adultsExtraOption+'</select>' +
'</div></div> </div></div></div> ' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
'<label for="name" class="text-black22">Child <br> <span class="adult-text">('+AllRoomFCAT+' - 12 Yrs)</span></label>' +
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="child_with[]" class="chils_bed' + (parseInt(m) + 1) + '" onchange="RoomWiseCost()">' +childOption+ '</select>' +
'</div></div></div></div></div>' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
'<label for="name" class="text-black22">Child <br> <span class="adult-text">(2 - '+(parseInt(AllRoomFCAT)-1)+' Yrs)</span></label>' +
'<div class="colspan-3"> <div class="inputBox"><div class="inputBoxIn dropBg">' +
'<select name="child_without[]" class="chils_Nobed' + (parseInt(m) + 1) + '" onchange="RoomWiseCost()">' +childOption+ '</select>' +
' </div></div> </div></div></div>' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class=" form-group1">' +
' <label for="name" class="text-black22">Infant<br> <span class="adult-text">(Below 3 Yrs)</span></label>' +
'<div class="colspan-3"><div class="inputBox"> <div class="inputBoxIn dropBg" >' +
' <select name="infant[]" class="infant' + (parseInt(m) + 1) + '" onchange="RoomWiseCost()"><option value="0">0 </option><option value="1">1 </option><option value="2" >2 </option><option value="3" >3 </option></select>' +
' </div></div></div></div></div>' +
'<div class="col-md-2 mobile-padd-tab align_padding_room"><div class="add-mor-room">' +
'<a href="javascript://" data-toggle="tooltip" data-placement="top" title="Add Room" id="selectHotel_" onclick="addDiv(this);"> <i class="fa fa-plus"></i> </a>' +
'<a href="javascript://" data-toggle="tooltip" data-placement="top" title="" id="detailbtn1" class="closex1" data-original-title="Delete" onclick="removeItRoom(' + m + ');"><i class="fa fa-times"></i></a>' +
'</div></div></div></div></div><div class="cl"></div></div></div>');
var RoomTypeArr = [];
$("input[class^='AllRoomType2']").each(function (i) {
RoomTypeArr.push($(this).val());
})
// console.log(RoomTypeArr);
if ($.inArray(selectedRoomTypeVal, RoomTypeArr) != '-1') {
$('#roomType' + (parseInt(m) + 1)).val(selectedRoomTypeVal);
var AllRoomMAdult = $('.AllRoomMAdult' + selectedRoomTypeVal).val();
var AllRoomMChild = $('.AllRoomMChild' + selectedRoomTypeVal).val();
$('.MAdultHtml_' + (parseInt(m) + 1)).html(AllRoomMAdult);
$('.MChldHtml_' + (parseInt(m) + 1)).html(AllRoomMChild);
}
var MealPlanTypeArr = [];
$("input[class^='mmealType']").each(function (i) {
MealPlanTypeArr.push($(this).val());
})
if ($.inArray(selectedMealPlanTypeVal, MealPlanTypeArr) != '-1') {
$('#mealPlanType' + (parseInt(m) + 1)).val(selectedMealPlanTypeVal);
}
// $('.adults' + (parseInt(m) + 1)).val(mAdult);
// $('.adults_bed' + (parseInt(m) + 1)).val(mAdult_bed);
// $('.chils_bed' + (parseInt(m) + 1)).val(mChild_bed);
// $('.chils_Nobed' + (parseInt(m) + 1)).val(mChild_no_bed);
// $('.infant' + (parseInt(m) + 1)).val(mInfant);
$('#itinerary_rooms').val(parseInt(count) + 1);
}
}
}
function changeMealPlanType(that, i) {
if(gtxagencysysid == 37338 || gtxagencysysid == 14114){
var arrMealType = {"1": "HB", "2": "FB", "3": "AI", "4": "RO", "5": "BB", "6": "BB", "7": "HB", "8": "FB", "9": "RO"};
}else{
var arrMealType = {"1": "HB", "2": "FB", "3": "AI", "4": "RO", "5": "BB", "6": "CP", "7": "MAP", "8": "AP", "9": "EP"};
}
var roomTypeVAl = $(that).val();
var values_extra = '';
$("input[class^='mmealType" + roomTypeVAl + "']").each(function (i) {
for (var key in arrMealType)
{
if ($(this).val() == key) {
var keyname = key;
var valname = arrMealType[key];
}
}
values_extra += '<option value="' + keyname + '">' + valname + '</option>';
});
$('#mealPlanType' + i).html(values_extra);
var AllRoomAdult = $('.AllRoomAdult' + roomTypeVAl).val();
var AllRoomMAdult = $('.AllRoomMAdult' + roomTypeVAl).val();
var AllRoomMChild = $('.AllRoomMChild' + roomTypeVAl).val();
var AllRoomTGuest = $('.AllRoomTGuest' + roomTypeVAl).val();
var adultsOption = '';
var adultsExtraOption = '';
var childOption = '';
var selected = '';
for (var ai = 1; ai <= AllRoomAdult; ai++) {
selected = (AllRoomAdult == ai) ? 'selected' : '';
adultsOption += '<option value="' + ai + '" ' + selected + '>' + ai + '</option>';
}
for (var aei = 0; aei <= (parseInt(AllRoomMAdult) - parseInt(AllRoomAdult)); aei++) {
adultsExtraOption += '<option value="' + aei + '">' + aei + '</option>';
}
for (var ci = 0; ci <= (parseInt(AllRoomMChild)); ci++) {
childOption += '<option value="' + ci + '">' + ci + '</option>';
}
$(' .adults'+ i).html(adultsOption);
$(' .adults_bed'+ i).html(adultsExtraOption);
$(' .chils_bed'+ i).html(childOption);
$(' .chils_Nobed'+ i).html(childOption);
$('.MAdultHtml_' + i).html(AllRoomMAdult);
$('.MChildHtml_' + i).html(AllRoomMChild);
$('.TGuestHtml_' + i).html(AllRoomTGuest);
RoomWiseCost();
}
function mealPlanTypeFun(that, i) {
RoomWiseCost();
}
// $(document).ready(function(){
// $('#sidebar-2').stickySidebar({
// containerSelector: '.top_package_detail_price ',
// innerWrapperClass: 'sidebarCount',
// topSpacing:0,
// bottomSpacing: 0
// });
// });
/*Code for Edit */
function responseHotelFunction() {
var countFunction = 0;
countFunction = $('#countFunctionOnresponse').val();
var totalCountDestinationTab = $('#totalCountDestinationTab').val();
var mTotalCountId = $('#totalCountId').val();
var mfirst_data_div = '';
if (mTotalCountId > 0) {
var incDesCount = 1;
for (var m = 1; m <= mTotalCountId; m++) {
if (countFunction == 0) {
var hotelId = $('#mHotelId_' + parseInt(m)).val();
var destId = $('#mDestinationId_' + parseInt(m)).val();
var ref = $('#mrefId_' + parseInt(m)).val();
var destIndex = $('#mdestSeq_' + parseInt(m)).val();
var hotelName = $('#hotelName_' + parseInt(hotelId) + '_' + parseInt(destId)+ '_' + parseInt(destIndex)).val();
var hotelStar = $('#hotelStar_' + parseInt(hotelId) + '_' + parseInt(destId)+ '_' + parseInt(destIndex)).val();
var mRoomTypeId_ = 'mRoomTypeId_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mRoomTypeName_ = 'mRoomTypeName_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mMealPlanId_ = 'mMealPlanId_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mAdult_ = 'mAdult_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mAdultExtraBed_ = 'mAdultExtraBed_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mChildWithBed_ = 'mChildWithBed_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mChildWithOutBed_ = 'mChildWithOutBed_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mInfent_ = 'mInfent_' + parseInt(hotelId) + '_' + parseInt(destId) + '_' + parseInt(destIndex);
var mRoomTypeId = $('#' + mRoomTypeId_).val();
var mRoomTypeName = $('#' + mRoomTypeName_).val();
var mMealPlanId = $('#' + mMealPlanId_).val();
var mAdult = $('#' + mAdult_).val();
var mAdultExtraBed = $('#' + mAdultExtraBed_).val();
var mChildWithBed = $('#' + mChildWithBed_).val();
var mChildWithOutBed = $('#' + mChildWithOutBed_).val();
var mInfent = $('#' + mInfent_).val();
var destsysId = $('#mdestsysId_' + parseInt(destId) + '_' + parseInt(destIndex)).val();
var valuesRoomType = [];
$("input[id='" + mRoomTypeId_ + "']").each(function () {
var mmmmRoomTypeId = $(this).val();
var mRoomTypeName = $('#mRoomTypeName_' + mmmmRoomTypeId).val();
valuesRoomType.push('<select name="roomType[]" ><option value="' + $(this).val() + '"></option></select><select name="roomTypeName[]" class="AllRoomTypeName' + mmmmRoomTypeId + '"><option value="' + mRoomTypeName + '"></option></select>');
});
var valuesmealPlanType = [];
$("input[id='" + mMealPlanId_ + "']").each(function () {
valuesmealPlanType.push('<select name="mealPlanType[]" ><option value="' + $(this).val() + '"></option></select>');
});
var valuesmAdult = [];
$("input[id='" + mAdult_ + "']").each(function () {
valuesmAdult.push('<select name="adults[]" ><option value="' + $(this).val() + '"></option></select>');
});
var valuesmAdultExtraBed = [];
$("input[id='" + mAdultExtraBed_ + "']").each(function () {
valuesmAdultExtraBed.push('<select name="adult_extra[]" ><option value="' + $(this).val() + '"></option></select>');
});
var valuesmChildWithBed = [];
$("input[id='" + mChildWithBed_ + "']").each(function () {
valuesmChildWithBed.push('<select name="child_with[]" ><option value="' + $(this).val() + '"></option></select>');
});
var valuesmChildWithOutBed = [];
$("input[id='" + mChildWithOutBed_ + "']").each(function () {
valuesmChildWithOutBed.push('<select name="child_without[]"><option value="' + $(this).val() + '"></option></select>');
});
var valuesmInfent = [];
$("input[id='" + mInfent_ + "']").each(function () {
valuesmInfent.push('<select name="infant[]"><option value="' + $(this).val() + '"></option></select>');
});
var HotelIdCurrent = $('#mHotelId_' + parseInt(m)).val();
var HotelIdPre = $('#mHotelId_' + (parseInt(m) - 1)).val();
var destSeqCurrent = $('#mdestSeq_' + parseInt(m)).val();
var destSeqPre = $('#mdestSeq_' + (parseInt(m) - 1)).val();
var CheckHotelIdCurrent = destSeqCurrent + '__' + HotelIdCurrent;
var CheckHotelIdPre = destSeqPre + '__' + HotelIdPre;
if (CheckHotelIdCurrent != CheckHotelIdPre) {
$('.appendDataForEdit').html(valuesRoomType + valuesmealPlanType + valuesmAdult + valuesmAdultExtraBed + valuesmChildWithBed + valuesmChildWithOutBed + valuesmInfent);
setHotel(hotelId, destId, ref, destIndex);
// alert(destsysId);
var hotelStarsHtml = ' <span> ';
for (var mm = 1; mm < 6; mm++) {
if (hotelStar >= mm) {
hotelStarsHtml += '<img src="public/images/red-star.png">';
} else {
hotelStarsHtml += '<img src="public/images/gray-star.png">';
}
}
hotelStarsHtml += '</span>';
$('#destSysId_' + destId + '_' + hotelId + '_' + parseInt(incDesCount)).val(destsysId);
$('#hotelStars_val_' + hotelId + '_' + destId + '_' + parseInt(destIndex)).val(hotelStar);
$('#hotelName_val_' + hotelId + '_' + destId + '_' + parseInt(destIndex)).val(hotelName);
$('#hotelName_html_' + hotelId + '_' + destId + '_' + parseInt(destIndex)).html(hotelName + hotelStarsHtml);
$('.appendDataForEdit').html('');
mfirst_data_div += '<input type="hidden" name="mRoomType[]" id="mRoomType' + (parseInt(m)+1) + '" value="' + mRoomTypeId + '">' +
'<input type="hidden" name="mAllRoomTypeName[]" id="mAllRoomTypeName' + (parseInt(m)+1) + '" value="' + mRoomTypeName + '">' +
'<input type="hidden" name="mMealPlanType[]" id="mMealPlanType' + (parseInt(m)+1) + '" value="' + mMealPlanId + '">' +
'<input type="hidden" name="mAdult[]" id="mAdult' + (parseInt(m)+1) + '" value="' + mAdult + '">' +
'<input type="hidden" name="mAdult_bed[]" id="mAdult_bed' + (parseInt(m)+1) + '" value="' + mAdultExtraBed + '">' +
'<input type="hidden" name="mChild_bed[]" id="mChild_bed' + (parseInt(m)+1) + '" value="' + mChildWithBed + '">' +
'<input type="hidden" name="mChild_no_bed[]" id="mChild_no_bed' + (parseInt(m)+1) + '" value="' + mChildWithOutBed + '">' +
'<input type="hidden" name="mInfant[]" id="mInfant' + (parseInt(m)+1) + '" value="' + mInfent + '">';
$("#mfirst_roomdata_div").html(mfirst_data_div);
$('#mfirst_roomdata_count').val(parseInt(valuesRoomType.length));
$('#mfirst_roomdata_count_total').val(parseInt(valuesRoomType.length)+1);
incDesCount++;
}
// if($('#mHotelId_'+parseInt(m)).val() == $('#mHotelId_'+(parseInt(m)-1)).val()){
// $('#destSysId_'+destId+'_'+hotelId+'_'+parseInt(m)).val(destsysId);
//
// }
} else {
var hotelId = $('#mHotelId_' + parseInt(m)).val();
var destId = $('#mDestinationId_' + parseInt(m)).val();
var ref = $('#mrefId_' + parseInt(m)).val();
var destIndex = $('#mdestSeq_' + parseInt(m)).val();
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).html("Room Selected");
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeClass('btn-secondry-light').addClass('btn-secondry');
var gethrefval = $("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).attr("href");
$("#hrefdata_" + hotelId + "_" + destIndex + "_" + destId).val(gethrefval);
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeAttr("href");
$("#selectHotel_" + hotelId + "_" + destIndex + "_" + destId).removeAttr("data-target");
}
}
}
$('#countFunctionOnresponse').val(parseInt(countFunction) + 1);
}
function RoomWiseCost() {
var data = $('.roomInfo').serialize();
$.ajax({
url: 'byo/index/calculate-room-selection',
type: 'post',
data: data,
dataType: 'json',
success: function (result) {
// console.log(result);
$.each(result, function (index, value) {
$('.RoomWiseCostHtml' + parseInt(index)).html(value);
})
}
});
}
function goToNextTab(){
var searchResultsTabLen = $('.searchResultsTab').length;
var searchResultsTab = $('.searchResultsTab:checked').attr('index');
if(searchResultsTabLen == searchResultsTab){
var seqnnn = $('.searchResultsTab').first().attr('seq');
$('.searchResultsTab'+seqnnn).click();
}else{
var searchResultsTabNext = $('.searchResultsTab:checked').nextAll('.searchResultsTab').first().attr('seq');
$('.searchResultsTab'+searchResultsTabNext).click();
}
}