Blame view
app/partials/flightDepDashboard/flightDepDashboard.controller.js
3.35 KB
da04b5b2f
|
1 2 3 4 5 |
(function() { 'use strict' angular.module('acufuel') |
f746aee1b
|
6 |
.controller('flightDepDashboardController', [ '$scope', '$filter', '$rootScope', '$state', 'flightDepDashboardService', flightDepDashboardController]); |
da04b5b2f
|
7 8 9 10 |
function flightDepDashboardController($scope, $filter, $rootScope, $state, flightDepDashboardService) { $scope.getQuote = true; $scope.showQuote = false; |
25082c4e3
|
11 12 13 14 15 16 17 |
$scope.order = {}; $scope.dispatchOrder = {}; $scope.dispatchOrder.fuelOrderList = []; $scope.order.upliftDate = ''; $scope.order.departingDate = ''; |
a9aef0b1c
|
18 |
$scope.fboList =[]; |
f746aee1b
|
19 |
getAircraftList(); |
da04b5b2f
|
20 21 22 23 24 25 26 27 28 29 |
$scope.getQuote = function () { $scope.getQuote = false; $scope.showQuote = true; } $scope.logout = function () { localStorage.removeItem("loginStatus"); $rootScope.path = false; $state.reload(); } |
25082c4e3
|
30 |
$scope.getFBOMarginList = function () { |
f746aee1b
|
31 32 |
console.log('111111111'); flightDepDashboardService.getFBOs($scope.order.airport).then(function(result) { |
25082c4e3
|
33 |
$scope.marginList = result; |
f746aee1b
|
34 35 36 37 38 39 40 |
}) } $scope.aircraftList = []; function getAircraftList() { flightDepDashboardService.getAircrafts().then(function(result) { $scope.aircraftList = result; |
a9aef0b1c
|
41 |
}) |
f746aee1b
|
42 |
} |
a9aef0b1c
|
43 |
|
25082c4e3
|
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
$scope.getTiers = function() { var temp = JSON.parse($scope.order.priceQuote); if(temp != null) { flightDepDashboardService.getTiers(temp.owner.id).then(function(result) { if(result != null){ $scope.tierList = result; } else { $scope.tierList = []; $scope.tierList.push({ 'minTierBreak': '0', 'maxTierBreak': '∞' }); } }) } |
a9aef0b1c
|
58 |
} |
da04b5b2f
|
59 |
|
25082c4e3
|
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
$scope.setCost = function(cost){ if(cost != null) { var obj =JSON.parse(cost); console.log('costttttt',obj.cost); $scope.order.fboCost = obj.cost; } } $scope.cancelOrder = function() { $scope.order = {}; $scope.getQuote = true; $scope.showQuote = false; } $scope.dispatchFuel = function(){ $scope.showLoader = true; $scope.order.companyId = $scope.selectedCompanyId; if ($scope.order.upliftDate != '') { $scope.order.upliftDate = new Date($scope.order.upliftDate); $scope.order.upliftDate = $scope.order.upliftDate.getTime(); } if ($scope.order.departingDate != '') { $scope.order.departingDate = new Date($scope.order.departingDate); $scope.order.departingDate = $scope.order.departingDate.getTime(); } |
da04b5b2f
|
85 |
|
25082c4e3
|
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
$scope.order.status = 'pending'; console.log($scope.order.quotePrice); var obj =JSON.parse($scope.order.priceQuote); console.log('obj.papMargin',obj.papMargin); $scope.order.priceQuote = obj.papMargin; $scope.order.fboOwnerId = obj.owner.id; $scope.dispatchOrder.fuelOrderList.push($scope.order); console.log('$scope.order', $scope.dispatchOrder); flightDepDashboardService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { console.log('result', result); $scope.showLoader = false; $scope.order = {}; toastr.success('Fuel Order Dispatched Successfully', { |
da04b5b2f
|
100 101 |
closeButton: true }) |
25082c4e3
|
102 103 |
}) } |
da04b5b2f
|
104 105 |
} })(); |