Commit 2f2d8a9efeaeb1b10656c8aa1141cc7ce1120a7e
1 parent
8d682e773e
Exists in
master
updates in update fuel manager
Showing
3 changed files
with
79 additions
and
13 deletions
Show diff stats
app/partials/updateFuelManager/updateFuelManager.controller.js
... | ... | @@ -594,9 +594,10 @@ |
594 | 594 | $scope.showLoader = true; |
595 | 595 | for (var i = 0; i<$scope.newFuelPricing.length; i++) { |
596 | 596 | //console.log(parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin)); |
597 | + console.log('-----',$scope.newFuelPricing[i].futureFuelPricing); | |
597 | 598 | if ($scope.newFuelPricing[i].futureFuelPricing != null) { |
598 | 599 | if ($scope.newFuelPricing[i].futureFuelPricing.cost != null || $scope.newFuelPricing[i].futureFuelPricing.cost != '' || $scope.newFuelPricing[i].futureFuelPricing.cost != undefined) { |
599 | - $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); | |
600 | + $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].futureFuelPricing.papMargin); | |
600 | 601 | if ($scope.newFuelPricing[i].futureFuelPricing.cost == null) { |
601 | 602 | $scope.newFuelPricing[i].futureFuelPricing.cost = ''; |
602 | 603 | } |
... | ... | @@ -870,6 +871,34 @@ |
870 | 871 | $('#deleteVtypeMargin').css('display', 'none'); |
871 | 872 | } |
872 | 873 | |
874 | + $scope.resetFutureFuelPricingClick = function(){ | |
875 | + $('#resetPricing').css('display', 'block'); | |
876 | + } | |
877 | + | |
878 | + $scope.confirmReset = function(){ | |
879 | + $('#resetPricing').css('display', 'none'); | |
880 | + $scope.showLoader = true; | |
881 | + updateFuelManagerService.resetPricing().then(function(result) { | |
882 | + toastr.success(''+result.success+'', { | |
883 | + closeButton: true | |
884 | + }) | |
885 | + $scope.showLoader = false; | |
886 | + }) | |
887 | + } | |
888 | + | |
889 | + $scope.cancelReset = function(){ | |
890 | + $('#resetPricing').css('display', 'none'); | |
891 | + } | |
892 | + $scope.noPrices = true; | |
893 | + $scope.disableButtons = function(value){ | |
894 | + if(value.length != 0){ | |
895 | + $scope.noPrices = false; | |
896 | + } | |
897 | + else{ | |
898 | + $scope.noPrices = true; | |
899 | + } | |
900 | + } | |
901 | + | |
873 | 902 | |
874 | 903 | |
875 | 904 | ... | ... |
app/partials/updateFuelManager/updateFuelManager.html
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span> |
44 | 44 | </td> |
45 | 45 | <td> |
46 | - <input type="text" class="form-control" ng-model="fuelPricing.futureFuelPricing.cost" style="height:31px; width: 50px; padding: 6px 6px;"> | |
46 | + <input type="text" class="form-control" ng-keyup="disableButtons(fuelPricing.futureFuelPricing.cost)" ng-model="fuelPricing.futureFuelPricing.cost" style="height:31px; width: 50px; padding: 6px 6px;"> | |
47 | 47 | </td> |
48 | 48 | <td> |
49 | 49 | <input type="text" class="form-control" ng-model="fuelPricing.futureFuelPricing.papMargin" style="height:31px; width: 80px; padding: 6px 6px;"> |
... | ... | @@ -63,12 +63,12 @@ |
63 | 63 | <div class="row" style="margin-left: 0px;"> |
64 | 64 | <div class="col-md-12" style= "text-align: right; padding-left: 0;"> |
65 | 65 | <div style="float: left;"> |
66 | - <button type="button" class="btn btn-primary btn-xs" ng-click="updateFutureFuelPricingImmediatelyClick()" style= "text-align: center; font-size:12px">Save & Deploy Immediately</button> | |
66 | + <button type="button" class="btn btn-primary btn-xs" ng-click="updateFutureFuelPricingImmediatelyClick()" ng-disabled="noPrices" style= "text-align: center; font-size:12px">Save & Deploy Immediately</button> | |
67 | 67 | |
68 | - <button type="reset" class="btn btn-default btn-xs">Reset All</button> | |
68 | + <button type="button" ng-click="resetFutureFuelPricingClick()" class="btn btn-default btn-xs">Reset All</button> | |
69 | 69 | </div> |
70 | 70 | <div style="float: right;"> |
71 | - <button type="button" class="btn btn-success btn-xs" ng-click="updateFutureFuelPricingClick()" style="margin-right:3%">Save & Stage for Deploy</button> | |
71 | + <button type="button" class="btn btn-success btn-xs" ng-click="updateFutureFuelPricingClick()" ng-disabled="noPrices" style="margin-right:3%">Save & Stage for Deploy</button> | |
72 | 72 | </div> |
73 | 73 | <div style="clear: both;"></div> |
74 | 74 | </div> |
... | ... | @@ -115,16 +115,16 @@ |
115 | 115 | <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span> |
116 | 116 | </td> |
117 | 117 | <td> |
118 | - <span>{{fuelPricing.fuelPricing.cost}}</span> | |
118 | + <span>{{fuelPricing.futureFuelPricing.cost}}</span> | |
119 | 119 | </td> |
120 | 120 | <td> |
121 | - <span>{{fuelPricing.fuelPricing.papMargin}}</span> | |
121 | + <span>{{fuelPricing.futureFuelPricing.papMargin}}</span> | |
122 | 122 | </td> |
123 | 123 | <td> |
124 | - <span style="line-height: 31px; color: #1ab394;">$ {{fuelPricing.fuelPricing.cost -- fuelPricing.fuelPricing.papMargin | number : 2 }}</span> | |
124 | + <span style="line-height: 31px; color: #1ab394;">$ {{fuelPricing.futureFuelPricing.cost -- fuelPricing.futureFuelPricing.papMargin | number : 2 }}</span> | |
125 | 125 | </td> |
126 | 126 | <td> |
127 | - <span>{{fuelPricing.fuelPricing.expirationDate}}</span> | |
127 | + <span>{{fuelPricing.futureFuelPricing.expirationDate}}</span> | |
128 | 128 | </td> |
129 | 129 | </tr> |
130 | 130 | </tbody> |
... | ... | @@ -483,7 +483,7 @@ |
483 | 483 | <img src="img/info.png" style="width: 50px;"> |
484 | 484 | </td> |
485 | 485 | <td> |
486 | - <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Tier ?</p> | |
486 | + <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Tier?</p> | |
487 | 487 | </td> |
488 | 488 | </tr> |
489 | 489 | </table> |
... | ... | @@ -504,7 +504,7 @@ |
504 | 504 | <img src="img/info.png" style="width: 50px;"> |
505 | 505 | </td> |
506 | 506 | <td> |
507 | - <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Tier ?</p> | |
507 | + <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Tier?</p> | |
508 | 508 | </td> |
509 | 509 | </tr> |
510 | 510 | </table> |
... | ... | @@ -525,7 +525,7 @@ |
525 | 525 | <img src="img/info.png" style="width: 50px;"> |
526 | 526 | </td> |
527 | 527 | <td> |
528 | - <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Margin Template ?</p> | |
528 | + <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Margin Template?</p> | |
529 | 529 | </td> |
530 | 530 | </tr> |
531 | 531 | </table> |
... | ... | @@ -546,7 +546,7 @@ |
546 | 546 | <img src="img/info.png" style="width: 50px;"> |
547 | 547 | </td> |
548 | 548 | <td> |
549 | - <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Margin Template ?</p> | |
549 | + <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to delete this Margin Template?</p> | |
550 | 550 | </td> |
551 | 551 | </tr> |
552 | 552 | </table> |
... | ... | @@ -558,6 +558,27 @@ |
558 | 558 | </div> |
559 | 559 | </div> |
560 | 560 | |
561 | +<div class="customConfirmPopBackdrop" id="resetPricing" style="display: none;"> | |
562 | + <div class="customModalInner"> | |
563 | + <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> | |
564 | + <table> | |
565 | + <tr> | |
566 | + <td> | |
567 | + <img src="img/info.png" style="width: 50px;"> | |
568 | + </td> | |
569 | + <td> | |
570 | + <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure you want to reset and clear all of the staged pricing above and current pricing below?</p> | |
571 | + </td> | |
572 | + </tr> | |
573 | + </table> | |
574 | + </div> | |
575 | + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> | |
576 | + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmReset()">Yes</button> | |
577 | + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelReset()">No</button> | |
578 | + </div> | |
579 | + </div> | |
580 | +</div> | |
581 | + | |
561 | 582 | <!-- Le javascript |
562 | 583 | ================================================== --> |
563 | 584 | <!-- Placed at the end of the document so the pages load faster --> | ... | ... |
app/partials/updateFuelManager/updateFuelManager.service.js
... | ... | @@ -291,6 +291,22 @@ |
291 | 291 | return deferred.promise; |
292 | 292 | } |
293 | 293 | |
294 | + this.resetPricing = function(data){ | |
295 | + var deferred = $q.defer(); | |
296 | + $http({ | |
297 | + method : 'DELETE', | |
298 | + url : BASE_URL.url +'/fuelPricing/resetAll', | |
299 | + headers : {'Content-Type': 'application/json'}, | |
300 | + data: data | |
301 | + }) | |
302 | + .then(function (result){ | |
303 | + deferred.resolve(result.data); | |
304 | + },function (result){ | |
305 | + deferred.resolve(result.data); | |
306 | + }) | |
307 | + return deferred.promise; | |
308 | + } | |
309 | + | |
294 | 310 | |
295 | 311 | |
296 | 312 | } | ... | ... |