| 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/travnet.co.in/public/js/ng/ |
Upload File : |
app.controller("PackageListingController", ["$scope", "$location", "$http", '$filter', 'rvServices', function($scope, $location, $http, $filter, rvServices) {
$scope.loading = true;
$scope.outerforloop = {};
$scope.outerforloop.Price = [];
$scope.outerforloop.PriceDiscounted = [];
$scope.hotelType = false;
$scope.packageCategoryTypeLimit = 3;
$scope.packageInclusionLimit = 5;
$scope.limitToResult = 0;
$scope.totalResult = 0;
$scope.tempPriceArray = [];
var $fullUrl, $fullUrlTemp, $url, $urlparams;
$fullUrl = $location.absUrl();
$fullUrlTemp = $fullUrl.split('?');
$url = ($fullUrlTemp[0]) ? $fullUrlTemp[0] : '';
$urlparams = ($fullUrlTemp[1]) ? $fullUrlTemp[1] : '';
$http({method: 'GET', url: conf.SITEURL + 'tour-packages/fetchall?myaction=getall&' + $urlparams, 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) {
$scope.resultset = response.data;
}, function errorCallback(response) {
}). finally(function() {
$scope.loading = false;
$scope.hotelType = 'Standard';
$scope.orderby = 'FinalTotalPrice';
$scope.orderval = false;
// $scope.limitToResult = $scope.resultset.length; // total result
$scope.limitToResult= 10; // total result
$scope.totalResult = $scope.resultset.length; // total result
});
$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'});
// angular.element(document.querySelector('#id_div_filter_option')).removeClass('div_filter_option');
}
// $('#pagging_loader').html('');
$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() {
var myHeight = window.innerHeight;
var padding = 0;
padding = parseInt(myHeight / 2);
padding = padding + 'px';
$('#overlay').css({'display': 'block', 'height': 'auto', 'padding-top': padding, 'text-align': 'center'}).html('<img src="public/images/loader.gif" />');
};
$scope.hideLoader = function() {
$('#overlay').css({'display': 'none', 'height': 'auto', 'text-align': 'center'});
};
$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 ) {
pType = parseInt(pType);
return $http.get(conf.SITEURL + 'public/data/package_price.json').then(function(data) {
var rt, tpid = '';
var $price;
rt = rvServices.rvFilterArrayByKey(PkgSysId, data.data);
if (pType === 1) {
$price = rt.P[categoryName].price[0];
tpid = rt.P[categoryName].TPId;
}
else if (pType === 2) {
$price = rt.G[categoryName].price[0];
tpid = rt.G[categoryName].TPId;
}
$('#packagetpid_' + 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, '');
return rt;
});
};
$scope.changePrices = function(PkgSysId, pType, categoryName , changeType ) {
pType = parseInt(pType);
var pTypeChar = (pType === 1) ? 'P' : 'G';
if( (('pr' in $scope.tempPriceArray[PkgSysId][pTypeChar][categoryName])== true ) ) {
var rt, tpid = '';
var $price;
rt = $scope.tempPriceArray[PkgSysId];
if (pType === 1) {
$price = rt.P[categoryName].pr;
tpid = rt.P[categoryName].TPId;
}
else if (pType === 2) {
$price = rt.G[categoryName].pr;
tpid = rt.G[categoryName].TPId;
}
$('#packagetpid_' + PkgSysId).val(tpid);
$scope.outerforloop.Price[parseInt(PkgSysId)] = $scope.moneyformatinrhtml($price);
$scope.outerforloop.PriceDiscounted[parseInt(PkgSysId)] = $scope.moneyformatinrhtml($price);
}
else {
return $http.get(conf.SITEURL + 'public/data/package_price.json').then(function(data) {
var rt, tpid = '';
var $price;
rt = rvServices.rvFilterArrayByKey(PkgSysId, data.data);
if (pType === 1) {
$price = rt.P[categoryName].price[0];
tpid = rt.P[categoryName].TPId;
}
else if (pType === 2) {
$price = rt.G[categoryName].price[0];
tpid = rt.G[categoryName].TPId;
}
// start : write the data here
var prd , DiscountValInPerc , DiscountVal ;
angular.forEach(rt, function(value, key) {
// this.push(key + ': ' + value);
$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']);
}
$scope.tempPriceArray[PkgSysId][key][keyINN] = { TPId : valueINN.TPId , pr: $price['PricePerPerson'] , prd: prd }; // write variable
});
});
// end : write the data here
$('#packagetpid_' + 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, '');
return rt;
});
}
};
$scope.changeType = function(ev, PkgSysId) {
var categoryName = ev;
var temp, pType , packageName , Countries = '';
pType = parseInt($('input[name="tType_' + PkgSysId + '"]:checked').val());
packageName = $('#packagename_' + PkgSysId ).val();
Countries = $('#package_location_' + PkgSysId ).val();
rvServices.rvChangeUrl(PkgSysId, categoryName , packageName, Countries);
$scope.showItineraryTable(PkgSysId, categoryName);
var categoryId = '';
categoryId = conf.CATEGORY[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);
$scope.changePrices(PkgSysId, pType, categoryName , 'category' );
};
$scope.changePackageType = function( type, PkgSysId ) {
var pType = type;
var categoryName, temp , packageName , Countries = '';
categoryName = $('input[name="hotelTypeElement_' + PkgSysId + '"]:checked').val();
packageName = $('#packagename_' + PkgSysId ).val();
Countries = $('#package_location_' + PkgSysId ).val();
rvServices.rvChangeUrl(PkgSysId, categoryName , packageName, Countries);
// 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);
$scope.changePrices(PkgSysId, pType, categoryName , 'package' );
};
$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;
}]);
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';
}
}
}]);