Blame view
app/partials/flightDepDashboard/flightDepDashboard.controller.js
11.2 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; |
f746aee1b
|
11 |
getAircraftList(); |
da04b5b2f
|
12 13 14 15 16 17 18 19 20 21 |
$scope.getQuote = function () { $scope.getQuote = false; $scope.showQuote = true; } $scope.logout = function () { localStorage.removeItem("loginStatus"); $rootScope.path = false; $state.reload(); } |
f746aee1b
|
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
$scope.fboList = []; $scope.getFBO = function () { console.log('111111111'); flightDepDashboardService.getFBOs($scope.order.airport).then(function(result) { $scope.fboList = result; }) } $scope.aircraftList = []; function getAircraftList() { flightDepDashboardService.getAircrafts().then(function(result) { $scope.aircraftList = result; }) } |
da04b5b2f
|
36 |
|
f746aee1b
|
37 |
/* $scope.marginList = {} |
da04b5b2f
|
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 85 86 87 88 89 90 91 92 93 94 |
flightDepDashboardService.getMargin().then(function(result) { $scope.marginList = result; console.log("Margin result", result) }) $scope.newFuelPricing = {}; flightDepDashboardService.getFuelPricingNew().then(function(result) { $scope.newFuelPricing = result; console.log("Fuel Pricing result", result) for (var i = 0; i<$scope.newFuelPricing.length; i++) { if ($scope.newFuelPricing[i].fuelPricing != null) { if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); var month = newTime.getUTCMonth() + 1; //months from 1-12 var day = newTime.getUTCDate(); var year = newTime.getUTCFullYear(); $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; } } if ($scope.newFuelPricing[i].futureFuelPricing != null) { if ($scope.newFuelPricing[i].futureFuelPricing != null) { if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 var nextDay = newTime.getUTCDate(); var nextYear = newTime.getUTCFullYear(); $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; } } if ($scope.newFuelPricing[i].futureFuelPricing != null) { if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 var dday = newTime.getUTCDate(); var dyear = newTime.getUTCFullYear(); $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; } } } var str =""+ $scope.newFuelPricing[i].name if(str.startsWith("J")){ $scope.newFuelPricing[i].jeta = true; var str1 = str.substring(0,5) var str2 = str.substring(6, str.length) $scope.newFuelPricing[i].name = str1 $scope.newFuelPricing[i].namejetrest = str2 }else if(str.startsWith("100")){ $scope.newFuelPricing[i].avgas = true; var str1 = str.substring(0,5) var str2 = str.substring(6, str.length) $scope.newFuelPricing[i].name = str1 $scope.newFuelPricing[i].nameavgasrest = str2 } } $scope.showLoader = false; |
f746aee1b
|
95 |
})*/ |
da04b5b2f
|
96 |
|
f746aee1b
|
97 |
/*$scope.updateFuelPricing = {}; |
da04b5b2f
|
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
$scope.updateFuelPricing.fuelPricingList = []; $scope.updateFuelPricing.userProfileId = $scope.userProfileId; $scope.updateFuelPricingClick = function(){ $scope.showLoader = true; for (var i = 0; i<$scope.newFuelPricing.length; i++) { if ($scope.newFuelPricing[i].fuelPricing != null) { $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); if ($scope.newFuelPricing[i].fuelPricing.cost == null) { $scope.newFuelPricing[i].fuelPricing.cost = ''; } if ($scope.newFuelPricing[i].fuelPricing.papMargin == null) { $scope.newFuelPricing[i].fuelPricing.papMargin = ''; } if ($scope.newFuelPricing[i].fuelPricing.papTotal == null) { $scope.newFuelPricing[i].fuelPricing.papTotal = ''; } if ($scope.newFuelPricing[i].fuelPricing.expirationDate == null) { $scope.newFuelPricing[i].fuelPricing.expirationDate = ''; }else{ $scope.newFuelPricing[i].fuelPricing.expirationDate = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); console.log('$scope.newFuelPricing[i].fuelPricing.expirationDate', $scope.newFuelPricing[i].fuelPricing.expirationDate); $scope.newFuelPricing[i].fuelPricing.expirationDate = $scope.newFuelPricing[i].fuelPricing.expirationDate.getTime(); } $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); $scope.updateFuelPricing.fuelPricingList.push({ 'cost': $scope.newFuelPricing[i].fuelPricing.cost, 'papMargin': $scope.newFuelPricing[i].fuelPricing.papMargin, 'papTotal': $scope.newFuelPricing[i].fuelPricing.papTotal, 'expirationDate': $scope.newFuelPricing[i].fuelPricing.expirationDate, 'productId': $scope.newFuelPricing[i].id, 'id': $scope.newFuelPricing[i].fuelPricing.id, }) }else{ |
f746aee1b
|
134 |
$scope.newFuelPricing[i].fuelPricing.cost = ''; |
da04b5b2f
|
135 136 |
$scope.newFuelPricing[i].fuelPricing.papMargin = ''; $scope.newFuelPricing[i].fuelPricing.papTotal = ''; |
f746aee1b
|
137 |
$scope.newFuelPricing[i].fuelPricing.expirationDate = ''; |
da04b5b2f
|
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
} } console.log('result',$scope.marginList) flightDepDashboardService.updateFuelPricing($scope.updateFuelPricing).then(function(result) { toastr.success('Successfully Updated', { closeButton: true }) flightDepDashboardService.getFuelPricingNew().then(function(result) { $scope.newFuelPricing = result; for (var i = 0; i<$scope.newFuelPricing.length; i++) { if ($scope.newFuelPricing[i].fuelPricing != null) { if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); var month = newTime.getUTCMonth() + 1; //months from 1-12 var day = newTime.getUTCDate(); var year = newTime.getUTCFullYear(); $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; } } if ($scope.newFuelPricing[i].futureFuelPricing != null) { if ($scope.newFuelPricing[i].futureFuelPricing != null) { if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 var nextDay = newTime.getUTCDate(); var nextYear = newTime.getUTCFullYear(); $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; } } if ($scope.newFuelPricing[i].futureFuelPricing != null) { if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 var dday = newTime.getUTCDate(); var dyear = newTime.getUTCFullYear(); $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; } } } } $scope.showLoader = false; }) }) |
f746aee1b
|
187 |
}*/ |
da04b5b2f
|
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
// $scope.submitLogin = function() { // LoginService.setAuth(true); // toastr.info("Login successfully"); // $state.go('app.dashboard'); // /*LoginService.login($scope.username, $scope.password).then(function(result){ // if(typeof result == 'object') { // LoginService.setAuth(true); // $rootScope.path = true; // var reqPwdChng = localStorage.getItem("requiredChangePwd"); // if (reqPwdChng && reqPwdChng == "Y") { // $state.go('resetPassword'); // } else { // $state.go('app.upload'); // } // } else { // toastr.info("Error in login. Please check login name and password"); // } // })*/ // } } })(); |