| 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/holidays.tripjack.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 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();
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{
$('.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></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)+'" >'+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">No <br>of Adult</label>'+
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">'+
'<select name="adults[]" class="adults'+(parseInt(count)+1)+'"><option value="1">1 </option><option value="2" '+selected+' >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=" form-group1">'+
'<label class="text-black22" for="name">Adult With Extra Bed </label>'+
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">'+
'<select name="adult_extra[]" class="adults_bed'+(parseInt(count)+1)+'"><option value="0">0 </option><option value="1">1 </option></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 With <br> Bed <span class="adult-text">(3 - 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)+'">'+
'<option value="0">0 </option><option value="1">1 </option></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 W/O Bed<span class="adult-text">(3 - 12 Yrs)</span.</label>'+
'<div class="colspan-3"> <div class="inputBox"><div class="inputBoxIn dropBg">'+
'<select name="child_without[]" class="chils_Nobed'+(parseInt(count)+1)+'">'+
' <option value="0">0 </option><option value="1">1 </option><option value="2">2 </option></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 3 Yrs)</span></label>'+
'<div class="colspan-3"><div class="inputBox"> <div class="inputBoxIn dropBg">'+
' <select name="infant[]" class="infant'+(parseInt(count)+1)+'"><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);
}
}
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();
var arrRoomType = { "1": "Deluxe","2":"Luxury",3:"Super Deluxe","4":"Standard","5":"Standard Single","7":"Standard Double","8":"Standard Triple","9":"Standard Twin","10":"Deluxe Twin",
"11":"Premium","12":"Superior","13":"Suite Room","14":"Executive Suite","15":"Karumba Suite","16":"Club Suite","17":"AC Luxury Houseboat","18":"Wild Orchid Suite",
"19":"Deluxe Cottage with Private Garden","20":"Sea Facing Deluxe suite","21":"Premium Cottage Sea View","22":"Executive Suite Palace wing","23":"Periyar Cottage",
"24":"Cottage","25":"Heritage Wing","26":"Lake Facing Room","27":"Standard Bamboo Cottage","28":"Wooden Cottage","29":"Fixed Tent","30":"Comfort Tent",
"31":"Double Room A Block","32":"Double Room B Block","33":"Standard Hut","34":"Standard Cottage","35":"Deluxe Cottage","36":"Deluxe Swiss Tents"
};
var arrMealType = { "9": "EP", "6": "CP", "8": "AP","7":"MAP" };
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 = [];
$("select[name='roomType[]']").each(function() {
valuesRoomType.push($(this).val());
});
var roomTypeid = '';
var economyTypeTitleName = [];
for(var g=0;g<valuesRoomType.length;g++){
for(var key in arrRoomType)
{
if(valuesRoomType[g]==key){
economyTypeTitleName.push(arrRoomType[key]);
}
}
roomTypeid += '<input type="hidden" name="roomType'+(parseInt(countHotel))+'_'+destId+'_'+hotelId+'[]" value="'+valuesRoomType[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++){
romm_meal += 'Room Type '+(parseInt(j)+1)+' : '+economyTypeTitleName[j]+' | '+mealPlanTitleName[j]+'<br>';
}
var hotel__count_no = $('#hotel__count_no').val();
var destSysId_no = $('#destSysId'+destId+'_'+hotel__count_no).val();
// var deatIdName = '<input type="hidden" name="destSysId[]" value="'+destSysId_no+'" >';
var deatIdName = '<input type="hidden" name="destSysId[]" id="destSysId_'+destId+'_'+hotelId+'_'+count_setHotel_val+'" 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+'">'+hotelName+hotelStarsHtml+'</span><input id="hotelName_val_'+hotelId+'_'+destId+'" type="hidden" name="hotelName[]" value="'+hotelName+'"><input id="hotelStars_val_'+hotelId+'_'+destId+'" 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-primary').addClass('btn-success');
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"+destId).val();
// alert(select_room_dest);
$('#select_room_dest'+destId).val(parseInt(select_room_dest1) + 1);
var select_room_dest2 = $("#select_room_dest"+destId).val();
if(select_room_dest2 >= 1){
$("#select_room_span"+destId).html("Room Selected");
}else{
$("#select_room_span"+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 = [];
$("input[name='destination_ids[]']").each(function() {
destination_ids.push($(this).val());
});
var disable_proceed = 0;
for(var m = 0;m < destination_ids.length; m++){
var disable_p = $('#disable_proceed_'+destination_ids[m]+'_'+(parseInt(m)+1)).val();
if(disable_p >= 1){
disable_p = 1;
}
disable_proceed = parseInt(disable_proceed) + parseInt(disable_p);
}
if(disable_proceed == destination_ids.length){
$(".proceedButton").prop('disabled',false);
}
$('#count_setHotel_val').val(parseInt(count_setHotel_val) + 1);
}
function closeDiv(hotelId,destId,destIndex){
var gethrefval = $("#hrefdata_"+hotelId+"_"+destIndex+"_"+destId).val();
$("#selectHotel_"+hotelId+"_"+destIndex+"_"+destId).html("Select Room");
$("#selectHotel_"+hotelId+"_"+destIndex+"_"+destId).removeClass('btn-success').addClass('btn-primary');
$("#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');
var select_room_dest1 = $("#select_room_dest"+destId).val();
// alert(select_room_dest);
$('#select_room_dest'+destId).val(parseInt(select_room_dest1) - 1);
var select_room_dest2 = $("#select_room_dest"+destId).val();
if(select_room_dest2 >= 1){
$("#select_room_span"+destId).html("Room Selected");
}else{
$("#select_room_span"+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").prop('disabled',true);
}
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);
}
}
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 selectedadult1 = $(".adults"+i).val();
var selectedadult2 = $(".adults_bed"+i).val();
totaladult = totaladult + parseInt(selectedadult1)+ parseInt(selectedadult2);
var selectedchild1 = $(".chils_bed"+i).val();
var selectedchild2 = $(".chils_Nobed"+i).val();
totalchild = totalchild + parseInt(selectedchild1)+ parseInt(selectedchild2);
var selectedinfant = $(".infant"+i).val();
totalinfant = totalinfant + parseInt(selectedinfant);
var totalA = 0;
totalA = parseInt(selectedadult1)+ parseInt(selectedadult2) + parseInt(selectedchild1)+ parseInt(selectedchild2) ;
if(totalA > 4){
$('.msg1').show().html('More than four travellers not allowed in room '+parseInt(i-1));
return false;
}
if((parseInt(selectedadult2)+ parseInt(selectedchild1)) == 2){
$('.msg1').show().html('Adult and Child both with bed are not allowed in room '+parseInt(i-1));
return false;
}
if((parseInt(selectedadult1)+ parseInt(selectedadult2)) > 3){
$('.msg1').show().html('Adult & Adult with bed more than 3 are 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="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() {
}, success: function(result) {
$("#processPricedetail").html(result);
$('#myModalpricetable').modal('show');
}
})
});
function autosuggest_Itinerary(startCity,endCity,id){
$("#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();
$("#itenararyDesc_"+id).val(ui.item.Description);
}
}
});
}
$("#save_itinerary").on('submit', function(e) {
var data = $("#save_itinerary").serialize();
// console.log(data);
$.ajax({url: SITEURL + 'byo/index/save-itinerary-detail-data', type: 'POST', data: data, dataType: 'json', beforeSend: function() {
}, success: function(result) {
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();
$('<form action="' + SITEURL + 'byo/index/price-detail/id/'+TPSysIden+'" method="POST">' + form + '</form>').appendTo($(document.body)).submit();
}
})
});
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);
for(var m=2;m<count_total;m++){
// alert(mfirst_roomdata_count);
var count = $('#itinerary_rooms').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);
$('.appendDiv').append('<div class="modal-body mob-pad inserted-room-row"><div class="add-rooms"><div class="col-md-2 mobile-padd-tab"><div class=" form-group1">'+
' <label for="name">Room Type '+m+'<br> <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></div></div></div>'+
'<div class="col-md-2 mobile-padd-tab"><div class=" form-group1">'+
'<label for="name">Meal Plan <br> <br></label>'+
' <div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">'+
' <select name="mealPlanType[]" id="mealPlanType'+(parseInt(m)+1)+'" >'+mealPlanTypeVal+'</select>'+
' </div></div></div></div></div>'+
' <div class="col-md-8 mobile-padd-tab "><div class="col-md-2 mobile-padd-tab"><div class=" form-group1">'+
'<label for="name">No of Adult <br> <br></label>'+
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">'+
'<select name="adults[]" class="adults'+(parseInt(m)+1)+'"><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"><div class=" form-group1">'+
'<label for="name">Adult With Extra Bed </label>'+
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">'+
'<select name="adult_extra[]" class="adults_bed'+(parseInt(m)+1)+'"><option value="0" >0 </option><option value="1" >1 </option></select>'+
'</div></div> </div></div></div> '+
'<div class="col-md-2 mobile-padd-tab"><div class=" form-group1">'+
'<label for="name">Child With Bed <br> <span class="adult-text">(Age 3 - 12 Year)</span></label>'+
'<div class="colspan-3"><div class="inputBox"><div class="inputBoxIn dropBg">'+
'<select name="child_with[]" class="chils_bed'+(parseInt(m)+1)+'">'+
'<option value="0" >0 </option><option value="1">1 </option></select>'+
'</div></div></div></div></div>'+
'<div class="col-md-2 mobile-padd-tab"><div class=" form-group1">'+
'<label for="name">Child W/O Bed <br> <span class="adult-text">(Age 3 - 12 Year)</span.</label>'+
'<div class="colspan-3"> <div class="inputBox"><div class="inputBoxIn dropBg">'+
'<select name="child_without[]" class="chils_Nobed'+(parseInt(m)+1)+'">'+
' <option value="0" >0 </option><option value="1" >1 </option><option value="2" >2 </option></select>'+
' </div></div> </div></div></div>'+
'<div class="col-md-2 mobile-padd-tab"><div class=" form-group1">'+
' <label for="name">Infant<br> <span class="adult-text">(Below 3 Year)</span></label>'+
'<div class="colspan-3"><div class="inputBox"> <div class="inputBoxIn dropBg">'+
' <select name="infant[]" class="infant'+(parseInt(m)+1)+'"><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"><div class="add-mor-room">'+
'<a href="javascript://" data-toggle="tooltip" data-placement="top" title="Add Room" id="selectHotel_" onclick="addDiv(this);"> Add Room M1 </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 class="cl"></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 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){
var arrMealType = { "9": "EP", "6": "CP", "8": "AP","7":"MAP" };
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);
}
// $(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();
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)).val();
var hotelStar = $('#hotelStar_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var mRoomTypeId = $('#mRoomTypeId_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var mMealPlanId = $('#mMealPlanId_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var mAdult = $('#mAdult_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var mAdultExtraBed = $('#mAdultExtraBed_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var mChildWithBed = $('#mChildWithBed_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var mChildWithOutBed = $('#mChildWithOutBed_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var mInfent = $('#mInfent_'+parseInt(hotelId)+'_'+parseInt(destId)).val();
var destsysId = $('#mdestsysId_'+parseInt(destId)).val();
var valuesRoomType = [];
$("input[id='mRoomTypeId_"+hotelId+"_"+destId+"']").each(function() {
valuesRoomType.push('<select name="roomType[]" ><option value="'+$(this).val()+'"></option></select>');
});
var valuesmealPlanType = [];
$("input[id='mMealPlanId_"+hotelId+"_"+destId+"']").each(function() {
valuesmealPlanType.push('<select name="mealPlanType[]" ><option value="'+$(this).val()+'"></option></select>');
});
var valuesmAdult = [];
$("input[id='mAdult_"+hotelId+"_"+destId+"']").each(function() {
valuesmAdult.push('<select name="adults[]" ><option value="'+$(this).val()+'"></option></select>');
});
var valuesmAdultExtraBed = [];
$("input[id='mAdultExtraBed_"+hotelId+"_"+destId+"']").each(function() {
valuesmAdultExtraBed.push('<select name="adult_extra[]" ><option value="'+$(this).val()+'"></option></select>');
});
var valuesmChildWithBed = [];
$("input[id='mChildWithBed_"+hotelId+"_"+destId+"']").each(function() {
valuesmChildWithBed.push('<select name="child_with[]" ><option value="'+$(this).val()+'"></option></select>');
});
var valuesmChildWithOutBed = [];
$("input[id='mChildWithOutBed_"+hotelId+"_"+destId+"']").each(function() {
valuesmChildWithOutBed.push('<select name="child_without[]"><option value="'+$(this).val()+'"></option></select>');
});
var valuesmInfent = [];
$("input[id='mInfent_"+hotelId+"_"+destId+"']").each(function() {
valuesmInfent.push('<select name="infant[]"><option value="'+$(this).val()+'"></option></select>');
});
if($('#mHotelId_'+parseInt(m)).val() != $('#mHotelId_'+(parseInt(m)-1)).val()){
$('.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).val(hotelStar);
$('#hotelName_val_'+hotelId+'_'+destId).val(hotelName);
$('#hotelName_html_'+hotelId+'_'+destId).html(hotelName+hotelStarsHtml);
$('.appendDataForEdit').html('');
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-primary').addClass('btn-success');
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);
}