Commit 33a64416feae95a5cd97c9051649102be6cf0bfd
1 parent
1d7e82fdd9
Exists in
master
mbug fixes
Showing
3 changed files
with
29 additions
and
23 deletions
Show diff stats
app/partials/viewCompany/viewCompany.controller.js
... | ... | @@ -336,30 +336,17 @@ angular.module('acufuel') |
336 | 336 | $scope.getModal = function(makeId, index) { |
337 | 337 | $scope.showLoader = true; |
338 | 338 | $scope.aircraft.make = makeId; |
339 | - | |
340 | - ViewCompanyService.checkFuelType($scope.aircraft.make).then(function(result){ | |
341 | - // $scope.showLoader = false; | |
342 | - if (result.type == "JetA") { | |
343 | - $scope.jetShow[index] = false; | |
344 | - $scope.marginShow[index] = true; | |
345 | - } else if (result.type == "Avgas") { | |
346 | - $scope.jetShow[index] = true; | |
347 | - $scope.marginShow[index] = false; | |
348 | - }else { | |
349 | - $scope.jetShow[index] = true; | |
350 | - $scope.marginShow[index] = true; | |
351 | - } | |
352 | 339 | CustomersService.getModal($scope.aircraft.make).then(function(result) { |
353 | - $scope.showLoader = false; | |
354 | - $scope.aircraftDetails[index].aircraftModalList = result; | |
355 | - //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0]; | |
356 | - }) | |
357 | - }) | |
358 | - | |
340 | + $scope.showLoader = false; | |
341 | + $scope.aircraftDetails[index].aircraftModalList = result; | |
342 | + //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0]; | |
343 | + }) | |
359 | 344 | } |
345 | + | |
360 | 346 | $scope.selectedOption = ''; |
361 | 347 | $scope.getSize = function(model, index) { |
362 | 348 | $scope.showLoader = true; |
349 | + $scope.aircraft.model = model; | |
363 | 350 | CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { |
364 | 351 | $scope.showLoader = false; |
365 | 352 | $scope.aircraftDetails[index].aircraftSizeList = result; |
... | ... | @@ -370,6 +357,24 @@ angular.module('acufuel') |
370 | 357 | // $scope.aircraftDetails[index].size = $scope.aircraftSizeList[0]; |
371 | 358 | }) |
372 | 359 | } |
360 | + | |
361 | + $scope.getFuelType = function(size, index) { | |
362 | + $scope.showLoader = true; | |
363 | + var data = "model="+$scope.aircraft.model+"&make="+$scope.aircraft.make+"&sizeId="+size; | |
364 | + ViewCompanyService.checkFuelType(data).then(function(result){ | |
365 | + $scope.showLoader = false; | |
366 | + if (result.type == "JetA") { | |
367 | + $scope.jetShow[index] = false; | |
368 | + $scope.marginShow[index] = true; | |
369 | + } else if (result.type == "Avgas") { | |
370 | + $scope.jetShow[index] = true; | |
371 | + $scope.marginShow[index] = false; | |
372 | + }else { | |
373 | + $scope.jetShow[index] = true; | |
374 | + $scope.marginShow[index] = true; | |
375 | + } | |
376 | + }) | |
377 | + } | |
373 | 378 | |
374 | 379 | $scope.aircraftListData = {}; |
375 | 380 | //$scope.addData = []; | ... | ... |
app/partials/viewCompany/viewCompany.html
... | ... | @@ -804,7 +804,7 @@ |
804 | 804 | </select> |
805 | 805 | </td> |
806 | 806 | <td style="width: 17%"> |
807 | - <select class="form-control" ng-model="aircraftData.sizeId"> | |
807 | + <select class="form-control" ng-model="aircraftData.size" ng-change="getFuelType(aircraftData.size, $index)"> | |
808 | 808 | <option value="" disabled>Select</option> |
809 | 809 | <option ng-repeat="size in aircraftData.aircraftSizeList" value="{{size.aircraftSize.id}}">{{size.aircraftSize.size}}</option> |
810 | 810 | </select> | ... | ... |
app/partials/viewCompany/viewCompany.service.js
... | ... | @@ -296,12 +296,13 @@ |
296 | 296 | return deferred.promise; |
297 | 297 | } |
298 | 298 | |
299 | - this.checkFuelType = function(make) { | |
299 | + this.checkFuelType = function(data) { | |
300 | 300 | |
301 | 301 | var deferred = $q.defer(); |
302 | 302 | $http({ |
303 | - method : 'GET', | |
304 | - url : BASE_URL.url +'/flightDept/getFuelType/'+make, | |
303 | + method : 'POST', | |
304 | + url : BASE_URL.url +'/flightDept/getFuelType', | |
305 | + data : data, | |
305 | 306 | headers : {'Content-Type': 'application/json'}, |
306 | 307 | }) |
307 | 308 | .then(function (result){ | ... | ... |