| 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 : |
var app = angular.module('flightBooking', []);
app.controller("FareQuotes",['$scope','$http',function($scope,$http) {
var data = $.param({
traceId: $("#traceId").val(),
rindex: $("#rindex").val(),
isInternational: $("#isInternational").val()
});
var url = SITEURL+'flights/search/fare-quotes';
$scope.isPricing = false;
$scope.success = true;
$http({
method: "POST",
url: url,
data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(function mySuccess(response) {
$scope.success = response.data.success;
if($scope.success){
$scope.getCountryList();
//console.log(response.data)
$scope.isPricing = true;
$scope.fareQuote = response.data.resdata;
if(response.data.IsPriceChanged){
$("#flight-fare-changed").modal('show');
}
}else{
//console.log(response.data);
$scope.isPricing = true;
$scope.success = false;
$scope.ErrorMsg = response.data.resdata.error;
}
}, function myError(response) {
});
$scope.getCountryList = function() {
var url = SITEURL+'/public/data/static/country.json';
$http({
method: "POST",
url: url,
}).then(function mySuccess(response) {
$scope.countrylist = response.data;
}, function myError(response) {
});
}
}]);
app.controller("ReturnFareQuotes",['$scope','$http',function($scope,$http) {
var data = $.param({
traceId: $("#traceId").val(),
rindex1: $("#rindex1").val(),
rindex2: $("#rindex2").val(),
isInternational: $("#isInternational").val()
});
var url = SITEURL+'flights/search/return-fare-quotes';
$scope.isPricing = false;
$scope.success = true;
//$scope.IsPriceChanged = false;
$http({
method: "POST",
url: url,
data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(function mySuccess(response) {
$scope.success = response.data.success;
if($scope.success){
//console.log(response.data)
$scope.getCountryList();
$scope.isPricing = true;
$scope.resdata = response.data.resdata;
$scope.fareQuoteOutbound = response.data.resdata.Depart;
$scope.fareQuoteInbound = response.data.resdata.Return;
if(response.data.IsPriceChanged){
$("#flight-fare-changed").modal('show');
}
}else{
$scope.isPricing = true;
$scope.success = false;
$scope.ErrorMsg = response.data.resdata.error;
}
}, function myError(response) {
});
$scope.getCountryList = function() {
var url = SITEURL+'/public/data/static/country.json';
$http({
method: "POST",
url: url,
}).then(function mySuccess(response) {
$scope.countrylist = response.data;
}, function myError(response) {
});
}
}]);
app.directive("datepicker", function () {
function link(scope, element, attrs) {
element.datepicker({
dateFormat: "dd/mm/yy",
changeYear: true,
maxDate: 0,
yearRange: '-100:+0'
});
}
return {
require: 'ngModel',
link: link
};
});
app.directive('allowPattern', [allowPatternDirective]);
function allowPatternDirective() {
return {
restrict: "A",
compile: function(tElement, tAttrs) {
return function(scope, element, attrs) {
// I handle key events
element.bind("keypress", function(event) {
var keyCode = event.which || event.keyCode; // I safely get the keyCode pressed from the event.
var keyCodeChar = String.fromCharCode(keyCode); // I determine the char from the keyCode.
// If the keyCode char does not match the allowed Regex Pattern, then don't allow the input into the field.
var controlKeyCodes = [8, 9, 46, 37, 39];
if (!keyCodeChar.match(new RegExp(attrs.allowPattern, "i")) && controlKeyCodes.indexOf(keyCode) === -1) {
event.preventDefault();
return false;
}
});
};
}
};
}
app.controller("ProcessBooking",['$scope','$http','$window',function($scope,$http,$window) {
var data = $.param({
urlId: $("#urlId").val(),
paymentStatus: $("#paymentStatus").val()
});
var url = SITEURL+'flights/search/process-booking';
$scope.isPricing = false;
$http({
method: "POST",
url: url,
data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(function mySuccess(response) {
$scope.success = response.data.success;
if($scope.success){
var urlid = response.data.id;
$window.location.href = SITEURL+"flights/index/booking-details/id/"+urlid;
}else{
var pstatus = response.data.pstatus;
if(pstatus == 'C'){
var pstatus = response.data.pstatus;
var id = response.data.id;
$window.location.href = SITEURL+"flights/index/payment-cancelled/id/"+id+"/status/"+pstatus;
}else{
var search_id = response.data.search_id;
var rindex = response.data.rindex;
$window.location.href = SITEURL+"flights/search/payment-failed/search_id/"+search_id+"/rindex/"+rindex+"/status/"+pstatus;
}
}
}, function myError(response) {
}). finally(function() {
});
setTimeout(function(){
$("#bookingInprocess").html("[ Please wait... still we are in booking processing ]");
},7000);
setTimeout(function(){
$("#bookingInprocess").html("[ Please do not refresh or press back button, We are Processing Your Booking ]");
},12000);
setTimeout(function(){
$("#bookingInprocess").html("[ Please wait... still we are in booking processing ]");
},17000);
setTimeout(function(){
$("#bookingInprocess").html("[ Please do not refresh or press back button, We are Processing Your Booking ]");
},20000);
}]);
app.controller("ProcessBookingRound",['$scope','$http','$window',function($scope,$http,$window) {
var data = $.param({
urlId: $("#urlId").val(),
paymentStatus: $("#paymentStatus").val()
});
var url = SITEURL+'flights/index/process-roundtrip-booking';
$scope.isPricing = false;
$http({
method: "POST",
url: url,
data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(function mySuccess(response) {
//$scope.success = response.data.success;
//console.log(response.data.success);
if(response.data.success == true){
var urlid = response.data.id;
$window.location.href = SITEURL+"flights/index/booking-details/id/"+urlid;
}else{
var search_id = response.data.search_id;
var rindex = response.data.rindex;
var pstatus = response.data.pstatus;
$window.location.href = SITEURL+"flights/search/payment-failed/search_id/"+search_id+"/rindex/"+rindex+"/status/"+pstatus;
}
}, function myError(response) {
}). finally(function() {
});
setTimeout(function(){
$("#bookingInprocess").html("[ Please wait... still we are in booking processing ]");
},7000);
setTimeout(function(){
$("#bookingInprocess").html("[ Please do not refresh or press back button, We are Processing Your Booking ]");
},12000);
setTimeout(function(){
$("#bookingInprocess").html("[ Please wait... still we are in booking processing ]");
},17000);
setTimeout(function(){
$("#bookingInprocess").html("[ Please do not refresh or press back button, We are Processing Your Booking ]");
},20000);
}]);
app.controller("BookingDetails",['$scope','$http',function($scope,$http) {
var data = $.param({
urlId: $("#urlId").val()
});
var url = SITEURL+'/flights/search/booking-details';
$scope.isPricing = false;
$scope.success = true;
$http({
method: "POST",
url: url,
data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(function mySuccess(response) {
$scope.success = response.data.success;
if($scope.success){
console.log(response.data)
$scope.isPricing = true;
$scope.fareQuote = response.data.resdata;
}else{
console.log(response.data);
$scope.isPricing = true;
$scope.success = false;
$scope.ErrorMsg = response.data.resdata.error;
}
}, function myError(response) {
}). finally(function() {
});
}]);