| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2b.hellogtx.com/public/js/ng/ |
Upload File : |
//app.directive("scroll", function ($window) {
// return function(scope, element, attrs) {
// angular.element($window).bind("scroll", function() {
// console.log(this.pageYOffset);
// console.log(this.pageYOffset % 3000);
// if (this.pageYOffset % 3000 == 0) {
// element.addClass('min');
// $('#show_button_package').click();
// setTimeout(function(){
// $(".verticalTab").each(function() {
// var pkg = $(this).attr('pkg');
// $('#verticalTab'+parseInt(pkg)).easyResponsiveTabs({
// type: 'vertical',
// width: 'auto',
// fit: true
// });
// $("#calendar"+parseInt(pkg)).asDatepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true });
// $("#customizeTravelDate"+parseInt(pkg)).asDatepicker({ outputFormat: 'dd/mm/yyyy',onceClick: true });
// $("#EnquireTravelDate"+parseInt(pkg)).asDatepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true});
// $(".travelerbox"+parseInt(pkg)).click(function(){
// $(".roomBoxMain"+parseInt(pkg)).toggle();
// });
// $(".travelerboxCustom"+parseInt(pkg)).click(function(){
// $(".roomBoxMainCustom"+parseInt(pkg)).toggle();
// });
// $(".travelerboxEnquire"+parseInt(pkg)).click(function(){
// $(".roomBoxMainEnquire"+parseInt(pkg)).toggle();
// });
//
// $('.inclusionHtml_'+parseInt(pkg)).html($('#inclusion_'+parseInt(pkg)).val());
// $('.exclusionHtml_'+parseInt(pkg)).html($('#exclusion_'+parseInt(pkg)).val());
// });}, 1000);
// }
// });
// };
//});
window.onscroll = function() {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 200) {
$scope.$apply(function() {
$scope.loadMoreData();
});
}
};
app.controller("PackageListingController", ["$scope", "$location", "$http", '$filter', 'rvServices', '$timeout', function ($scope, $location, $http, $filter, rvServices, $timeout) {
// alert("test");
$scope.loading = false;
$scope.currentPage = 1;
$scope.outerforloop = {};
$scope.outerforloop.Price = [];
$scope.outerforloop.CommissionValueFg = [];
$scope.outerforloop.PriceDiscounted = [];
$scope.hotelType = false;
$scope.packageCategoryTypeLimit = 2;
$scope.limitToResult = 0;
$scope.totalResult = 0;
$scope.mydevice = dvc;
$scope.tempPriceArray = [];
$scope.resultset = [];
$scope.resultset = resultsetFull = [];
var $fullUrl, $fullUrlTemp, $url, $urlparams;
$scope.getUrlParameter2 = function (sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
$scope.loadMoreData = function() {
if ($scope.loading) {
return; // Don't load if a request is already in progress
}
$scope.loading = true;
var Keydes = '';
var Keydes = ($scope.getUrlParameter2('des')) ? $scope.getUrlParameter2('des') : '';
var Keycat = ($scope.getUrlParameter2('cat')) ? $scope.getUrlParameter2('cat') : '';
var myKeydes = myKeyCat = myKeyCatUpper = '';
var destinationm = Keydes.split("-");
for (var m = 0; m < destinationm.length; m++) {
myKeydes += destinationm[m] + ' ';
}
var destinationmCat = Keycat.split("-");
for (var m1 = 0; m1 < destinationmCat.length; m1++) {
myKeyCat += destinationmCat[m1] + ' ';
myKeyCatUpper += destinationmCat[m1].charAt(0).toUpperCase() + destinationmCat[m1].slice(1) + ' ';
}
if (dvc == 'm')
$scope.packageInclusionLimit = 1;
else
$scope.packageInclusionLimit = 3;
$scope.filterCat, $scope.filterDest, $scope.filterNight, $scope.filterPrice, $scope.tempArr,$scope.filterMonth = [];
// $http({method: 'GET', url: conf.SITEURL + 'public/data/dynamic/tours_package.json?'+Math.random() , headers: {'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET ', 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With', }, /*cache: true*/}).then(function successCallback(response) {
$http({ method: 'GET',
url: conf.SITEURL + 'holidays/search-result/getsearchdata?key=' + Keydes + '&cat=' + myKeyCat + '&page='+$scope.currentPage,
headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET ', 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With', }, /*cache: true*/ }).then(function successCallback(response) {
var des = (myKeydes) ? myKeydes.trim() : '';
var noofday = ($scope.getUrlParameter('noofday')) ? $scope.getUrlParameter('noofday') : '';
var pricerange = ($scope.getUrlParameter('pricerange')) ? $scope.getUrlParameter('pricerange') : '';
var category = (myKeyCatUpper) ? myKeyCatUpper.trim() : '';
if (des === 'fix' || des === 'pvt') {
des = '';
}
$scope.loading = false;
//alert(category)
//alert(des.split('+').join(' '));
$scope.resultset = $scope.resultsetFull = $scope.resultset.concat($scope.searchInResponse(response.data.rows, des.split('+').join(' '), noofday, pricerange, category)); // get rows here
//$scope.data = $scope.data.concat(response.data);
$scope.filterCat = response.data.filterCat; // filter array
$scope.filterMonth = response.data.filterMonth; // filter array
$scope.filterDest = response.data.filterDest; // filter array
$scope.filterNight = response.data.filterNight; // filter array
$scope.filterPrice = response.data.filterPrice; // filter array
$scope.currentPage++;
console.log($scope.filterPrice);
$scope.totalResult = response.data.total_count;
}, function errorCallback(response) {
}).finally(function () {
$scope.hotelType = 'Standard';
$scope.orderby = 'DisplayIndex';
$scope.orderval = true;
$scope.limitToResult = $scope.resultset.length;
$scope.filterNight = $scope.searchInResponseForFilter($scope.resultset, $scope.filterNight, 'Nights').sort(rvServices.sortNumber);
$scope.filterCat = $scope.searchInResponseForFilter($scope.resultset, $scope.filterCat, 'Category');
$scope.filterDest = $scope.searchInResponseForFilter($scope.resultset, $scope.filterDest, 'Destination');
});
}
$scope.loadMoreData();
window.onscroll = function() {
// Check if the user has scrolled to the bottom of the document
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 200 && $scope.totalResult > $scope.limitToResult) {
$scope.$apply(function() {
$scope.loadMoreData();
});
}
};
$scope.getUrlParameter = function (sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
$scope.searchInResponseForFilter = function (data, filterValues, type) {
var finaldata = [];
var innerkey = '';
if (type == 'Nights') {
innerkey = 'Duration';
$.each(data, function (index, element) {
if ($.inArray(element[innerkey], filterValues) != -1) {
// push data in final array if already not exists
if (($.inArray(element[innerkey], finaldata)) == -1) {
finaldata.push(element[innerkey]);
}
}
});
return finaldata;
}
else if (type == 'Category') {
innerkey = 'PackageTypeArr';
$.each(data, function (index, element) {
$.each(element[innerkey], function (i, ele) {
if ($.inArray(ele, filterValues) != -1) {
// push data in final array if already not exists
if (($.inArray(ele, finaldata)) == -1) {
finaldata.push(ele);
}
}
});
});
return finaldata;
}
else if (type == 'Destination') {
innerkey = 'Destinations';
$.each(data, function (index, element) {
// console.log(element[innerkey]);
var desti = element[innerkey];
// desti.split(',');
// console.log(desti.split(','));
$.each(desti.split(','), function (i, ele) {
if ($.inArray(ele, filterValues) != -1) {
// push data in final array if already not exists
if (($.inArray(ele, finaldata)) == -1) {
finaldata.push(ele);
}
}
});
});
return finaldata;
}
else if (type == 'Price') {
innerkey = 'PriceRange';
$.each(data, function (index, element) {
if ($.inArray(element[innerkey], filterValues) != -1) {
// push data in final array if already not exists
if (($.inArray(element[innerkey], finaldata)) == -1) {
finaldata.push(element[innerkey]);
}
}
});
return finaldata;
}
else {
return data;
}
};
$scope.searchInResponse = function (data, destination, noofnights, pricerange, category) {
var data1 = [];
var data2 = [];
var data3 = [];
var data4 = [];
var finaldata = [];
var filteredArray = [];
if ((destination == '') && (noofnights == '') && (pricerange == '') && (category == '')) {
return data;
}
if (destination !== '') {
$.each(data, function (index, element) {
if ($scope.checkSubstrInString(destination, element.Destinations) || $scope.checkSubstrInString(destination, element.Countries)) {
data1.push(element);
}
});
filteredArray = data1;
} else {
filteredArray = data;
}
var filteredArray1 = [];
if (parseInt(noofnights) > 0) {
$.each(filteredArray, function (index, element) {
if (element.Duration == noofnights) {
data2.push(element);
}
});
filteredArray1 = data2;
}
else {
filteredArray1 = filteredArray;
}
var filteredArray2 = [];
if ((pricerange !== '') && (pricerange.toLowerCase() !== 'all')) {
$.each(filteredArray1, function (index, element) {
if (element.PriceRange == pricerange) {
data3.push(element);
}
});
filteredArray2 = data3;
} else {
filteredArray2 = filteredArray1;
}
var filteredArray3 = [];
if ((category !== '')) {
$.each(filteredArray2, function (index, element) {
if ($.inArray(category, element.PackageTypeArr) != -1) {
data4.push(element);
}
});
filteredArray3 = data4;
} else {
filteredArray3 = filteredArray2;
}
return filteredArray3;
};
$scope.applyFilterBoxSize = function (type, tag, lengthh, $index) {
//console.log(lengthh);
if (lengthh > 5) {
if (lengthh - 1 == $index) {
var $selector = angular.element('.box-filter-' + type + ' .filterbox-' + tag);
$selector.css({ 'height': '180px', 'overflow': 'hidden', 'position': 'relative' });
$selector.append('<a href="javascript:void(0);" style="position: absolute; bottom: 5px; right: 8px;" class="iamplusminus" title="More..."><i class="fa fa-plus"></i></a>');
}
}
};
// start : code for filter data
// function is used for filtering package result data
$scope.filterData = function () {
// $scope.showLoader('result_area'); // show loader
// declare the variable here
var filterSTR = { 'night': [], 'cat': [], 'desti': [], 'price': [],'month':[] };
angular.element('.box-filter input:checkbox').each(function () {
if ($(this).is(":checked")) {
if ($(this).hasClass('filter-nn')) {
filterSTR.night.push($(this).val());
}
else if ($(this).hasClass('filter-cat')) {
filterSTR.cat.push($(this).val());
}
else if ($(this).hasClass('filter-destination')) {
filterSTR.desti.push($(this).val());
}
else if ($(this).hasClass('filter-price')) {
filterSTR.price.push($(this).val());
}
else if ($(this).hasClass('filter-month')) {
filterSTR.month.push($(this).val());
}
}
});
// if filter has any value
if ((filterSTR.night.length > 0) || (filterSTR.cat.length > 0) || (filterSTR.desti.length > 0) || (filterSTR.price.length > 0) || (filterSTR.month.length > 0)) {
$scope.resultset = this.filterFromArray($scope.resultsetFull, filterSTR);
}
else {
$scope.resultset = $scope.resultsetFull;
console.log('start');
setTimeout(function () {
$(".verticalTab").each(function () {
var pkg = $(this).attr('pkg');
console.log(pkg);
$('#verticalTab' + parseInt(pkg)).easyResponsiveTabs({
type: 'vertical',
width: 'auto',
fit: true
});
var IsFixedDeparturePackage = $('#IsFixedDeparturePackage_'+ parseInt(pkg)).val();
if(IsFixedDeparturePackage == 0){
$("#calendar" + parseInt(pkg)).datepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true });
$("#customizeTravelDate" + parseInt(pkg)).datepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true });
$("#EnquireTravelDate" + parseInt(pkg)).datepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true });
}
$(".travelerbox" + parseInt(pkg)).click(function () {
$(".roomBoxMain" + parseInt(pkg)).toggle();
});
$(".travelerboxCustom" + parseInt(pkg)).click(function () {
$(".roomBoxMainCustom" + parseInt(pkg)).toggle();
});
$(".travelerboxEnquire" + parseInt(pkg)).click(function () {
$(".roomBoxMainEnquire" + parseInt(pkg)).toggle();
});
$('.inclusionHtml_' + parseInt(pkg)).html($('#inclusion_' + parseInt(pkg)).val());
$('.exclusionHtml_' + parseInt(pkg)).html($('#exclusion_' + parseInt(pkg)).val());
});
}, 1000);
}
//console.log($scope.resultset);
// $scope.hideLoader('result_area'); // hide loader
};
$scope.applyDurationFilter = function (data, nightArr) {
// number of nights
var resultsetFiltered = [];
if (nightArr.length == 0) {
return data;
}
$.each(data, function (index, element) {
if (nightArr.length > 0) {
$.each(nightArr, function (indexinn, elementinn) {
if (elementinn == element.Duration) {
if ($scope.checkAlreadyExistsInArray(element.PkgSysId, resultsetFiltered, 'PkgSysId') == false) {
resultsetFiltered.push(element);
}
}
});
}
});
return resultsetFiltered;
};
$scope.applyCategoryFilter = function (data, catArr) {
// filter by category
var resultsetFiltered = [];
if (catArr.length == 0) {
return data;
}
$.each(data, function (index, element) {
if (catArr.length > 0) {
$.each(catArr, function (indexinn, elementinn) {
if ($.inArray(elementinn, element.PackageTypeArr) != -1) {
// push into array if not exists
if ($scope.checkAlreadyExistsInArray(element.PkgSysId, resultsetFiltered, 'PkgSysId') == false) {
resultsetFiltered.push(element);
} else {
//resultsetFiltered.slice(element , 1);
}
}
});
}
});
return resultsetFiltered;
};
$scope.applyMonthFilter = function (data, monthArr) {
// filter by category
var resultsetFiltered = [];
if (monthArr.length == 0) {
return data;
}
$.each(data, function (index, element) {
if (monthArr.length > 0) {
$.each(monthArr, function (indexinn, elementinn) {
if ($.inArray(elementinn, element.getMonthsArray) != -1) {
// push into array if not exists
if ($scope.checkAlreadyExistsInArray(element.PkgSysId, resultsetFiltered, 'PkgSysId') == false) {
resultsetFiltered.push(element);
} else {
//resultsetFiltered.slice(element , 1);
}
}
});
}
});
return resultsetFiltered;
};
$scope.applyDestinationFilter = function (data, DestiArr) {
// filter by category
var resultsetFiltered = [];
if (DestiArr.length == 0) {
return data;
}
$.each(data, function (index, element) {
if (DestiArr.length > 0) {
$.each(DestiArr, function (indexinn, elementinn) {
if ($scope.checkSubstrInString(elementinn, element.Destinations)) {
resultsetFiltered.push(element);
}
});
}
});
return resultsetFiltered;
};
$scope.applyPriceRangeFilter = function (data, priceArr) {
// number of nights
var resultsetFiltered = [];
if (priceArr.length == 0) {
return data;
}
$.each(data, function (index, element) {
if (priceArr.length > 0) {
$.each(priceArr, function (indexinn, elementinn) {
if (elementinn == element.PriceRange) {
if ($scope.checkAlreadyExistsInArray(element.PkgSysId, resultsetFiltered, 'PkgSysId') == false) {
resultsetFiltered.push(element);
}
}
});
}
});
return resultsetFiltered;
};
$scope.filterFromArray = function (data, filterSTR) {
var resultsetFiltered = [];
resultsetFiltered = $scope.applyDurationFilter(data, filterSTR.night);
resultsetFiltered = $scope.applyCategoryFilter(resultsetFiltered, filterSTR.cat);
resultsetFiltered = $scope.applyDestinationFilter(resultsetFiltered, filterSTR.desti);
resultsetFiltered = $scope.applyPriceRangeFilter(resultsetFiltered, filterSTR.price);
resultsetFiltered = $scope.applyMonthFilter(resultsetFiltered, filterSTR.month);
// console.log(resultsetFiltered);
return resultsetFiltered;
};
// end : code for filter data
$scope.checkAlreadyExistsInArray = function (value, arr, innerkey) {
var ret = false;
// if single dimension array
if (innerkey == null) {
if ($.inArray(value, arr) != -1) {
ret = true;
}
}
// if multi dimenstion array then pass inner key also
else {
$.each(arr, function (index, element) {
if (value == element[innerkey]) {
ret = true;
}
});
}
return ret;
};
// param : substr , full string
$scope.checkSubstrInString = function (substr, str) {
if (str && substr) {
if (str.toLowerCase().indexOf(substr.toLowerCase()) == -1)
return false;
else
return true;
}
};
// load all data after 7 seconds only if production mode
if (appmode == 'MODE_PROD') {
$timeout(function () {
// $scope.displayall();
}, 7000);
}
$scope.loadmore = function () {
if ($scope.limitToResult <= $scope.totalResult) {
$scope.limitToResult = $scope.summ($scope.limitToResult, 10);
}
if ($scope.limitToResult > $scope.totalResult) {
// $('#loadmorepaging').parent().css({'display' : 'none'});
$('#pagging_loader').css({ 'display': 'none' });
// angular.element(document.querySelector('#id_div_filter_option')).removeClass('div_filter_option');
}
// $('#pagging_loader').html('');
$scope.hideLoader();
};
$scope.displayall = function () {
$scope.showLoader();
$scope.limitToResult = $scope.totalResult;
$('#loadmorepaging').parent().css({ 'display': 'none' });
$scope.hideLoader();
};
$scope.alert = function (text) {
alert(text);
};
$scope.sortListings = function ($event, orderby, orderval) {
var currentElem = angular.element($event.currentTarget);
angular.element(document.querySelector('#sortingContainer')).find('a').removeClass('active');
currentElem.addClass('active');
$scope.showLoader();
$scope.orderby = orderby;
$scope.orderval = orderval;
$scope.hideLoader();
};
$scope.FilterPriceRange = {};
$scope.FilterDuration = {};
$scope.FilterDestination = {};
$scope.showLoader = function (divid) {
// $('#'+divid).next().text('Loading...');
var divid1 = (divid) ? divid : 'overlay';
var myHeight = window.innerHeight;
var padding = 0;
padding = parseInt(myHeight / 2);
padding = padding + 'px';
$('#' + divid1).css({ 'display': 'block', 'height': 'auto', 'padding-top': padding, 'text-align': 'center', 'background': '#f3f3f3' }).html('<img src="' + SITEURL + 'public/images/loader.gif" />');
$(".verticalTab").each(function () {
var pkg = $(this).attr('pkg');
$('#verticalTab' + parseInt(pkg)).easyResponsiveTabs({
type: 'vertical',
width: 'auto',
fit: true
});
$("#calendar" + parseInt(pkg)).datepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true });
$("#customizeTravelDate" + parseInt(pkg)).datepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true });
$("#EnquireTravelDate" + parseInt(pkg)).datepicker({ outputFormat: 'dd/mm/yyyy', onceClick: true });
$(".travelerbox" + parseInt(pkg)).click(function () {
$(".roomBoxMain" + parseInt(pkg)).toggle();
});
$(".travelerboxCustom" + parseInt(pkg)).click(function () {
$(".roomBoxMainCustom" + parseInt(pkg)).toggle();
});
$(".travelerboxEnquire" + parseInt(pkg)).click(function () {
$(".roomBoxMainEnquire" + parseInt(pkg)).toggle();
});
});
};
$scope.hideLoader = function (divid) {
var divid1 = (divid) ? divid : 'overlay';
$('#' + divid1).css({ 'display': 'none', 'height': 'auto', 'text-align': 'center', 'background': '#ffffff' });
};
$scope.openmodal = function (popid) {
var ar = { 'p1': ['p1 data'], 'p2': ['p2 data'], 'p3': ['p3 data'], };
var ret = ar[popid];
var clicked_pack_id = 33;
$('#overlay').show();
$(".popup_" + clicked_pack_id).css({ 'right': '0px', 'opacity': '1', 'z-index': '9999', 'background-color': '#FFFFFF', 'display': 'block' });
$('.package_det_d_side').html(ret);
};
$scope.showItineraryTable = function (itiPkgSysId, itidefaultHotelStandard) {
$('.hotelCategoryTable' + itiPkgSysId).hide();
$('#hotelCategoryTable' + itidefaultHotelStandard + itiPkgSysId).show().removeClass('ng-hide');
};
$scope.summ = function (a, b) {
return parseInt(a) + parseInt(b);
};
$scope.rvGetSeoUrl = function (str) {
return rvServices.rvSanitizeForUrl(str);
};
$scope.changePrices = function (PkgSysId, pType, categoryName, changeType) {
// console.log(PkgSysId);
// console.log(pType);
// console.log(categoryName);
// console.log(changeType);
//
var changed_mpid = $('#mptype_select_' + categoryName + "_" + PkgSysId).val();
if (changed_mpid) {
$("#mealplantype_" + PkgSysId).val(changed_mpid);
}
$('.CategoryWiseDates'+PkgSysId).addClass('display-none-class');
$('.CategoryWiseDates'+PkgSysId+'_'+categoryName).removeClass('display-none-class');
pType = parseInt(pType);
var pTypeChar = (pType === 1) ? 'P' : 'G';
var fixdeparture_destinations = $('.fixdeparture-destinations'+parseInt(PkgSysId)).val();
var TotalPriceWithflight = parseInt($('#TotalPriceWithflight_'+parseInt(PkgSysId)+''+parseInt(fixdeparture_destinations)).val());
if(isNaN(TotalPriceWithflight)){
TotalPriceWithflight = 0;
}
if ((('pr' in $scope.tempPriceArray[PkgSysId][pTypeChar][categoryName]) == true)) {
var rt, tpid = '';
var $price;
var $priceCommissionValueFg;
rt = $scope.tempPriceArray[PkgSysId];
if (pType === 1) {
$price = rt.P[categoryName].pr + parseInt(TotalPriceWithflight);
tpid = rt.P[categoryName].TPId;
$priceCommissionValueFg = rt.P[categoryName].prcmmfg;
}
else if (pType === 2) {
$price = rt.G[categoryName].pr+ parseInt(TotalPriceWithflight);
tpid = rt.G[categoryName].TPId;
$priceCommissionValueFg = rt.G[categoryName].prcmmfg;
}
if (tpid) {
$('#packagetpid_' + PkgSysId).val(tpid);
$('#package_tpid' + PkgSysId).val(tpid);
}
$scope.outerforloop.Price[parseInt(PkgSysId)] = $scope.moneyformatinrhtml($price);
$scope.outerforloop.CommissionValueFg[parseInt(PkgSysId)] = rvServices.rvMoneyFormatINR($priceCommissionValueFg, 2, '');
$scope.outerforloop.PriceDiscounted[parseInt(PkgSysId)] = $scope.moneyformatinrhtml($price);
}
else {
return $http.get(conf.SITEURL + 'public/upload/'+conf.gtxagencysysid+'/data/package_price.json').then(function (data) {
var rt, tpid = '';
var $price;
rt = rvServices.rvFilterArrayByKey(PkgSysId, data.data);
var aa = rt[pTypeChar];
$price = aa[categoryName].price[0];
tpid = aa[categoryName].TPId;
// start : write the data here
var prd, DiscountValInPerc, DiscountVal, prcmmfg;
angular.forEach(rt, function (value, key) {
$scope.tempPriceArray[PkgSysId][key] = {};
angular.forEach(value, function (valueINN, keyINN) {
$price = valueINN.price[0];
if ($price['DiscountType'] === 1) {
prd = parseFloat($price['PricePerPerson']) + parseFloat($price['DiscountVal']);
}
else if ($price['DiscountType'] === 2) {
DiscountValInPerc = ($price['PricePerPerson'] * $price['DiscountVal']) / 100;
prd = parseFloat($price['PricePerPerson']) + parseFloat(DiscountValInPerc);
}
else {
prd = parseFloat($price['PricePerPerson']);
}
prcmmfg = parseFloat($price['CommissionValueFg']);
$scope.tempPriceArray[PkgSysId][key][keyINN] = { TPId: valueINN.TPId, pr: parseFloat($price['PricePerPerson']), CommissionValueFg: parseFloat($price['CommissionValueFg']), prd: prd ,prcmmfg:prcmmfg }; // write variable
});
});
// end : write the data here
var rate = $scope.tempPriceArray[PkgSysId];
var aa = rate[pTypeChar];
var bb = aa[categoryName];
//console.log($scope.tempPriceArray);
$price = bb.pr + parseInt(TotalPriceWithflight);
$priceCommissionValueFg = bb.CommissionValueFg;
tpid = bb.TPId;
if (tpid) {
$('#packagetpid_' + PkgSysId).val(tpid);
$('#package_tpid' + PkgSysId).val(tpid);
}
// $scope.outerforloop.Price[parseInt(PkgSysId)] = rvServices.rvMoneyFormatINR(rvServices.rvChangePriceValue(parseInt(PkgSysId), $price), 2, '');
// $scope.outerforloop.PriceDiscounted[parseInt(PkgSysId)] = rvServices.rvMoneyFormatINR(rvServices.rvChangePriceDiscountedValue(parseInt(PkgSysId), $price), 2, '');
$scope.outerforloop.Price[parseInt(PkgSysId)] = rvServices.rvMoneyFormatINR($price, 2, '');
$scope.outerforloop.CommissionValueFg[parseInt(PkgSysId)] = rvServices.rvMoneyFormatINR($priceCommissionValueFg, 2, '');
$scope.outerforloop.PriceDiscounted[parseInt(PkgSysId)] = rvServices.rvMoneyFormatINR($price, 2, '');
return rt;
});
}
};
$scope.changeType = function (ev, PkgSysId) {
// $location.path('/ranvir'+PkgSysId);
$('#my_custom_select_field_' + PkgSysId).val(ev);
var categoryName = $('#my_custom_select_field_' + PkgSysId ).val();
var categoryId = ev;
var temp, pType, packageName, Countries, mp = '';
pType = parseInt($('input[name="tType_' + PkgSysId + '"]:checked').val());
packageName = $('#packagename_' + PkgSysId).val();
Countries = $('#package_location_' + PkgSysId).val();
$scope.showItineraryTable(PkgSysId, categoryName);
// write the data here
var pTypeChar = (pType === 1) ? 'P' : 'G';
if ((PkgSysId in $scope.tempPriceArray) === false) {
$scope.tempPriceArray[PkgSysId] = {};
}
if ((pTypeChar in $scope.tempPriceArray[PkgSysId]) == false) {
$scope.tempPriceArray[PkgSysId][pTypeChar] = {};
}
if ((categoryName in $scope.tempPriceArray[PkgSysId][pTypeChar]) == false) {
$scope.tempPriceArray[PkgSysId][pTypeChar][categoryName] = {};
}
$("#hotelCategory" + PkgSysId).val(categoryId);
$("#hotelcategoryid_" + PkgSysId).val(categoryId);
$("#package_hotelcategoryid" + PkgSysId).val(categoryId);
var AgencyType = $('#AgencyType').val();
var TPSysId = $('#TPSysId'+ PkgSysId).val();
if(AgencyType == 3 && TPSysId > 0){
$('.viewCheckRateClass'+parseInt(PkgSysId)).click();
}else{
$('.ratedetail' + PkgSysId).hide();
}
$scope.changePrices(PkgSysId, pType, categoryName, 'category');
mp = $('#mealplantype_' + PkgSysId).val();
rvServices.rvChangeUrl(PkgSysId, categoryName, packageName, Countries, mp);
};
$scope.changePackageType = function (type, PkgSysId) {
var pType = type;
var categoryName, temp, packageName, Countries, mp = '';
categoryName = $('input[name="hotelTypeElement_' + PkgSysId + '"]:checked').val();
packageName = $('#packagename_' + PkgSysId).val();
Countries = $('#package_location_' + PkgSysId).val();
// write the data here
var pTypeChar = (pType === 1) ? 'P' : 'G';
if ((PkgSysId in $scope.tempPriceArray) === false) {
$scope.tempPriceArray[PkgSysId] = {};
}
if ((pTypeChar in $scope.tempPriceArray[PkgSysId]) == false) {
$scope.tempPriceArray[PkgSysId][pTypeChar] = {};
}
if ((categoryName in $scope.tempPriceArray[PkgSysId][pTypeChar]) == false) {
$scope.tempPriceArray[PkgSysId][pTypeChar][categoryName] = {};
}
$("#packageTourType" + PkgSysId).val(pType);
$("#tourtype_" + PkgSysId).val(pType);
$scope.changePrices(PkgSysId, pType, categoryName, 'package');
mp = $('#mealplantype_' + PkgSysId).val();
rvServices.rvChangeUrl(PkgSysId, categoryName, packageName, Countries, mp);
};
$scope.rvFromJson = function (data) {
return angular.fromJson(data);
};
$scope.rvToArray = function (arr) {
return arr;
};
$scope.print_rv = function (val) {
console.log(val);
};
$scope.moneyformatinrhtml = function (n) {
return rvServices.rvMoneyFormatINR(n, 2, '')
};
$scope.filterByPropertiesMatchingAND = function (data) {
var matchesAND = true;
for (var obj in $scope.filter) {
if ($scope.filter.hasOwnProperty(obj)) {
if (noSubFilter($scope.filter[obj]))
continue;
if (!$scope.filter[obj][data[obj]]) {
matchesAND = false;
break;
}
}
}
return matchesAND;
};
function noSubFilter(obj) {
for (var key in obj) {
if (obj[key])
return false;
}
return true;
}
$scope.filterSingle = '';
$scope.resultset1 = $scope.resultset;
// start : activity search listing here
//
$scope.ngActivityTab = function () {
$scope.loadingAct = true;
$scope.activityContentLimit = 200;
$http({
method: 'GET', url: conf.SITEURL + 'public/data/dynamic/activities.json?' + Math.random(),
headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET ', 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With', },
/*cache: true*/
}).then(function successCallback(response) {
var des = ($scope.getUrlParameter('des')) ? $scope.getUrlParameter('des') : '';
var pricerange = ($scope.getUrlParameter('pricerange')) ? $scope.getUrlParameter('pricerange') : '';
var category = ($scope.getUrlParameter('cat')) ? $scope.getUrlParameter('cat') : '';
var noofday = '';
// console.log(des);
// $scope.resultsetACT = $scope.resultsetActFull = $scope.searchInResponse( response.data.rows , des , noofday , pricerange , category ); // get rows here
// $scope.resultsetACT = $scope.resultsetActFull = response.data.rows; // get rows here
$scope.resultsetACT = $scope.resultsetActFull = $scope.searchInResponseActivity(response.data.rows, des); // get rows here
$scope.filterCatAct = response.data.filterCat; // filter array
$scope.filterPriceAct = response.data.filterPrice; // filter array
// console.log( $scope.filterPriceAct );
// console.log( response.data );
// console.log( $scope.resultsetACT );
// rvServices.rvTrimcontent(50 , 'more' , 'morelink');
$scope.moreContent = true;
$scope.resultsetActFull.sort(sortDesc);
//console.log($scope.resultsetActFull);
}, function errorCallback(response) {
}).finally(function () {
$scope.loadingAct = false;
$scope.limitToResultAct = 10; // total result
// console.log( $scope.resultsetACT );
$scope.totalResultAct = $scope.resultsetACT.length; // total result
$scope.filterCatAct = $scope.searchInResponseForFilterActivity($scope.resultsetACT, $scope.filterCatAct, 'Category'); // filter array
$scope.filterPriceAct = $scope.searchInResponseForFilterActivity($scope.resultsetACT, $scope.filterPriceAct, 'Price'); // filter array
// console.log( $scope.filterPriceAct );
});
};
function sortAsc(a, b) {
a = parseInt(a.PriceOrderBy);
b = parseInt(b.PriceOrderBy);
return a > b ? 1 : (a === b ? 0 : -1);
}
function sortDesc(a, b) {
a = parseInt(a.PriceOrderBy);
b = parseInt(b.PriceOrderBy);
return a > b ? -1 : (a === b ? 0 : 1);
}
$scope.loadmoreAct = function () {
if ($scope.limitToResultAct <= $scope.totalResultAct) {
$scope.limitToResultAct = $scope.summ($scope.limitToResultAct, 10);
}
if ($scope.limitToResult > $scope.totalResult) {
// $('#loadmorepaging').parent().css({'display' : 'none'});
$('#pagging_loader').css({ 'display': 'none' });
// angular.element(document.querySelector('#id_div_filter_option')).removeClass('div_filter_option');
}
// $('#pagging_loader').html('');
$scope.hideLoader();
};
//
// end : activity search listing here
// start : code for filter activity data
// function is used for filtering package result data
$scope.filterDataActivity = function () {
// $scope.showLoader('result_area'); // show loader
// declare the variable here
var filterSTR = { 'cat': [], 'price': [] };
angular.element('.box-filter-activity input:checkbox').each(function () {
if ($(this).is(":checked")) {
if ($(this).hasClass('filter-cat')) {
filterSTR.cat.push($(this).val());
}
else if ($(this).hasClass('filter-price')) {
filterSTR.price.push($(this).val());
}
}
});
// if filter has any value
if ((filterSTR.cat.length > 0) || (filterSTR.price.length > 0)) {
$scope.resultsetACT = this.filterActivityFromArray($scope.resultsetActFull, filterSTR);
} else {
$scope.resultsetACT = $scope.resultsetActFull;
}
};
$scope.filterActivityFromArray = function (data, filterSTR) {
var resultsetFiltered = [];
resultsetFiltered = $scope.applyCategoryFilterActivity(data, filterSTR.cat);
resultsetFiltered = $scope.applyPriceRangeFilterActivity(resultsetFiltered, filterSTR.price);
return resultsetFiltered;
};
$scope.searchInResponseForFilterActivity = function (data, filterValues, type) {
var finaldata = [];
var innerkey = '';
// console.log(filterValues);
if (type == 'Category') {
innerkey = 'ActivityGrType';
$.each(data, function (index, element) {
$.each(element[innerkey], function (i, ele) {
if ($.inArray(ele, filterValues) != -1) {
// push data in final array if already not exists
if (($.inArray(ele, finaldata)) == -1) {
finaldata.push(ele);
}
}
});
});
// console.log(finaldata);
return finaldata;
}
else if (type == 'Price') {
innerkey = 'pRng';
$.each(data, function (index, element) {
if ($.inArray(element[innerkey], filterValues) != -1) {
// push data in final array if already not exists
if (($.inArray(element[innerkey], finaldata)) == -1) {
finaldata.push(element[innerkey]);
}
}
});
return finaldata;
}
else {
return data;
}
};
$scope.applyCategoryFilterActivity = function (data, catArr) {
// filter by category
var resultsetFiltered = [];
if (catArr.length == 0) {
return data;
}
// console.log(data);
// console.log(catArr);
$.each(data, function (index, element) {
if (catArr.length > 0) {
$.each(catArr, function (indexinn, elementinn) {
if ($.inArray(elementinn, element.ActivityGrType) != -1) {
// push into array if not exists
if ($scope.checkAlreadyExistsInArray(element.PkgSysId, resultsetFiltered, 'PkgSysId') == false) {
resultsetFiltered.push(element);
}
}
});
}
});
return resultsetFiltered;
};
$scope.applyPriceRangeFilterActivity = function (data, priceArr) {
// number of nights
var resultsetFiltered = [];
if (priceArr.length == 0) {
return data;
}
$.each(data, function (index, element) {
if (priceArr.length > 0) {
$.each(priceArr, function (indexinn, elementinn) {
if (elementinn == element.pRng) {
if ($scope.checkAlreadyExistsInArray(element.PkgSysId, resultsetFiltered, 'PkgSysId') == false) {
resultsetFiltered.push(element);
}
}
});
}
});
return resultsetFiltered;
};
// end : code for filter activity data
$scope.searchInResponseActivity = function (data, destination) {
var data1 = [];
var finaldata = [];
var filteredArray = [];
if ((destination == '')) {
return data;
}
// console.log(data);
if (destination !== '') {
$.each(data, function (index, element) {
if ($scope.checkSubstrInString(destination, element.city)) {
data1.push(element);
}
});
filteredArray = data1;
} else {
filteredArray = data;
}
// console.log(filteredArray);
return filteredArray;
};
}]);
app.filter('trusted', ['$sce', function ($sce) {
var div = document.createElement('div');
return function (text) {
// div.innerHTML = text;
div.innerHTML = text.substring(0, 200);
return $sce.trustAsHtml(div.textContent);
};
}]);
app.controller("SendQueryController", ["$scope", "$http", function ($scope, $http) {
var deafualtForm = { inputName: '', inputEmail: '', inputPhone: '', inputMessage: '' }
$scope.reset = function (formData) {
$scope.formData = angular.copy(deafualtForm);
}
$scope.resultClass, $scope.resultMessage = '';
$scope.formData;
$scope.submitButtonDisabled = false;
$scope.submitted = false;
$scope.querysent = false;
$scope.sendQuery = function (contactform) {
$scope.submitted = true;
$scope.submitButtonDisabled = true;
$scope.querysent = false;
if (contactform.$valid) {
var gtxpackageid = $('#PkgSysIdHTML').val();
var TravelPlanId = $('#packagetpid_' + gtxpackageid).val();
var PriceRange = '';
var PKGCheckInDate = '';
var PKGCheckOutDate = '';
var MinPrice = '';
var MaxPrice = '';
$scope.formData.TravelPlanId = TravelPlanId;
$scope.formData.PriceRange = PriceRange;
$scope.formData.PKGCheckInDate = PKGCheckInDate;
$scope.formData.PKGCheckOutDate = PKGCheckOutDate;
$scope.formData.MinPrice = MinPrice;
$scope.formData.MaxPrice = MaxPrice;
$http({ method: 'POST', url: conf.SITEURL + 'detail/index/send-query', data: $.param($scope.formData), headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).success(function (data) {
if (data.status) {
$scope.submitButtonDisabled = true;
$scope.resultMessage = data.message;
$scope.resultClass = 'bg-success';
$scope.submitButtonDisabled = false;
contactform.$setPristine(true);
$scope.reset(contactform);
$scope.querysent = true;
$scope.submitted = false;
} else {
$scope.submitButtonDisabled = false;
$scope.resultMessage = data.message;
$scope.resultClass = 'bg-danger';
}
});
} else {
$scope.submitButtonDisabled = false;
$scope.resultMessage = 'Please fill out all the fields mark red';
$scope.resultClass = 'bg-danger';
}
}
}]);