Commit 2f2d8a9efeaeb1b10656c8aa1141cc7ce1120a7e

Authored by Mr. Hot Foods
1 parent 8d682e773e
Exists in master

updates in update fuel manager

app/partials/updateFuelManager/updateFuelManager.controller.js
1 1
2 'use strict'; 2 'use strict';
3 3
4 //Load controller 4 //Load controller
5 angular.module('acufuel') 5 angular.module('acufuel')
6 6
7 7
8 .controller('updateFuelManagerController', ['$scope','$uibModal', 'updateFuelManagerService', function($scope , $uibModal, updateFuelManagerService) { 8 .controller('updateFuelManagerController', ['$scope','$uibModal', 'updateFuelManagerService', function($scope , $uibModal, updateFuelManagerService) {
9 9
10 10
11 11
12 $scope.showLoader = true; 12 $scope.showLoader = true;
13 $scope.yes = function(data){ 13 $scope.yes = function(data){
14 console.log('========'); 14 console.log('========');
15 console.log('value', data); 15 console.log('value', data);
16 $uibModal.yes({ 16 $uibModal.yes({
17 templateUrl: 'partials/pricingcontact/pricingcontact.html', 17 templateUrl: 'partials/pricingcontact/pricingcontact.html',
18 backdrop: true, 18 backdrop: true,
19 scope: $scope, 19 scope: $scope,
20 }) 20 })
21 } 21 }
22 22
23 $scope.options = { 23 $scope.options = {
24 language: 'en', 24 language: 'en',
25 allowedContent: true, 25 allowedContent: true,
26 entities: false 26 entities: false
27 }; 27 };
28 28
29 // Called when the editor is completely ready. 29 // Called when the editor is completely ready.
30 $scope.onReady = function () { 30 $scope.onReady = function () {
31 // ... 31 // ...
32 }; 32 };
33 33
34 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')); 34 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'));
35 35
36 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { 36 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
37 $scope.aTypeJets = result; 37 $scope.aTypeJets = result;
38 $scope.showLoader = false; 38 $scope.showLoader = false;
39 }) 39 })
40 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) { 40 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) {
41 $scope.vTypeJets = result; 41 $scope.vTypeJets = result;
42 $scope.showLoader = false; 42 $scope.showLoader = false;
43 }) 43 })
44 $scope.toggleJestAccordian = function(id, index){ 44 $scope.toggleJestAccordian = function(id, index){
45 $scope.showLoader = true; 45 $scope.showLoader = true;
46 $('.'+id).slideDown(); 46 $('.'+id).slideDown();
47 $('#'+id).addClass('customActive'); 47 $('#'+id).addClass('customActive');
48 $('#'+id+' select, #'+id+' input').prop("disabled", false); 48 $('#'+id+' select, #'+id+' input').prop("disabled", false);
49 $('#'+id+' .btn-success, #'+id+' .btn-danger').css('display', 'inline-block'); 49 $('#'+id+' .btn-success, #'+id+' .btn-danger').css('display', 'inline-block');
50 $('#'+id+' .btn-default').css('display', 'none'); 50 $('#'+id+' .btn-default').css('display', 'none');
51 $('#'+id+' .btn-primary').css('display', 'none'); 51 $('#'+id+' .btn-primary').css('display', 'none');
52 52
53 updateFuelManagerService.getJetTiers(id).then(function(tiers) { 53 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
54 $scope.aTypeJets[index].tierList = tiers; 54 $scope.aTypeJets[index].tierList = tiers;
55 $scope.showLoader = false; 55 $scope.showLoader = false;
56 }) 56 })
57 } 57 }
58 $scope.toggleVtypeJestAccordian = function(id, index){ 58 $scope.toggleVtypeJestAccordian = function(id, index){
59 $scope.showLoader = true; 59 $scope.showLoader = true;
60 $('.'+id).slideDown(); 60 $('.'+id).slideDown();
61 $('#'+id).addClass('customActive'); 61 $('#'+id).addClass('customActive');
62 $('#'+id+' select, #'+id+' input').prop("disabled", false); 62 $('#'+id+' select, #'+id+' input').prop("disabled", false);
63 $('#'+id+' .btn-success, #'+id+' .btn-danger').css('display', 'inline-block'); 63 $('#'+id+' .btn-success, #'+id+' .btn-danger').css('display', 'inline-block');
64 $('#'+id+' .btn-default').css('display', 'none'); 64 $('#'+id+' .btn-default').css('display', 'none');
65 $('#'+id+' .btn-primary').css('display', 'none'); 65 $('#'+id+' .btn-primary').css('display', 'none');
66 66
67 updateFuelManagerService.getJetTiers(id).then(function(tiers) { 67 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
68 $scope.vTypeJets[index].tierList = tiers; 68 $scope.vTypeJets[index].tierList = tiers;
69 $scope.showLoader = false; 69 $scope.showLoader = false;
70 }) 70 })
71 } 71 }
72 //$scope.trData = {}; 72 //$scope.trData = {};
73 $scope.addNewTier = function(id, trData, index){ 73 $scope.addNewTier = function(id, trData, index){
74 $scope.showLoader = true; 74 $scope.showLoader = true;
75 $scope.tr = {}; 75 $scope.tr = {};
76 $scope.tr[index] = {}; 76 $scope.tr[index] = {};
77 $scope.tr[index].minTierBreak = trData[index].minTierBreak; 77 $scope.tr[index].minTierBreak = trData[index].minTierBreak;
78 $scope.tr[index].maxTierBreak = trData[index].maxTierBreak; 78 $scope.tr[index].maxTierBreak = trData[index].maxTierBreak;
79 $scope.tr[index].margin = trData[index].margin; 79 $scope.tr[index].margin = trData[index].margin;
80 $scope.tr[index].marginTotal = '1.00'; 80 $scope.tr[index].marginTotal = '1.00';
81 $scope.tr[index].marginTemplateId = id; 81 $scope.tr[index].marginTemplateId = id;
82 82
83 var tierData = 'minTierBreak='+$scope.tr[index].minTierBreak+'&maxTierBreak='+$scope.tr[index].maxTierBreak+'&margin='+$scope.tr[index].margin+ 83 var tierData = 'minTierBreak='+$scope.tr[index].minTierBreak+'&maxTierBreak='+$scope.tr[index].maxTierBreak+'&margin='+$scope.tr[index].margin+
84 '&marginTotal='+$scope.tr[index].marginTotal+'&marginTemplateId='+$scope.tr[index].marginTemplateId; 84 '&marginTotal='+$scope.tr[index].marginTotal+'&marginTemplateId='+$scope.tr[index].marginTemplateId;
85 85
86 updateFuelManagerService.addNewTier(tierData).then(function(result) { 86 updateFuelManagerService.addNewTier(tierData).then(function(result) {
87 toastr.success('Successfully Added', { 87 toastr.success('Successfully Added', {
88 closeButton: true 88 closeButton: true
89 }) 89 })
90 trData[index].minTierBreak = ''; 90 trData[index].minTierBreak = '';
91 trData[index].maxTierBreak = ''; 91 trData[index].maxTierBreak = '';
92 trData[index].margin = ''; 92 trData[index].margin = '';
93 93
94 updateFuelManagerService.getJetTiers(id).then(function(tiers) { 94 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
95 $scope.aTypeJets[index].tierList = tiers; 95 $scope.aTypeJets[index].tierList = tiers;
96 $scope.showLoader = false; 96 $scope.showLoader = false;
97 }) 97 })
98 }) 98 })
99 } 99 }
100 100
101 $scope.addNewVtypeTier = function(id, vtrData, index){ 101 $scope.addNewVtypeTier = function(id, vtrData, index){
102 $scope.showLoader = true; 102 $scope.showLoader = true;
103 $scope.tr = {}; 103 $scope.tr = {};
104 $scope.tr[index] = {}; 104 $scope.tr[index] = {};
105 $scope.tr[index].minTierBreak = vtrData[index].minTierBreak; 105 $scope.tr[index].minTierBreak = vtrData[index].minTierBreak;
106 $scope.tr[index].maxTierBreak = vtrData[index].maxTierBreak; 106 $scope.tr[index].maxTierBreak = vtrData[index].maxTierBreak;
107 $scope.tr[index].margin = vtrData[index].margin; 107 $scope.tr[index].margin = vtrData[index].margin;
108 $scope.tr[index].marginTotal = '1.00'; 108 $scope.tr[index].marginTotal = '1.00';
109 $scope.tr[index].marginTemplateId = id; 109 $scope.tr[index].marginTemplateId = id;
110 110
111 var tierData = 'minTierBreak='+$scope.tr[index].minTierBreak+'&maxTierBreak='+$scope.tr[index].maxTierBreak+'&margin='+$scope.tr[index].margin+ 111 var tierData = 'minTierBreak='+$scope.tr[index].minTierBreak+'&maxTierBreak='+$scope.tr[index].maxTierBreak+'&margin='+$scope.tr[index].margin+
112 '&marginTotal='+$scope.tr[index].marginTotal+'&marginTemplateId='+$scope.tr[index].marginTemplateId; 112 '&marginTotal='+$scope.tr[index].marginTotal+'&marginTemplateId='+$scope.tr[index].marginTemplateId;
113 113
114 updateFuelManagerService.addNewTier(tierData).then(function(result) { 114 updateFuelManagerService.addNewTier(tierData).then(function(result) {
115 toastr.success('Successfully Added', { 115 toastr.success('Successfully Added', {
116 closeButton: true 116 closeButton: true
117 }) 117 })
118 vtrData[index].minTierBreak = ''; 118 vtrData[index].minTierBreak = '';
119 vtrData[index].maxTierBreak = ''; 119 vtrData[index].maxTierBreak = '';
120 vtrData[index].margin = ''; 120 vtrData[index].margin = '';
121 updateFuelManagerService.getJetTiers(id).then(function(tiers) { 121 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
122 $scope.vTypeJets[index].tierList = tiers; 122 $scope.vTypeJets[index].tierList = tiers;
123 $scope.showLoader = false; 123 $scope.showLoader = false;
124 }) 124 })
125 }) 125 })
126 } 126 }
127 127
128 $scope.editTier = function(tier, index){ 128 $scope.editTier = function(tier, index){
129 $scope.showLoader = true; 129 $scope.showLoader = true;
130 var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+ 130 var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+
131 '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id; 131 '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id;
132 132
133 updateFuelManagerService.editTier(editTierData).then(function(result) { 133 updateFuelManagerService.editTier(editTierData).then(function(result) {
134 toastr.success('Successfully Updated', { 134 toastr.success('Successfully Updated', {
135 closeButton: true 135 closeButton: true
136 }) 136 })
137 updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) { 137 updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) {
138 $scope.aTypeJets[index].tierList = tiers; 138 $scope.aTypeJets[index].tierList = tiers;
139 $scope.showLoader = false; 139 $scope.showLoader = false;
140 }) 140 })
141 }) 141 })
142 142
143 } 143 }
144 144
145 $scope.editVtypeTier = function(tier, index){ 145 $scope.editVtypeTier = function(tier, index){
146 $scope.showLoader = true; 146 $scope.showLoader = true;
147 var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+ 147 var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+
148 '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id; 148 '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id;
149 149
150 updateFuelManagerService.editTier(editTierData).then(function(result) { 150 updateFuelManagerService.editTier(editTierData).then(function(result) {
151 toastr.success('Successfully Updated', { 151 toastr.success('Successfully Updated', {
152 closeButton: true 152 closeButton: true
153 }) 153 })
154 updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) { 154 updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) {
155 $scope.vTypeJets[index].tierList = tiers; 155 $scope.vTypeJets[index].tierList = tiers;
156 $scope.showLoader = false; 156 $scope.showLoader = false;
157 }) 157 })
158 }) 158 })
159 159
160 } 160 }
161 161
162 $scope.deleteTierObject = {}; 162 $scope.deleteTierObject = {};
163 $scope.deleteTier = function(id, jetid, index){ 163 $scope.deleteTier = function(id, jetid, index){
164 $scope.deleteTierObject.id = id; 164 $scope.deleteTierObject.id = id;
165 $scope.deleteTierObject.jetId = jetid; 165 $scope.deleteTierObject.jetId = jetid;
166 $scope.deleteTierObject.index = index; 166 $scope.deleteTierObject.index = index;
167 $('#deleteTierConfirm').css('display', 'block'); 167 $('#deleteTierConfirm').css('display', 'block');
168 } 168 }
169 169
170 $scope.confirmDeleteTier = function(){ 170 $scope.confirmDeleteTier = function(){
171 $scope.showLoader = true; 171 $scope.showLoader = true;
172 updateFuelManagerService.deleteTier($scope.deleteTierObject.id).then(function(result) { 172 updateFuelManagerService.deleteTier($scope.deleteTierObject.id).then(function(result) {
173 toastr.success(''+result.success+'', { 173 toastr.success(''+result.success+'', {
174 closeButton: true 174 closeButton: true
175 }) 175 })
176 updateFuelManagerService.getJetTiers($scope.deleteTierObject.jetId).then(function(tiers) { 176 updateFuelManagerService.getJetTiers($scope.deleteTierObject.jetId).then(function(tiers) {
177 $scope.aTypeJets[$scope.deleteTierObject.index].tierList = tiers; 177 $scope.aTypeJets[$scope.deleteTierObject.index].tierList = tiers;
178 $scope.showLoader = false; 178 $scope.showLoader = false;
179 $scope.deleteTierObject = {}; 179 $scope.deleteTierObject = {};
180 }) 180 })
181 }) 181 })
182 $('#deleteTierConfirm').css('display', 'none'); 182 $('#deleteTierConfirm').css('display', 'none');
183 } 183 }
184 184
185 $scope.cancelTierDelete = function(){ 185 $scope.cancelTierDelete = function(){
186 console.log('cancel'); 186 console.log('cancel');
187 $('#deleteTierConfirm').css('display', 'none'); 187 $('#deleteTierConfirm').css('display', 'none');
188 $scope.deleteTierObject = {}; 188 $scope.deleteTierObject = {};
189 } 189 }
190 190
191 /*$scope.deleteVtypeTier = function(id, jetid, index){ 191 /*$scope.deleteVtypeTier = function(id, jetid, index){
192 $scope.showLoader = true; 192 $scope.showLoader = true;
193 updateFuelManagerService.deleteTier(id).then(function(result) { 193 updateFuelManagerService.deleteTier(id).then(function(result) {
194 toastr.success(''+result.success+'', { 194 toastr.success(''+result.success+'', {
195 closeButton: true 195 closeButton: true
196 }) 196 })
197 updateFuelManagerService.getJetTiers(jetid).then(function(tiers) { 197 updateFuelManagerService.getJetTiers(jetid).then(function(tiers) {
198 $scope.vTypeJets[index].tierList = tiers; 198 $scope.vTypeJets[index].tierList = tiers;
199 $scope.showLoader = false; 199 $scope.showLoader = false;
200 }) 200 })
201 }) 201 })
202 }*/ 202 }*/
203 203
204 $scope.deleteVtypeTierObject = {}; 204 $scope.deleteVtypeTierObject = {};
205 $scope.deleteVtypeTier = function(id, jetid, index){ 205 $scope.deleteVtypeTier = function(id, jetid, index){
206 $scope.deleteVtypeTierObject.id = id; 206 $scope.deleteVtypeTierObject.id = id;
207 $scope.deleteVtypeTierObject.jetId = jetid; 207 $scope.deleteVtypeTierObject.jetId = jetid;
208 $scope.deleteVtypeTierObject.index = index; 208 $scope.deleteVtypeTierObject.index = index;
209 $('#deleteVtypeTierConfirm').css('display', 'block'); 209 $('#deleteVtypeTierConfirm').css('display', 'block');
210 } 210 }
211 211
212 $scope.confirmDeleteVtypeTier = function(){ 212 $scope.confirmDeleteVtypeTier = function(){
213 $scope.showLoader = true; 213 $scope.showLoader = true;
214 updateFuelManagerService.deleteTier($scope.deleteVtypeTierObject.id).then(function(result) { 214 updateFuelManagerService.deleteTier($scope.deleteVtypeTierObject.id).then(function(result) {
215 toastr.success(''+result.success+'', { 215 toastr.success(''+result.success+'', {
216 closeButton: true 216 closeButton: true
217 }) 217 })
218 updateFuelManagerService.getJetTiers($scope.deleteVtypeTierObject.jetId).then(function(tiers) { 218 updateFuelManagerService.getJetTiers($scope.deleteVtypeTierObject.jetId).then(function(tiers) {
219 $scope.vTypeJets[$scope.deleteVtypeTierObject.index].tierList = tiers; 219 $scope.vTypeJets[$scope.deleteVtypeTierObject.index].tierList = tiers;
220 $scope.showLoader = false; 220 $scope.showLoader = false;
221 $scope.deleteVtypeTierObject = {}; 221 $scope.deleteVtypeTierObject = {};
222 }) 222 })
223 }) 223 })
224 $('#deleteVtypeTierConfirm').css('display', 'none'); 224 $('#deleteVtypeTierConfirm').css('display', 'none');
225 } 225 }
226 226
227 $scope.cancelVtypeTierDelete = function(){ 227 $scope.cancelVtypeTierDelete = function(){
228 console.log('cancel'); 228 console.log('cancel');
229 $('#deleteVtypeTierConfirm').css('display', 'none'); 229 $('#deleteVtypeTierConfirm').css('display', 'none');
230 $scope.deleteVtypeTierObject = {}; 230 $scope.deleteVtypeTierObject = {};
231 } 231 }
232 232
233 $scope.saveJetAccordian = function(jets){ 233 $scope.saveJetAccordian = function(jets){
234 $scope.showLoader = true; 234 $scope.showLoader = true;
235 $scope.jetsDetail = jets; 235 $scope.jetsDetail = jets;
236 $scope.jetsDetail.userProfileId = $scope.userProfileId; 236 $scope.jetsDetail.userProfileId = $scope.userProfileId;
237 //console.log('jets', $scope.jetsDetail); 237 //console.log('jets', $scope.jetsDetail);
238 $('.'+$scope.jetsDetail.id).slideUp(); 238 $('.'+$scope.jetsDetail.id).slideUp();
239 $('#'+$scope.jetsDetail.id).removeClass('customActive'); 239 $('#'+$scope.jetsDetail.id).removeClass('customActive');
240 $('#'+$scope.jetsDetail.id+' select, #'+$scope.jetsDetail.id+' input').prop("disabled", true); 240 $('#'+$scope.jetsDetail.id+' select, #'+$scope.jetsDetail.id+' input').prop("disabled", true);
241 $('#'+$scope.jetsDetail.id+' .btn-success, #'+$scope.jetsDetail.id+' .btn-danger').css('display', 'none'); 241 $('#'+$scope.jetsDetail.id+' .btn-success, #'+$scope.jetsDetail.id+' .btn-danger').css('display', 'none');
242 $('#'+$scope.jetsDetail.id+' .btn-default').css('display', 'inline-block'); 242 $('#'+$scope.jetsDetail.id+' .btn-default').css('display', 'inline-block');
243 $('#'+$scope.jetsDetail.id+' .btn-primary').css('display', 'inline-block'); 243 $('#'+$scope.jetsDetail.id+' .btn-primary').css('display', 'inline-block');
244 244
245 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+'&message='+$scope.jetsDetail.message; 245 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+'&message='+$scope.jetsDetail.message;
246 246
247 updateFuelManagerService.editAtypeJetMargin(editJetData).then(function(result) { 247 updateFuelManagerService.editAtypeJetMargin(editJetData).then(function(result) {
248 console.log('newJet', editJetData); 248 console.log('newJet', editJetData);
249 toastr.success('Successfully Updated', { 249 toastr.success('Successfully Updated', {
250 closeButton: true 250 closeButton: true
251 }) 251 })
252 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { 252 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
253 console.log('result', result); 253 console.log('result', result);
254 $scope.aTypeJets = result; 254 $scope.aTypeJets = result;
255 $scope.showLoader = false; 255 $scope.showLoader = false;
256 }) 256 })
257 }) 257 })
258 258
259 } 259 }
260 260
261 $scope.closeAccordian = function(jets){ 261 $scope.closeAccordian = function(jets){
262 $('.'+jets.id).slideUp(); 262 $('.'+jets.id).slideUp();
263 $('#'+jets.id).removeClass('customActive'); 263 $('#'+jets.id).removeClass('customActive');
264 $('#'+jets.id+' select, #'+jets.id+' input').prop("disabled", true); 264 $('#'+jets.id+' select, #'+jets.id+' input').prop("disabled", true);
265 $('#'+jets.id+' .btn-success, #'+jets.id+' .btn-danger').css('display', 'none'); 265 $('#'+jets.id+' .btn-success, #'+jets.id+' .btn-danger').css('display', 'none');
266 $('#'+jets.id+' .btn-default').css('display', 'inline-block'); 266 $('#'+jets.id+' .btn-default').css('display', 'inline-block');
267 $('#'+jets.id+' .btn-primary').css('display', 'inline-block'); 267 $('#'+jets.id+' .btn-primary').css('display', 'inline-block');
268 } 268 }
269 269
270 $scope.closeAccordianVtype = function(jets){ 270 $scope.closeAccordianVtype = function(jets){
271 $('.'+jets.id).slideUp(); 271 $('.'+jets.id).slideUp();
272 $('#'+jets.id).removeClass('customActive'); 272 $('#'+jets.id).removeClass('customActive');
273 $('#'+jets.id+' select, #'+jets.id+' input').prop("disabled", true); 273 $('#'+jets.id+' select, #'+jets.id+' input').prop("disabled", true);
274 $('#'+jets.id+' .btn-success, #'+jets.id+' .btn-danger').css('display', 'none'); 274 $('#'+jets.id+' .btn-success, #'+jets.id+' .btn-danger').css('display', 'none');
275 $('#'+jets.id+' .btn-default').css('display', 'inline-block'); 275 $('#'+jets.id+' .btn-default').css('display', 'inline-block');
276 $('#'+jets.id+' .btn-primary').css('display', 'inline-block'); 276 $('#'+jets.id+' .btn-primary').css('display', 'inline-block');
277 } 277 }
278 278
279 $scope.saveVtypeJetAccordian = function(jets){ 279 $scope.saveVtypeJetAccordian = function(jets){
280 $scope.showLoader = true; 280 $scope.showLoader = true;
281 $scope.jetsDetail = jets; 281 $scope.jetsDetail = jets;
282 $scope.jetsDetail.userProfileId = $scope.userProfileId; 282 $scope.jetsDetail.userProfileId = $scope.userProfileId;
283 //console.log('jets', $scope.jetsDetail); 283 //console.log('jets', $scope.jetsDetail);
284 $('.'+$scope.jetsDetail.id).slideUp(); 284 $('.'+$scope.jetsDetail.id).slideUp();
285 $('#'+$scope.jetsDetail.id).removeClass('customActive'); 285 $('#'+$scope.jetsDetail.id).removeClass('customActive');
286 $('#'+$scope.jetsDetail.id+' select, #'+$scope.jetsDetail.id+' input').prop("disabled", true); 286 $('#'+$scope.jetsDetail.id+' select, #'+$scope.jetsDetail.id+' input').prop("disabled", true);
287 $('#'+$scope.jetsDetail.id+' .btn-success, #'+$scope.jetsDetail.id+' .btn-danger').css('display', 'none'); 287 $('#'+$scope.jetsDetail.id+' .btn-success, #'+$scope.jetsDetail.id+' .btn-danger').css('display', 'none');
288 $('#'+$scope.jetsDetail.id+' .btn-default').css('display', 'inline-block'); 288 $('#'+$scope.jetsDetail.id+' .btn-default').css('display', 'inline-block');
289 $('#'+jets.id+' .btn-primary').css('display', 'inline-block'); 289 $('#'+jets.id+' .btn-primary').css('display', 'inline-block');
290 290
291 var editVtypeJetData = 'productType='+$scope.jetsDetail.productType+'&marginName='+$scope.jetsDetail.marginName+'&pricingStructure='+$scope.jetsDetail.pricingStructure+'&marginValue='+$scope.jetsDetail.marginValue+'&userProfileId='+$scope.jetsDetail.userProfileId+'&marginId='+$scope.jetsDetail.id+'&message='+$scope.jetsDetail.message; 291 var editVtypeJetData = 'productType='+$scope.jetsDetail.productType+'&marginName='+$scope.jetsDetail.marginName+'&pricingStructure='+$scope.jetsDetail.pricingStructure+'&marginValue='+$scope.jetsDetail.marginValue+'&userProfileId='+$scope.jetsDetail.userProfileId+'&marginId='+$scope.jetsDetail.id+'&message='+$scope.jetsDetail.message;
292 292
293 updateFuelManagerService.editVtypeJetMargin(editVtypeJetData).then(function(result) { 293 updateFuelManagerService.editVtypeJetMargin(editVtypeJetData).then(function(result) {
294 console.log('newJet', editVtypeJetData); 294 console.log('newJet', editVtypeJetData);
295 toastr.success('Successfully Updated', { 295 toastr.success('Successfully Updated', {
296 closeButton: true 296 closeButton: true
297 }) 297 })
298 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) { 298 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) {
299 $scope.vTypeJets = result; 299 $scope.vTypeJets = result;
300 console.log('second jets', result); 300 console.log('second jets', result);
301 $scope.showLoader = false; 301 $scope.showLoader = false;
302 }) 302 })
303 }) 303 })
304 304
305 } 305 }
306 306
307 $scope.newJet = {}; 307 $scope.newJet = {};
308 308
309 $scope.addNewMarginBtn = function(){ 309 $scope.addNewMarginBtn = function(){
310 $('.addNewMargin').css('display', 'block'); 310 $('.addNewMargin').css('display', 'block');
311 } 311 }
312 $scope.closeMarginPopup = function(){ 312 $scope.closeMarginPopup = function(){
313 $('.addNewMargin').css('display', 'none'); 313 $('.addNewMargin').css('display', 'none');
314 $scope.newJet = {}; 314 $scope.newJet = {};
315 } 315 }
316 316
317 //$scope.newJet.productType = ''; 317 //$scope.newJet.productType = '';
318 318
319 $scope.addNewATypeJet = function(){ 319 $scope.addNewATypeJet = function(){
320 $scope.showLoader = true; 320 $scope.showLoader = true;
321 $scope.newJet.productType = 'JET-A'; 321 $scope.newJet.productType = 'JET-A';
322 $scope.newJet.userProfileId = $scope.userProfileId; 322 $scope.newJet.userProfileId = $scope.userProfileId;
323 323
324 var jetData = 'productType='+$scope.newJet.productType+'&marginName='+$scope.newJet.marginName+'&pricingStructure='+$scope.newJet.pricingStructure+'&marginValue='+$scope.newJet.marginValue+'&userProfileId='+$scope.newJet.userProfileId+'&message='+$scope.newJet.message; 324 var jetData = 'productType='+$scope.newJet.productType+'&marginName='+$scope.newJet.marginName+'&pricingStructure='+$scope.newJet.pricingStructure+'&marginValue='+$scope.newJet.marginValue+'&userProfileId='+$scope.newJet.userProfileId+'&message='+$scope.newJet.message;
325 325
326 updateFuelManagerService.addNewAtypeJetMargin(jetData).then(function(result) { 326 updateFuelManagerService.addNewAtypeJetMargin(jetData).then(function(result) {
327 console.log('newJet', jetData); 327 console.log('newJet', jetData);
328 toastr.success('Successfully Added', { 328 toastr.success('Successfully Added', {
329 closeButton: true 329 closeButton: true
330 }) 330 })
331 $('.addNewMargin').css('display', 'none'); 331 $('.addNewMargin').css('display', 'none');
332 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { 332 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
333 console.log('result', result); 333 console.log('result', result);
334 $scope.aTypeJets = result; 334 $scope.aTypeJets = result;
335 $scope.showLoader = false; 335 $scope.showLoader = false;
336 }) 336 })
337 }) 337 })
338 } 338 }
339 339
340 $scope.newVtypeJet = {}; 340 $scope.newVtypeJet = {};
341 341
342 $scope.addNewVtypePop = function(){ 342 $scope.addNewVtypePop = function(){
343 $('.addNewVtype').css('display', 'block'); 343 $('.addNewVtype').css('display', 'block');
344 } 344 }
345 $scope.closeNewVtypePop = function(){ 345 $scope.closeNewVtypePop = function(){
346 $('.addNewVtype').css('display', 'none'); 346 $('.addNewVtype').css('display', 'none');
347 $scope.newVtypeJet = {}; 347 $scope.newVtypeJet = {};
348 } 348 }
349 349
350 $scope.addNewVTypeJet = function(){ 350 $scope.addNewVTypeJet = function(){
351 $scope.showLoader = true; 351 $scope.showLoader = true;
352 $scope.newVtypeJet.productType = 'AVGAS'; 352 $scope.newVtypeJet.productType = 'AVGAS';
353 $scope.newVtypeJet.userProfileId = $scope.userProfileId; 353 $scope.newVtypeJet.userProfileId = $scope.userProfileId;
354 354
355 var vJetData = 'productType='+$scope.newVtypeJet.productType+'&marginName='+$scope.newVtypeJet.marginName+'&pricingStructure='+$scope.newVtypeJet.pricingStructure+'&marginValue='+$scope.newVtypeJet.marginValue+'&userProfileId='+$scope.newVtypeJet.userProfileId+'&message='+$scope.newVtypeJet.message; 355 var vJetData = 'productType='+$scope.newVtypeJet.productType+'&marginName='+$scope.newVtypeJet.marginName+'&pricingStructure='+$scope.newVtypeJet.pricingStructure+'&marginValue='+$scope.newVtypeJet.marginValue+'&userProfileId='+$scope.newVtypeJet.userProfileId+'&message='+$scope.newVtypeJet.message;
356 356
357 updateFuelManagerService.addNewVtypeJet(vJetData).then(function(result) { 357 updateFuelManagerService.addNewVtypeJet(vJetData).then(function(result) {
358 358
359 toastr.success('Successfully Added', { 359 toastr.success('Successfully Added', {
360 closeButton: true 360 closeButton: true
361 }) 361 })
362 $('.addNewVtype').css('display', 'none'); 362 $('.addNewVtype').css('display', 'none');
363 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) { 363 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) {
364 $scope.vTypeJets = result; 364 $scope.vTypeJets = result;
365 $scope.showLoader = false; 365 $scope.showLoader = false;
366 }) 366 })
367 }) 367 })
368 368
369 } 369 }
370 370
371 $scope.emailForMargin; 371 $scope.emailForMargin;
372 $scope.emailPricingForMargin = function(value){ 372 $scope.emailPricingForMargin = function(value){
373 $('#confirm2').css('display', 'block'); 373 $('#confirm2').css('display', 'block');
374 $scope.emailForMargin = value; 374 $scope.emailForMargin = value;
375 375
376 } 376 }
377 $scope.saveAndCloseForMarginConfirm = function(){ 377 $scope.saveAndCloseForMarginConfirm = function(){
378 $('#confirm2').css('display', 'none'); 378 $('#confirm2').css('display', 'none');
379 updateFuelManagerService.sendMailToMargin($scope.emailForMargin).then(function(result) { 379 updateFuelManagerService.sendMailToMargin($scope.emailForMargin).then(function(result) {
380 toastr.success(''+result.success+'', { 380 toastr.success(''+result.success+'', {
381 closeButton: true 381 closeButton: true
382 }) 382 })
383 }) 383 })
384 } 384 }
385 $scope.cancelAndCloseForMarginConfirm = function(){ 385 $scope.cancelAndCloseForMarginConfirm = function(){
386 $('#confirm2').css('display', 'none'); 386 $('#confirm2').css('display', 'none');
387 } 387 }
388 388
389 $scope.sendEmail = {}; 389 $scope.sendEmail = {};
390 390
391 $scope.confirmMail = function(){ 391 $scope.confirmMail = function(){
392 if ($scope.sendEmail.pricing != '' && $scope.sendEmail.pricing != null && $scope.sendEmail.pricing != undefined) { 392 if ($scope.sendEmail.pricing != '' && $scope.sendEmail.pricing != null && $scope.sendEmail.pricing != undefined) {
393 $('#confirm1').css('display', 'block'); 393 $('#confirm1').css('display', 'block');
394 } 394 }
395 } 395 }
396 396
397 $scope.saveAndCloseConfirm = function(){ 397 $scope.saveAndCloseConfirm = function(){
398 $('#confirm1').css('display', 'none'); 398 $('#confirm1').css('display', 'none');
399 updateFuelManagerService.sendMailToGroupMargin($scope.sendEmail.pricing).then(function(result) { 399 updateFuelManagerService.sendMailToGroupMargin($scope.sendEmail.pricing).then(function(result) {
400 toastr.success(''+result.success+'', { 400 toastr.success(''+result.success+'', {
401 closeButton: true 401 closeButton: true
402 }) 402 })
403 }) 403 })
404 } 404 }
405 $scope.cancelAndCloseConfirm = function(){ 405 $scope.cancelAndCloseConfirm = function(){
406 $scope.sendEmail = {}; 406 $scope.sendEmail = {};
407 $scope.sendEmail.pricing = ''; 407 $scope.sendEmail.pricing = '';
408 $('#confirm1').css('display', 'none'); 408 $('#confirm1').css('display', 'none');
409 } 409 }
410 410
411 $scope.newFuelPricing = {}; 411 $scope.newFuelPricing = {};
412 $scope.holdFuelPricing = {}; 412 $scope.holdFuelPricing = {};
413 updateFuelManagerService.getFuelPricingNew().then(function(result) { 413 updateFuelManagerService.getFuelPricingNew().then(function(result) {
414 $scope.newFuelPricing = result; 414 $scope.newFuelPricing = result;
415 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 415 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
416 if ($scope.newFuelPricing[i].fuelPricing != null) { 416 if ($scope.newFuelPricing[i].fuelPricing != null) {
417 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 417 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
418 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 418 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
419 var month = newTime.getUTCMonth() + 1; //months from 1-12 419 var month = newTime.getUTCMonth() + 1; //months from 1-12
420 var day = newTime.getUTCDate(); 420 var day = newTime.getUTCDate();
421 var year = newTime.getUTCFullYear(); 421 var year = newTime.getUTCFullYear();
422 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 422 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
423 } 423 }
424 } 424 }
425 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 425 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
426 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 426 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
427 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 427 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
428 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 428 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
429 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 429 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
430 var nextDay = newTime.getUTCDate(); 430 var nextDay = newTime.getUTCDate();
431 var nextYear = newTime.getUTCFullYear(); 431 var nextYear = newTime.getUTCFullYear();
432 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 432 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
433 } 433 }
434 } 434 }
435 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 435 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
436 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 436 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
437 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 437 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
438 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 438 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
439 var dday = newTime.getUTCDate(); 439 var dday = newTime.getUTCDate();
440 var dyear = newTime.getUTCFullYear(); 440 var dyear = newTime.getUTCFullYear();
441 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 441 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
442 } 442 }
443 } 443 }
444 } 444 }
445 445
446 var str =""+ $scope.newFuelPricing[i].name 446 var str =""+ $scope.newFuelPricing[i].name
447 if(str.startsWith("J")){ 447 if(str.startsWith("J")){
448 $scope.newFuelPricing[i].jeta = true; 448 $scope.newFuelPricing[i].jeta = true;
449 var str1 = str.substring(0,5) 449 var str1 = str.substring(0,5)
450 var str2 = str.substring(6, str.length) 450 var str2 = str.substring(6, str.length)
451 $scope.newFuelPricing[i].name = str1 451 $scope.newFuelPricing[i].name = str1
452 $scope.newFuelPricing[i].namejetrest = str2 452 $scope.newFuelPricing[i].namejetrest = str2
453 453
454 454
455 }else if(str.startsWith("100")){ 455 }else if(str.startsWith("100")){
456 $scope.newFuelPricing[i].avgas = true; 456 $scope.newFuelPricing[i].avgas = true;
457 var str1 = str.substring(0,5) 457 var str1 = str.substring(0,5)
458 var str2 = str.substring(6, str.length) 458 var str2 = str.substring(6, str.length)
459 $scope.newFuelPricing[i].name = str1 459 $scope.newFuelPricing[i].name = str1
460 $scope.newFuelPricing[i].nameavgasrest = str2 460 $scope.newFuelPricing[i].nameavgasrest = str2
461 } 461 }
462 } 462 }
463 463
464 for (var i = 0; i<result.length; i++) { 464 for (var i = 0; i<result.length; i++) {
465 if (result[i].fuelPricing != null) { 465 if (result[i].fuelPricing != null) {
466 if (result[i].fuelPricing.expirationDate != null && result[i].fuelPricing.expirationDate != '') { 466 if (result[i].fuelPricing.expirationDate != null && result[i].fuelPricing.expirationDate != '') {
467 var newTime = new Date(result[i].fuelPricing.expirationDate); 467 var newTime = new Date(result[i].fuelPricing.expirationDate);
468 var month = newTime.getUTCMonth() + 1; //months from 1-12 468 var month = newTime.getUTCMonth() + 1; //months from 1-12
469 var day = newTime.getUTCDate(); 469 var day = newTime.getUTCDate();
470 var year = newTime.getUTCFullYear(); 470 var year = newTime.getUTCFullYear();
471 result[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 471 result[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
472 } 472 }
473 } 473 }
474 if (result[i].futureFuelPricing != null) { 474 if (result[i].futureFuelPricing != null) {
475 if (result[i].futureFuelPricing != null) { 475 if (result[i].futureFuelPricing != null) {
476 if (result[i].futureFuelPricing.nextExpiration != null && result[i].futureFuelPricing.nextExpiration != '') { 476 if (result[i].futureFuelPricing.nextExpiration != null && result[i].futureFuelPricing.nextExpiration != '') {
477 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 477 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
478 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 478 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
479 var nextDay = newTime.getUTCDate(); 479 var nextDay = newTime.getUTCDate();
480 var nextYear = newTime.getUTCFullYear(); 480 var nextYear = newTime.getUTCFullYear();
481 result[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 481 result[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
482 } 482 }
483 } 483 }
484 if (result[i].futureFuelPricing != null) { 484 if (result[i].futureFuelPricing != null) {
485 if (result[i].futureFuelPricing.deployDate != null && result[i].futureFuelPricing.deployDate != '') { 485 if (result[i].futureFuelPricing.deployDate != null && result[i].futureFuelPricing.deployDate != '') {
486 var newTime = new Date(result[i].futureFuelPricing.deployDate); 486 var newTime = new Date(result[i].futureFuelPricing.deployDate);
487 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 487 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
488 var dday = newTime.getUTCDate(); 488 var dday = newTime.getUTCDate();
489 var dyear = newTime.getUTCFullYear(); 489 var dyear = newTime.getUTCFullYear();
490 result[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 490 result[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
491 } 491 }
492 } 492 }
493 } 493 }
494 } 494 }
495 495
496 $scope.holdFuelPricing = result; 496 $scope.holdFuelPricing = result;
497 $scope.showLoader = false; 497 $scope.showLoader = false;
498 498
499 }) 499 })
500 $scope.$watch("fuelPricing.fuelPricing.expirationDate",function(old,newv){ 500 $scope.$watch("fuelPricing.fuelPricing.expirationDate",function(old,newv){
501 }); 501 });
502 $scope.updateFuelPricing = {}; 502 $scope.updateFuelPricing = {};
503 $scope.updateFuelPricing.fuelPricingList = []; 503 $scope.updateFuelPricing.fuelPricingList = [];
504 $scope.updateFuelPricing.userProfileId = $scope.userProfileId; 504 $scope.updateFuelPricing.userProfileId = $scope.userProfileId;
505 $scope.updateFuelPricingClick = function(){ 505 $scope.updateFuelPricingClick = function(){
506 $scope.showLoader = true; 506 $scope.showLoader = true;
507 507
508 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 508 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
509 if ($scope.newFuelPricing[i].fuelPricing != null) { 509 if ($scope.newFuelPricing[i].fuelPricing != null) {
510 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); 510 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin);
511 if ($scope.newFuelPricing[i].fuelPricing.cost == null) { 511 if ($scope.newFuelPricing[i].fuelPricing.cost == null) {
512 $scope.newFuelPricing[i].fuelPricing.cost = ''; 512 $scope.newFuelPricing[i].fuelPricing.cost = '';
513 } 513 }
514 if ($scope.newFuelPricing[i].fuelPricing.papMargin == null) { 514 if ($scope.newFuelPricing[i].fuelPricing.papMargin == null) {
515 $scope.newFuelPricing[i].fuelPricing.papMargin = ''; 515 $scope.newFuelPricing[i].fuelPricing.papMargin = '';
516 } 516 }
517 if ($scope.newFuelPricing[i].fuelPricing.papTotal == null) { 517 if ($scope.newFuelPricing[i].fuelPricing.papTotal == null) {
518 $scope.newFuelPricing[i].fuelPricing.papTotal = ''; 518 $scope.newFuelPricing[i].fuelPricing.papTotal = '';
519 } 519 }
520 if ($scope.newFuelPricing[i].fuelPricing.expirationDate == null) { 520 if ($scope.newFuelPricing[i].fuelPricing.expirationDate == null) {
521 $scope.newFuelPricing[i].fuelPricing.expirationDate = ''; 521 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';
522 }else{ 522 }else{
523 $scope.newFuelPricing[i].fuelPricing.expirationDate = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 523 $scope.newFuelPricing[i].fuelPricing.expirationDate = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
524 console.log('$scope.newFuelPricing[i].fuelPricing.expirationDate', $scope.newFuelPricing[i].fuelPricing.expirationDate); 524 console.log('$scope.newFuelPricing[i].fuelPricing.expirationDate', $scope.newFuelPricing[i].fuelPricing.expirationDate);
525 $scope.newFuelPricing[i].fuelPricing.expirationDate = $scope.newFuelPricing[i].fuelPricing.expirationDate.getTime(); 525 $scope.newFuelPricing[i].fuelPricing.expirationDate = $scope.newFuelPricing[i].fuelPricing.expirationDate.getTime();
526 } 526 }
527 527
528 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); 528 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin);
529 $scope.updateFuelPricing.fuelPricingList.push({ 529 $scope.updateFuelPricing.fuelPricingList.push({
530 'cost': $scope.newFuelPricing[i].fuelPricing.cost, 530 'cost': $scope.newFuelPricing[i].fuelPricing.cost,
531 'papMargin': $scope.newFuelPricing[i].fuelPricing.papMargin, 531 'papMargin': $scope.newFuelPricing[i].fuelPricing.papMargin,
532 'papTotal': $scope.newFuelPricing[i].fuelPricing.papTotal, 532 'papTotal': $scope.newFuelPricing[i].fuelPricing.papTotal,
533 'expirationDate': $scope.newFuelPricing[i].fuelPricing.expirationDate, 533 'expirationDate': $scope.newFuelPricing[i].fuelPricing.expirationDate,
534 'productId': $scope.newFuelPricing[i].id, 534 'productId': $scope.newFuelPricing[i].id,
535 'id': $scope.newFuelPricing[i].fuelPricing.id, 535 'id': $scope.newFuelPricing[i].fuelPricing.id,
536 }) 536 })
537 537
538 }else{ 538 }else{
539 /*$scope.newFuelPricing[i].fuelPricing.cost = ''; 539 /*$scope.newFuelPricing[i].fuelPricing.cost = '';
540 $scope.newFuelPricing[i].fuelPricing.papMargin = ''; 540 $scope.newFuelPricing[i].fuelPricing.papMargin = '';
541 $scope.newFuelPricing[i].fuelPricing.papTotal = ''; 541 $scope.newFuelPricing[i].fuelPricing.papTotal = '';
542 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';*/ 542 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';*/
543 } 543 }
544 544
545 } 545 }
546 updateFuelManagerService.updateFuelPricing($scope.updateFuelPricing).then(function(result) { 546 updateFuelManagerService.updateFuelPricing($scope.updateFuelPricing).then(function(result) {
547 toastr.success('Successfully Updated', { 547 toastr.success('Successfully Updated', {
548 closeButton: true 548 closeButton: true
549 }) 549 })
550 updateFuelManagerService.getFuelPricingNew().then(function(result) { 550 updateFuelManagerService.getFuelPricingNew().then(function(result) {
551 $scope.newFuelPricing = result; 551 $scope.newFuelPricing = result;
552 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 552 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
553 if ($scope.newFuelPricing[i].fuelPricing != null) { 553 if ($scope.newFuelPricing[i].fuelPricing != null) {
554 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 554 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
555 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 555 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
556 var month = newTime.getUTCMonth() + 1; //months from 1-12 556 var month = newTime.getUTCMonth() + 1; //months from 1-12
557 var day = newTime.getUTCDate(); 557 var day = newTime.getUTCDate();
558 var year = newTime.getUTCFullYear(); 558 var year = newTime.getUTCFullYear();
559 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 559 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
560 } 560 }
561 } 561 }
562 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 562 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
563 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 563 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
564 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 564 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
565 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 565 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
566 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 566 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
567 var nextDay = newTime.getUTCDate(); 567 var nextDay = newTime.getUTCDate();
568 var nextYear = newTime.getUTCFullYear(); 568 var nextYear = newTime.getUTCFullYear();
569 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 569 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
570 } 570 }
571 } 571 }
572 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 572 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
573 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 573 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
574 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 574 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
575 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 575 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
576 var dday = newTime.getUTCDate(); 576 var dday = newTime.getUTCDate();
577 var dyear = newTime.getUTCFullYear(); 577 var dyear = newTime.getUTCFullYear();
578 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 578 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
579 } 579 }
580 } 580 }
581 } 581 }
582 } 582 }
583 583
584 $scope.showLoader = false; 584 $scope.showLoader = false;
585 }) 585 })
586 }) 586 })
587 587
588 } 588 }
589 589
590 $scope.updateFutureFuelPricing = {}; 590 $scope.updateFutureFuelPricing = {};
591 $scope.updateFutureFuelPricing.futureFuelPricingList = []; 591 $scope.updateFutureFuelPricing.futureFuelPricingList = [];
592 $scope.updateFutureFuelPricing.userProfileId = $scope.userProfileId; 592 $scope.updateFutureFuelPricing.userProfileId = $scope.userProfileId;
593 $scope.updateFutureFuelPricingClick = function(){ 593 $scope.updateFutureFuelPricingClick = function(){
594 $scope.showLoader = true; 594 $scope.showLoader = true;
595 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 595 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
596 //console.log(parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin)); 596 //console.log(parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin));
597 console.log('-----',$scope.newFuelPricing[i].futureFuelPricing);
597 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 598 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
598 if ($scope.newFuelPricing[i].futureFuelPricing.cost != null || $scope.newFuelPricing[i].futureFuelPricing.cost != '' || $scope.newFuelPricing[i].futureFuelPricing.cost != undefined) { 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 if ($scope.newFuelPricing[i].futureFuelPricing.cost == null) { 601 if ($scope.newFuelPricing[i].futureFuelPricing.cost == null) {
601 $scope.newFuelPricing[i].futureFuelPricing.cost = ''; 602 $scope.newFuelPricing[i].futureFuelPricing.cost = '';
602 } 603 }
603 if ($scope.newFuelPricing[i].futureFuelPricing.papMargin == null) { 604 if ($scope.newFuelPricing[i].futureFuelPricing.papMargin == null) {
604 $scope.newFuelPricing[i].futureFuelPricing.papMargin = ''; 605 $scope.newFuelPricing[i].futureFuelPricing.papMargin = '';
605 } 606 }
606 if ($scope.newFuelPricing[i].futureFuelPricing.papTotal == null) { 607 if ($scope.newFuelPricing[i].futureFuelPricing.papTotal == null) {
607 $scope.newFuelPricing[i].futureFuelPricing.papTotal = ''; 608 $scope.newFuelPricing[i].futureFuelPricing.papTotal = '';
608 } 609 }
609 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration == null) { 610 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration == null) {
610 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = ''; 611 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = '';
611 }else{ 612 }else{
612 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 613 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
613 console.log('$scope.newFuelPricing[i].futureFuelPricing.nextExpiration', $scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 614 console.log('$scope.newFuelPricing[i].futureFuelPricing.nextExpiration', $scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
614 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = $scope.newFuelPricing[i].futureFuelPricing.nextExpiration.getTime(); 615 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = $scope.newFuelPricing[i].futureFuelPricing.nextExpiration.getTime();
615 } 616 }
616 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate == null) { 617 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate == null) {
617 $scope.newFuelPricing[i].futureFuelPricing.deployDate = ''; 618 $scope.newFuelPricing[i].futureFuelPricing.deployDate = '';
618 }else{ 619 }else{
619 $scope.newFuelPricing[i].futureFuelPricing.deployDate = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 620 $scope.newFuelPricing[i].futureFuelPricing.deployDate = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
620 $scope.newFuelPricing[i].futureFuelPricing.deployDate = $scope.newFuelPricing[i].futureFuelPricing.deployDate.getTime(); 621 $scope.newFuelPricing[i].futureFuelPricing.deployDate = $scope.newFuelPricing[i].futureFuelPricing.deployDate.getTime();
621 } 622 }
622 623
623 $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].futureFuelPricing.papMargin); 624 $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].futureFuelPricing.papMargin);
624 //$scope.newFuelPricing[i].futureFuelPricing.papTotal; 625 //$scope.newFuelPricing[i].futureFuelPricing.papTotal;
625 $scope.updateFutureFuelPricing.futureFuelPricingList.push({ 626 $scope.updateFutureFuelPricing.futureFuelPricingList.push({
626 'cost': $scope.newFuelPricing[i].futureFuelPricing.cost, 627 'cost': $scope.newFuelPricing[i].futureFuelPricing.cost,
627 'papMargin': $scope.newFuelPricing[i].futureFuelPricing.papMargin, 628 'papMargin': $scope.newFuelPricing[i].futureFuelPricing.papMargin,
628 //'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal, 629 //'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal,
629 'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal, 630 'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal,
630 'expirationDate': $scope.newFuelPricing[i].futureFuelPricing.nextExpiration, 631 'expirationDate': $scope.newFuelPricing[i].futureFuelPricing.nextExpiration,
631 'deployDate': $scope.newFuelPricing[i].futureFuelPricing.deployDate, 632 'deployDate': $scope.newFuelPricing[i].futureFuelPricing.deployDate,
632 'productId': $scope.newFuelPricing[i].id, 633 'productId': $scope.newFuelPricing[i].id,
633 'id': $scope.newFuelPricing[i].futureFuelPricing.id, 634 'id': $scope.newFuelPricing[i].futureFuelPricing.id,
634 }) 635 })
635 } 636 }
636 }else{ 637 }else{
637 /*$scope.newFuelPricing[i].futureFuelPricing.cost = ''; 638 /*$scope.newFuelPricing[i].futureFuelPricing.cost = '';
638 $scope.newFuelPricing[i].futureFuelPricing.papMargin = ''; 639 $scope.newFuelPricing[i].futureFuelPricing.papMargin = '';
639 $scope.newFuelPricing[i].futureFuelPricing.papTotal = ''; 640 $scope.newFuelPricing[i].futureFuelPricing.papTotal = '';
640 $scope.newFuelPricing[i].futureFuelPricing.expirationDate = ''; 641 $scope.newFuelPricing[i].futureFuelPricing.expirationDate = '';
641 $scope.newFuelPricing[i].futureFuelPricing.deployDate = '';*/ 642 $scope.newFuelPricing[i].futureFuelPricing.deployDate = '';*/
642 } 643 }
643 } 644 }
644 //console.log('$scope.updateFutureFuelPricing', $scope.updateFutureFuelPricing); 645 //console.log('$scope.updateFutureFuelPricing', $scope.updateFutureFuelPricing);
645 updateFuelManagerService.updateFutureFuelPricing($scope.updateFutureFuelPricing).then(function(result) { 646 updateFuelManagerService.updateFutureFuelPricing($scope.updateFutureFuelPricing).then(function(result) {
646 toastr.success('Successfully Updated', { 647 toastr.success('Successfully Updated', {
647 closeButton: true 648 closeButton: true
648 }) 649 })
649 updateFuelManagerService.getFuelPricingNew().then(function(result) { 650 updateFuelManagerService.getFuelPricingNew().then(function(result) {
650 $scope.newFuelPricing = result; 651 $scope.newFuelPricing = result;
651 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 652 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
652 if ($scope.newFuelPricing[i].fuelPricing != null) { 653 if ($scope.newFuelPricing[i].fuelPricing != null) {
653 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 654 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
654 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 655 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
655 var month = newTime.getUTCMonth() + 1; //months from 1-12 656 var month = newTime.getUTCMonth() + 1; //months from 1-12
656 var day = newTime.getUTCDate(); 657 var day = newTime.getUTCDate();
657 var year = newTime.getUTCFullYear(); 658 var year = newTime.getUTCFullYear();
658 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 659 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
659 } 660 }
660 } 661 }
661 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 662 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
662 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 663 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
663 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 664 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
664 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 665 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
665 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 666 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
666 var nextDay = newTime.getUTCDate(); 667 var nextDay = newTime.getUTCDate();
667 var nextYear = newTime.getUTCFullYear(); 668 var nextYear = newTime.getUTCFullYear();
668 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 669 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
669 } 670 }
670 } 671 }
671 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 672 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
672 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 673 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
673 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 674 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
674 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 675 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
675 var dday = newTime.getUTCDate(); 676 var dday = newTime.getUTCDate();
676 var dyear = newTime.getUTCFullYear(); 677 var dyear = newTime.getUTCFullYear();
677 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 678 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
678 } 679 }
679 } 680 }
680 } 681 }
681 682
682 var str =""+ $scope.newFuelPricing[i].name 683 var str =""+ $scope.newFuelPricing[i].name
683 if(str.startsWith("J")){ 684 if(str.startsWith("J")){
684 $scope.newFuelPricing[i].jeta = true; 685 $scope.newFuelPricing[i].jeta = true;
685 var str1 = str.substring(0,5) 686 var str1 = str.substring(0,5)
686 var str2 = str.substring(6, str.length) 687 var str2 = str.substring(6, str.length)
687 $scope.newFuelPricing[i].name = str1 688 $scope.newFuelPricing[i].name = str1
688 $scope.newFuelPricing[i].namejetrest = str2 689 $scope.newFuelPricing[i].namejetrest = str2
689 690
690 691
691 }else if(str.startsWith("100")){ 692 }else if(str.startsWith("100")){
692 $scope.newFuelPricing[i].avgas = true; 693 $scope.newFuelPricing[i].avgas = true;
693 var str1 = str.substring(0,5) 694 var str1 = str.substring(0,5)
694 var str2 = str.substring(6, str.length) 695 var str2 = str.substring(6, str.length)
695 $scope.newFuelPricing[i].name = str1 696 $scope.newFuelPricing[i].name = str1
696 $scope.newFuelPricing[i].nameavgasrest = str2 697 $scope.newFuelPricing[i].nameavgasrest = str2
697 } 698 }
698 699
699 } 700 }
700 $scope.showLoader = false; 701 $scope.showLoader = false;
701 }) 702 })
702 }) 703 })
703 704
704 705
705 } 706 }
706 707
707 $scope.updateFutureFuelPricingImmediatelyClick = function(){ 708 $scope.updateFutureFuelPricingImmediatelyClick = function(){
708 $scope.showLoader = true; 709 $scope.showLoader = true;
709 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 710 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
710 //console.log(parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin)); 711 //console.log(parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin));
711 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 712 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
712 if ($scope.newFuelPricing[i].futureFuelPricing.cost != null || $scope.newFuelPricing[i].futureFuelPricing.cost != '' || $scope.newFuelPricing[i].futureFuelPricing.cost != undefined) { 713 if ($scope.newFuelPricing[i].futureFuelPricing.cost != null || $scope.newFuelPricing[i].futureFuelPricing.cost != '' || $scope.newFuelPricing[i].futureFuelPricing.cost != undefined) {
713 $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); 714 $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin);
714 if ($scope.newFuelPricing[i].futureFuelPricing.cost == null) { 715 if ($scope.newFuelPricing[i].futureFuelPricing.cost == null) {
715 $scope.newFuelPricing[i].futureFuelPricing.cost = ''; 716 $scope.newFuelPricing[i].futureFuelPricing.cost = '';
716 } 717 }
717 if ($scope.newFuelPricing[i].futureFuelPricing.papMargin == null) { 718 if ($scope.newFuelPricing[i].futureFuelPricing.papMargin == null) {
718 $scope.newFuelPricing[i].futureFuelPricing.papMargin = ''; 719 $scope.newFuelPricing[i].futureFuelPricing.papMargin = '';
719 } 720 }
720 if ($scope.newFuelPricing[i].futureFuelPricing.papTotal == null) { 721 if ($scope.newFuelPricing[i].futureFuelPricing.papTotal == null) {
721 $scope.newFuelPricing[i].futureFuelPricing.papTotal = ''; 722 $scope.newFuelPricing[i].futureFuelPricing.papTotal = '';
722 } 723 }
723 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration == null) { 724 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration == null) {
724 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = ''; 725 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = '';
725 }else{ 726 }else{
726 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 727 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
727 console.log('$scope.newFuelPricing[i].futureFuelPricing.nextExpiration', $scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 728 console.log('$scope.newFuelPricing[i].futureFuelPricing.nextExpiration', $scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
728 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = $scope.newFuelPricing[i].futureFuelPricing.nextExpiration.getTime(); 729 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = $scope.newFuelPricing[i].futureFuelPricing.nextExpiration.getTime();
729 } 730 }
730 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate == null) { 731 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate == null) {
731 $scope.newFuelPricing[i].futureFuelPricing.deployDate = ''; 732 $scope.newFuelPricing[i].futureFuelPricing.deployDate = '';
732 }else{ 733 }else{
733 $scope.newFuelPricing[i].futureFuelPricing.deployDate = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 734 $scope.newFuelPricing[i].futureFuelPricing.deployDate = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
734 $scope.newFuelPricing[i].futureFuelPricing.deployDate = $scope.newFuelPricing[i].futureFuelPricing.deployDate.getTime(); 735 $scope.newFuelPricing[i].futureFuelPricing.deployDate = $scope.newFuelPricing[i].futureFuelPricing.deployDate.getTime();
735 } 736 }
736 737
737 $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].futureFuelPricing.papMargin); 738 $scope.newFuelPricing[i].futureFuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].futureFuelPricing.cost) + parseFloat($scope.newFuelPricing[i].futureFuelPricing.papMargin);
738 //$scope.newFuelPricing[i].futureFuelPricing.papTotal; 739 //$scope.newFuelPricing[i].futureFuelPricing.papTotal;
739 $scope.updateFutureFuelPricing.futureFuelPricingList.push({ 740 $scope.updateFutureFuelPricing.futureFuelPricingList.push({
740 'cost': $scope.newFuelPricing[i].futureFuelPricing.cost, 741 'cost': $scope.newFuelPricing[i].futureFuelPricing.cost,
741 'papMargin': $scope.newFuelPricing[i].futureFuelPricing.papMargin, 742 'papMargin': $scope.newFuelPricing[i].futureFuelPricing.papMargin,
742 //'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal, 743 //'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal,
743 'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal, 744 'papTotal': $scope.newFuelPricing[i].futureFuelPricing.papTotal,
744 'expirationDate': $scope.newFuelPricing[i].futureFuelPricing.nextExpiration, 745 'expirationDate': $scope.newFuelPricing[i].futureFuelPricing.nextExpiration,
745 'deployDate': $scope.newFuelPricing[i].futureFuelPricing.deployDate, 746 'deployDate': $scope.newFuelPricing[i].futureFuelPricing.deployDate,
746 'productId': $scope.newFuelPricing[i].id, 747 'productId': $scope.newFuelPricing[i].id,
747 'id': $scope.newFuelPricing[i].futureFuelPricing.id, 748 'id': $scope.newFuelPricing[i].futureFuelPricing.id,
748 }) 749 })
749 } 750 }
750 }else{ 751 }else{
751 /*$scope.newFuelPricing[i].futureFuelPricing.cost = ''; 752 /*$scope.newFuelPricing[i].futureFuelPricing.cost = '';
752 $scope.newFuelPricing[i].futureFuelPricing.papMargin = ''; 753 $scope.newFuelPricing[i].futureFuelPricing.papMargin = '';
753 $scope.newFuelPricing[i].futureFuelPricing.papTotal = ''; 754 $scope.newFuelPricing[i].futureFuelPricing.papTotal = '';
754 $scope.newFuelPricing[i].futureFuelPricing.expirationDate = ''; 755 $scope.newFuelPricing[i].futureFuelPricing.expirationDate = '';
755 $scope.newFuelPricing[i].futureFuelPricing.deployDate = '';*/ 756 $scope.newFuelPricing[i].futureFuelPricing.deployDate = '';*/
756 } 757 }
757 } 758 }
758 //console.log('$scope.updateFutureFuelPricing', $scope.updateFutureFuelPricing); 759 //console.log('$scope.updateFutureFuelPricing', $scope.updateFutureFuelPricing);
759 updateFuelManagerService.updateFutureFuelPricingImmediatlly($scope.updateFutureFuelPricing).then(function(result) { 760 updateFuelManagerService.updateFutureFuelPricingImmediatlly($scope.updateFutureFuelPricing).then(function(result) {
760 toastr.success('Successfully Updated', { 761 toastr.success('Successfully Updated', {
761 closeButton: true 762 closeButton: true
762 }) 763 })
763 updateFuelManagerService.getFuelPricingNew().then(function(result) { 764 updateFuelManagerService.getFuelPricingNew().then(function(result) {
764 $scope.newFuelPricing = result; 765 $scope.newFuelPricing = result;
765 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 766 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
766 if ($scope.newFuelPricing[i].fuelPricing != null) { 767 if ($scope.newFuelPricing[i].fuelPricing != null) {
767 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 768 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
768 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 769 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
769 var month = newTime.getUTCMonth() + 1; //months from 1-12 770 var month = newTime.getUTCMonth() + 1; //months from 1-12
770 var day = newTime.getUTCDate(); 771 var day = newTime.getUTCDate();
771 var year = newTime.getUTCFullYear(); 772 var year = newTime.getUTCFullYear();
772 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 773 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
773 } 774 }
774 } 775 }
775 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 776 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
776 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 777 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
777 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 778 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
778 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 779 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
779 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 780 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
780 var nextDay = newTime.getUTCDate(); 781 var nextDay = newTime.getUTCDate();
781 var nextYear = newTime.getUTCFullYear(); 782 var nextYear = newTime.getUTCFullYear();
782 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 783 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
783 } 784 }
784 } 785 }
785 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 786 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
786 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 787 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
787 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 788 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
788 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 789 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
789 var dday = newTime.getUTCDate(); 790 var dday = newTime.getUTCDate();
790 var dyear = newTime.getUTCFullYear(); 791 var dyear = newTime.getUTCFullYear();
791 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 792 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
792 } 793 }
793 } 794 }
794 } 795 }
795 796
796 var str =""+ $scope.newFuelPricing[i].name 797 var str =""+ $scope.newFuelPricing[i].name
797 if(str.startsWith("J")){ 798 if(str.startsWith("J")){
798 $scope.newFuelPricing[i].jeta = true; 799 $scope.newFuelPricing[i].jeta = true;
799 var str1 = str.substring(0,5) 800 var str1 = str.substring(0,5)
800 var str2 = str.substring(6, str.length) 801 var str2 = str.substring(6, str.length)
801 $scope.newFuelPricing[i].name = str1 802 $scope.newFuelPricing[i].name = str1
802 $scope.newFuelPricing[i].namejetrest = str2 803 $scope.newFuelPricing[i].namejetrest = str2
803 804
804 805
805 }else if(str.startsWith("100")){ 806 }else if(str.startsWith("100")){
806 $scope.newFuelPricing[i].avgas = true; 807 $scope.newFuelPricing[i].avgas = true;
807 var str1 = str.substring(0,5) 808 var str1 = str.substring(0,5)
808 var str2 = str.substring(6, str.length) 809 var str2 = str.substring(6, str.length)
809 $scope.newFuelPricing[i].name = str1 810 $scope.newFuelPricing[i].name = str1
810 $scope.newFuelPricing[i].nameavgasrest = str2 811 $scope.newFuelPricing[i].nameavgasrest = str2
811 } 812 }
812 813
813 } 814 }
814 $scope.showLoader = false; 815 $scope.showLoader = false;
815 }) 816 })
816 }) 817 })
817 } 818 }
818 819
819 updateFuelManagerService.getMargin().then(function(result) { 820 updateFuelManagerService.getMargin().then(function(result) {
820 $scope.marginList = result; 821 $scope.marginList = result;
821 }) 822 })
822 823
823 $scope.marginIdDelete = ''; 824 $scope.marginIdDelete = '';
824 $scope.deleteJetAccordian = function(id){ 825 $scope.deleteJetAccordian = function(id){
825 $scope.marginIdDelete = id; 826 $scope.marginIdDelete = id;
826 $('#deleteMargin').css('display', 'block'); 827 $('#deleteMargin').css('display', 'block');
827 } 828 }
828 829
829 $scope.confirmDeleteMargin = function(){ 830 $scope.confirmDeleteMargin = function(){
830 $('#deleteMargin').css('display', 'none'); 831 $('#deleteMargin').css('display', 'none');
831 $scope.showLoader = true; 832 $scope.showLoader = true;
832 updateFuelManagerService.deleteMargin($scope.marginIdDelete).then(function(result) { 833 updateFuelManagerService.deleteMargin($scope.marginIdDelete).then(function(result) {
833 toastr.success(''+result.success+'', { 834 toastr.success(''+result.success+'', {
834 closeButton: true 835 closeButton: true
835 }) 836 })
836 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { 837 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
837 $scope.aTypeJets = result; 838 $scope.aTypeJets = result;
838 $scope.showLoader = false; 839 $scope.showLoader = false;
839 }) 840 })
840 }) 841 })
841 } 842 }
842 843
843 $scope.cancelMarginDelete = function(){ 844 $scope.cancelMarginDelete = function(){
844 $scope.marginIdDelete = ''; 845 $scope.marginIdDelete = '';
845 $('#deleteMargin').css('display', 'none'); 846 $('#deleteMargin').css('display', 'none');
846 } 847 }
847 848
848 $scope.marginVtypeIdDelete = ''; 849 $scope.marginVtypeIdDelete = '';
849 $scope.deleteVtypeJetAccordian = function(id){ 850 $scope.deleteVtypeJetAccordian = function(id){
850 $scope.marginVtypeIdDelete = id; 851 $scope.marginVtypeIdDelete = id;
851 $('#deleteVtypeMargin').css('display', 'block'); 852 $('#deleteVtypeMargin').css('display', 'block');
852 } 853 }
853 854
854 $scope.confirmDeletVtypeMargin = function(){ 855 $scope.confirmDeletVtypeMargin = function(){
855 $('#deleteVtypeMargin').css('display', 'none'); 856 $('#deleteVtypeMargin').css('display', 'none');
856 $scope.showLoader = true; 857 $scope.showLoader = true;
857 updateFuelManagerService.deleteMargin($scope.marginVtypeIdDelete).then(function(result) { 858 updateFuelManagerService.deleteMargin($scope.marginVtypeIdDelete).then(function(result) {
858 toastr.success(''+result.success+'', { 859 toastr.success(''+result.success+'', {
859 closeButton: true 860 closeButton: true
860 }) 861 })
861 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) { 862 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) {
862 $scope.vTypeJets = result; 863 $scope.vTypeJets = result;
863 $scope.showLoader = false; 864 $scope.showLoader = false;
864 }) 865 })
865 }) 866 })
866 } 867 }
867 868
868 $scope.cancelVtypeMarginDelete = function(){ 869 $scope.cancelVtypeMarginDelete = function(){
869 $scope.marginVtypeIdDelete = ''; 870 $scope.marginVtypeIdDelete = '';
870 $('#deleteVtypeMargin').css('display', 'none'); 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
876 905
877 }]); 906 }]);
878 907
879 908
880 909
app/partials/updateFuelManager/updateFuelManager.html
1 1
2 2
3 <style> 3 <style>
4 .subnavbar .mainnav > li:nth-child(2) > a{ 4 .subnavbar .mainnav > li:nth-child(2) > a{
5 color: #ff9900; 5 color: #ff9900;
6 } 6 }
7 .extraClasToMerge{ 7 .extraClasToMerge{
8 color: #fff; 8 color: #fff;
9 } 9 }
10 </style> 10 </style>
11 <div class="myLoader" ng-show="showLoader"> 11 <div class="myLoader" ng-show="showLoader">
12 <img src="../img/hourglass.gif" width="50px;"> 12 <img src="../img/hourglass.gif" width="50px;">
13 </div> 13 </div>
14 14
15 <div class="col-xs-12 col-md-6"> 15 <div class="col-xs-12 col-md-6">
16 16
17 <div class="widget stacked"> 17 <div class="widget stacked">
18 <div class="widget-header"> 18 <div class="widget-header">
19 <i class="fa fa-pencil"></i> 19 <i class="fa fa-pencil"></i>
20 <h3>Price Manager Staging</h3> 20 <h3>Price Manager Staging</h3>
21 </div> 21 </div>
22 <!-- /widget-header --> 22 <!-- /widget-header -->
23 <div class="widget-content"> 23 <div class="widget-content">
24 <h6 style="color:#F90">Queue Pricing for Deployment in the Price Manager below</h6> 24 <h6 style="color:#F90">Queue Pricing for Deployment in the Price Manager below</h6>
25 <form> 25 <form>
26 <table class="table"> 26 <table class="table">
27 <thead> 27 <thead>
28 <tr> 28 <tr>
29 <th> Product</th> 29 <th> Product</th>
30 <th> Cost</th> 30 <th> Cost</th>
31 <th> PAP(Margin)</th> 31 <th> PAP(Margin)</th>
32 <th> Deploy Date</th> 32 <th> Deploy Date</th>
33 <th style="color: #F90;">Price Expires</th> 33 <th style="color: #F90;">Price Expires</th>
34 <th> PAP(Total)</th> 34 <th> PAP(Total)</th>
35 </tr> 35 </tr>
36 </thead> 36 </thead>
37 <tbody> 37 <tbody>
38 <tr ng-repeat="fuelPricing in newFuelPricing | filter:{ status: true }"> 38 <tr ng-repeat="fuelPricing in newFuelPricing | filter:{ status: true }">
39 <td> 39 <td>
40 <span style="color: #2196f3" ng-show="fuelPricing.jeta">{{fuelPricing.name}}</span> 40 <span style="color: #2196f3" ng-show="fuelPricing.jeta">{{fuelPricing.name}}</span>
41 <span ng-show="fuelPricing.jeta">{{fuelPricing.namejetrest}}</span> 41 <span ng-show="fuelPricing.jeta">{{fuelPricing.namejetrest}}</span>
42 <span style="color: 39c" ng-show="fuelPricing.avgas">{{fuelPricing.name}}</span> 42 <span style="color: 39c" ng-show="fuelPricing.avgas">{{fuelPricing.name}}</span>
43 <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span> 43 <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span>
44 </td> 44 </td>
45 <td> 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 </td> 47 </td>
48 <td> 48 <td>
49 <input type="text" class="form-control" ng-model="fuelPricing.futureFuelPricing.papMargin" style="height:31px; width: 80px; padding: 6px 6px;"> 49 <input type="text" class="form-control" ng-model="fuelPricing.futureFuelPricing.papMargin" style="height:31px; width: 80px; padding: 6px 6px;">
50 </td> 50 </td>
51 <td> 51 <td>
52 <input type="text" class="form-control" ng-disabled="fuelPricing.futureFuelPricing.cost == undefined || fuelPricing.futureFuelPricing.cost == null || fuelPricing.futureFuelPricing.cost == ''" datepicker ng-model="fuelPricing.futureFuelPricing.deployDate" style="height:31px; width: 80px; padding: 6px 6px;"> 52 <input type="text" class="form-control" ng-disabled="fuelPricing.futureFuelPricing.cost == undefined || fuelPricing.futureFuelPricing.cost == null || fuelPricing.futureFuelPricing.cost == ''" datepicker ng-model="fuelPricing.futureFuelPricing.deployDate" style="height:31px; width: 80px; padding: 6px 6px;">
53 </td> 53 </td>
54 <td> 54 <td>
55 <input type="text" class="form-control" datepicker ng-disabled="fuelPricing.futureFuelPricing.cost == undefined || fuelPricing.futureFuelPricing.cost == null || fuelPricing.futureFuelPricing.cost == ''" ng-model="fuelPricing.futureFuelPricing.nextExpiration" style="height:31px; width: 80px; padding: 6px 6px;"> 55 <input type="text" class="form-control" datepicker ng-disabled="fuelPricing.futureFuelPricing.cost == undefined || fuelPricing.futureFuelPricing.cost == null || fuelPricing.futureFuelPricing.cost == ''" ng-model="fuelPricing.futureFuelPricing.nextExpiration" style="height:31px; width: 80px; padding: 6px 6px;">
56 </td> 56 </td>
57 <td> 57 <td>
58 <span style="line-height: 31px; color: #1ab394;">$ {{fuelPricing.futureFuelPricing.cost -- fuelPricing.futureFuelPricing.papMargin | number : 2}}</span> 58 <span style="line-height: 31px; color: #1ab394;">$ {{fuelPricing.futureFuelPricing.cost -- fuelPricing.futureFuelPricing.papMargin | number : 2}}</span>
59 </td> 59 </td>
60 </tr> 60 </tr>
61 </tbody> 61 </tbody>
62 </table> 62 </table>
63 <div class="row" style="margin-left: 0px;"> 63 <div class="row" style="margin-left: 0px;">
64 <div class="col-md-12" style= "text-align: right; padding-left: 0;"> 64 <div class="col-md-12" style= "text-align: right; padding-left: 0;">
65 <div style="float: left;"> 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 </div> 69 </div>
70 <div style="float: right;"> 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 </div> 72 </div>
73 <div style="clear: both;"></div> 73 <div style="clear: both;"></div>
74 </div> 74 </div>
75 </div> 75 </div>
76 </form> 76 </form>
77 </div> 77 </div>
78 <!-- /widget-content --> 78 <!-- /widget-content -->
79 </div> 79 </div>
80 <!-- /widget --> 80 <!-- /widget -->
81 81
82 82
83 83
84 <div class="widget stacked"> 84 <div class="widget stacked">
85 <div class="widget-header"> 85 <div class="widget-header">
86 <i class="fa fa-pencil"></i> 86 <i class="fa fa-pencil"></i>
87 <h3>Price Manager</h3> 87 <h3>Price Manager</h3>
88 <select style="float: right; margin: 7px 10px; width: 150px; height: 26px; padding: 0 0;" class="btn btn-primary" class="form-control" ng-model="sendEmail.pricing" ng-change="confirmMail()"> 88 <select style="float: right; margin: 7px 10px; width: 150px; height: 26px; padding: 0 0;" class="btn btn-primary" class="form-control" ng-model="sendEmail.pricing" ng-change="confirmMail()">
89 <option value="" disabled selected="selected">Email All Pricing</option> 89 <option value="" disabled selected="selected">Email All Pricing</option>
90 <option value="JET-A">Email JET-A pricing only</option> 90 <option value="JET-A">Email JET-A pricing only</option>
91 <option value="AVGAS">Email AVGAS pricing only</option> 91 <option value="AVGAS">Email AVGAS pricing only</option>
92 <option disabled>_______________________________</option> 92 <option disabled>_______________________________</option>
93 <option value="all">Distribute All</option> 93 <option value="all">Distribute All</option>
94 </select> 94 </select>
95 </div> 95 </div>
96 <!-- /widget-header --> 96 <!-- /widget-header -->
97 <div class="widget-content"> 97 <div class="widget-content">
98 <h4>Deployed Fuel Prices</h4> 98 <h4>Deployed Fuel Prices</h4>
99 <table class="table"> 99 <table class="table">
100 <thead> 100 <thead>
101 <tr> 101 <tr>
102 <th> Product</th> 102 <th> Product</th>
103 <th> Cost</th> 103 <th> Cost</th>
104 <th> Margin</th> 104 <th> Margin</th>
105 <th> PAP(Total)</th> 105 <th> PAP(Total)</th>
106 <th style="color: #F90;"> Expires</th> 106 <th style="color: #F90;"> Expires</th>
107 </tr> 107 </tr>
108 </thead> 108 </thead>
109 <tbody> 109 <tbody>
110 <tr ng-repeat="fuelPricing in newFuelPricing | filter:{ status: true }"> 110 <tr ng-repeat="fuelPricing in newFuelPricing | filter:{ status: true }">
111 <td> 111 <td>
112 <span style="color: #2196f3" ng-show="fuelPricing.jeta">{{fuelPricing.name}}</span> 112 <span style="color: #2196f3" ng-show="fuelPricing.jeta">{{fuelPricing.name}}</span>
113 <span ng-show="fuelPricing.jeta">{{fuelPricing.namejetrest}}</span> 113 <span ng-show="fuelPricing.jeta">{{fuelPricing.namejetrest}}</span>
114 <span style="color: 39c" ng-show="fuelPricing.avgas">{{fuelPricing.name}}</span> 114 <span style="color: 39c" ng-show="fuelPricing.avgas">{{fuelPricing.name}}</span>
115 <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span> 115 <span ng-show="fuelPricing.avgas">{{fuelPricing.nameavgasrest}}</span>
116 </td> 116 </td>
117 <td> 117 <td>
118 <span>{{fuelPricing.fuelPricing.cost}}</span> 118 <span>{{fuelPricing.futureFuelPricing.cost}}</span>
119 </td> 119 </td>
120 <td> 120 <td>
121 <span>{{fuelPricing.fuelPricing.papMargin}}</span> 121 <span>{{fuelPricing.futureFuelPricing.papMargin}}</span>
122 </td> 122 </td>
123 <td> 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 </td> 125 </td>
126 <td> 126 <td>
127 <span>{{fuelPricing.fuelPricing.expirationDate}}</span> 127 <span>{{fuelPricing.futureFuelPricing.expirationDate}}</span>
128 </td> 128 </td>
129 </tr> 129 </tr>
130 </tbody> 130 </tbody>
131 </table> 131 </table>
132 132
133 </div> 133 </div>
134 <!-- /widget-content --> 134 <!-- /widget-content -->
135 </div> 135 </div>
136 <!-- /widget --> 136 <!-- /widget -->
137 137
138 138
139 </div> 139 </div>
140 <div class="col-xs-12 col-md-6"> 140 <div class="col-xs-12 col-md-6">
141 141
142 142
143 <div class="widget stacked"> 143 <div class="widget stacked">
144 <div class="widget-header"> 144 <div class="widget-header">
145 <i class="fa fa-pencil"></i> 145 <i class="fa fa-pencil"></i>
146 <h3 style="font-style: italic"><b style="color: #2196f3; font-style: normal">JET-A</b> Customer Margin Template</h3> 146 <h3 style="font-style: italic"><b style="color: #2196f3; font-style: normal">JET-A</b> Customer Margin Template</h3>
147 147
148 </div> 148 </div>
149 <!-- /widget-header --> 149 <!-- /widget-header -->
150 <div class="widget-content" style="padding-top: 10px;"> 150 <div class="widget-content" style="padding-top: 10px;">
151 <section id="accordions"> 151 <section id="accordions">
152 <div class="newCustomAccordian"> 152 <div class="newCustomAccordian">
153 <!-- tab 1 --> 153 <!-- tab 1 -->
154 <div ng-repeat="jets in aTypeJets"> 154 <div ng-repeat="jets in aTypeJets">
155 <div class="customAccordianHeader" id="{{jets.id}}"> 155 <div class="customAccordianHeader" id="{{jets.id}}">
156 <span>{{jets.marginName}}</span> 156 <span>{{jets.marginName}}</span>
157 <select class="form-control" disabled="true" ng-model="jets.pricingStructure"> 157 <select class="form-control" disabled="true" ng-model="jets.pricingStructure">
158 <option value="" disabled selected>Pricing Structure</option> 158 <option value="" disabled selected>Pricing Structure</option>
159 <option value="minus">Retail/PAP-(minus)</option> 159 <option value="minus">Retail/PAP-(minus)</option>
160 <option value="plus">Cost+(plus)</option> 160 <option value="plus">Cost+(plus)</option>
161 </select> 161 </select>
162 <span style="margin-right: 0;">$</span> 162 <span style="margin-right: 0;">$</span>
163 <input type="text" disabled="true" class="form-control" ng-model="jets.marginValue"> 163 <input type="text" disabled="true" class="form-control" ng-model="jets.marginValue">
164 <div class="pull-right"> 164 <div class="pull-right">
165 <button class="btn btn-success" style="display: none; background-image: none; background-color: #f3f3f3; color: #333; border:0;" ng-click="closeAccordian(jets)">Close</button> 165 <button class="btn btn-success" style="display: none; background-image: none; background-color: #f3f3f3; color: #333; border:0;" ng-click="closeAccordian(jets)">Close</button>
166 <button class="btn btn-success" style="display: none;" ng-click="saveJetAccordian(jets)">Save</button> 166 <button class="btn btn-success" style="display: none;" ng-click="saveJetAccordian(jets)">Save</button>
167 <button class="btn btn-danger" style="display: none;" ng-click="deleteJetAccordian(jets.id)">Delete</button> 167 <button class="btn btn-danger" style="display: none;" ng-click="deleteJetAccordian(jets.id)">Delete</button>
168 <button type="button" class="btn btn-primary" ng-click="emailPricingForMargin(jets.id)" style= "font-weight: normal; text-align: center; font-size:12px">Email Pricing for this Margin</button> 168 <button type="button" class="btn btn-primary" ng-click="emailPricingForMargin(jets.id)" style= "font-weight: normal; text-align: center; font-size:12px">Email Pricing for this Margin</button>
169 <button class="btn btn-default" ng-click="toggleJestAccordian(jets.id, $index)" style= "text-align: center; font-size:12px">Edit</button> 169 <button class="btn btn-default" ng-click="toggleJestAccordian(jets.id, $index)" style= "text-align: center; font-size:12px">Edit</button>
170 </div> 170 </div>
171 <div class="clearfix"></div> 171 <div class="clearfix"></div>
172 </div> 172 </div>
173 <div class="customAccordianTabBody {{jets.id}}" style="display: none;"> 173 <div class="customAccordianTabBody {{jets.id}}" style="display: none;">
174 <div class="tierListWrap" ng-repeat="tier in aTypeJets[$index].tierList"> 174 <div class="tierListWrap" ng-repeat="tier in aTypeJets[$index].tierList">
175 <div class="tierListHead" style="height: 36px;"> 175 <div class="tierListHead" style="height: 36px;">
176 <span class="pull-left tierHeadingSpan" ng-hide="showEditTier">{{tier.minTierBreak}}-{{tier.maxTierBreak}} gal. 176 <span class="pull-left tierHeadingSpan" ng-hide="showEditTier">{{tier.minTierBreak}}-{{tier.maxTierBreak}} gal.
177 </span> 177 </span>
178 <i class="fa fa-pencil-square-o pull-right" ng-click="showEditTier = ! showEditTier" ng-hide="showEditTier" style="margin-top: 5px; cursor: pointer;" aria-hidden="true"></i> 178 <i class="fa fa-pencil-square-o pull-right" ng-click="showEditTier = ! showEditTier" ng-hide="showEditTier" style="margin-top: 5px; cursor: pointer;" aria-hidden="true"></i>
179 179
180 <input type="text" placeholder="min" style="width: 36px;" ng-model="tier.minTierBreak" ng-show="showEditTier"> 180 <input type="text" placeholder="min" style="width: 36px;" ng-model="tier.minTierBreak" ng-show="showEditTier">
181 <span ng-show="showEditTier">-</span> 181 <span ng-show="showEditTier">-</span>
182 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.maxTierBreak" ng-show="showEditTier"> <b ng-show="showEditTier">gal.</b> 182 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.maxTierBreak" ng-show="showEditTier"> <b ng-show="showEditTier">gal.</b>
183 <div class="clearfix"></div> 183 <div class="clearfix"></div>
184 </div> 184 </div>
185 <div class="tierListBody" style="height: 35px;"> 185 <div class="tierListBody" style="height: 35px;">
186 <span class="pull-left minTierSpan" ng-hide="showEditTier">-${{tier.margin}}</span> 186 <span class="pull-left minTierSpan" ng-hide="showEditTier">-${{tier.margin}}</span>
187 187
188 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.margin" ng-show="showEditTier"> &nbsp; 188 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.margin" ng-show="showEditTier"> &nbsp;
189 189
190 <span class="pull-right maxTierSpan" ng-hide="showEditTier">(${{tier.marginTotal | number : 2}})</span> 190 <span class="pull-right maxTierSpan" ng-hide="showEditTier">(${{tier.marginTotal | number : 2}})</span>
191 191
192 <button class="addTierBtn" ng-click="editTier(tier, $parent.$index)" ng-show="showEditTier">Save</button> 192 <button class="addTierBtn" ng-click="editTier(tier, $parent.$index)" ng-show="showEditTier">Save</button>
193 193
194 <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteTier(tier.id, jets.id, $parent.$index)" aria-hidden="true" ng-show="showEditTier"></i> 194 <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteTier(tier.id, jets.id, $parent.$index)" aria-hidden="true" ng-show="showEditTier"></i>
195 195
196 <div class="clearfix"></div> 196 <div class="clearfix"></div>
197 </div> 197 </div>
198 </div> 198 </div>
199 <div class="tierListWrap" style="width: 160px;"> 199 <div class="tierListWrap" style="width: 160px;">
200 <div class="tierListHead" style="border-right: 1px solid #ddd;"> 200 <div class="tierListHead" style="border-right: 1px solid #ddd;">
201 <input type="text" placeholder="min" ng-model="trData[$index].minTierBreak"> 201 <input type="text" placeholder="min" ng-model="trData[$index].minTierBreak">
202 <span>-</span> 202 <span>-</span>
203 <input type="text" placeholder="max" ng-model="trData[$index].maxTierBreak"> <b>gal.</b> 203 <input type="text" placeholder="max" ng-model="trData[$index].maxTierBreak"> <b>gal.</b>
204 <div class="clearfix"></div> 204 <div class="clearfix"></div>
205 </div> 205 </div>
206 <div class="tierListBody" style="border-right: 1px solid #ddd;"> 206 <div class="tierListBody" style="border-right: 1px solid #ddd;">
207 <span style="color: #449d44;">$</span> 207 <span style="color: #449d44;">$</span>
208 <input type="text" placeholder="margin" ng-model="trData[$index].margin" class="tierTextBox" style="width: 70px; height: 24px;"> 208 <input type="text" placeholder="margin" ng-model="trData[$index].margin" class="tierTextBox" style="width: 70px; height: 24px;">
209 <button class="addTierBtn" ng-click="addNewTier(jets.id, trData, $index)">Add Tier</button> 209 <button class="addTierBtn" ng-click="addNewTier(jets.id, trData, $index)">Add Tier</button>
210 <div class="clearfix"></div> 210 <div class="clearfix"></div>
211 </div> 211 </div>
212 </div> 212 </div>
213 <!-- <div class="tierListWrap" style="width: 32px;"> 213 <!-- <div class="tierListWrap" style="width: 32px;">
214 <div class="tierListHead" style="height: 36px; border-right: 1px solid #ddd;"> 214 <div class="tierListHead" style="height: 36px; border-right: 1px solid #ddd;">
215 &nbsp; 215 &nbsp;
216 </div> 216 </div>
217 <div class="tierListBody" style="height: 35px; border-right: 1px solid #ddd;"> 217 <div class="tierListBody" style="height: 35px; border-right: 1px solid #ddd;">
218 <i class="fa fa-trash-o deleteTierIcon" aria-hidden="true"></i> 218 <i class="fa fa-trash-o deleteTierIcon" aria-hidden="true"></i>
219 </div> 219 </div>
220 </div> --> 220 </div> -->
221 <div class="clearfix"></div> 221 <div class="clearfix"></div>
222 <!-- <textarea class="form-control resizeTextarea" ng-model="jets.message" placeholder="Message..."></textarea> --> 222 <!-- <textarea class="form-control resizeTextarea" ng-model="jets.message" placeholder="Message..."></textarea> -->
223 <br/> 223 <br/>
224 <div ckeditor="options" ng-model="jets.message" ready="onReady()"></div> 224 <div ckeditor="options" ng-model="jets.message" ready="onReady()"></div>
225 </div> 225 </div>
226 </div> 226 </div>
227 </div> 227 </div>
228 <div class="pull-right"> 228 <div class="pull-right">
229 <button type="submit" class="btn btn-success btn-sm" ng-click="addNewMarginBtn()" style="margin-top: 4px; margin-right: 10px;"><i class="fa fa-plus" aria-hidden="true"></i> Add New Margin</button> 229 <button type="submit" class="btn btn-success btn-sm" ng-click="addNewMarginBtn()" style="margin-top: 4px; margin-right: 10px;"><i class="fa fa-plus" aria-hidden="true"></i> Add New Margin</button>
230 </div> 230 </div>
231 </section> 231 </section>
232 <!-- <div class="row">&nbsp;</div> 232 <!-- <div class="row">&nbsp;</div>
233 <div class="row"> 233 <div class="row">
234 <div class="form-group"> 234 <div class="form-group">
235 <div class="col-lg-12 text-right"> 235 <div class="col-lg-12 text-right">
236 <button type="submit" class="btn btn-success"><i class="icon-ok"></i> Save Form</button>&nbsp;&nbsp; 236 <button type="submit" class="btn btn-success"><i class="icon-ok"></i> Save Form</button>&nbsp;&nbsp;
237 <button type="reset" class="btn btn-default">Cancel</button> 237 <button type="reset" class="btn btn-default">Cancel</button>
238 </div> 238 </div>
239 </div> 239 </div>
240 </div> --> 240 </div> -->
241 </div> 241 </div>
242 <!-- /widget-content --> 242 <!-- /widget-content -->
243 </div> 243 </div>
244 <!-- /widget --> 244 <!-- /widget -->
245 245
246 246
247 247
248 <div class="widget stacked"> 248 <div class="widget stacked">
249 <div class="widget-header"> 249 <div class="widget-header">
250 <i class="fa fa-pencil"></i> 250 <i class="fa fa-pencil"></i>
251 <h3><b style="color: 39c;">AVGAS 100LL </b> <i>Customer Margin Template</i></h3> 251 <h3><b style="color: 39c;">AVGAS 100LL </b> <i>Customer Margin Template</i></h3>
252 252
253 </div> 253 </div>
254 <!-- /widget-header --> 254 <!-- /widget-header -->
255 <div class="widget-content" style="padding-top: 10px;"> 255 <div class="widget-content" style="padding-top: 10px;">
256 <section id="accordions"> 256 <section id="accordions">
257 <div class="newCustomAccordian"> 257 <div class="newCustomAccordian">
258 <!-- tab 1 --> 258 <!-- tab 1 -->
259 <div ng-repeat="jets in vTypeJets"> 259 <div ng-repeat="jets in vTypeJets">
260 <div class="customAccordianHeader" id="{{jets.id}}"> 260 <div class="customAccordianHeader" id="{{jets.id}}">
261 <span>{{jets.marginName}}</span> 261 <span>{{jets.marginName}}</span>
262 <select class="form-control" disabled="true" ng-model="jets.pricingStructure"> 262 <select class="form-control" disabled="true" ng-model="jets.pricingStructure">
263 <option value="" disabled selected>Pricing Structure</option> 263 <option value="" disabled selected>Pricing Structure</option>
264 <option value="minus">Retail-(minus)</option> 264 <option value="minus">Retail-(minus)</option>
265 <option value="plus">Cost+(plus)</option> 265 <option value="plus">Cost+(plus)</option>
266 <option value="equal">Direct=(equal)</option> 266 <option value="equal">Direct=(equal)</option>
267 </select> 267 </select>
268 <span style="margin-right: 0;">$</span> 268 <span style="margin-right: 0;">$</span>
269 <input type="text" disabled="true" class="form-control" ng-model="jets.marginValue"> 269 <input type="text" disabled="true" class="form-control" ng-model="jets.marginValue">
270 <div class="pull-right"> 270 <div class="pull-right">
271 <button class="btn btn-success" style="display: none; background-image: none; background-color: #f3f3f3; color: #333; border:0;" ng-click="closeAccordianVtype(jets)">Close</button> 271 <button class="btn btn-success" style="display: none; background-image: none; background-color: #f3f3f3; color: #333; border:0;" ng-click="closeAccordianVtype(jets)">Close</button>
272 <button class="btn btn-success" style="display: none;" ng-click="saveVtypeJetAccordian(jets)">Save</button> 272 <button class="btn btn-success" style="display: none;" ng-click="saveVtypeJetAccordian(jets)">Save</button>
273 <button class="btn btn-danger" style="display: none;" ng-click="deleteVtypeJetAccordian(jets.id)">Delete</button> 273 <button class="btn btn-danger" style="display: none;" ng-click="deleteVtypeJetAccordian(jets.id)">Delete</button>
274 <button type="button" class="btn btn-primary" ng-click="emailPricingForMargin()" style= "font-weight: normal; text-align: center; font-size:12px">Email Pricing for this Margin</button> 274 <button type="button" class="btn btn-primary" ng-click="emailPricingForMargin()" style= "font-weight: normal; text-align: center; font-size:12px">Email Pricing for this Margin</button>
275 <button class="btn btn-default" ng-click="toggleVtypeJestAccordian(jets.id, $index)" style= "text-align: center; font-size:12px">Edit</button> 275 <button class="btn btn-default" ng-click="toggleVtypeJestAccordian(jets.id, $index)" style= "text-align: center; font-size:12px">Edit</button>
276 </div> 276 </div>
277 <div class="clearfix"></div> 277 <div class="clearfix"></div>
278 </div> 278 </div>
279 <div class="customAccordianTabBody {{jets.id}}" style="display: none;"> 279 <div class="customAccordianTabBody {{jets.id}}" style="display: none;">
280 <div class="tierListWrap" ng-repeat="tier in vTypeJets[$index].tierList"> 280 <div class="tierListWrap" ng-repeat="tier in vTypeJets[$index].tierList">
281 <div class="tierListHead" style="height: 36px;"> 281 <div class="tierListHead" style="height: 36px;">
282 <span class="pull-left tierHeadingSpan" ng-hide="showEditTier">{{tier.minTierBreak}}-{{tier.maxTierBreak}} gal. 282 <span class="pull-left tierHeadingSpan" ng-hide="showEditTier">{{tier.minTierBreak}}-{{tier.maxTierBreak}} gal.
283 </span> 283 </span>
284 <i class="fa fa-pencil-square-o pull-right" ng-click="showEditTier = ! showEditTier" ng-hide="showEditTier" style="margin-top: 5px; cursor: pointer;" aria-hidden="true"></i> 284 <i class="fa fa-pencil-square-o pull-right" ng-click="showEditTier = ! showEditTier" ng-hide="showEditTier" style="margin-top: 5px; cursor: pointer;" aria-hidden="true"></i>
285 285
286 <input type="text" placeholder="min" style="width: 36px;" ng-model="tier.minTierBreak" ng-show="showEditTier"> 286 <input type="text" placeholder="min" style="width: 36px;" ng-model="tier.minTierBreak" ng-show="showEditTier">
287 <span ng-show="showEditTier">-</span> 287 <span ng-show="showEditTier">-</span>
288 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.maxTierBreak" ng-show="showEditTier"> <b ng-show="showEditTier">gal.</b> 288 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.maxTierBreak" ng-show="showEditTier"> <b ng-show="showEditTier">gal.</b>
289 <div class="clearfix"></div> 289 <div class="clearfix"></div>
290 </div> 290 </div>
291 <div class="tierListBody" style="height: 35px;"> 291 <div class="tierListBody" style="height: 35px;">
292 <span class="pull-left minTierSpan" ng-hide="showEditTier">-${{tier.margin}}</span> 292 <span class="pull-left minTierSpan" ng-hide="showEditTier">-${{tier.margin}}</span>
293 293
294 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.margin" ng-show="showEditTier"> &nbsp; 294 <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.margin" ng-show="showEditTier"> &nbsp;
295 295
296 <span class="pull-right maxTierSpan" ng-hide="showEditTier">(${{tier.marginTotal | number : 2}})</span> 296 <span class="pull-right maxTierSpan" ng-hide="showEditTier">(${{tier.marginTotal | number : 2}})</span>
297 297
298 <button class="addTierBtn" ng-click="editVtypeTier(tier, $parent.$index)" ng-show="showEditTier">Save</button> 298 <button class="addTierBtn" ng-click="editVtypeTier(tier, $parent.$index)" ng-show="showEditTier">Save</button>
299 299
300 <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteVtypeTier(tier.id, jets.id, $parent.$index)" aria-hidden="true" ng-show="showEditTier"></i> 300 <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteVtypeTier(tier.id, jets.id, $parent.$index)" aria-hidden="true" ng-show="showEditTier"></i>
301 301
302 <div class="clearfix"></div> 302 <div class="clearfix"></div>
303 </div> 303 </div>
304 </div> 304 </div>
305 <div class="tierListWrap" style="width: 160px;"> 305 <div class="tierListWrap" style="width: 160px;">
306 <div class="tierListHead" style="border-right: 1px solid #ddd;"> 306 <div class="tierListHead" style="border-right: 1px solid #ddd;">
307 <input type="text" placeholder="min" ng-model="vtrData[$index].minTierBreak"> 307 <input type="text" placeholder="min" ng-model="vtrData[$index].minTierBreak">
308 <span>-</span> 308 <span>-</span>
309 <input type="text" placeholder="max" ng-model="vtrData[$index].maxTierBreak"> <b>gal.</b> 309 <input type="text" placeholder="max" ng-model="vtrData[$index].maxTierBreak"> <b>gal.</b>
310 <div class="clearfix"></div> 310 <div class="clearfix"></div>
311 </div> 311 </div>
312 <div class="tierListBody" style="border-right: 1px solid #ddd;"> 312 <div class="tierListBody" style="border-right: 1px solid #ddd;">
313 <span style="color: #449d44;">$</span> 313 <span style="color: #449d44;">$</span>
314 <input type="text" placeholder="margin" ng-model="vtrData[$index].margin" class="tierTextBox" style="width: 70px; height: 24px;"> 314 <input type="text" placeholder="margin" ng-model="vtrData[$index].margin" class="tierTextBox" style="width: 70px; height: 24px;">
315 <button class="addTierBtn" ng-click="addNewVtypeTier(jets.id, vtrData, $index)">Add Tier</button> 315 <button class="addTierBtn" ng-click="addNewVtypeTier(jets.id, vtrData, $index)">Add Tier</button>
316 <div class="clearfix"></div> 316 <div class="clearfix"></div>
317 </div> 317 </div>
318 </div> 318 </div>
319 <!-- <div class="tierListWrap" style="width: 32px;"> 319 <!-- <div class="tierListWrap" style="width: 32px;">
320 <div class="tierListHead" style="height: 36px; border-right: 1px solid #ddd;"> 320 <div class="tierListHead" style="height: 36px; border-right: 1px solid #ddd;">
321 &nbsp; 321 &nbsp;
322 </div> 322 </div>
323 <div class="tierListBody" style="height: 35px; border-right: 1px solid #ddd;"> 323 <div class="tierListBody" style="height: 35px; border-right: 1px solid #ddd;">
324 <i class="fa fa-trash-o deleteTierIcon" aria-hidden="true"></i> 324 <i class="fa fa-trash-o deleteTierIcon" aria-hidden="true"></i>
325 </div> 325 </div>
326 </div> --> 326 </div> -->
327 <div class="clearfix"></div> 327 <div class="clearfix"></div>
328 <br/> 328 <br/>
329 <div ckeditor="options" ng-model="jets.message" ready="onReady()"></div> 329 <div ckeditor="options" ng-model="jets.message" ready="onReady()"></div>
330 </div> 330 </div>
331 </div> 331 </div>
332 </div> 332 </div>
333 <div class="pull-right"> 333 <div class="pull-right">
334 <button type="submit" class="btn btn-success btn-sm" ng-click="addNewVtypePop()" style="margin-top: 4px; margin-right: 10px;"><i class="fa fa-plus" aria-hidden="true"></i> Add New Margin</button> 334 <button type="submit" class="btn btn-success btn-sm" ng-click="addNewVtypePop()" style="margin-top: 4px; margin-right: 10px;"><i class="fa fa-plus" aria-hidden="true"></i> Add New Margin</button>
335 </div> 335 </div>
336 </section> 336 </section>
337 <!-- <div class="row">&nbsp;</div> 337 <!-- <div class="row">&nbsp;</div>
338 <div class="row"> 338 <div class="row">
339 <div class="form-group"> 339 <div class="form-group">
340 <div class="col-lg-12 text-right"> 340 <div class="col-lg-12 text-right">
341 <button type="submit" class="btn btn-success"><i class="icon-ok"></i> Save Form</button>&nbsp;&nbsp; 341 <button type="submit" class="btn btn-success"><i class="icon-ok"></i> Save Form</button>&nbsp;&nbsp;
342 <button type="reset" class="btn btn-default">Cancel</button> 342 <button type="reset" class="btn btn-default">Cancel</button>
343 </div> 343 </div>
344 </div> 344 </div>
345 </div> --> 345 </div> -->
346 </div> 346 </div>
347 <!-- /widget-content --> 347 <!-- /widget-content -->
348 </div> 348 </div>
349 <!-- /widget --> 349 <!-- /widget -->
350 350
351 351
352 352
353 </div> 353 </div>
354 <div class="clearfix"></div> 354 <div class="clearfix"></div>
355 355
356 <div class="addNewMargin" style="display: none;"> 356 <div class="addNewMargin" style="display: none;">
357 <div class="customBackdrop"> 357 <div class="customBackdrop">
358 <div class="customModalInner" style="max-width: 700px;"> 358 <div class="customModalInner" style="max-width: 700px;">
359 <div class="customModelHead"> 359 <div class="customModelHead">
360 <p class="pull-left"> 360 <p class="pull-left">
361 <i class="fa fa-list-alt" aria-hidden="true"></i> 361 <i class="fa fa-list-alt" aria-hidden="true"></i>
362 Add New JET-A Customer Margin 362 Add New JET-A Customer Margin
363 </p> 363 </p>
364 <p class="pull-right"> 364 <p class="pull-right">
365 <i class="fa fa-times" aria-hidden="true" style="cursor: pointer;" ng-click="closeMarginPopup()"></i> 365 <i class="fa fa-times" aria-hidden="true" style="cursor: pointer;" ng-click="closeMarginPopup()"></i>
366 </p> 366 </p>
367 <div class="clearfix"></div> 367 <div class="clearfix"></div>
368 </div> 368 </div>
369 <div class="customModelBody"> 369 <div class="customModelBody">
370 370
371 <div class="customAccordianHeader customActive"> 371 <div class="customAccordianHeader customActive">
372 <input type="text" class="form-control" style="width: 120px; margin-right: 10px;" placeholder="Margin Name" ng-model="newJet.marginName"> 372 <input type="text" class="form-control" style="width: 120px; margin-right: 10px;" placeholder="Margin Name" ng-model="newJet.marginName">
373 <select class="form-control" ng-model="newJet.pricingStructure"> 373 <select class="form-control" ng-model="newJet.pricingStructure">
374 <option value="" disabled selected>Pricing Structure</option> 374 <option value="" disabled selected>Pricing Structure</option>
375 <option value="minus">Retail-(minus)</option> 375 <option value="minus">Retail-(minus)</option>
376 <option value="plus">Cost+(plus)</option> 376 <option value="plus">Cost+(plus)</option>
377 <option value="equal">Direct=(equal)</option> 377 <option value="equal">Direct=(equal)</option>
378 </select> 378 </select>
379 <span style="margin-right: 0;">$</span> 379 <span style="margin-right: 0;">$</span>
380 <input type="text" class="form-control" style="width: 120px;" placeholder="Margin Price" ng-model="newJet.marginValue"> 380 <input type="text" class="form-control" style="width: 120px;" placeholder="Margin Price" ng-model="newJet.marginValue">
381 <div class="clearfix"></div> 381 <div class="clearfix"></div>
382 </div> 382 </div>
383 <div class="customAccordianTabBody"> 383 <div class="customAccordianTabBody">
384 <div ckeditor="options" ng-model="newJet.message" ready="onReady()"></div> 384 <div ckeditor="options" ng-model="newJet.message" ready="onReady()"></div>
385 </div> 385 </div>
386 386
387 </div> 387 </div>
388 <div class="customModelFooter text-center"> 388 <div class="customModelFooter text-center">
389 <input type="submit" value="Save" class="btn" ng-click="addNewATypeJet()"> 389 <input type="submit" value="Save" class="btn" ng-click="addNewATypeJet()">
390 <button class="btn" ng-click="closeMarginPopup()">Cancel</button> 390 <button class="btn" ng-click="closeMarginPopup()">Cancel</button>
391 </div> 391 </div>
392 </div> 392 </div>
393 </div> 393 </div>
394 </div> 394 </div>
395 395
396 <div class="addNewVtype" style="display: none;"> 396 <div class="addNewVtype" style="display: none;">
397 <div class="customBackdrop"> 397 <div class="customBackdrop">
398 <div class="customModalInner" style="max-width: 700px;"> 398 <div class="customModalInner" style="max-width: 700px;">
399 <div class="customModelHead"> 399 <div class="customModelHead">
400 <p class="pull-left"> 400 <p class="pull-left">
401 <i class="fa fa-list-alt" aria-hidden="true"></i> 401 <i class="fa fa-list-alt" aria-hidden="true"></i>
402 Add New AVGAS 100LL Customer Margin Template 402 Add New AVGAS 100LL Customer Margin Template
403 </p> 403 </p>
404 <p class="pull-right"> 404 <p class="pull-right">
405 <i class="fa fa-times" aria-hidden="true" style="cursor: pointer;" ng-click="closeNewVtypePop()"></i> 405 <i class="fa fa-times" aria-hidden="true" style="cursor: pointer;" ng-click="closeNewVtypePop()"></i>
406 </p> 406 </p>
407 <div class="clearfix"></div> 407 <div class="clearfix"></div>
408 </div> 408 </div>
409 <div class="customModelBody"> 409 <div class="customModelBody">
410 410
411 <div class="customAccordianHeader customActive"> 411 <div class="customAccordianHeader customActive">
412 <input type="text" class="form-control" style="width: 120px; margin-right: 10px;" placeholder="Margin Name" ng-model="newVtypeJet.marginName"> 412 <input type="text" class="form-control" style="width: 120px; margin-right: 10px;" placeholder="Margin Name" ng-model="newVtypeJet.marginName">
413 <select class="form-control" ng-model="newVtypeJet.pricingStructure"> 413 <select class="form-control" ng-model="newVtypeJet.pricingStructure">
414 <option value="" disabled selected>Pricing Structure</option> 414 <option value="" disabled selected>Pricing Structure</option>
415 <option value="minus">Retail-(minus)</option> 415 <option value="minus">Retail-(minus)</option>
416 <option value="plus">Cost+(plus)</option> 416 <option value="plus">Cost+(plus)</option>
417 <option value="equal">Direct=(equal)</option> 417 <option value="equal">Direct=(equal)</option>
418 </select> 418 </select>
419 <span style="margin-right: 0;">$</span> 419 <span style="margin-right: 0;">$</span>
420 <input type="text" class="form-control" style="width: 120px;" placeholder="Margin Price" ng-model="newVtypeJet.marginValue"> 420 <input type="text" class="form-control" style="width: 120px;" placeholder="Margin Price" ng-model="newVtypeJet.marginValue">
421 <div class="clearfix"></div> 421 <div class="clearfix"></div>
422 </div> 422 </div>
423 <div class="customAccordianTabBody"> 423 <div class="customAccordianTabBody">
424 <div ckeditor="options" ng-model="newVtypeJet.message" ready="onReady()"></div> 424 <div ckeditor="options" ng-model="newVtypeJet.message" ready="onReady()"></div>
425 </div> 425 </div>
426 426
427 </div> 427 </div>
428 <div class="customModelFooter text-center"> 428 <div class="customModelFooter text-center">
429 <input type="submit" value="Save" class="btn" ng-click="addNewVTypeJet()"> 429 <input type="submit" value="Save" class="btn" ng-click="addNewVTypeJet()">
430 <button class="btn" ng-click="closeNewVtypePop()">Cancel</button> 430 <button class="btn" ng-click="closeNewVtypePop()">Cancel</button>
431 </div> 431 </div>
432 </div> 432 </div>
433 </div> 433 </div>
434 </div> 434 </div>
435 435
436 <div class="customConfirmPopBackdrop" id="confirm1" style="display: none;"> 436 <div class="customConfirmPopBackdrop" id="confirm1" style="display: none;">
437 <div class="customModalInner"> 437 <div class="customModalInner">
438 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 438 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
439 <table> 439 <table>
440 <tr> 440 <tr>
441 <td> 441 <td>
442 <img src="img/info.png" style="width: 50px;"> 442 <img src="img/info.png" style="width: 50px;">
443 </td> 443 </td>
444 <td> 444 <td>
445 <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to email pricing to everyone in your contact list?</p> 445 <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to email pricing to everyone in your contact list?</p>
446 </td> 446 </td>
447 </tr> 447 </tr>
448 </table> 448 </table>
449 </div> 449 </div>
450 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 450 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
451 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="saveAndCloseConfirm()">Yes</button> 451 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="saveAndCloseConfirm()">Yes</button>
452 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelAndCloseConfirm()">Cancel</button> 452 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelAndCloseConfirm()">Cancel</button>
453 </div> 453 </div>
454 </div> 454 </div>
455 </div> 455 </div>
456 <div class="customConfirmPopBackdrop" id="confirm2" style="display: none;"> 456 <div class="customConfirmPopBackdrop" id="confirm2" style="display: none;">
457 <div class="customModalInner"> 457 <div class="customModalInner">
458 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 458 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
459 <table> 459 <table>
460 <tr> 460 <tr>
461 <td> 461 <td>
462 <img src="img/info.png" style="width: 50px;"> 462 <img src="img/info.png" style="width: 50px;">
463 </td> 463 </td>
464 <td> 464 <td>
465 <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to email pricing for this margin?</p> 465 <p style="padding: 5px 10px; margin-bottom: 0;">Are you sure that you want to email pricing for this margin?</p>
466 </td> 466 </td>
467 </tr> 467 </tr>
468 </table> 468 </table>
469 </div> 469 </div>
470 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 470 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
471 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="saveAndCloseForMarginConfirm()">Yes</button> 471 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="saveAndCloseForMarginConfirm()">Yes</button>
472 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelAndCloseForMarginConfirm()">Cancel</button> 472 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelAndCloseForMarginConfirm()">Cancel</button>
473 </div> 473 </div>
474 </div> 474 </div>
475 </div> 475 </div>
476 476
477 <div class="customConfirmPopBackdrop" id="deleteTierConfirm" style="display: none;"> 477 <div class="customConfirmPopBackdrop" id="deleteTierConfirm" style="display: none;">
478 <div class="customModalInner"> 478 <div class="customModalInner">
479 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 479 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
480 <table> 480 <table>
481 <tr> 481 <tr>
482 <td> 482 <td>
483 <img src="img/info.png" style="width: 50px;"> 483 <img src="img/info.png" style="width: 50px;">
484 </td> 484 </td>
485 <td> 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 </td> 487 </td>
488 </tr> 488 </tr>
489 </table> 489 </table>
490 </div> 490 </div>
491 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 491 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
492 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeleteTier()">Yes</button> 492 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeleteTier()">Yes</button>
493 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelTierDelete()">Cancel</button> 493 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelTierDelete()">Cancel</button>
494 </div> 494 </div>
495 </div> 495 </div>
496 </div> 496 </div>
497 497
498 <div class="customConfirmPopBackdrop" id="deleteVtypeTierConfirm" style="display: none;"> 498 <div class="customConfirmPopBackdrop" id="deleteVtypeTierConfirm" style="display: none;">
499 <div class="customModalInner"> 499 <div class="customModalInner">
500 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 500 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
501 <table> 501 <table>
502 <tr> 502 <tr>
503 <td> 503 <td>
504 <img src="img/info.png" style="width: 50px;"> 504 <img src="img/info.png" style="width: 50px;">
505 </td> 505 </td>
506 <td> 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 </td> 508 </td>
509 </tr> 509 </tr>
510 </table> 510 </table>
511 </div> 511 </div>
512 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 512 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
513 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeleteVtypeTier()">Yes</button> 513 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeleteVtypeTier()">Yes</button>
514 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelVtypeTierDelete()">Cancel</button> 514 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelVtypeTierDelete()">Cancel</button>
515 </div> 515 </div>
516 </div> 516 </div>
517 </div> 517 </div>
518 518
519 <div class="customConfirmPopBackdrop" id="deleteMargin" style="display: none;"> 519 <div class="customConfirmPopBackdrop" id="deleteMargin" style="display: none;">
520 <div class="customModalInner"> 520 <div class="customModalInner">
521 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 521 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
522 <table> 522 <table>
523 <tr> 523 <tr>
524 <td> 524 <td>
525 <img src="img/info.png" style="width: 50px;"> 525 <img src="img/info.png" style="width: 50px;">
526 </td> 526 </td>
527 <td> 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 </td> 529 </td>
530 </tr> 530 </tr>
531 </table> 531 </table>
532 </div> 532 </div>
533 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 533 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
534 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeleteMargin()">Yes</button> 534 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeleteMargin()">Yes</button>
535 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelMarginDelete()">Cancel</button> 535 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelMarginDelete()">Cancel</button>
536 </div> 536 </div>
537 </div> 537 </div>
538 </div> 538 </div>
539 539
540 <div class="customConfirmPopBackdrop" id="deleteVtypeMargin" style="display: none;"> 540 <div class="customConfirmPopBackdrop" id="deleteVtypeMargin" style="display: none;">
541 <div class="customModalInner"> 541 <div class="customModalInner">
542 <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> 542 <div class="customModelBody" style="border-radius: 5px 5px 0 0;">
543 <table> 543 <table>
544 <tr> 544 <tr>
545 <td> 545 <td>
546 <img src="img/info.png" style="width: 50px;"> 546 <img src="img/info.png" style="width: 50px;">
547 </td> 547 </td>
548 <td> 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 </td> 550 </td>
551 </tr> 551 </tr>
552 </table> 552 </table>
553 </div> 553 </div>
554 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> 554 <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;">
555 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeletVtypeMargin()">Yes</button> 555 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="confirmDeletVtypeMargin()">Yes</button>
556 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelVtypeMarginDelete()">Cancel</button> 556 <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelVtypeMarginDelete()">Cancel</button>
557 </div> 557 </div>
558 </div> 558 </div>
559 </div> 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 <!-- Le javascript 582 <!-- Le javascript
562 ================================================== --> 583 ================================================== -->
563 <!-- Placed at the end of the document so the pages load faster --> 584 <!-- Placed at the end of the document so the pages load faster -->
564 <!-- <script> 585 <!-- <script>
565 CKEDITOR.replace( 'editor2', { 586 CKEDITOR.replace( 'editor2', {
566 height: 250, 587 height: 250,
567 extraPlugins: 'divarea' 588 extraPlugins: 'divarea'
568 } ); 589 } );
569 </script> --> 590 </script> -->
app/partials/updateFuelManager/updateFuelManager.service.js
1 (function(){ 1 (function(){
2 'use strict'; 2 'use strict';
3 angular.module('acufuel') 3 angular.module('acufuel')
4 .service('updateFuelManagerService', ['$q', '$http', 'BASE_URL', updateFuelManagerService]); 4 .service('updateFuelManagerService', ['$q', '$http', 'BASE_URL', updateFuelManagerService]);
5 5
6 function updateFuelManagerService($q, $http, BASE_URL) { 6 function updateFuelManagerService($q, $http, BASE_URL) {
7 var temp = {}; 7 var temp = {};
8 8
9 this.getATypeJets = function(id) { 9 this.getATypeJets = function(id) {
10 10
11 var deferred = $q.defer(); 11 var deferred = $q.defer();
12 $http({ 12 $http({
13 method : 'GET', 13 method : 'GET',
14 url : BASE_URL.url +'/margin/getJetAType/'+id, 14 url : BASE_URL.url +'/margin/getJetAType/'+id,
15 headers : {'Content-Type': 'application/json'}, 15 headers : {'Content-Type': 'application/json'},
16 }) 16 })
17 .then(function (result){ 17 .then(function (result){
18 deferred.resolve(result.data); 18 deferred.resolve(result.data);
19 },function (result){ 19 },function (result){
20 deferred.resolve(result.data); 20 deferred.resolve(result.data);
21 }) 21 })
22 return deferred.promise; 22 return deferred.promise;
23 } 23 }
24 24
25 this.getVTypeJets = function(id) { 25 this.getVTypeJets = function(id) {
26 26
27 var deferred = $q.defer(); 27 var deferred = $q.defer();
28 $http({ 28 $http({
29 method : 'GET', 29 method : 'GET',
30 url : BASE_URL.url +'/margin/getAVGASType/'+id, 30 url : BASE_URL.url +'/margin/getAVGASType/'+id,
31 headers : {'Content-Type': 'application/json'}, 31 headers : {'Content-Type': 'application/json'},
32 }) 32 })
33 .then(function (result){ 33 .then(function (result){
34 deferred.resolve(result.data); 34 deferred.resolve(result.data);
35 },function (result){ 35 },function (result){
36 deferred.resolve(result.data); 36 deferred.resolve(result.data);
37 }) 37 })
38 return deferred.promise; 38 return deferred.promise;
39 } 39 }
40 40
41 this.addNewAtypeJetMargin = function(data){ 41 this.addNewAtypeJetMargin = function(data){
42 var deferred = $q.defer(); 42 var deferred = $q.defer();
43 $http({ 43 $http({
44 method : 'POST', 44 method : 'POST',
45 url : BASE_URL.url +'/margin', 45 url : BASE_URL.url +'/margin',
46 headers : {'Content-Type': 'application/json'}, 46 headers : {'Content-Type': 'application/json'},
47 data: data 47 data: data
48 }) 48 })
49 .then(function (result){ 49 .then(function (result){
50 deferred.resolve(result.data); 50 deferred.resolve(result.data);
51 },function (result){ 51 },function (result){
52 deferred.resolve(result.data); 52 deferred.resolve(result.data);
53 }) 53 })
54 return deferred.promise; 54 return deferred.promise;
55 } 55 }
56 56
57 this.addNewVtypeJet = function(data){ 57 this.addNewVtypeJet = function(data){
58 var deferred = $q.defer(); 58 var deferred = $q.defer();
59 $http({ 59 $http({
60 method : 'POST', 60 method : 'POST',
61 url : BASE_URL.url +'/margin', 61 url : BASE_URL.url +'/margin',
62 headers : {'Content-Type': 'application/json'}, 62 headers : {'Content-Type': 'application/json'},
63 data: data 63 data: data
64 }) 64 })
65 .then(function (result){ 65 .then(function (result){
66 deferred.resolve(result.data); 66 deferred.resolve(result.data);
67 },function (result){ 67 },function (result){
68 deferred.resolve(result.data); 68 deferred.resolve(result.data);
69 }) 69 })
70 return deferred.promise; 70 return deferred.promise;
71 } 71 }
72 72
73 this.editAtypeJetMargin = function(data){ 73 this.editAtypeJetMargin = function(data){
74 var deferred = $q.defer(); 74 var deferred = $q.defer();
75 $http({ 75 $http({
76 method : 'PUT', 76 method : 'PUT',
77 url : BASE_URL.url +'/margin', 77 url : BASE_URL.url +'/margin',
78 headers : {'Content-Type': 'application/json'}, 78 headers : {'Content-Type': 'application/json'},
79 data: data 79 data: data
80 }) 80 })
81 .then(function (result){ 81 .then(function (result){
82 deferred.resolve(result.data); 82 deferred.resolve(result.data);
83 },function (result){ 83 },function (result){
84 deferred.resolve(result.data); 84 deferred.resolve(result.data);
85 }) 85 })
86 return deferred.promise; 86 return deferred.promise;
87 } 87 }
88 88
89 this.editVtypeJetMargin = function(data){ 89 this.editVtypeJetMargin = function(data){
90 var deferred = $q.defer(); 90 var deferred = $q.defer();
91 $http({ 91 $http({
92 method : 'PUT', 92 method : 'PUT',
93 url : BASE_URL.url +'/margin', 93 url : BASE_URL.url +'/margin',
94 headers : {'Content-Type': 'application/json'}, 94 headers : {'Content-Type': 'application/json'},
95 data: data 95 data: data
96 }) 96 })
97 .then(function (result){ 97 .then(function (result){
98 deferred.resolve(result.data); 98 deferred.resolve(result.data);
99 },function (result){ 99 },function (result){
100 deferred.resolve(result.data); 100 deferred.resolve(result.data);
101 }) 101 })
102 return deferred.promise; 102 return deferred.promise;
103 } 103 }
104 104
105 this.getJetTiers = function(id) { 105 this.getJetTiers = function(id) {
106 var deferred = $q.defer(); 106 var deferred = $q.defer();
107 $http({ 107 $http({
108 method : 'GET', 108 method : 'GET',
109 url : BASE_URL.url +'/margin/getCustomMargins/'+id, 109 url : BASE_URL.url +'/margin/getCustomMargins/'+id,
110 headers : {'Content-Type': 'application/json'}, 110 headers : {'Content-Type': 'application/json'},
111 }) 111 })
112 .then(function (result){ 112 .then(function (result){
113 deferred.resolve(result.data); 113 deferred.resolve(result.data);
114 },function (result){ 114 },function (result){
115 deferred.resolve(result.data); 115 deferred.resolve(result.data);
116 }) 116 })
117 return deferred.promise; 117 return deferred.promise;
118 } 118 }
119 119
120 this.addNewTier = function(data){ 120 this.addNewTier = function(data){
121 var deferred = $q.defer(); 121 var deferred = $q.defer();
122 $http({ 122 $http({
123 method : 'POST', 123 method : 'POST',
124 url : BASE_URL.url +'/margin/custom', 124 url : BASE_URL.url +'/margin/custom',
125 headers : {'Content-Type': 'application/json'}, 125 headers : {'Content-Type': 'application/json'},
126 data: data 126 data: data
127 }) 127 })
128 .then(function (result){ 128 .then(function (result){
129 deferred.resolve(result.data); 129 deferred.resolve(result.data);
130 },function (result){ 130 },function (result){
131 deferred.resolve(result.data); 131 deferred.resolve(result.data);
132 }) 132 })
133 return deferred.promise; 133 return deferred.promise;
134 } 134 }
135 135
136 this.editTier = function(data){ 136 this.editTier = function(data){
137 var deferred = $q.defer(); 137 var deferred = $q.defer();
138 $http({ 138 $http({
139 method : 'PUT', 139 method : 'PUT',
140 url : BASE_URL.url +'/margin/custom', 140 url : BASE_URL.url +'/margin/custom',
141 headers : {'Content-Type': 'application/json'}, 141 headers : {'Content-Type': 'application/json'},
142 data: data 142 data: data
143 }) 143 })
144 .then(function (result){ 144 .then(function (result){
145 deferred.resolve(result.data); 145 deferred.resolve(result.data);
146 },function (result){ 146 },function (result){
147 deferred.resolve(result.data); 147 deferred.resolve(result.data);
148 }) 148 })
149 return deferred.promise; 149 return deferred.promise;
150 } 150 }
151 151
152 this.deleteTier = function(id) { 152 this.deleteTier = function(id) {
153 153
154 var deferred = $q.defer(); 154 var deferred = $q.defer();
155 $http({ 155 $http({
156 method : 'DELETE', 156 method : 'DELETE',
157 url : BASE_URL.url +'/margin/customMargins/'+id, 157 url : BASE_URL.url +'/margin/customMargins/'+id,
158 headers : {'Content-Type': 'application/json'}, 158 headers : {'Content-Type': 'application/json'},
159 }) 159 })
160 .then(function (result){ 160 .then(function (result){
161 deferred.resolve(result.data); 161 deferred.resolve(result.data);
162 },function (result){ 162 },function (result){
163 deferred.resolve(result.data); 163 deferred.resolve(result.data);
164 }) 164 })
165 return deferred.promise; 165 return deferred.promise;
166 } 166 }
167 167
168 this.getFuelPricingNew = function() { 168 this.getFuelPricingNew = function() {
169 169
170 var deferred = $q.defer(); 170 var deferred = $q.defer();
171 $http({ 171 $http({
172 method : 'GET', 172 method : 'GET',
173 url : BASE_URL.url +'/user/products', 173 url : BASE_URL.url +'/user/products',
174 headers : {'Content-Type': 'application/json'}, 174 headers : {'Content-Type': 'application/json'},
175 }) 175 })
176 .then(function (result){ 176 .then(function (result){
177 deferred.resolve(result.data); 177 deferred.resolve(result.data);
178 },function (result){ 178 },function (result){
179 deferred.resolve(result.data); 179 deferred.resolve(result.data);
180 }) 180 })
181 return deferred.promise; 181 return deferred.promise;
182 } 182 }
183 183
184 this.updateFuelPricing = function(data){ 184 this.updateFuelPricing = function(data){
185 var deferred = $q.defer(); 185 var deferred = $q.defer();
186 $http({ 186 $http({
187 method : 'POST', 187 method : 'POST',
188 url : BASE_URL.url +'/fuelPricing', 188 url : BASE_URL.url +'/fuelPricing',
189 headers : {'Content-Type': 'application/json'}, 189 headers : {'Content-Type': 'application/json'},
190 data: data 190 data: data
191 }) 191 })
192 .then(function (result){ 192 .then(function (result){
193 deferred.resolve(result.data); 193 deferred.resolve(result.data);
194 },function (result){ 194 },function (result){
195 deferred.resolve(result.data); 195 deferred.resolve(result.data);
196 }) 196 })
197 return deferred.promise; 197 return deferred.promise;
198 } 198 }
199 199
200 this.updateFutureFuelPricing = function(data){ 200 this.updateFutureFuelPricing = function(data){
201 var deferred = $q.defer(); 201 var deferred = $q.defer();
202 $http({ 202 $http({
203 method : 'POST', 203 method : 'POST',
204 url : BASE_URL.url +'/fuelPricing/futureFuelPricing', 204 url : BASE_URL.url +'/fuelPricing/futureFuelPricing',
205 headers : {'Content-Type': 'application/json'}, 205 headers : {'Content-Type': 'application/json'},
206 data: data 206 data: data
207 }) 207 })
208 .then(function (result){ 208 .then(function (result){
209 deferred.resolve(result.data); 209 deferred.resolve(result.data);
210 },function (result){ 210 },function (result){
211 deferred.resolve(result.data); 211 deferred.resolve(result.data);
212 }) 212 })
213 return deferred.promise; 213 return deferred.promise;
214 } 214 }
215 215
216 this.updateFutureFuelPricingImmediatlly = function(data){ 216 this.updateFutureFuelPricingImmediatlly = function(data){
217 var deferred = $q.defer(); 217 var deferred = $q.defer();
218 $http({ 218 $http({
219 method : 'POST', 219 method : 'POST',
220 url : BASE_URL.url +'/fuelPricing/updateImmediateFuelPrice', 220 url : BASE_URL.url +'/fuelPricing/updateImmediateFuelPrice',
221 headers : {'Content-Type': 'application/json'}, 221 headers : {'Content-Type': 'application/json'},
222 data: data 222 data: data
223 }) 223 })
224 .then(function (result){ 224 .then(function (result){
225 deferred.resolve(result.data); 225 deferred.resolve(result.data);
226 },function (result){ 226 },function (result){
227 deferred.resolve(result.data); 227 deferred.resolve(result.data);
228 }) 228 })
229 return deferred.promise; 229 return deferred.promise;
230 } 230 }
231 231
232 this.getMargin = function() { 232 this.getMargin = function() {
233 233
234 var deferred = $q.defer(); 234 var deferred = $q.defer();
235 $http({ 235 $http({
236 method : 'GET', 236 method : 'GET',
237 url : BASE_URL.url +'/user/margins', 237 url : BASE_URL.url +'/user/margins',
238 headers : {'Content-Type': 'application/json'}, 238 headers : {'Content-Type': 'application/json'},
239 }) 239 })
240 .then(function (result){ 240 .then(function (result){
241 deferred.resolve(result.data); 241 deferred.resolve(result.data);
242 },function (result){ 242 },function (result){
243 deferred.resolve(result.data); 243 deferred.resolve(result.data);
244 }) 244 })
245 return deferred.promise; 245 return deferred.promise;
246 } 246 }
247 247
248 this.sendMailToMargin = function(id){ 248 this.sendMailToMargin = function(id){
249 var deferred = $q.defer(); 249 var deferred = $q.defer();
250 $http({ 250 $http({
251 method : 'POST', 251 method : 'POST',
252 url : BASE_URL.url +'/fuelPricing/sendPriceEmail/'+id, 252 url : BASE_URL.url +'/fuelPricing/sendPriceEmail/'+id,
253 headers : {'Content-Type': 'application/json'} 253 headers : {'Content-Type': 'application/json'}
254 }) 254 })
255 .then(function (result){ 255 .then(function (result){
256 deferred.resolve(result.data); 256 deferred.resolve(result.data);
257 },function (result){ 257 },function (result){
258 deferred.resolve(result.data); 258 deferred.resolve(result.data);
259 }) 259 })
260 return deferred.promise; 260 return deferred.promise;
261 } 261 }
262 262
263 this.sendMailToGroupMargin = function(type){ 263 this.sendMailToGroupMargin = function(type){
264 var deferred = $q.defer(); 264 var deferred = $q.defer();
265 $http({ 265 $http({
266 method : 'POST', 266 method : 'POST',
267 url : BASE_URL.url +'/fuelPricing/sendPriceEmailByType/'+type, 267 url : BASE_URL.url +'/fuelPricing/sendPriceEmailByType/'+type,
268 headers : {'Content-Type': 'application/json'} 268 headers : {'Content-Type': 'application/json'}
269 }) 269 })
270 .then(function (result){ 270 .then(function (result){
271 deferred.resolve(result.data); 271 deferred.resolve(result.data);
272 },function (result){ 272 },function (result){
273 deferred.resolve(result.data); 273 deferred.resolve(result.data);
274 }) 274 })
275 return deferred.promise; 275 return deferred.promise;
276 } 276 }
277 277
278 this.deleteMargin = function(id) { 278 this.deleteMargin = function(id) {
279 279
280 var deferred = $q.defer(); 280 var deferred = $q.defer();
281 $http({ 281 $http({
282 method : 'DELETE', 282 method : 'DELETE',
283 url : BASE_URL.url +'/margin/'+id, 283 url : BASE_URL.url +'/margin/'+id,
284 headers : {'Content-Type': 'application/json'}, 284 headers : {'Content-Type': 'application/json'},
285 }) 285 })
286 .then(function (result){ 286 .then(function (result){
287 deferred.resolve(result.data); 287 deferred.resolve(result.data);
288 },function (result){ 288 },function (result){
289 deferred.resolve(result.data); 289 deferred.resolve(result.data);
290 }) 290 })
291 return deferred.promise; 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 }
297 313
298 })(); 314 })();