| 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/b2c.hellogtx.com/public/js/ |
Upload File : |
/**
* Create by Ranvir singh 03 Aug 2017
* Updated on 23 Aug 2017
*/
// params : element class | returns : total sum of values
function countTotalValuesOfSelected(element_class) {
var totalNumber = 0;
$('.' + element_class).each(function (i, element) {
if (this.checked == true) {
totalNumber += parseInt($(this).val());
}
});
return totalNumber;
}
function redirect_to_newurl() {
var currenturl, hotelcategory, packagetourtype, newurl, url, base_url, host, urlparams, mealplantype;
currenturl = $('body').find('#change_category_form #currenturl').val();
packagetourtype = $('body').find('#change_category_form #packagetourtype').val();
hotelcategory = $('body').find('#change_category_form #hotelcategory').val();
mealplantype = $('body').find('#change_category_form #mptype_pop').val();
base_url = (window.location.origin);
host = (window.location.host);
urlparams = (window.location.pathname);
url = urlparams.split('/');
var countryname = url[url.length - 2];
var getallidstr = (url[url.length - 1]).slice(0, -5);
var getallidstrArry = getallidstr.split('-');
var packagename = getallidstrArry[0];
var pkgid = getallidstrArry[(getallidstrArry.length - 5)];
// var catid = getallidstrArry[2];
var gtxid = getallidstrArry[(getallidstrArry.length - 3)];
var tourtype = getallidstrArry[(getallidstrArry.length - 2)];
var mealplantype_old = getallidstrArry[(getallidstrArry.length - 1)];
var packagenameArr = [];
for (var i = 0; i <= (getallidstrArry.length - 6); i++) {
packagenameArr.push(getallidstrArry[i]);
}
packagename = packagenameArr.join('-');
if (mealplantype_old !== mealplantype) {
$.ajax({
url: SITEURL + 'detail/index/write-session-modifytrue',
type: 'POST',
async: false,
data: { mealplantype: mealplantype },
dataType: 'json',
success: function (result) {
//console.log(result);
},
error: function (result) {
}
});
}
newurl = SITEURL + '/detail';
if (host === 'localhost') {
newurl += '/' + countryname + '/' + packagename + '-' + pkgid + '-' + hotelcategory + '-' + gtxid + '-' + tourtype + '-' + mealplantype + '.html';
}
else if (appmode === 'MODE_BETA') {
newurl += '/beta/' + countryname + '/' + packagename + '-' + pkgid + '-' + hotelcategory + '-' + gtxid + '-' + tourtype + '-' + mealplantype + '.html';
} else {
newurl += '/' + countryname + '/' + packagename + '-' + pkgid + '-' + hotelcategory + '-' + gtxid + '-' + tourtype + '-' + mealplantype + '.html';
}
window.location.href = newurl;
}
// add activity / sightseeing / services | all multi items
function add_options_into_package(that) {
// start : ask for confirmation
if (!askforconfirmation()) {
return false;
}
// end : ask for confirmation
var packageid, os_price, price, old_price, divbody, modaltype, itemid, daynumber, type, itinerary, tourtype, catid;
var mp = '';
var countit = '';
divbody = $(that).closest('.modal-content');
// packageid = divbody.find('.modal-body .otherservices').attr('data-packageid');
packageid = divbody.find('.modal-body #modaltype_pkgid').val();
itemid = divbody.find('.modal-body .changeoption:checked').val(); // checked item
daynumber = divbody.find('.modal-body .changeoption').attr('data-day');
// type = divbody.find('.modal-body .changeoption').attr('data-type'); this is below used
itinerary = divbody.find('.modal-body .changeoption').attr('data-itinerary');
tourtype = divbody.find('.modal-body .changeoption').attr('data-tourtype');
catid = divbody.find('.modal-body .changeoption').attr('data-catid');
price = divbody.find('.modal-body .changeoption:checked').attr('data-price'); // get the checked radio value
modaltype = divbody.find('.modal-body #modaltype_' + packageid).val();
update_recent_session_price(packageid);
old_price = $('.updated_pkgprice_' + packageid).val();
// update price on UI
// update_price(old_price, price, packageid);
type = modaltype.toLowerCase(); // get the type
// console.log(type);
// update Options on UI | last param [group rate = yes]
update_ui(type, packageid, daynumber, itinerary, itemid, 'add', '');
// update Checkbox UI
update_ui_checkbox(type, packageid, daynumber, itemid, 'add');
// update the session variables
update_session(type, packageid, tourtype, catid, itinerary, daynumber, itemid, price, 'add', 'yes', mp, countit);
close_modal('myModalActSS'); // pass id of madal to close
}
// add activity / sightseeing / services | all multi items
function remove_options_from_package(that, packageid, itemid, daynumber, itinerary, tourtype, catid, price, type, myaction) {
// start : ask for confirmation
if (!askforconfirmation()) {
return false;
}
// end : ask for confirmation
var os_price, price, old_price, divbody, modaltype, priceResponse;
var mp = '';
var countit = '';
// update the session variables
priceResponse = update_session(type, packageid, tourtype, catid, itinerary, daynumber, itemid, price, myaction, '', mp, countit); // get filtered accurate price here
//console.log(priceResponse.responseJSON);
price = (priceResponse.responseJSON).price;
if (myaction === 'remove') {
// price = '-'+(price=='') ? 0 : price;
price = '-' + price;
}
// update_recent_session_price ( packageid );
old_price = $('#updated_pkgprice_' + packageid).val();
// update price on UI
update_price(old_price, price, packageid);
// update Options on UI
update_ui(type, packageid, daynumber, itinerary, itemid, 'remove', '');
// update Checkbox UI
update_ui_checkbox(type, packageid, daynumber, itemid, 'remove');
}
// add activity / sightseeing / services | all multi items
function add_services_into_package(that) {
// start : ask for confirmation
if (!askforconfirmation()) {
return false;
}
// end : ask for confirmation
var packageid, divbody, modaltype, itemid, daynumber, type, itinerary, tourtype, catid, priceResponse;
var os_price, price, old_price, priceTotal = 0;
var mp = '';
var countit = '';
divbody = $(that).closest('.modal-content');
var ids = ''; // get all check ids array
divbody.find('.modal-body input[name="otherservices"]:checked').each(function (index) {
price = $(this).attr('data-price'); // get itinerary price
priceTotal = parseInt(priceTotal) + parseInt(price);
ids += ((index == 0) ? '' : ',') + $(this).val();
});
// checked items
tourtype = divbody.find('.modal-body .otherservices').attr('data-tourtype');
catid = divbody.find('.modal-body .otherservices').attr('data-catid');
packageid = divbody.find('.modal-body #modaltype_pkgid').val();
modaltype = divbody.find('.modal-body #modaltype_' + packageid).val();
type = modaltype.toLowerCase(); // get the type
// console.log(packageid);
itemid = ids; // get multi ids
price = priceTotal; // get total price
old_price = $('.updated_pkgprice_' + packageid).val();
// console.log('add service ' + old_price + ' || ');
update_recent_session_price(packageid);
// update the session variables
priceResponse = update_session(type, packageid, tourtype, catid, itinerary, daynumber, itemid, price, 'add', '', mp, countit); // get filtered accurate price here
price = (priceResponse.responseJSON).price;
// console.log(price);
// update price on UI
update_price(old_price, price, packageid);
close_modal('myModalAddServices'); // pass id of madal to close
}
function change_options(that, uitype) {
// start : ask for confirmation
if (!askforconfirmation()) {
return false;
}
// end : ask for confirmation
var packageid, os_price, price, old_price, divbody, itemid,pricetype, daynumber, type, itinerary, tourtype, catid, group, mp, roomtype, myaction, itemidnew, pricenew, myactionnew,pricetypenew;
var RunInclude = $('#isincluded').val();
if (uitype == 'T') {
divbody = $(that).closest(".activity-window-wrap");
mp = $('.selectedhotelMealPlan').val();
roomtype = $('.selectedhotelMealPlan').val();
packageid = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-packageid');
daynumber = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-day');
type = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-type');
itinerary = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-itinerary');
tourtype = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-tourtype');
catid = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-catid');
group = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-group');
countit = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-countit');
MasterIntSysId = divbody.find('.viewDetailsWrapper .changeoptionRoom').attr('data-MasterIntSysId');
itemidsint = $('#ITMPKGID').val();
} else {
divbody = $(that).closest('.activity-window-wrap');
packageid = divbody.find('.modal-body .changeoption').attr('data-packageid');
daynumber = divbody.find('.modal-body .changeoption').attr('data-day');
type = divbody.find('.modal-body .changeoption').attr('data-type');
itinerary = divbody.find('.modal-body .changeoption').attr('data-itinerary');
tourtype = divbody.find('.modal-body .changeoption').attr('data-tourtype');
catid = divbody.find('.modal-body .changeoption').attr('data-catid');
group = divbody.find('.modal-body .changeoption').attr('data-group');
mp = divbody.find('.modal-body .changeoption').attr('data-mp');
roomtype = divbody.find('.modal-body .changeoption').attr('data-roomtype');
countit = divbody.find('.modal-body .changeoption').attr('data-countit');
itemidsint = divbody.find('.modal-body .changeoption').attr('data-itemid');
MasterIntSysId = divbody.find('.modal-body .changeoption').attr('data-MasterIntSysId');
}
if ((RunInclude == 'Selected') && (type == 'h' || type == 'R')) {
var activityWindow = $('#activity-window');
$(activityWindow).removeClass('window-show');
$('body').removeClass('body-fixed');
$('.activity-window-root').removeClass('bg-activity-window');
$('#hotel-window, #flight-window, #travel-window, .roomview').css('display', 'none');
return false;
} else {
totalprice = $('.pop_pkgprice_updated').html();
$('.update_totalPrice').html(totalprice);
destinationId = $('#destination_Id').val();
gtxID = $("#gtxID").val();
myaction = $('.transferaction').val();
// alert(myaction);
if (type == 'car' && (myaction != '')) {
RouteSysId = $('.transferRoute').val();
price = $('.selectedtransferPrice').val(); // get the checked radio value
itemid = $('.selectedtransferfixTransSysId').val(); // checked item
$.ajax({
type: "POST",
url: baseUrl + "detail/index/get-transfer-detail-onclick",
async: true,
data: "gtxid=" + gtxID + "&RouteSysId=" + RouteSysId + "&RouteVechSysId=" + itemid + "&day=" + daynumber + "&packageId=" + packageid + "&itinerary=" + itinerary + "&categoryid=" + catid + "&tourtype=" + tourtype + "&countit=" + countit + "&group=" + group + "&type=" + type + "&myaction=" + myaction,
success: function (data) {
$("#transferDetailViewonclick").html(data);
return false;
}
});
} else if (type == 'h' || type == 'R') {
price = $('.selectedhotelPrice').val(); // get the checked radio value
itemid = $('.selectedhotelRefHotelId').val(); // checked item
mp = $('.selectedhotelMealPlan').val();
roomtype = $('.selectedhotelRoomTypeId').val();
myaction = $('#hotelaction').val();
// alert(itemidsint);
var suppliersysid = $('.selectedhotelSupplierSysId_' + itemid).val();
$.ajax({
type: "POST",
url: baseUrl + "detail/index/get-hotel-detail-onclick",
async: true,
data: "gtxid=" + gtxID + "&hotelId=" + itemid + "&day=" + daynumber + "&packageId=" + packageid + "&itinerary=" + itinerary + "&categoryid=" + catid + "&MasterIntSysId=" + MasterIntSysId + "&tourtype=" + tourtype + "&group=" + group + "&countit=" + countit + "&destinationId=" + destinationId + "&itemid=" + itemidsint + "&type=h&mp=" + mp + "&roomtype=" + roomtype,
success: function (data) {
$(".hotelDetailViewonclick_" + itemidsint).html(data);
$(".changeroom_" + itemidsint).each(function(i){
if(i == 0){
$(this).addClass('showw').removeClass('hidee');
}else {
$(this).addClass('hidee').removeClass('showw');
}
});
$(".hotelImg_" + itemidsint).each(function(i){
if(i == 0){
$(this).addClass('showw').removeClass('hidee');
}else {
$(this).addClass('hidee').removeClass('showw');
}
});
$(".hotelDetails_" + itemidsint).each(function(i){
if(i == 0){
$(this).addClass('showw').removeClass('hidee');
}else {
$(this).addClass('hidee').removeClass('showw');
}
});
return false;
}
});
} else if (type == 's') {
price = $('.selectedsightPrice').val(); // get the checked radio value
itemidnew = []; // checked item
pricenew = [];
myactionnew = [];
pricetypenew = [];
$('.removeoption').each(function (i, element) {
itemidnew.push($(this).val());
pricetypenew.push($(this).attr('price-type'));
pricenew.push($(this).attr('data-price'));
if ($(this).hasClass('showw')) {
myactionnew.push('add');
} else {
myactionnew.push('remove');
}
});
itemid = itemidnew.join('__');
pricetype = pricetypenew.join('__');
price = pricenew.join('__');
myaction = myactionnew.join('__');
}
// alert(myaction);
if (type === 'cc') {
redirect_to_newurl();
return;
}
if (myaction != '' || myaction != 'undefined') {
if (group === 'yes') {
update_recent_session_price(packageid);
old_price = $('#recent_pkgprice_' + packageid).val();
// update price on UI
// update_price(old_price, price, packageid , myaction);
// update Options on UI
update_ui(type, packageid, daynumber, itinerary, itemid, myaction, 'yes');
update_ui_hidden_value(type, packageid, daynumber, itinerary, itemid, myaction);
// update the session variables
update_session(type, packageid, tourtype, catid, itinerary, daynumber, itemid, price, myaction, 'yes', mp, daynumber, roomtype, countit);
}
else {
update_recent_session_price(packageid);
old_price = $('#recent_pkgprice_' + packageid).val();
// update price on UI
// update_price(old_price, price, packageid ,myaction);
// update Options on UI
update_ui(type, packageid, daynumber, itinerary, itemid, myaction, '');
update_ui_hidden_value(type, packageid, daynumber, itinerary, itemid);
// update the session variables
update_session(type, packageid, tourtype, catid, itinerary, daynumber, itemid, price, myaction, '', mp, countit);
}
}
var activityWindow = $('#activity-window');
$(activityWindow).removeClass('window-show');
$('body').removeClass('body-fixed');
$('.activity-window-root').removeClass('bg-activity-window');
$('#hotel-window, #flight-window, #travel-window, .roomview').css('display', 'none');
}
}
function change_hotel_category(that) {
var category = that.value;
var categoryTitle = that.title;
var tourtype = $(that).attr('data-tourtype');
$('#hotelcategory').val(category);
var mp = $('.mptype-' + that.value).val();
$('#mptype_pop').val((mp) ? mp : 0);
// console.log(rv.ratecard);
// console.log(categoryTitle);
// console.log(tourtype);
// console.log(mp);
// get category rate for dynamic package
var tourtypeChar = (tourtype == 1) ? 'P' : 'G'
var price = getRateCategoryPopUp(rv.ratecard, tourtypeChar, categoryTitle, mp);
// console.log(price);
$('.pop_pkgprice_updated').text(rvMoneyFormatINR(parseInt(price), 2, ''));
$('.div-mptype').hide();
$('#div-mptype-' + that.value).show();
}
function change_mealplan(that) {
var mpid = that.value;
var elem = $(that).closest('td');
var node = $(elem).find('input.changeoption');
var categoryTitle = $(node).attr('title');
var tourtype = $(node).attr('data-tourtype');
var tourtypeChar = (tourtype == 1) ? 'P' : 'G'
$('#mptype_pop').val(mpid);
// get category rate for dynamic package
var tourtypeChar = (tourtype == 1) ? 'P' : 'G'
var price = getRateCategoryPopUp(rv.ratecard, tourtypeChar, categoryTitle, mpid);
$('.pop_pkgprice_updated').text(rvMoneyFormatINR(parseInt(price), 2, ''));
}
function getRateCategoryPopUp(array, tourtype, category, mptype) {
var a = array[tourtype][category];
// console.log(a);
if (isNaN(mptype)) {
price = a.price[0].PricePerPerson;
}
else {
var b = a.mptype[mptype];
var price = b.price[0].PricePerPerson;
}
return parseInt(price);
}
function update_recent_session_price(packageid) {
var recent_pkgprice_ = $('.update_totalPrice').html();
// alert(recent_pkgprice_);
$('#updated_pkgprice_' + packageid).val(recent_pkgprice_);
}
function update_session(type, packageid, tourtype, catid, itinerary, daynumber, itemid, price, myaction, group, mp, daynumber, roomtype, countit) {
var org_price, pkgid;
pkgid = packageid;
RouteSysId = $('.transferRoute').val();
vehiclename = $('.VehName').val();
vehicletypename = $('.VehicleTypeName').val();
suppliersysid = $('.SupplierSysId').val();
vehiclesysid = $('.VehicleSysId').val();
vehicletypesysid = $('.VehicleTypeSysId').val();
capacity = $('.Capacity').val();
pickup = $('.PickUPLocation').val();
droplocation = $('.DropLocation').val();
quantity = $('.quantity').val();
gtxID = $("#gtxID").val();
TransportSubType = $('.TransportSubType').val();
SubCategory = $('.SubCategory').val();
// alert(gtxID);
var selectedHotelName_ = $('.selectedHotelName_' + itemid).val();
var selectedhotelSupplierSysId_ = $('.selectedhotelSupplierSysId_' + itemid).val();
var carsuppliersysid = suppliersysid;
return $.ajax({
url: SITEURL + 'detail/index/write-session',
type: 'POST',
async: false,
data: {
type: type, gtxID: gtxID, pkgid: pkgid, tourtype: tourtype, catid: catid, itinerary: itinerary, itemid: itemid, price: price, myaction: myaction, group: group, mp: mp, roomtype: roomtype, daynumber: daynumber, countit: countit, SupplierSysId: selectedhotelSupplierSysId_, HotelName: selectedHotelName_, vehiclesysid: vehiclesysid,
vehicletypesysid: vehicletypesysid, RouteSysId: RouteSysId, vehiclesysid: vehiclesysid, vehicletypename: vehicletypename, pickup: pickup, droplocation: droplocation, capacity: capacity, vehiclename: vehiclename, carsuppliersysid: carsuppliersysid, quantity: quantity, TransportSubType: TransportSubType, SubCategory: SubCategory,
},
dataType: 'json',
success: function (result) {
if (result.status == 'success') {
return (result.price);
}
},
error: function (result) {
}
});
}
// update hidden values on UI
function update_ui_hidden_value(type, packageid, daynumber, itinerary, itemid, myaction) {
if (type === 'h') {
$('.itinerary_' + type + '_' + packageid + '_' + itinerary).val(itemid);
} else if (type === 'car') {
if (myaction != 'remove') {
$('.itinerary_car_' + type + '_' + packageid + '_' + itinerary).val(itemid);
}
}
}
function filterHotelDataByStar(seq, destId, that) {
if ($(that).hasClass('staractive')) {
$(that).removeClass('staractive')
} else {
$(that).addClass('staractive')
}
var satrChecked = [];
$('.starRatingLi' + parseInt(seq)).each(function () {
if ($(this).hasClass('staractive') == true) {
satrChecked.push($(this).attr('value'));
}
})
if (satrChecked.length > 0 && $.inArray("0", satrChecked) == -1) {
$('.listingHotelDiv' + parseInt(seq)).each(function () {
var stars = $(this).attr('stars');
if ($.inArray(stars, satrChecked) == -1) {
$(this).hide();
} else {
$(this).show();
}
})
}else{
$('.listingHotelDiv' + parseInt(seq)).show();
}
}
function sortHotelDataByPrice(packageId, categoryId, day, countit, tourtype, itinerary) {
var sortbyprice = $('#priceFilterValue').val();
var destinationId = $('#destination_Id').val();
var gtxID = $("#gtxID").val();
// console.log(sortbyprice);
$.ajax({
type: "GET",
url: baseUrl + "detail/index/change-options/gtxID/" + gtxID + "/packageid/" + packageId + "/type/h/categoryid/" + categoryId + "/day/" + day + "/countit/" + countit + "/tourtype/" + tourtype + "/destinationId/" + destinationId + "/itinerary/" + itinerary + "/sortbyprice/" + sortbyprice,
async: true,
dataType: 'html',
data: '',
beforeSend: function () {
},
success: function (data) {
// alert('jhdhgh');
$(".modal-body").html(data);
return false;
}
});
}
// update UI only
function update_ui(type, packageid, daynumber, itinerary, itemid, action, group) {
var itempkg = $('#ITMPKGID').val();
if (group === 'yes') {
if (type === 'h' || type === 'car') {
if (action === 'remove') {
if (type == 's' || type == 'car') {
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).removeClass('showw').addClass('hidee');
if(type == 'h'){
$('#' + type + '_activity_window_' + daynumber).removeClass('hidee').addClass('showw');
}
// $('#' + type + '_activity_window_' + daynumber).removeClass('hidee').addClass('showw');
} else {
// $('.' + type + '_option_' + packageid + '_' + daynumber).addClass('hidee').removeClass('showw');
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).removeClass('showw').addClass('hidee');
$('#' + type + '_optionaddremove_' + packageid + '_' + daynumber).removeClass('hidee').addClass('showw');
}
} else if (action === 'add') {
if (type == 's' || type == 'car') {
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).removeClass('hidee').addClass('showw');
$('#' + type + '_changebtn_' + packageid + '_' + daynumber + '_' + itemid).removeClass('hidee').addClass('showw');
$('#' + type + '_activity_window_' + daynumber).removeClass('showw').addClass('hidee');
} else {
// alert(itempkg);
$('.changetxt_' + itempkg).text('Change');
$('.changetui_' + itempkg).removeClass('showw').addClass('hidee');
// $('.' + type + '_option_' + packageid + '_' + daynumber).addClass('hidee').removeClass('showw');
// $('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).removeClass('hidee').addClass('showw');
// // for changing the related itinerary
// $('.' + 'group_' + itinerary).addClass('hidee').removeClass('showw');
// $('.' + 'group_' + itinerary + '_' + itemid).addClass('showw').removeClass('hidee');
}
}
} else if (type === 's') {
var itemidS = itemid.split('__');
var actionS = action.split('__');
if (itemidS.length > 0) {
for (var i = 0; i < itemidS.length; i++) {
var itemid_ = itemidS[i];
// console.log(itemid_);
// console.log(actionS[i]);
if (actionS[i] === 'remove') {
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid_).removeClass('showw').addClass('hidee');
$('#' + type + '_activity_window_' + daynumber).removeClass('hidee').addClass('showw');
} else {
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid_).removeClass('hidee').addClass('showw');
$('#' + type + '_changebtn_' + packageid + '_' + daynumber + '_' + itemid_).removeClass('hidee').addClass('showw');
$('#' + type + '_activity_window_' + daynumber).removeClass('showw').addClass('hidee');
}
}
}
}
}
else {
if (type === 'h') {
$('.' + type + '_option_' + packageid + '_' + daynumber).addClass('hidee').removeClass('showw');
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).removeClass('hidee').addClass('showw');
}
else if (type === 'a') {
if (action === 'remove') {
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).find('.add-button').show();
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).find('.remove-button').hide();
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).find('.INCLUDED-OPTIONAL').text('(OPTIONAL)');
} else {
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).find('.add-button').hide();
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).find('.remove-button').show();
$('#' + type + '_option_' + packageid + '_' + daynumber + '_' + itemid).find('.INCLUDED-OPTIONAL').text('(INCLUDED)');
}
}
}
}
// update UI only
function update_ui_checkbox(type, packageid, daynumber, itemid, action) {
$('#itinerary_' + type + '_' + packageid + '_' + daynumber + '_' + itemid).trigger('click');
}
// update price on UI
// function update_price(old_price, price, packageid , action) {
// var new_price;
// var priceS = price.split('__');
// var actionS = action.split('__');
// if(priceS.length > 0){
// for(var i = 0; i < priceS.length; i++){
// var price_ = priceS[i];
// // console.log(price_);
// // console.log(actionS[i]);
// if(actionS[i] === 'add'){
// new_price = parseInt(old_price) + parseInt(price);
// $('.updated_pkgprice_' + packageid).val(new_price);
// $('.pkgprice_html_' + packageid).text(rvMoneyFormatINR(new_price, 2, ''));
// }
// }
// }
// // alert(price);
// // alert(old_price);
// // alert(new_price);
// }
function askforconfirmation() {
// return true; // this is temporary only , need to remove this line
var isconfirm = confirm('Are you sure for this change in package?');
if (isconfirm === false)
return false;
else
return true;
}
function close_modal(modalid) {
$('#' + modalid).modal('hide');
}
function pick_itemprice(modalBody) {
return modalBody.find('#new_item_price').val();
}
function show_loader_price(classname) {
$('.' + classname).html('<img src="' + SITEURL + '/public/images/loader-sm.gif" width="20" />');
}
function remove_transfer_onclick(that, packageid, type, clicktype) {
var price, itemprice, _package_price = 0;
var itemprice = $(that).attr('data-price'); // get itinerary price
var packageid = $(that).attr('data-packageid'); // get itinerary price
var itemid = $(that).attr('value'); // get itinerary price
var tourtype = $(that).attr('data-tourtype');
var catid = $(that).attr('data-catid');
var itinerary = $(that).attr('data-itinerary');
var daynumber = $(that).attr('data-day');
var group = $(that).attr('data-group');
var myaction = "remove";
var mp = $(that).attr('data-mp');
var vehiclename = $(that).attr('data-vehiclename');
var vehicletypename = $(that).attr('data-vehicletypename');
var suppliersysid = $(that).attr('data-suppliersysid');
var vehiclesysid = $(that).attr('data-vehiclesysid');
var vehicletypesysid = $(that).attr('data-vehicletypesysid');
var capacity = $(that).attr('data-capacity');
var pickup = $(that).attr('data-pickup');
var droplocation = $(that).attr('data-droplocation');
var RouteSysId = $(that).attr('data-route');
var roomtype = $(that).attr('data-roomtype');
var quantity = $(that).attr('data-quantity');
var countit = '';
if (clicktype == "detail") {
$('.update_totalPrice').each(function (i, element) {
if (i == 0) {
_package_price = parseInt($(this).text().replace(',', ''));
}
});
} else {
$('.pop_pkgprice_updated').each(function (i, element) {
if (i == 0) {
_package_price = parseInt($(this).text().replace(',', ''));
}
});
}
price = parseInt(_package_price) - parseInt(itemprice);
if (!askforconfirmation()) {
return false;
}
$('.changeoption').html('select');
var selectedtraid = $(that).val();
$('.changeoption_' + selectedtraid).removeClass('hidee');
$('.changeoption_' + selectedtraid).addClass('showw');
$(that).closest('.window-item-box').removeClass('selected');
$(that).closest('.removeoption').removeClass('showw');
$(that).closest('.removeoption').addClass('hidee');
if (type == 'car') {
$(that).closest('.changeoption_' + selectedtraid).removeClass('hidee').addClass('showw');
}
$('.pop_pkgprice_updated').text(price);
$('.update_totalPrice').text(price);
$('.selected-badge').removeClass('showw');
$('.selected-badge').addClass('hidee');
$('.selected-badge_' + selectedtraid).removeClass('showw');
$('.selected-badge_' + selectedtraid).addClass('hidee');
$('.selectedtransferfixTransSysId').val(itemid);
$('.selectedtransferPrice').val(itemprice);
$('.transferaction').val('remove');
if (clicktype == "detail") {
// change_options(that);
$('.update_totalPrice').each(function (i, element) {
if (i == 0) {
_package_price = parseInt($(this).text().replace(',', ''));
}
});
// }
// alert(itemprice);
price = parseInt(_package_price) - parseInt(itemprice);
if (type == 'car') {
price = $('.selectedtransferPrice').val(); // get the checked radio value
itemid = $('.selectedtransferfixTransSysId').val(); // checked item
} else if (type == 's') {
price = parseInt(_package_price) - parseInt(itemprice);
var itemid = $(that).attr('value');
}
else {
price = $('.selectedhotelPrice').val(); // get the checked radio value
itemid = $('.selectedhotelRefHotelId').val(); // checked item
mp = $('.selectedhotelMealPlan').val();
roomtype = $('.selectedhotelRoomTypeId').val();
}
// alert(packageid); return;
var itemid = $(that).attr('value'); // get itinerary price
if (group === 'yes') {
update_recent_session_price(packageid);
old_price = $('.recent_pkgprice_').html();
// update price on UI
// alert(old_price);
// update_price(old_price, itemprice, packageid, myaction);
// alert($(that).attr('value'));
// update Options on UI
update_ui(type, packageid, daynumber, itinerary, itemid, myaction, 'yes');
update_ui_hidden_value(type, packageid, daynumber, itinerary, itemid, myaction);
// update the session variables
update_session(type, packageid, tourtype, catid, itinerary, daynumber, itemid, price, myaction, 'yes', mp, daynumber, roomtype, countit);
}
}
}
function update_price_onclick(that, packageid, type) {
isincluded = $(that).attr('data-include');
// alert(isincluded);
if (isincluded == 'Selected') {
// alert(isincluded);
$('#isincluded').val(isincluded);
return false;
} else {
$('#isincluded').val(isincluded);
var price, itemprice, _package_price, priceincluded = 0;
var itemprice = $(that).attr('data-price'); // get itinerary price
var packageid = $(that).attr('data-packageid'); // get itinerary price
var itemid = $(that).attr('value'); // get itinerary price
var mealplan = $(that).attr('data-mp');
var roomtype = $(that).attr('data-roomtype');
var RouteSysId = $(that).attr('data-route');
var vehiclename = $(that).attr('data-vehiclename');
var vehicletypename = $(that).attr('data-vehicletypename');
var suppliersysid = $(that).attr('data-suppliersysid');
var vehiclesysid = $(that).attr('data-vehiclesysid');
var vehicletypesysid = $(that).attr('data-vehicletypesysid');
var capacity = $(that).attr('data-capacity');
var quantity = $(that).attr('data-quantity');
// alert(totaltravelers);
if (type === 'services') {
$('.pop_pkgprice_updated').each(function (i, element) {
if (i == 0) {
_package_price = parseInt($(this).text().replace(',', ''));
}
});
if ($(that).is(':selected')) {
price = parseInt(_package_price) + parseInt(itemprice);
}
else {
price = parseInt(_package_price) - parseInt(itemprice);
}
}
else if ((type === 'car') || (type === 'h') || (type === 'R')) {
// alert(_package_price);
$('.pop_pkgprice_').each(function (i, element) {
if (i == 0) {
_package_price = parseInt($(this).text().replace(',', ''));
}
});
price = parseInt(_package_price) + parseInt(itemprice);
var selectedhotelid = $(that).val();
if (type === 'h') {
$('.changeoption').html('select');
$('.window-item-box').removeClass('selected');
$('.selected-badge').addClass('hidee');
} else if (type === 'R') {
$('.changeoptionRoom').html('select');
$('.changeoptionRoom_' + mealplan + '_' + roomtype).html('selected');
} else if (type == 'car') {
$('.window-item-box').removeClass('selected');
$('.selected-badge').addClass('hidee');
$('.changeoption').removeClass('hidee').addClass('showw');
$('.removeoption').removeClass('showw').addClass('hidee');
$('.changeoption_' + selectedhotelid).removeClass('showw').addClass('hidee');
$('.removeoption_' + selectedhotelid).removeClass('hidee').addClass('showw');
} else {
$('.changeoption_' + selectedhotelid).removeClass('showw').addClass('hidee');
$('.removeoption_' + selectedhotelid).removeClass('hidee').addClass('showw');
}
if (type != 'R') {
$('.changeoption_' + selectedhotelid).html('selected');
$(that).closest('.window-item-box').addClass('selected');
$('.selected-badge').removeClass('showw');
$('.selected-badge_' + selectedhotelid).removeClass('hidee');
$('.selected-badge_' + selectedhotelid).addClass('showw');
}
} else if (type === 's') {
$('.pop_pkgprice_updated').each(function (i, element) {
if (i == 0) {
_package_price = parseInt($(this).text().replace(',', ''));
}
});
// alert(_package_price);
price = parseInt(_package_price) + parseInt(itemprice);
var selectedhotelid = $(that).val();
$('.changeoption_' + selectedhotelid).removeClass('showw').addClass('hidee');
$('.removeoption_' + selectedhotelid).removeClass('hidee').addClass('showw');
$(that).closest('.window-item-box').addClass('selected');
$('.selected-badge').removeClass('showw');
$('.selected-badge_' + selectedhotelid).removeClass('hidee');
$('.selected-badge_' + selectedhotelid).addClass('showw');
}
if (type == 'car') {
$('.selectedtransferfixTransSysId').val(itemid);
$('.selectedtransferPrice').val(itemprice);
$('.transferRoute').val(RouteSysId);
$('.VehName').val(vehiclename);
$('.VehicleTypeName').val(vehicletypename);
$('.SupplierSysId').val(suppliersysid);
$('.VehicleSysId').val(vehiclesysid);
$('.VehicleTypeSysId').val(vehicletypesysid);
$('.Capacity').val(capacity);
$('.quantity').val(quantity);
} else if ((type === 'h')) {
var hotelpri = $('.PriceInclude_' + itemid + '_' + roomtype + '_' + mealplan).html();
$('.PriceInclude').each(function () {
var priceincluded = $(this).html();
if (priceincluded == "Included") {
$('.PriceInclude').html('<span class="WebRupee">Rs</span> 0');
} else if (hotelpri == '<span class="PriceInclude"><span class="WebRupee">Rs</span> 0</span>') {
$('.PriceInclude_' + itemid + '_' + roomtype + '_' + mealplan).html('<span class="PriceInclude">Included</span>');
}
});
$('.selectedhotelRefHotelId').val(itemid);
$('.selectedhotelMealPlan').val(mealplan);
$('.selectedhotelRoomTypeId').val(roomtype);
$('.selectedhotelPrice').val(itemprice);
} else if ((type === 's')) {
$('.selectedsightId').val(itemid);
$('.selectedsightPrice').val(itemprice);
$('.update_totalPrice').html(rvMoneyFormatINR(parseInt(price), 2, ''));
} else if (type === 'R') {
var Roompri = $('.roomincluded_' + itemid + '_' + roomtype + '_' + mealplan).html();
$('.roomincluded').each(function () {
var roomincluded = $(this).html();
if (roomincluded == "Included") {
$('.roomincluded').html('<span class="WebRupee">Rs</span> -1');
} else if ($.trim(Roompri) == '<span class="roomincluded"><span class="WebRupee">Rs</span> -1</span>') {
$('.roomincluded_' + itemid + '_' + roomtype + '_' + mealplan).html('<span class="roomincluded">Included</span>');
}
});
$('.selectedhotelMealPlan').val(mealplan);
$('.selectedhotelRoomTypeId').val(roomtype);
$('.selectedhotelPrice').val(itemprice);
$('.selectedhotelRefHotelId').val(itemid);
}
$('.pop_pkgprice_updated').text(rvMoneyFormatINR(parseInt(price), 2, ''));
$('.transferaction').val('add');
}
}
function filterHotelListByName(id) {
var hotelName = $('#hotelName' + parseInt(id)).val().toLowerCase();
if (hotelName.length > 2) {
$('.listingHotelDiv' + parseInt(id)).hide();
$('.listingHotelDiv' + parseInt(id)).each(function () {
var hotelNameDiv = $(this).attr('hotelNameDiv');
if (hotelNameDiv.search(hotelName) != -1) {
$(this).show();
}
})
} else {
$('.listingHotelDiv' + parseInt(id)).show();
}
}
function filterTransferListByName(id) {
var transferName = $('#transferName' + parseInt(id)).val().toLowerCase();
// alert(transferName);
if (transferName.length > 2) {
$('.listingTransferDiv' + parseInt(id)).hide();
$('.listingTransferDiv' + parseInt(id)).each(function () {
var transferNameDiv = $(this).attr('TransferNameDiv');
if (transferNameDiv.search(transferName) != -1) {
$(this).show();
}
})
} else {
$('.listingTransferDiv' + parseInt(id)).show();
}
}
function filterSightSeeingListByName(id) {
var sightName = $('#sightName' + parseInt(id)).val().toLowerCase();
if (sightName.length > 2) {
$('.listingSightseeingDiv' + parseInt(id)).hide();
$('.listingSightseeingDiv' + parseInt(id)).each(function () {
var hotelSightseeingDiv = $(this).attr('sightNameDiv');
if (hotelSightseeingDiv.search(sightName) != -1) {
$(this).show();
}
})
} else {
$('.listingSightseeingDiv' + parseInt(id)).show();
}
}
function update_popup_price(type, packageid, itemprice) {
var _package_price = $('#updated_pkgprice_' + packageid).val();
var currency_type = $('#currency_type').text();
var _updated_pkg_dayval = $('#updated_pkg_dayval' + packageid).val();
var fromdate = $('.checkINDate').val();
var todate = $('.checkOUTDate').val();
var datefromto = [fromdate, todate].join(' to ');
// alert(currency_type);
$('.PopCurrencyType').text(currency_type);
$('.pop_pkgday_fromto').text(datefromto);
$('.pop_pkgprice_').text(_package_price);
if ((type === 'car') || (type === 's') || (type === 'h')) {
$('.pop_pkgprice_updated').text(_package_price);
}
else if ((type === 'services')) {
$('.pop_pkgprice_updated').text(rvMoneyFormatINR(parseInt(_package_price), 2, ''));
}
else if ((type === 'cc')) {
$('.pop_pkgprice_updated').text(rvMoneyFormatINR(parseInt(_package_price), 2, ''));
}
// else if ( (type === 'h')) {
// $('.pop_pkgprice_updated').text(parseInt(_package_price) + parseInt(itemprice));
// }
}
// this is just modal opener for hotel options available for any package
$(document).ready(function () {
// $(document).on('click' , '.modal-link' , function(e) {
// var modal = $('#myModalChangeOptions'), modalBody = $('#myModalChangeOptions .modal-body') , href , titleType;
// // var itinerary = $(this).attr('data-itinerary');
// titleType = $(this).attr('data-pop');
// href = $(this).attr('href');
// if(titleType === 'changecar') {
// modal.find('.modal-title').text('Available Options');
// modal.find('.addorchange').hide();
// }
// if(titleType === 'change-category') {
// modal.find('.modal-title').text('Available Category Options');
// modal.find('.addorchange').hide();
// }
// modal.modal('show');
// modalBody.html('<div style="text-align:center;padding-top:30px;"><img src="' + SITEURL + 'public/images/loader.gif"/></div>');
// modalBody.load(href);
// e.preventDefault();
// });
$(document).on('click', '.modal-link-act-ss', function (e) {
var modal = $('#myModalActSS'), modalBody = $('#myModalActSS .modal-body'), href, titleType;
href = $(this).attr('href');
titleType = $(this).attr('data-pop');
if (titleType === 'view') {
modal.find('.modal-title').text('Available Details');
modal.find('.addorchange').hide();
}
else {
modal.find('.modal-title').text('Available Options');
modal.find('.addorchange').show();
}
modal.modal('show');
modalBody.html('<div style="text-align:center;padding-top:30px;"><img src="' + SITEURL + 'public/images/loader.gif"/></div>');
modalBody.load(href);
show_loader_price('price-span');
e.preventDefault();
});
$(document).on('click', '.modal-link-add-services', function (e) {
var modal = $('#myModalAddServices'), modalBody = $('#myModalAddServices .modal-body'), href, titleType;
href = $(this).attr('href');
titleType = $(this).attr('data-pop');
if (titleType === 'view') {
modal.find('.modal-title').text('Available Details');
modal.find('.addorchange , .fa-pull-left').hide();
}
else {
modal.find('.modal-title').text('Available Options');
modal.find('.addorchange').show();
}
modal.modal('show');
modalBody.html('<div style="text-align:center;padding-top:30px;"><img src="' + SITEURL + 'public/images/loader.gif"/></div>');
modalBody.load(href);
show_loader_price('price-span');
e.preventDefault();
});
});
function rvMoneyFormatINR(n, prec, currSign) {
if (prec == null)
prec = 2;
var n = ('' + parseFloat(n).toFixed(prec).toString()).split('.');
var num = n[0];
var dec = n[1];
var r, s, t;
if (num.length > 3) {
s = num.length % 3;
if (s) {
t = num.substring(0, s);
num = t + num.substring(s).replace(/(\d{3})/g, ",$1");
} else {
num = num.substring(s).replace(/(\d{3})/g, ",$1").substring(1);
}
}
// return(currSign == null ? "" : currSign + "") + num + '.' + dec;
return (currSign == null ? "" : currSign + "") + num;
}
function countTotalValues(element_class) {
var totalNumber = 0;
$('.' + element_class).each(function (i, element) {
totalNumber += parseInt($(this).val());
});
return totalNumber;
}
function countTotalTravelers() {
var totalAdults = countTotalValues('traveler_adult');
var totalKids = countTotalValues('traveler_child');
var totalInfant = countTotalValues('traveler_infant');
return parseInt(totalAdults) + parseInt(totalKids) + parseInt(totalInfant);
}
function selectRoomModel(that, MealPlanTypeId, RoomTypeId, hotelId, included, type, uitype, gtxID, packageId, categoryId, day, selectedhoteltourtype, countit, itinerary, destinationId, itemid) {
//preventDefault();
var type = type;
var included = included;
if(uitype == 'popup'){
$('#hotel-window').css('display', 'none');
$('.roomview').css('display', 'block');
}
$.ajax({
type: "GET",
url: baseUrl + "detail/index/change-options/gtxID/" + gtxID + "/packageid/" + packageId + "/type/" + type + "/included/" + included + "/categoryid/" + categoryId + "/day/" + day + "/itemid/"+ itemid + "/countit/" + countit + "/tourtype/" + selectedhoteltourtype + "/destinationId/" + destinationId + "/MealPlanTypeId/" + MealPlanTypeId + "/RoomTypeId/" + RoomTypeId + "/itinerary/" + itinerary + "/hotelId/" + hotelId,
async: true,
dataType: 'html',
data: '',
beforeSend: function () {
},
success: function (data) {
$("#roomhtml").html(data);
return false;
}
});
}
$('#strTravdate').datepicker({
dateFormat: 'dd/mm/yy',
numberOfMonths: 2,
minDate: 0,
beforeShow: function (input, inst) {
var rect = input.getBoundingClientRect();
setTimeout(function () {
inst.dpDiv.css({
top: rect.top + 45,
left: rect.left + 0
});
}, 0);
}
});
$(document).on('click', '.modify-date-pkg', function (e) {
e.preventDefault();
$('#strTravdate').focus();
$('html, body').animate({ scrollTop: 0 }, '300')
});
$(document).on('submit', '.dyn-pkg-mdfy', function (e) {
subdata = $(".dyn-pkg-mdfy").serialize();
// console.log(subdata);
$.ajax({
url: SITEURL + 'detail/index/packagesearchdata',
type: 'POST',
async: false,
data: subdata,
dataType: 'json',
success: function (response) {
if (response.success == true) {
window.location.href = window.location.href;
}
},
error: function (result) {
}
});
});
function tottraveller2() {
var totaladult = '0';
var totalchild = '0';
var totalinfant = '0';
var child = '0';
var Group = $('.Group').is(":checked");
var roomlp = $("#roomlp").val();
//alert(roomlp-1);
if (Group === true) {
var adult_1 = $("#adult_1").val();
var child_1 = $("#child_1").val();
if (adult_1 === '') {
alert('Please enter total adults');
$("#adult_1").focus();
return false;
}
if (child_1 === '') {
alert('Please enter total children');
$("#child_1").focus();
return false;
}
}
var childrenbed = [];
for (j = 1; j <= roomlp; j++) {
totaladult = parseFloat(totaladult) + parseFloat($("#adult_" + j).val());
totalchild = parseFloat(totalchild) + parseFloat($("#child_" + j).val());
// totalinfant = parseFloat(totalinfant) + parseFloat($("#infant_" + j).val());
var extraBed = $('#extrabed_' + j + ':checked').val();
childrenbed.push(extraBed);
}
var totaltraveller = parseInt(totaladult) + parseInt(totalchild) + parseInt(totalinfant);
// alert(totaltraveller);
var MaxPax = parseInt(roomlp) * 4;
if (Group === false) {
if (totaltraveller > MaxPax) {
alert('Only 4 pax are allowed in each room. Please modify travelers');
return false;
}
}
// alert(totaladult);
$("#totadlt").val(totaladult);
$("#totchld").val(totalchild);
$("#totinfnt").val(totalchild);
$("#numberofroom").html(roomlp);
$("#roomguest").html(totaltraveller);
$("#totaltravelers").val(totaltraveller);
$(".roomBoxMain").hide();
var roominfojson = '[{"totalRoom" : ' + roomlp + '},{"totalTraveler" : ' + totaltraveller + '},{"totaladult" : ' + totaladult + '},{"totalchild" : ' + totalchild + '},{"totalinfant" : ' + totalinfant + '}]'
$("#roominfojson").val(roominfojson);
$(".roomBoxMain").hide();
}
function tottravelerInRoom(roomno) {
// alert(roomno);
var adult = $("#adult_" + roomno).val();
var child = $("#child_" + roomno).val();
var infant = $("#infant_" + roomno).val();
var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(infant);
var Group = $('.Group').is(":checked");
if (Group === false) {
if (totalPaxInRoom >= 5) {
alert('Only 4 pax are allowed in each room. Please modify travelers in Room no. ' + roomno);
return false;
}
}
}