Commit 64b3dc0e3570e4fa773a5c877b0fc18c3af29f5f
1 parent
978dc5040f
Exists in
master
omit vendor and company specific
Showing
6 changed files
with
99 additions
and
47 deletions
Show diff stats
app/partials/viewCompany/viewCompany.controller.js
... | ... | @@ -237,7 +237,7 @@ angular.module('acufuel') |
237 | 237 | |
238 | 238 | function getAircraftList() { |
239 | 239 | ViewCompanyService.getAircraft(companyId).then(function(result) { |
240 | - console.log("aircrafts",result) | |
240 | + //console.log("aircrafts",result) | |
241 | 241 | $scope.contactAircraftList = result; |
242 | 242 | for (var i = 0; i < $scope.contactAircraftList.length; i++) { |
243 | 243 | if ($scope.contactAircraftList[i].aircraftsMargin != null) { |
... | ... | @@ -608,18 +608,26 @@ angular.module('acufuel') |
608 | 608 | } |
609 | 609 | } |
610 | 610 | |
611 | - /* editing */ | |
611 | + /* omit strike out*/ | |
612 | 612 | updateFuelManagerService.getFuelPricingNew().then(function(result) { |
613 | 613 | $scope.fuelPricing = result; |
614 | 614 | $scope.omitData; |
615 | 615 | ViewCompanyService.getOmitCompany($scope.compId).then(function(result){ |
616 | 616 | $scope.omitData = result; |
617 | - console.log("omit data===", $scope.omitData); | |
617 | + //console.log("omit data===", $scope.omitData); | |
618 | + for(var i = 0 ; i< $scope.fuelPricing.length; i++){ | |
619 | + for(var j = 0; j<$scope.omitData.length; j++){ | |
620 | + if($scope.omitData[j].marginId == $scope.fuelPricing[i].fuelPricing.id){ | |
621 | + $scope.fuelPricing[i].fuelPricing.omit = $scope.omitData[j].omit; | |
622 | + } | |
623 | + } | |
624 | + } | |
625 | + | |
618 | 626 | }) |
619 | 627 | |
620 | - console.log("$scope.fuelPricing",$scope.fuelPricing) | |
628 | + // console.log("$scope.fuelPricing",$scope.fuelPricing) | |
621 | 629 | for (var i = 0; i < $scope.fuelPricing.length; i++) { |
622 | - console.log('$scope.fuelPricing[i].fuelPricing', $scope.fuelPricing[i].fuelPricing); | |
630 | + // console.log('$scope.fuelPricing[i].fuelPricing', $scope.fuelPricing[i].fuelPricing); | |
623 | 631 | //console.log("fuelid",$scope.fuelPricing[i].fuelPricing.id,"getid",$scope.omitData[j].id) |
624 | 632 | if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) { |
625 | 633 | $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); |
... | ... | @@ -725,6 +733,16 @@ angular.module('acufuel') |
725 | 733 | }) |
726 | 734 | } |
727 | 735 | |
736 | + /*omitStrikeout(); | |
737 | + function omitStrikeout(){ | |
738 | + for(var i = 0; i < $scope.omitData.length; i++){ | |
739 | + if($scope.omitData.marginId === $scope.fuelPricing.id){ | |
740 | + console.log(hi) | |
741 | + $scope.fuelPricing.omit = 'true'; | |
742 | + } | |
743 | + } | |
744 | + }*/ | |
745 | + | |
728 | 746 | |
729 | 747 | $scope.updateOmit = function(fuel, omit) { |
730 | 748 | $scope.fuelData = {}; |
... | ... | @@ -735,11 +753,8 @@ angular.module('acufuel') |
735 | 753 | $scope.fuelData.papTotal = fuel.papTotal; |
736 | 754 | $scope.fuelData.cost = fuel.cost; |
737 | 755 | $scope.fuelData.companyId = $scope.compId ; |
738 | - console.log("companyId",$scope.compId) | |
739 | - console.log("omit checked",$scope.fuelData.omit) | |
740 | 756 | if($scope.fuelData.omit == true) |
741 | 757 | { |
742 | - console.log("Insert API called",$scope.fuelData.customMarginId) | |
743 | 758 | var customData = "companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId; |
744 | 759 | ViewCompanyService.omitAddCompanyFuel(customData).then(function(result) { |
745 | 760 | if (result.success) { |
... | ... | @@ -753,9 +768,8 @@ angular.module('acufuel') |
753 | 768 | } |
754 | 769 | }) |
755 | 770 | }else{ |
756 | - console.log("Delete API called",$scope.compId) | |
757 | - // var Id = "companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId; | |
758 | - ViewCompanyService.omitDeleteCompanyFuel($scope.fuelData.customMarginId).then(function(result){ | |
771 | + var data ="companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId; | |
772 | + ViewCompanyService.omitDeleteCompanyFuel(data).then(function(result){ | |
759 | 773 | if (result.success) { |
760 | 774 | toastr.success('' + result.success + '', { |
761 | 775 | closeButton: true | ... | ... |
app/partials/viewCompany/viewCompany.html
... | ... | @@ -424,8 +424,8 @@ |
424 | 424 | </div> |
425 | 425 | <div class="widget-content"> |
426 | 426 | <div class="table-responsive"> |
427 | - <!-- <table class="table table-striped strikeTable" style="position: relative; margin-bottom: 0;"> --> | |
428 | - <table class="table table-striped" style="position: relative; margin-bottom: 0;"> | |
427 | + <table class="table table-striped strikeTable" style="position: relative; margin-bottom: 0;"> | |
428 | + <!-- <table class="table table-striped" style="position: relative; margin-bottom: 0;"> --> | |
429 | 429 | <thead> |
430 | 430 | <tr> |
431 | 431 | <th>Omit</th> |
... | ... | @@ -437,8 +437,8 @@ |
437 | 437 | </tr> |
438 | 438 | </thead> |
439 | 439 | <tbody> |
440 | - <!-- <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }" ng-class="fuel.fuelPricing.omit ? 'strikeout' : ''"> --> | |
441 | - <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }"> | |
440 | + <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }" ng-class="fuel.fuelPricing.omit ? 'strikeout' : ''"> | |
441 | + <!-- <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }"> --> | |
442 | 442 | <td><input type="checkbox" ng-model="fuel.fuelPricing.omit" ng-change="updateOmit(fuel.fuelPricing, fuel.status)"></td> |
443 | 443 | <td>{{fuel.name}}</td> |
444 | 444 | <td>${{fuel.fuelPricing.cost | number :4}}</td> | ... | ... |
app/partials/viewCompany/viewCompany.service.js
... | ... | @@ -314,7 +314,7 @@ |
314 | 314 | return deferred.promise; |
315 | 315 | } |
316 | 316 | |
317 | - this.omitDeleteCompanyFuel = function(id) { | |
317 | + /*this.omitDeleteCompanyFuel = function(id) { | |
318 | 318 | |
319 | 319 | var deferred = $q.defer(); |
320 | 320 | $http({ |
... | ... | @@ -330,6 +330,24 @@ |
330 | 330 | return deferred.promise; |
331 | 331 | } |
332 | 332 | |
333 | + | |
334 | +*/ | |
335 | + this.omitDeleteCompanyFuel = function(data){ | |
336 | + var deferred = $q.defer(); | |
337 | + $http({ | |
338 | + method : 'POST', | |
339 | + url : BASE_URL.url +'/company/omitData/delete', | |
340 | + data : data, | |
341 | + headers : {'Content-Type': 'application/json'}, | |
342 | + }) | |
343 | + .then(function (result){ | |
344 | + deferred.resolve(result.data); | |
345 | + },function (result){ | |
346 | + deferred.resolve(result.data); | |
347 | + }) | |
348 | + return deferred.promise; | |
349 | + } | |
350 | + | |
333 | 351 | this.omitAddCompanyFuel = function(data){ |
334 | 352 | var deferred = $q.defer(); |
335 | 353 | $http({ | ... | ... |
app/partials/viewFuelVendor/viewFuelVendor.controller.js
... | ... | @@ -33,17 +33,7 @@ |
33 | 33 | }) |
34 | 34 | } |
35 | 35 | |
36 | - $scope.omitData ={}; | |
37 | - getOmitVendorFuel(); | |
38 | - function getOmitVendorFuel() { | |
39 | - console.log("sada" ,vendorId) | |
40 | - ViewFuelVendorService.getOmitVendor(vendorId).then(function(result){ | |
41 | - $scope.omitData = result; | |
42 | - console.log("omit data===",$scope.omitData ) | |
43 | - }) | |
44 | - | |
45 | - } | |
46 | - | |
36 | + | |
47 | 37 | $scope.changeCompanyStatus = function(){ |
48 | 38 | $('#deleteVendor').css('display', 'block'); |
49 | 39 | if($scope.vendorData.activate == true){ |
... | ... | @@ -166,7 +156,7 @@ |
166 | 156 | $scope.sendMail = function(){ |
167 | 157 | $('#confirm2').css('display', 'none'); |
168 | 158 | ViewFuelVendorService.sendMail(vendorId).then(function(result) { |
169 | - console.log("email", vendorId) | |
159 | + // console.log("email", vendorId) | |
170 | 160 | if(result != null && result.success){ |
171 | 161 | toastr.success(''+result.success+'', { |
172 | 162 | closeButton: true |
... | ... | @@ -304,18 +294,32 @@ |
304 | 294 | } |
305 | 295 | } |
306 | 296 | |
297 | + /* omit strike out here */ | |
307 | 298 | updateFuelManagerService.getFuelPricingNew().then(function(result) { |
308 | 299 | $scope.fuelPricing = result; |
309 | - for (var i = 0; i<$scope.fuelPricing.length; i++) { | |
310 | - if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) { | |
311 | - $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); | |
312 | - var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); | |
313 | - var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 | |
314 | - var dday = newTime.getUTCDate(); | |
315 | - var dyear = newTime.getUTCFullYear(); | |
316 | - $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth+'/'+dday+'/'+dyear; | |
317 | - } | |
318 | - } | |
300 | + $scope.omitData; | |
301 | + ViewFuelVendorService.getOmitVendor(vendorId).then(function(result){ | |
302 | + $scope.omitData = result; | |
303 | + // console.log("omit data===",$scope.omitData); | |
304 | + for(var i = 0 ; i< $scope.fuelPricing.length; i++){ | |
305 | + for(var j = 0; j<$scope.omitData.length; j++){ | |
306 | + if($scope.omitData[j].marginId == $scope.fuelPricing[i].fuelPricing.id){ | |
307 | + $scope.fuelPricing[i].fuelPricing.omit = $scope.omitData[j].omit; | |
308 | + } | |
309 | + } | |
310 | + } | |
311 | + }) | |
312 | + // console.log("$scope.fuelPricing",$scope.fuelPricing) | |
313 | + for (var i = 0; i<$scope.fuelPricing.length; i++) { | |
314 | + if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) { | |
315 | + $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); | |
316 | + var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); | |
317 | + var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 | |
318 | + var dday = newTime.getUTCDate(); | |
319 | + var dyear = newTime.getUTCFullYear(); | |
320 | + $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth+'/'+dday+'/'+dyear; | |
321 | + } | |
322 | + } | |
319 | 323 | }) |
320 | 324 | |
321 | 325 | |
... | ... | @@ -372,9 +376,9 @@ |
372 | 376 | } |
373 | 377 | }) |
374 | 378 | }else{ |
375 | - console.log("Delete API called",vendorId) | |
376 | - // var Id = "vendorId=" + vendorId + "&customMarginId=" + $scope.fuelData.customMarginId; | |
377 | - ViewFuelVendorService.omitDeleteVendorFuel(vendorId).then(function(result){ | |
379 | + // console.log("Delete API called",vendorId) | |
380 | + var data ="vendorId=" + vendorId + "&customMarginId=" + $scope.fuelData.customMarginId; | |
381 | + ViewFuelVendorService.omitDeleteVendorFuel(data).then(function(result){ | |
378 | 382 | if (result.success) { |
379 | 383 | toastr.success('' + result.success + '', { |
380 | 384 | closeButton: true | ... | ... |
app/partials/viewFuelVendor/viewFuelVendor.html
... | ... | @@ -243,8 +243,8 @@ |
243 | 243 | </div> |
244 | 244 | <div class="widget-content"> |
245 | 245 | <div class="table-responsive"> |
246 | - <!-- <table class="table table-hover table-striped strikeTable"> --> | |
247 | - <table class="table table-hover table-striped"> | |
246 | + <table class="table table-hover table-striped strikeTable"> | |
247 | + <!-- <table class="table table-hover table-striped"> --> | |
248 | 248 | <thead> |
249 | 249 | <tr> |
250 | 250 | <th>Omit</th> |
... | ... | @@ -256,8 +256,8 @@ |
256 | 256 | </tr> |
257 | 257 | </thead> |
258 | 258 | <tbody> |
259 | - <!-- <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }" ng-class="fuel.fuelPricing.omit ? 'strikeout' : ''"> --> | |
260 | - <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }"> | |
259 | + <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }" ng-class="fuel.fuelPricing.omit ? 'strikeout' : ''"> | |
260 | + <!-- <tr ng-repeat="fuel in fuelPricing | orderBy:'name' : 'reverse' | filter:{ status: true }"> --> | |
261 | 261 | <td><input type="checkbox" ng-model="fuel.fuelPricing.omit" ng-change="updateOmit(fuel.fuelPricing, fuel.status)"></td> |
262 | 262 | <td>{{fuel.name}}</td> |
263 | 263 | <td>${{fuel.fuelPricing.cost}}</td> | ... | ... |
app/partials/viewFuelVendor/viewFuelVendor.service.js
... | ... | @@ -251,7 +251,7 @@ |
251 | 251 | return deferred.promise; |
252 | 252 | } |
253 | 253 | |
254 | - this.omitDeleteVendorFuel = function(id) { | |
254 | + /*this.omitDeleteVendorFuel = function(id) { | |
255 | 255 | |
256 | 256 | var deferred = $q.defer(); |
257 | 257 | $http({ |
... | ... | @@ -265,8 +265,24 @@ |
265 | 265 | deferred.resolve(result.data); |
266 | 266 | }) |
267 | 267 | return deferred.promise; |
268 | - } | |
268 | + } */ | |
269 | 269 | |
270 | + this.omitDeleteVendorFuel = function(data){ | |
271 | + var deferred = $q.defer(); | |
272 | + $http({ | |
273 | + method : 'POST', | |
274 | + url : BASE_URL.url +'/vendor/omitData/delete', | |
275 | + data : data, | |
276 | + headers : {'Content-Type': 'application/json'}, | |
277 | + }) | |
278 | + .then(function (result){ | |
279 | + deferred.resolve(result.data); | |
280 | + },function (result){ | |
281 | + deferred.resolve(result.data); | |
282 | + }) | |
283 | + return deferred.promise; | |
284 | + } | |
285 | + | |
270 | 286 | this.omitAddvendorFuel = function(data){ |
271 | 287 | var deferred = $q.defer(); |
272 | 288 | $http({ | ... | ... |