| 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 : |
//var hotelSearch = angular.module("hotelSearch", []);
app.controller("HotelListingController",['$scope','$http','$timeout',function($scope,$http,$timeout) {
$scope.limitToHotelResults = 0;
$scope.totalHotelResults = 0;
$scope.sortedHotelResults = 0;
$scope.loadingHotel = true;
$scope.hotelcategoryArray = [{
hotelcategory: "0",
on: false,
label:"No"
},{
hotelcategory: "1",
on: false,
label:"1"
}, {
hotelcategory: "2",
on: false,
label:"2"
}, {
hotelcategory: "3",
on: false,
label:"3"
}, {
hotelcategory: "4",
on: false,
label:"4"
}, {
hotelcategory: "5",
on: false,
label:"5"
}];
// $scope.hotelPropertyType = [{
// hotelsource: "API",
// source: "Online",
// on: false
// }, {
// hotelsource: "INV",
// source: "Offline",
// on: false
// }];
$scope.ngHotelTab = function() { //alert("HI")
$scope.loadingHotel = true;
var SessionId = $("#session_id").val();
var search_file = "hotel_search_"+SessionId+".json?"+Math.random();
var url = SITEURL+"public/data/hotel-search/"+search_file;
$http({method: 'GET', url: url}).then(function successCallback(response) {
$scope.hotelslist = response.data.Hotels;
$scope.hotelslistfull = response.data.Hotels;
$scope.pricerange = response.data.pricerange;
$scope.urlId = response.data.urlId;
$scope.totalHotelResults = ($scope.hotelslist.length!=undefined)?$scope.hotelslist.length:0; // total result
$scope.sortedHotelResults = ($scope.hotelslist.length!=undefined)?$scope.hotelslist.length:0; // total result
$scope.limitToHotelResults = 10;
console.log($scope.hotelslist);
}, function errorCallback(response) {
//error block
}). finally(function() {
$scope.loadingHotel = false;
});
}
$scope.loadmorehotels = function() {
if( $scope.limitToHotelResults <= $scope.totalHotelResults ) {
$scope.limitToHotelResults = $scope.summhotels( $scope.limitToHotelResults , 10);
}
};
$scope.summhotels = function(a, b) {
return parseInt(a) + parseInt(b);
};
$scope.applyFilterBoxSize = function( type , tag , lengthh , $index ){
if(lengthh > 5) {
if(lengthh-1 == $index) {
var $selector = angular.element('.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>');
}
}
};
}]).filter('customFilter', function() {
return function(input, techs) { //console.log(input);
if(!techs || techs.length === 0){
this.sortedHotelResults = (input!=undefined)?input.length:0;
return input;
}
var out = [];
angular.forEach(input, function(item) {
angular.forEach(techs, function(tech) {
if (item.hotelcategory == tech.hotelcategory) {
out.push(item);
}else if(item.hotelsource == tech.hotelsource){
out.push(item);
}else if(tech.type == "price"){ // for price
var arrPrice = tech.range.split("-");
if(item.hotelprice >= arrPrice[0] && item.hotelprice <= arrPrice[1] ){
out.push(item);
}
}
});
});
this.sortedHotelResults = out.length;
return out;
}
});
app.directive('onErrorSrc', function() {
return {
link: function(scope, element, attrs) {
element.bind('error', function() {
if (attrs.src != attrs.onErrorSrc) {
attrs.$set('src', attrs.onErrorSrc);
}
});
}
}
});