Blame view
app/partials/fuelManager/fuelManager.controller.js
18.7 KB
feacde5ff
|
1 2 3 4 5 |
'use strict'; //Load controller angular.module('acufuel') |
4bda5699a
![]() |
6 7 |
//.controller('fuelManagerController', ['$scope', 'fuelManagerService',function($scope, fuelManagerService) { .controller('fuelManagerController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'fuelManagerService', fuelManagerController]); |
feacde5ff
|
8 |
|
4bda5699a
![]() |
9 10 11 |
function fuelManagerController($scope, $rootScope, $uibModal, $filter, $http, fuelManagerService) { $scope.currentUserData = JSON.parse(localStorage.getItem('userProfileId')); |
ec746c7d9
![]() |
12 |
$scope.showLoader = true; |
4bda5699a
![]() |
13 14 |
fuelManagerService.getFullList().then(function(result) { |
4bda5699a
![]() |
15 |
$scope.fullJetList = result; |
a9e3a7365
![]() |
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
console.log('$scope.fullJetList', $scope.fullJetList); for (var i = 0; i<$scope.fullJetList.length; i++) { for (var j = 0; j<$scope.fullJetList[i].aircraftsSize.length; j++) { if ($scope.fullJetList[i].aircraftsSize[j].rampFeesAndAvoidance != null) { if ($scope.fullJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate != null && $scope.fullJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate != '') { var newTime = new Date($scope.fullJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate); var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 var dday = newTime.getUTCDate(); var dyear = newTime.getUTCFullYear(); $scope.fullJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate = dmonth+'/'+dday+'/'+dyear; console.log('$scope.fullJetList.aircraftsSize.rampFeesAndAvoidance.expirationDate', $scope.fullJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate); } } } } |
ec746c7d9
![]() |
31 |
$scope.showLoader = false; |
4bda5699a
![]() |
32 33 34 35 36 |
}) $scope.avoidanceList = {}; $scope.updateList = function(fullJetList){ |
ec746c7d9
![]() |
37 |
$scope.showLoader = true; |
4bda5699a
![]() |
38 39 |
$scope.addData = []; $scope.newJetList = fullJetList; |
a9e3a7365
![]() |
40 |
if ($scope.currentUserData != undefined || $scope.currentUserData != null) { |
4bda5699a
![]() |
41 42 43 |
for(var i=0; i<$scope.newJetList.length;i++){ for(var j = 0; j < $scope.newJetList[i].aircraftsSize.length; j++){ if($scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance != null){ |
a9e3a7365
![]() |
44 45 46 47 |
if ($scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate != null) { $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate = new Date($scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate); $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate = $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate.getTime(); } |
4bda5699a
![]() |
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
$scope.addData.push({ //'aircraftType': $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.aircraftType, 'id': $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.id, 'aircraftSizeId': $scope.newJetList[i].aircraftsSize[j].id, 'rampFees': $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.rampFees, 'avoidance' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.avoidance, 'applicable' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.applicable, 'expirationDate' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate, 'notes' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.notes }); } } } $scope.avoidanceList.rampFeesAndAvoidanceList = $scope.addData; $scope.avoidanceList.fboUserId = $scope.currentUserData; |
4bda5699a
![]() |
64 |
|
a9e3a7365
![]() |
65 |
/*fuelManagerService.updateFullList($scope.avoidanceList).then(function(result) { |
fb26e70bf
![]() |
66 67 68 |
toastr.success(''+result.success+'', { closeButton: true }) |
4bda5699a
![]() |
69 70 |
fuelManagerService.getFullList().then(function(result) { $scope.fullJetList = result; |
ec746c7d9
![]() |
71 |
$scope.showLoader = false; |
4bda5699a
![]() |
72 |
}) |
a9e3a7365
![]() |
73 |
})*/ |
4bda5699a
![]() |
74 75 76 77 |
} } |
9fabc0d40
![]() |
78 |
|
fb26e70bf
![]() |
79 |
$scope.dropOptions = {}; |
9fabc0d40
![]() |
80 81 82 83 |
fuelManagerService.getOptions().then(function(result) { $scope.dropOptions = result; }) |
fb26e70bf
![]() |
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
fuelManagerService.getAircrafts().then(function(result) { $scope.aircrafts = result; }) $scope.openRampFeeModal = false; $scope.customRampData = {}; $scope.customRampData.rampFeesAndAvoidanceList = {}; $scope.customRampData.rampFeesAndAvoidanceList.aircraftType = null; $scope.customRampData.rampFeesAndAvoidanceList.aircraftMake = ''; $scope.customRampData.rampFeesAndAvoidanceList.aircraftSizeId = ''; $scope.customRampData.rampFeesAndAvoidanceList.tailNumber = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.rampFees = ''; $scope.customRampData.rampFeesAndAvoidanceList.avoidance = ''; //$scope.customRampData.fboUserId = ''; |
9fabc0d40
![]() |
104 |
//$scope.rampFeeType = ''; |
fb26e70bf
![]() |
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 134 135 136 137 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 |
$scope.openRampModal = function(){ //console.log('$scope.dropOptions', $scope.dropOptions) if ($scope.customRampData.rampFeesAndAvoidanceList.aircraftType === 'WEIGHT') { $scope.openRampFeeModal = true; $scope.showWeight = true; $scope.showWingspan = false; $scope.showTail = false; $scope.showAircraft = false; $scope.customRampData.rampFeesAndAvoidanceList.aircraftMake = ''; $scope.customRampData.rampFeesAndAvoidanceList.tailNumber = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.rampFees = ''; $scope.customRampData.rampFeesAndAvoidanceList.avoidance = ''; }else if ($scope.customRampData.rampFeesAndAvoidanceList.aircraftType === 'MAKE_AND_MODEL') { $scope.openRampFeeModal = true; $scope.showWeight = false; $scope.showWingspan = false; $scope.showTail = false; $scope.showAircraft = true; $scope.customRampData.rampFeesAndAvoidanceList.tailNumber = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.rampFees = ''; $scope.customRampData.rampFeesAndAvoidanceList.avoidance = ''; }else if ($scope.customRampData.rampFeesAndAvoidanceList.aircraftType === 'WINGSPAN') { $scope.openRampFeeModal = true; $scope.showWeight = false; $scope.showWingspan = true; $scope.showTail = false; $scope.showAircraft = false; $scope.customRampData.rampFeesAndAvoidanceList.aircraftMake = ''; $scope.customRampData.rampFeesAndAvoidanceList.tailNumber = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.rampFees = ''; $scope.customRampData.rampFeesAndAvoidanceList.avoidance = ''; }else if ($scope.customRampData.rampFeesAndAvoidanceList.aircraftType === 'TAIL') { $scope.openRampFeeModal = true; $scope.showWeight = false; $scope.showWingspan = false; $scope.showTail = true; $scope.showAircraft = false; $scope.customRampData.rampFeesAndAvoidanceList.aircraftMake = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.wingspanMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMin = ''; $scope.customRampData.rampFeesAndAvoidanceList.weightRangeMax = ''; $scope.customRampData.rampFeesAndAvoidanceList.rampFees = ''; $scope.customRampData.rampFeesAndAvoidanceList.avoidance = ''; }else if ($scope.customRampData.rampFeesAndAvoidanceList.aircraftType = null){ $scope.openRampFeeModal = false; $scope.showWeight = false; $scope.showWingspan = false; $scope.showTail = false; $scope.showAircraft = false; }else{ $scope.openRampFeeModal = false; $scope.showWeight = false; $scope.showWingspan = false; $scope.showTail = false; $scope.showAircraft = false; } for (var i = 0; $scope.dropOptions.length; i++) { if ($scope.customRampData.rampFeesAndAvoidanceList.aircraftType === $scope.dropOptions[i].size) { $scope.customRampData.rampFeesAndAvoidanceList.aircraftSizeId = $scope.dropOptions[i].id; } } } $scope.addCustomRamp = function(){ |
9fabc0d40
![]() |
182 |
|
fb26e70bf
![]() |
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
$scope.newData = {}; $scope.newData.rampFeesAndAvoidanceList = []; $scope.newData.rampFeesAndAvoidanceList.push($scope.customRampData.rampFeesAndAvoidanceList); $scope.newData.fboUserId = $scope.currentUserData; console.log('$scope.customRampData', $scope.newData) fuelManagerService.updateFullList($scope.newData).then(function(result) { toastr.success(''+result.success+'', { closeButton: true }); $scope.openRampFeeModal = false; $scope.customRampData.rampFeesAndAvoidanceList = {}; $scope.customRampData.rampFeesAndAvoidanceList.aircraftType = null; $scope.newData = {}; $scope.newData.rampFeesAndAvoidanceList = []; fuelManagerService.getFullList().then(function(result) { $scope.fullJetList = result; }) }) } $scope.closeRampFeeModel = function(){ $scope.openRampFeeModal = false; $scope.showWeight = false; $scope.showWingspan = false; $scope.showTail = false; $scope.showAircraft = false; $scope.customRampData.rampFeesAndAvoidanceList = {}; $scope.customRampData.rampFeesAndAvoidanceList.aircraftType = null; |
9fabc0d40
![]() |
211 |
} |
4bda5699a
![]() |
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
$scope.parentOpen = function(index){ $('#parentOpen'+index).css('display', 'none'); $('#parentClose'+index).css('display', 'initial'); $('#parentTogglebody'+index).slideDown(); } $scope.parentClose = function(index){ $('#parentOpen'+index).css('display', 'initial'); $('#parentClose'+index).css('display', 'none'); $('#parentTogglebody'+index).slideUp(); } $scope.toggleChild = function(id){ if ($('.'+id).hasClass('fa-plus-circle')) { $('.'+id).removeClass('fa-plus-circle'); $('.'+id).addClass('fa-minus-circle'); }else{ $('.'+id).removeClass('fa-minus-circle'); $('.'+id).addClass('fa-plus-circle'); } $('#'+id).slideToggle(); } |
feacde5ff
|
233 |
|
32ea0c476
![]() |
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
$scope.dates = [{date:'01-05-2001'}, {date:'05-05-2014'}, {date:'10-11-2008'}] $scope.open = function($event, dt) { $event.preventDefault(); $event.stopPropagation(); dt.opened = true; }; $scope.dateOptions = { formatYear: 'yy', startingDay: 1 }; $scope.format = 'dd-MMMM-yyyy' |
4b64fa3a3
![]() |
251 |
$(document).ready(function(){ |
9fabc0d40
![]() |
252 253 254 255 256 |
setInterval(function(){ var newHeight = $('.feeManagerLeft').height(); $('.feeManagerRight').css('height', newHeight); }, 3); |
4b64fa3a3
![]() |
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
$('#customTabToggle1').click(function(){ console.log('tab 1'); $('#customTabsBody1').slideDown(); $('#customTabsBody2').slideUp(); $('#customTabsBody3').slideUp(); $('#customTabsBody4').slideUp(); $('#customTabs1').addClass('customActive'); $('#customTabs2').removeClass('customActive'); $('#customTabs3').removeClass('customActive'); $('#customTabs4').removeClass('customActive'); $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true); $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false); $('#customTabs1 > .pull-right > .btn-default').css('display', 'none'); $('#customTabs1 > .pull-right > .btn-success').css('display', 'inline-block'); $('#customTabs1 > .pull-right > .btn-danger').css('display', 'inline-block'); $('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs2 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs2 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs3 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs3 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs4 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs4 > .pull-right > .btn-danger').css('display', 'none'); }) $('#customTabToggle2').click(function(){ console.log('tab 2'); $('#customTabsBody1').slideUp(); $('#customTabsBody2').slideDown(); $('#customTabsBody3').slideUp(); $('#customTabsBody4').slideUp(); $('#customTabs1').removeClass('customActive'); $('#customTabs2').addClass('customActive'); $('#customTabs3').removeClass('customActive'); $('#customTabs4').removeClass('customActive'); $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true); $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false); $('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs1 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs1 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs2 > .pull-right > .btn-default').css('display', 'none'); $('#customTabs2 > .pull-right > .btn-success').css('display', 'inline-block'); $('#customTabs2 > .pull-right > .btn-danger').css('display', 'inline-block'); $('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs3 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs3 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs4 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs4 > .pull-right > .btn-danger').css('display', 'none'); }) $('#customTabToggle3').click(function(){ console.log('tab 3'); $('#customTabsBody1').slideUp(); $('#customTabsBody2').slideUp(); $('#customTabsBody3').slideDown(); $('#customTabsBody4').slideUp(); $('#customTabs1').removeClass('customActive'); $('#customTabs2').removeClass('customActive'); $('#customTabs3').addClass('customActive'); $('#customTabs4').removeClass('customActive'); $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true); $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false); $('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs1 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs1 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs2 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs2 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs3 > .pull-right > .btn-default').css('display', 'none'); $('#customTabs3 > .pull-right > .btn-success').css('display', 'inline-block'); $('#customTabs3 > .pull-right > .btn-danger').css('display', 'inline-block'); $('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs4 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs4 > .pull-right > .btn-danger').css('display', 'none'); }) $('#customTabToggle4').click(function(){ console.log('tab 4'); $('#customTabsBody1').slideUp(); $('#customTabsBody2').slideUp(); $('#customTabsBody3').slideUp(); $('#customTabsBody4').slideDown(); $('#customTabs1').removeClass('customActive'); $('#customTabs2').removeClass('customActive'); $('#customTabs3').removeClass('customActive'); $('#customTabs4').addClass('customActive'); $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true); $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false); $('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs1 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs1 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs2 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs2 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block'); $('#customTabs3 > .pull-right > .btn-success').css('display', 'none'); $('#customTabs3 > .pull-right > .btn-danger').css('display', 'none'); $('#customTabs4 > .pull-right > .btn-default').css('display', 'none'); $('#customTabs4 > .pull-right > .btn-success').css('display', 'inline-block'); $('#customTabs4 > .pull-right > .btn-danger').css('display', 'inline-block'); }) }) |
4bda5699a
![]() |
379 |
} |