| 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/ng/ |
Upload File : |
app.directive('bsTooltip', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
$(element).hover(function() {
// on mouseenter
$(element).tooltip('show');
}, function() {
// on mouseleave
$(element).tooltip('hide');
});
}
};
});
app.directive('icheck', function() {
return {
restrict: 'A',
link: function($scope, element, $attrs) {
element.iCheck({
checkboxClass: "icheckbox_flat",
radioClass: "iradio_flat"
}).on('ifClicked', function(event) {
$(event.target).trigger('click');
});
}
};
});
app.directive("scroll", function($window) {
return function(scope, element, attrs) {
angular.element($window).bind("scroll", function() {
// if (this.pageYOffset >= 350) {
if ($(window).scrollTop() >= ($(document).height() - $(window).height()) * 0.75) {
element.addClass('min');
$('#loadmore').click();
}
});
};
});
app.controller("BusListingController", ["$scope", "$location", "$http", '$filter', '$window', function($scope, $location, $http, $filter, $window) {
$scope.loading = true;
$scope.outerforloop = {};
$scope.filter = {};
$scope.outerforloop.Price = [];
$scope.outerforloop.PriceDiscounted = [];
$scope.hotelType = false;
$scope.packageCategoryTypeLimit = 2;
$scope.limitToResult = 0;
$scope.totalResult = 0;
$scope.tempPriceArray = [];
$scope.fares = 'fares';
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];
}
}
};
var busSource = $scope.getUrlParameter2('source');
var busDestinationSource = $scope.getUrlParameter2('destination');
var busdoj = $scope.getUrlParameter2('doj');
var selectedDate = new Date(busdoj);
var convertedDate = $.datepicker.formatDate('yy-mm-dd', selectedDate);
$http({ method: 'GET', url: conf.SITEURL + 'bus/getbuslist?busSource=' + busSource + '&busDestination=' + busDestinationSource + '&doj=' + convertedDate, 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) {
console.log(response);
$scope.loading = false;
$scope.resultset = $scope.resultsetFull = response.data.outbound; // get rows here
$scope.busType = response.data.busType; // get rows here
$scope.filterDeparture = response.data.filterCat; // filter array
$scope.filterBusType = response.data.filterDest; // filter array
$scope.filterArrival = response.data.filterNight; // filter array
if (response.data.outbound.length > 0) {
//$('.buslistingpaddingDiv').show();
}
//console.log($scope.resultset);
}, function errorCallback(response) {}).finally(function() {
$scope.loading = false;
$scope.orderby = 'Price';
$scope.orderval = false;
$scope.limitToResult = 200; // total result
$scope.totalResult = $scope.resultset.length; // total result
});
$scope.filterByFlightMatchingAND = 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.sortBy = function(fares) {
$scope.reverse = ($scope.fares === fares) ? !$scope.reverse : false;
$scope.fares = fares;
};
$scope.viewSeat = function(row, id) {
$('#AppendSeatLayout_' + id).html('<div style="text-align:center;padding-top:30px;"><img src="public/images/loader.gif"/></div>');
var url = SITEURL + "bus/index/tripdetails";
$http({
method: "POST",
url: url,
data: { row: row, tripdetails_id: id },
cache: false,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(function successCallback(response) {
//console.log(id);
//console.log(response.data);
$('#AppendSeatLayout_' + id).html(response.data);
$('.viewseatsDIv').hide();
}, function errorCallback(response) {
//alert(response.data.message);
});
};
//
}]);
$(document).on('click', '.closestDIv', function() {
var id = $(this).attr('data');
$('a#Safety' + id).removeClass('active');
$('#Safety_collapse' + id).removeClass('active');
$('a#Amenities' + id).removeClass('active');
$('#Amenities_collapse' + id).removeClass('active');
$('a#cancellPolicy' + id).removeClass('active');
$('#cancellationPolicy' + id).removeClass('active');
$('a#Boarding' + id).removeClass('active');
$('#Boarding_collapse' + id).removeClass('active');
$('a#viewseatsbutton' + id).removeClass('active');
$('#viewseats' + id).removeClass('active');
$('.Hsleeper').addClass('Cell');
$('.seater').addClass('Cell');
$('.Vsleeper').addClass('Cell');
$('.Hsleeper').removeClass('CellSelected');
$('.seater').removeClass('CellSelected');
$('.Vsleeper').removeClass('CellSelected');
$('div.busseat').removeClass('CellSelected');
//$('#items_' + id).val('');
//$('#AppendSeatLayout_' + id).html('');
$('.viewseatsDIv').show();
});
$(document).on('click', '[name="borTime"]', function() {
var classes = $(this).parent().parent().parent().parent().parent().attr('id');
var seleted = classes.split("_");
var selected_id = seleted[1];
$(this).parent().parent().parent().parent().parent().removeClass('active');
$('[href*=broadingtab_' + selected_id).removeClass('active');
$('[href*=droppingtab_' + selected_id).addClass('active');
// $(this).parent().parent().parent().parent().parent()..parent().parent();
$('#droppingtab_' + selected_id).addClass('active');
// href="#droppingtab_2000000141280054664"
})
$(document).on('click', '.proceedbtn', function() {
var SelectedSeat = new Array();
var id = $(this).attr('data');
var searchData = $('#searchData').val();
var selectedBusData = $('#rowData_' + id).val();
var seatData = $('#items_' + id).val();
var availableTripId_ = $('#availableTripId_' + id).val();
if ($('.borTime' + id).is(":checked")) {
var bpId = $('.borTime' + id + ':checked').val();
}
if ($('.dropTime' + id).is(":checked")) {
var dpId = $('.dropTime' + id + ':checked').val();
}
$('.CellSelected').each(function(e) {
var SeatNo = $(this).attr('stnumber');
SelectedSeat.push(SeatNo);
});
$.ajax({
type: "POST",
url: "bus/booknow",
dataType: 'json',
data: {
availableTripId: availableTripId_,
boardingPointId: bpId,
dropingPointId: dpId,
selectedBusData: (selectedBusData),
seatData: (seatData),
SelectedSeat: SelectedSeat,
searchData: searchData,
},
beforeSend: function() {
$(".proceedbtn").html("Please Wait");
$(".proceedbtn").prop('disabled', true);
},
success: function(result) {
if (result.success) {
window.location.href = result.url;
} else {
alert(result.message);
$(".proceedbtn").html("Proceed to book");
$(".proceedbtn").prop('disabled', false);
return false;
}
}
});
});