Blame view
app/partials/updateFuelManager/updateFuelManager.controller.js
6.61 KB
feacde5ff
|
1 2 3 4 5 |
'use strict'; //Load controller angular.module('acufuel') |
feacde5ff
|
6 |
|
1097c2ce1
![]() |
7 8 |
.controller('updateFuelManagerController', ['$scope','$uibModal', 'updateFuelManagerService', function($scope , $uibModal, updateFuelManagerService) { |
4bb02bb84
|
9 10 11 12 13 14 15 16 17 |
$scope.yes = function(data){ console.log('========'); console.log('value', data); $uibModal.yes({ templateUrl: 'partials/pricingcontact/pricingcontact.html', backdrop: true, scope: $scope, }) } |
1097c2ce1
![]() |
18 |
$scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')); |
e8983332d
![]() |
19 |
|
1097c2ce1
![]() |
20 |
updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { |
1097c2ce1
![]() |
21 22 |
$scope.aTypeJets = result; }) |
1097c2ce1
![]() |
23 24 25 26 27 28 |
$scope.toggleJestAccordian = function(id){ $('.'+id).slideDown(); $('#'+id).addClass('customActive'); $('#'+id+' select, #'+id+' input').prop("disabled", false); $('#'+id+' .btn-success, #'+id+' .btn-danger').css('display', 'inline-block'); $('#'+id+' .btn-default').css('display', 'none'); |
05c2f6fb3
![]() |
29 30 31 32 33 34 35 36 37 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 |
updateFuelManagerService.getJetTiers(id).then(function(tiers) { $scope.tierList = tiers; }) } $scope.tr = {}; $scope.addNewTier = function(id){ $scope.tr.marginTotal = '1.00'; $scope.tr.marginTemplateId = id; var tierData = 'minTierBreak='+$scope.tr.minTierBreak+'&maxTierBreak='+$scope.tr.maxTierBreak+'&margin='+$scope.tr.margin+ '&marginTotal='+$scope.tr.marginTotal+'&marginTemplateId='+$scope.tr.marginTemplateId; updateFuelManagerService.addNewTier(tierData).then(function(result) { toastr.success('Successfully Added', { closeButton: true }) $scope.tr = {}; updateFuelManagerService.getJetTiers(id).then(function(tiers) { $scope.tierList = tiers; }) }) } $scope.editTier = function(tier){ var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+ '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id; updateFuelManagerService.editTier(editTierData).then(function(result) { toastr.success('Successfully Updated', { closeButton: true }) updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) { $scope.tierList = tiers; }) }) } |
90e918562
![]() |
67 |
$scope.deleteTier = function(id, jetid){ |
05c2f6fb3
![]() |
68 |
updateFuelManagerService.deleteTier(id).then(function(result) { |
90e918562
![]() |
69 |
toastr.success(''+result.success+'', { |
05c2f6fb3
![]() |
70 71 |
closeButton: true }) |
90e918562
![]() |
72 |
updateFuelManagerService.getJetTiers(jetid).then(function(tiers) { |
05c2f6fb3
![]() |
73 74 75 |
$scope.tierList = tiers; }) }) |
1097c2ce1
![]() |
76 |
} |
e8983332d
![]() |
77 |
|
1097c2ce1
![]() |
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
$scope.saveJetAccordian = function(jets){ $scope.jetsDetail = jets; $scope.jetsDetail.userProfileId = $scope.userProfileId; //console.log('jets', $scope.jetsDetail); $('.'+$scope.jetsDetail.id).slideUp(); $('#'+$scope.jetsDetail.id).removeClass('customActive'); $('#'+$scope.jetsDetail.id+' select, #'+$scope.jetsDetail.id+' input').prop("disabled", true); $('#'+$scope.jetsDetail.id+' .btn-success, #'+$scope.jetsDetail.id+' .btn-danger').css('display', 'none'); $('#'+$scope.jetsDetail.id+' .btn-default').css('display', 'inline-block'); var editJetData = 'productType='+$scope.jetsDetail.productType+'&marginName='+$scope.jetsDetail.marginName+'&pricingStructure='+$scope.jetsDetail.pricingStructure+'&marginValue='+$scope.jetsDetail.marginValue+'&userProfileId='+$scope.jetsDetail.userProfileId+'&marginId='+$scope.jetsDetail.id; updateFuelManagerService.editAtypeJetMargin(editJetData).then(function(result) { console.log('newJet', editJetData); toastr.success('Successfully Updated', { closeButton: true }) updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { console.log('result', result); $scope.aTypeJets = result; }) |
e8983332d
![]() |
99 |
}) |
e8983332d
![]() |
100 |
|
1097c2ce1
![]() |
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 |
} $scope.addNewMarginBtn = function(){ $('.addNewMargin').css('display', 'block'); } $scope.closeMarginPopup = function(){ $('.addNewMargin').css('display', 'none'); } $scope.newJet = {}; $scope.newJet.productType = ''; $scope.addNewATypeJet = function(){ $scope.newJet.productType = 'JET-A'; $scope.newJet.userProfileId = $scope.userProfileId; var jetData = 'productType='+$scope.newJet.productType+'&marginName='+$scope.newJet.marginName+'&pricingStructure='+$scope.newJet.pricingStructure+'&marginValue='+$scope.newJet.marginValue+'&userProfileId='+$scope.newJet.userProfileId; updateFuelManagerService.addNewAtypeJetMargin(jetData).then(function(result) { console.log('newJet', jetData); toastr.success('Successfully Added', { closeButton: true }) $('.addNewMargin').css('display', 'none'); updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { console.log('result', result); $scope.aTypeJets = result; }) |
e8983332d
![]() |
129 |
}) |
1097c2ce1
![]() |
130 |
} |
e8983332d
![]() |
131 |
|
1097c2ce1
![]() |
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
/* $scope.addNewATypeJet = function(){ $scope.newJet.productType = 'JET-A'; $scope.newJet.userProfileId = $scope.userProfileId; var jetData = 'productType='+$scope.newJet.productType+'&marginName='+$scope.newJet.marginName+'&pricingStructure='+$scope.newJet.pricingStructure+'&marginValue='+$scope.newJet.marginValue+'&userProfileId='+$scope.newJet.userProfileId; updateFuelManagerService.addNewAtypeJetMargin(jetData).then(function(result) { console.log('newJet', jetData); toastr.success('Successfully Added', { closeButton: true }) $('.addNewMargin').css('display', 'none'); updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { console.log('result', result); $scope.aTypeJets = result; }) |
e8983332d
![]() |
148 |
}) |
1097c2ce1
![]() |
149 |
}*/ |
e8983332d
![]() |
150 |
|
feacde5ff
|
151 152 |
}]); |