Commit 00d325f95252df4e44827b23c7ea8c5f2b2452c9

Authored by Kuldeep Arora
1 parent a858eca3e7
Exists in master

logs

app/partials/enterFuelOrder/enterFuelOrder.controller.js
1 'use strict'; 1 'use strict';
2 2
3 angular.module('acufuel') 3 angular.module('acufuel')
4 4
5 .controller('enterFuelOrderController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'enterFuelOrderService', enterFuelOrderController]); 5 .controller('enterFuelOrderController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'enterFuelOrderService', enterFuelOrderController]);
6 6
7 function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, enterFuelOrderService) { 7 function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, enterFuelOrderService) {
8 $scope.showLoader = true; 8 $scope.showLoader = true;
9 9
10 $scope.companyList = {}; 10 $scope.companyList = {};
11 11
12 enterFuelOrderService.getAllCompanies().then(function(result) { 12 enterFuelOrderService.getAllCompanies().then(function(result) {
13 $scope.showLoader = false; 13 $scope.showLoader = false;
14 $scope.companyList = result; 14 $scope.companyList = result;
15 //console.log("===company====",result) 15 //console.log("===company====",result)
16 }) 16 })
17 17
18 $scope.order = {}; 18 $scope.order = {};
19 $scope.dispatchOrder = {}; 19 $scope.dispatchOrder = {};
20 $scope.dispatchOrder.fuelOrderList = []; 20 $scope.dispatchOrder.fuelOrderList = [];
21 $scope.order.upliftDate = ''; 21 $scope.order.upliftDate = '';
22 //$scope.order.departingDate = ''; 22 //$scope.order.departingDate = '';
23 $scope.selectedCompanyName = ''; 23 $scope.selectedCompanyName = '';
24 $scope.selectedCompanyId = ''; 24 $scope.selectedCompanyId = '';
25 $scope.marginId = ''; 25 $scope.marginId = '';
26 $scope.selectedTier = ''; 26 $scope.selectedTier = '';
27 27
28 $scope.getAircraft = function(company){ 28 $scope.getAircraft = function(company){
29 $scope.selectedCompanyName = company; 29 $scope.selectedCompanyName = company;
30 30
31 31
32 $scope.showLoader = true; 32 $scope.showLoader = true;
33 for (var i = 0; i < $scope.companyList.length; i++) { 33 for (var i = 0; i < $scope.companyList.length; i++) {
34 if ($scope.companyList[i].companyName == company) { 34 if ($scope.companyList[i].companyName == company) {
35 $scope.order.certificateType = $scope.companyList[i].certificateType; 35 $scope.order.certificateType = $scope.companyList[i].certificateType;
36 $scope.baseTenant = $scope.companyList[i].baseTenant; 36 $scope.baseTenant = $scope.companyList[i].baseTenant;
37 $scope.contractFuelVendor = $scope.companyList[i].contractFuelVendor; 37 $scope.contractFuelVendor = $scope.companyList[i].contractFuelVendor;
38 $scope.fuelerlinxCustomer = $scope.companyList[i].fuelerlinxCustomer; 38 $scope.fuelerlinxCustomer = $scope.companyList[i].fuelerlinxCustomer;
39 39
40 if($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null){ 40 if($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null){
41 console.log("1====",$scope.companyList[i].margin,"===",$scope.companyList[i].marginAVGAS);
42 enterFuelOrderService.getFuelCost($scope.companyList[i].id).then(function(margins) { 41 enterFuelOrderService.getFuelCost($scope.companyList[i].id).then(function(margins) {
43 $scope.marginList = margins; 42 $scope.marginList = margins;
44 console.log("===margins===",margins);
45 }) 43 })
46 } else if ($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS == null) { 44 } else if ($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS == null) {
47 console.log("2====",$scope.companyList[i].margin,"===",$scope.companyList[i].marginAVGAS);
48 enterFuelOrderService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) { 45 enterFuelOrderService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) {
49 $scope.marginList = margins; 46 $scope.marginList = margins;
50 console.log("===margins===",margins); }) 47 })
51 } else if ($scope.companyList[i].margin == null && $scope.companyList[i].marginAVGAS != null) { 48 } else if ($scope.companyList[i].margin == null && $scope.companyList[i].marginAVGAS != null) {
52 console.log("3====",$scope.companyList[i].margin,"===",$scope.companyList[i].marginAVGAS);
53 enterFuelOrderService.getVTypeFuelPricing($scope.companyList[i].id).then(function(margins) { 49 enterFuelOrderService.getVTypeFuelPricing($scope.companyList[i].id).then(function(margins) {
54 $scope.marginList = margins; 50 $scope.marginList = margins;
55 console.log("===margins===",margins);
56 }) 51 })
57 } else if ($scope.companyList[i].margin == null && $scope.companyList[i].marginAVGAS == null) { 52 } else if ($scope.companyList[i].margin == null && $scope.companyList[i].marginAVGAS == null) {
58 console.log("4====",$scope.companyList[i].margin,"===",$scope.companyList[i].marginAVGAS);
59 enterFuelOrderService.getPapFuelPricing($scope.companyList[i].id).then(function(margins) { 53 enterFuelOrderService.getPapFuelPricing($scope.companyList[i].id).then(function(margins) {
60 $scope.marginList = margins; 54 $scope.marginList = margins;
61 console.log("===margins===",margins);
62 }) 55 })
63 } 56 }
64 $scope.selectedCompanyId = $scope.companyList[i].id; 57 $scope.selectedCompanyId = $scope.companyList[i].id;
65 58
66 if ($scope.selectedCompanyId != '') { 59 if ($scope.selectedCompanyId != '') {
67 enterFuelOrderService.getAircraft($scope.selectedCompanyId).then(function(aircraft) { 60 enterFuelOrderService.getAircraft($scope.selectedCompanyId).then(function(aircraft) {
68 $scope.aircraftList = aircraft; 61 $scope.aircraftList = aircraft;
69 }) 62 })
70 } 63 }
71 if($scope.companyList[i].margin == null) { 64 if($scope.companyList[i].margin == null) {
72 $scope.tierList = []; 65 $scope.tierList = [];
73 $scope.tierList.push({ 66 $scope.tierList.push({
74 'minTierBreak': '0', 'maxTierBreak': '∞' 67 'minTierBreak': '0', 'maxTierBreak': '∞'
75 }); 68 });
76 $scope.showLoader = false; 69 $scope.showLoader = false;
77 } else { 70 } else {
78 $scope.marginId = $scope.companyList[i].margin.id; 71 $scope.marginId = $scope.companyList[i].margin.id;
79 if ($scope.marginId != '') { 72 if ($scope.marginId != '') {
80 enterFuelOrderService.getJetTiers($scope.marginId).then(function(tiers) { 73 enterFuelOrderService.getJetTiers($scope.marginId).then(function(tiers) {
81 $scope.tierList = tiers; 74 $scope.tierList = tiers;
82 $scope.showLoader = false; 75 $scope.showLoader = false;
83 $scope.selectedTier = $scope.tierList[0]; 76 $scope.selectedTier = $scope.tierList[0];
84 }) 77 })
85 }else{ 78 }else{
86 $scope.showLoader = false; 79 $scope.showLoader = false;
87 } 80 }
88 } 81 }
89 } 82 }
90 } 83 }
91 84
92 } 85 }
93 86
94 $scope.tiervalue=function(){ 87 $scope.tiervalue=function(){
95 $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak; 88 $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak;
96 } 89 }
97 90
98 91
99 92
100 93
101 $scope.cancelOrder = function() { 94 $scope.cancelOrder = function() {
102 $scope.order = {}; 95 $scope.order = {};
103 } 96 }
104 97
105 98
106 $scope.setCost = function(cost){ 99 $scope.setCost = function(cost){
107 if(cost != null) { 100 if(cost != null) {
108 var obj =JSON.parse(cost); 101 var obj =JSON.parse(cost);
109 $scope.order.fboCost = obj.cost; 102 $scope.order.fboCost = obj.cost;
110 } 103 }
111 } 104 }
112 105
113 106
114 $scope.addTotal = function(value, valueOf) { 107 $scope.addTotal = function(value, valueOf) {
115 if (value != undefined && valueOf != undefined) { 108 if (value != undefined && valueOf != undefined) {
116 value = JSON.parse(value) 109 value = JSON.parse(value)
117 $scope.order.total = Math.abs(value.papTotal) * valueOf; 110 $scope.order.total = Math.abs(value.papTotal) * valueOf;
118 } 111 }
119 } 112 }
120 113
121 $scope.dispatchFuel = function(){ 114 $scope.dispatchFuel = function(){
122 $scope.showLoader = true; 115 $scope.showLoader = true;
123 116
124 $scope.order.companyId = $scope.selectedCompanyId; 117 $scope.order.companyId = $scope.selectedCompanyId;
125 $scope.order.companyName = $scope.order.companyName; 118 $scope.order.companyName = $scope.order.companyName;
126 var aircraftObj =JSON.parse($scope.order.aircraftName); 119 var aircraftObj =JSON.parse($scope.order.aircraftName);
127 $scope.order.aircraftName = aircraftObj.tail; 120 $scope.order.aircraftName = aircraftObj.tail;
128 $scope.order.make = aircraftObj.make; 121 $scope.order.make = aircraftObj.make;
129 $scope.order.model = aircraftObj.model; 122 $scope.order.model = aircraftObj.model;
130 //$scope.order.fuelOn = $scope.order.fuelOn; 123 //$scope.order.fuelOn = $scope.order.fuelOn;
131 124
132 $scope.order.invoiced = $scope.order.invoiced; 125 $scope.order.invoiced = $scope.order.invoiced;
133 $scope.order.volume = $scope.order.volume; 126 $scope.order.volume = $scope.order.volume;
134 // $scope.order.source = $scope.order.source; 127 // $scope.order.source = $scope.order.source;
135 128
136 $scope.order.total = $scope.order.total; 129 $scope.order.total = $scope.order.total;
137 130
138 var obj =JSON.parse($scope.order.priceQuote); 131 var obj =JSON.parse($scope.order.priceQuote);
139 $scope.order.priceQuote = obj.papTotal; 132 $scope.order.priceQuote = obj.papTotal;
140 $scope.order.fboCost = obj.cost; 133 $scope.order.fboCost = obj.cost;
141 $scope.order.productName = obj.productName; 134 $scope.order.productName = obj.productName;
142 135
143 $scope.order.etaTime = $scope.order.etaTime; 136 $scope.order.etaTime = $scope.order.etaTime;
144 $scope.order.etdTime = $scope.order.etdTime; 137 $scope.order.etdTime = $scope.order.etdTime;
145 $scope.order.certificateType = $scope.order.certificateType; 138 $scope.order.certificateType = $scope.order.certificateType;
146 var currentDate = new Date(); 139 var currentDate = new Date();
147 var hours = currentDate.getHours(); 140 var hours = currentDate.getHours();
148 var min = currentDate.getMinutes(); 141 var min = currentDate.getMinutes();
149 var sec = currentDate.getSeconds(); 142 var sec = currentDate.getSeconds();
150 if ($scope.order.upliftDate != '') { 143 if ($scope.order.upliftDate != '') {
151 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec; 144 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec;
152 $scope.order.upliftDate = new Date($scope.order.upliftDate); 145 $scope.order.upliftDate = new Date($scope.order.upliftDate);
153 $scope.order.upliftDate = $scope.order.upliftDate.getTime(); 146 $scope.order.upliftDate = $scope.order.upliftDate.getTime();
154 } 147 }
155 148
156 149
157 if ($scope.order.departingDate != '') { 150 if ($scope.order.departingDate != '') {
158 $scope.order.departingDate = $scope.order.departingDate + ' ' + hours + ':' + min + ':' + sec; 151 $scope.order.departingDate = $scope.order.departingDate + ' ' + hours + ':' + min + ':' + sec;
159 $scope.order.departingDate = new Date($scope.order.departingDate); 152 $scope.order.departingDate = new Date($scope.order.departingDate);
160 $scope.order.departingDate = $scope.order.departingDate.getTime(); 153 $scope.order.departingDate = $scope.order.departingDate.getTime();
161 } 154 }
162 155
163 if($scope.order.status === null || $scope.order.status === undefined){ 156 if($scope.order.status === null || $scope.order.status === undefined){
164 157
165 $scope.order.status = "pending"; //default status 158 $scope.order.status = "pending"; //default status
166 159
167 }else { 160 }else {
168 161
169 $scope.order.status = $scope.order.status; 162 $scope.order.status = $scope.order.status;
170 } 163 }
171 if($scope.order.fuelOn === null || $scope.order.fuelOn ===undefined){ 164 if($scope.order.fuelOn === null || $scope.order.fuelOn ===undefined){
172 $scope.order.fuelOn = "Arrival"; //default fuelon 165 $scope.order.fuelOn = "Arrival"; //default fuelon
173 }else { 166 }else {
174 $scope.order.fuelOn = $scope.order.fuelOn ; 167 $scope.order.fuelOn = $scope.order.fuelOn ;
175 } 168 }
176 169
177 if($scope.baseTenant && $scope.contractFuelVendor ){ 170 if($scope.baseTenant && $scope.contractFuelVendor ){
178 $scope.order.source = "Tenant/CAA" ; 171 $scope.order.source = "Tenant/CAA" ;
179 }else if($scope.baseTenant) 172 }else if($scope.baseTenant)
180 { 173 {
181 $scope.order.source = "Tenant/Base Customer"; 174 $scope.order.source = "Tenant/Base Customer";
182 }else if($scope.contractFuelVendor){ 175 }else if($scope.contractFuelVendor){
183 $scope.order.source = "CAA Member"; 176 $scope.order.source = "CAA Member";
184 } 177 }
185 178
186 $scope.dispatchOrder.fuelOrderList.push($scope.order); 179 $scope.dispatchOrder.fuelOrderList.push($scope.order);
187 180
188 enterFuelOrderService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { 181 enterFuelOrderService.dispathFuelOrder($scope.dispatchOrder).then(function(result) {
189 $scope.showLoader = false; 182 $scope.showLoader = false;
190 $scope.order = {}; 183 $scope.order = {};
191 $scope.dispatchOrder={}; 184 $scope.dispatchOrder={};
192 $scope.order.source=''; 185 $scope.order.source='';
193 $scope.baseTenant=false; 186 $scope.baseTenant=false;
194 $scope.contractFuelVendor=false; 187 $scope.contractFuelVendor=false;
195 toastr.success('Fuel Order Created Successfully', { 188 toastr.success('Fuel Order Created Successfully', {
196 closeButton: true 189 closeButton: true
197 }) 190 })
198 }) 191 })
199 } 192 }
200 193
201 194
202 $scope.etaTimeList=[]; 195 $scope.etaTimeList=[];
203 $scope.etdTimeList =[]; 196 $scope.etdTimeList =[];
204 197
205 $scope.etaTimeList = [{time:"12:00 AM"},{time:"12:30 AM"},{time:"01:00 AM"},{time:"01:30 AM"},{time:"02:00 AM"},{time:"02:30 AM"},{time:"03:00 AM"},{time:"03:30 AM"}, 198 $scope.etaTimeList = [{time:"12:00 AM"},{time:"12:30 AM"},{time:"01:00 AM"},{time:"01:30 AM"},{time:"02:00 AM"},{time:"02:30 AM"},{time:"03:00 AM"},{time:"03:30 AM"},
206 {time:"04:00 AM"},{time:"04:30 AM"},{time:"05:00 AM"},{time:"05:30 AM"},{time:"06:00 AM"},{time:"06:30 AM"},{time:"07:00 AM"},{time:"07:30 AM"}, 199 {time:"04:00 AM"},{time:"04:30 AM"},{time:"05:00 AM"},{time:"05:30 AM"},{time:"06:00 AM"},{time:"06:30 AM"},{time:"07:00 AM"},{time:"07:30 AM"},
207 {time:"08:00 AM"},{time:"08:30 AM"},{time:"09:00 AM"},{time:"09:30 AM"},{time:"10:00 AM"},{time:"10:30 AM"},{time:"11:00 AM"},{time:"11:30 AM"}, 200 {time:"08:00 AM"},{time:"08:30 AM"},{time:"09:00 AM"},{time:"09:30 AM"},{time:"10:00 AM"},{time:"10:30 AM"},{time:"11:00 AM"},{time:"11:30 AM"},
208 {time:"12:00 PM"},{time:"12:30 PM"},{time:"01:00 PM"},{time:"01:30 PM"},{time:"02:00 PM"},{time:"02:30 PM"},{time:"03:00 PM"},{time:"03:30 PM"}, 201 {time:"12:00 PM"},{time:"12:30 PM"},{time:"01:00 PM"},{time:"01:30 PM"},{time:"02:00 PM"},{time:"02:30 PM"},{time:"03:00 PM"},{time:"03:30 PM"},
209 {time:"04:00 PM"},{time:"04:30 PM"},{time:"05:00 PM"},{time:"05:30 PM"},{time:"06:00 PM"},{time:"06:30 PM"},{time:"07:00 PM"},{time:"07:30 PM"}, 202 {time:"04:00 PM"},{time:"04:30 PM"},{time:"05:00 PM"},{time:"05:30 PM"},{time:"06:00 PM"},{time:"06:30 PM"},{time:"07:00 PM"},{time:"07:30 PM"},
210 {time:"08:00 PM"},{time:"08:30 PM"},{time:"9:00 PM"},{time:"09:30 PM"},{time:"10:00 PM"},{time:"10:30 PM"},{time:"11:00 PM"},{time:"11:30 PM"},]; 203 {time:"08:00 PM"},{time:"08:30 PM"},{time:"9:00 PM"},{time:"09:30 PM"},{time:"10:00 PM"},{time:"10:30 PM"},{time:"11:00 PM"},{time:"11:30 PM"},];
211 204
212 $scope.etdTimeList = [{time:"12:00 AM"},{time:"12:30 AM"},{time:"01:00 AM"},{time:"01:30 AM"},{time:"02:00 AM"},{time:"02:30 AM"},{time:"03:00 AM"},{time:"03:30 AM"}, 205 $scope.etdTimeList = [{time:"12:00 AM"},{time:"12:30 AM"},{time:"01:00 AM"},{time:"01:30 AM"},{time:"02:00 AM"},{time:"02:30 AM"},{time:"03:00 AM"},{time:"03:30 AM"},
213 {time:"04:00 AM"},{time:"04:30 AM"},{time:"05:00 AM"},{time:"05:30 AM"},{time:"06:00 AM"},{time:"06:30 AM"},{time:"07:00 AM"},{time:"07:30 AM"}, 206 {time:"04:00 AM"},{time:"04:30 AM"},{time:"05:00 AM"},{time:"05:30 AM"},{time:"06:00 AM"},{time:"06:30 AM"},{time:"07:00 AM"},{time:"07:30 AM"},
214 {time:"08:00 AM"},{time:"08:30 AM"},{time:"09:00 AM"},{time:"09:30 AM"},{time:"10:00 AM"},{time:"10:30 AM"},{time:"11:00 AM"},{time:"11:30 AM"}, 207 {time:"08:00 AM"},{time:"08:30 AM"},{time:"09:00 AM"},{time:"09:30 AM"},{time:"10:00 AM"},{time:"10:30 AM"},{time:"11:00 AM"},{time:"11:30 AM"},
215 {time:"12:00 PM"},{time:"12:30 PM"},{time:"01:00 PM"},{time:"01:30 PM"},{time:"02:00 PM"},{time:"02:30 PM"},{time:"03:00 PM"},{time:"03:30 PM"}, 208 {time:"12:00 PM"},{time:"12:30 PM"},{time:"01:00 PM"},{time:"01:30 PM"},{time:"02:00 PM"},{time:"02:30 PM"},{time:"03:00 PM"},{time:"03:30 PM"},
216 {time:"04:00 PM"},{time:"04:30 PM"},{time:"05:00 PM"},{time:"05:30 PM"},{time:"06:00 PM"},{time:"06:30 PM"},{time:"07:00 PM"},{time:"07:30 PM"}, 209 {time:"04:00 PM"},{time:"04:30 PM"},{time:"05:00 PM"},{time:"05:30 PM"},{time:"06:00 PM"},{time:"06:30 PM"},{time:"07:00 PM"},{time:"07:30 PM"},
217 {time:"08:00 PM"},{time:"08:30 PM"},{time:"9:00 PM"},{time:"09:30 PM"},{time:"10:00 PM"},{time:"10:30 PM"},{time:"11:00 PM"},{time:"11:30 PM"},]; 210 {time:"08:00 PM"},{time:"08:30 PM"},{time:"9:00 PM"},{time:"09:30 PM"},{time:"10:00 PM"},{time:"10:30 PM"},{time:"11:00 PM"},{time:"11:30 PM"},];
218 211
219 } 212 }
app/partials/viewCompany/viewCompany.controller.js
1 'use strict'; 1 'use strict';
2 2
3 //Load controller 3 //Load controller
4 angular.module('acufuel') 4 angular.module('acufuel')
5 5
6 .controller('viewCompanyController', ['$scope', '$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewFuelVendorService', 'ViewcontactService', '$state', 'fuelOrdersService', 'enterFuelOrderService', 'NgTableParams', function($scope, $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewFuelVendorService, ViewcontactService, $state, fuelOrdersService, enterFuelOrderService, NgTableParams) { 6 .controller('viewCompanyController', ['$scope', '$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewFuelVendorService', 'ViewcontactService', '$state', 'fuelOrdersService', 'enterFuelOrderService', 'NgTableParams', function($scope, $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewFuelVendorService, ViewcontactService, $state, fuelOrdersService, enterFuelOrderService, NgTableParams) {
7 $scope.data = {}; 7 $scope.data = {};
8 $scope.data.priceEmail = true; 8 $scope.data.priceEmail = true;
9 $scope.aircraft = {}; 9 $scope.aircraft = {};
10 $scope.primayData = {}; 10 $scope.primayData = {};
11 $scope.showLoader = false; 11 $scope.showLoader = false;
12 $scope.showUpdateBtn = false; 12 $scope.showUpdateBtn = false;
13 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')); 13 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'));
14 $scope.selected = []; 14 $scope.selected = [];
15 $scope.jetShow = []; 15 $scope.jetShow = [];
16 $scope.marginShow = []; 16 $scope.marginShow = [];
17 $scope.compId = $stateParams.id; 17 $scope.compId = $stateParams.id;
18 $scope.jetShow[0] = true; 18 $scope.jetShow[0] = true;
19 $scope.marginShow[0] = true; 19 $scope.marginShow[0] = true;
20 $scope.dispatchOrder = {}; 20 $scope.dispatchOrder = {};
21 $scope.dispatchOrder.fuelOrderList = []; 21 $scope.dispatchOrder.fuelOrderList = [];
22 $scope.statusFilterOptions = []; 22 $scope.statusFilterOptions = [];
23 $scope.companyList = {}; 23 $scope.companyList = {};
24 $scope.statusFilterOptions.push({ 24 $scope.statusFilterOptions.push({
25 'id': '', 25 'id': '',
26 'title': 'Show All' 26 'title': 'Show All'
27 }, { 27 }, {
28 'id': 'pending', 28 'id': 'pending',
29 'title': 'Pending' 29 'title': 'Pending'
30 }, { 30 }, {
31 'id': 'invoiced', 31 'id': 'invoiced',
32 'title': 'Invoiced' 32 'title': 'Invoiced'
33 }, { 33 }, {
34 'id': 'paid', 34 'id': 'paid',
35 'title': 'Paid' 35 'title': 'Paid'
36 }, { 36 }, {
37 'id': 'cancelled', 37 'id': 'cancelled',
38 'title': 'Cancelled' 38 'title': 'Cancelled'
39 }, { 39 }, {
40 'id': 'archived', 40 'id': 'archived',
41 'title': 'Archived' 41 'title': 'Archived'
42 } 42 }
43 43
44 ); 44 );
45 45
46 $scope.order = {}; 46 $scope.order = {};
47 $scope.order.companyName = ''; 47 $scope.order.companyName = '';
48 $scope.order.upliftDate = ''; 48 $scope.order.upliftDate = '';
49 /*Get AllCompany api is used from CustomersService*/ 49 /*Get AllCompany api is used from CustomersService*/
50 getAllCompanies(); 50 getAllCompanies();
51 51
52 function getAllCompanies() { 52 function getAllCompanies() {
53 CustomersService.getAllCompanies().then(function(result) { 53 CustomersService.getAllCompanies().then(function(result) {
54 //console.log('log', result[2].id); 54 //console.log('log', result[2].id);
55 $scope.companyList = result; 55 $scope.companyList = result;
56 56
57 for (var i = 0; i < $scope.companyList.length; i++) { 57 for (var i = 0; i < $scope.companyList.length; i++) {
58 if ($scope.companyList[i].companyContact != null) { 58 if ($scope.companyList[i].companyContact != null) {
59 if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) { 59 if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) {
60 $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber; 60 $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber;
61 } 61 }
62 } 62 }
63 if ($scope.companyList[i].primaryContact != null) { 63 if ($scope.companyList[i].primaryContact != null) {
64 if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) { 64 if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) {
65 $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName; 65 $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName;
66 } 66 }
67 } 67 }
68 if ($scope.companyList[i].margin != null) { 68 if ($scope.companyList[i].margin != null) {
69 if ($scope.companyList[i].margin.marginName != null) { 69 if ($scope.companyList[i].margin.marginName != null) {
70 $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id; 70 $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id;
71 } 71 }
72 } 72 }
73 } 73 }
74 $scope.displayCompanyList = new NgTableParams({ 74 $scope.displayCompanyList = new NgTableParams({
75 page: 1, 75 page: 1,
76 count: 10, 76 count: 10,
77 }, { 77 }, {
78 data: $scope.companyList 78 data: $scope.companyList
79 }); 79 });
80 $scope.showLoader = false; 80 $scope.showLoader = false;
81 }) 81 })
82 } 82 }
83 83
84 84
85 $(document).ready(function() { 85 $(document).ready(function() {
86 $("#reset").click(function() { 86 $("#reset").click(function() {
87 $("input").val(""); 87 $("input").val("");
88 }); 88 });
89 }); 89 });
90 90
91 $scope.values = [{ 91 $scope.values = [{
92 'id': 1, 92 'id': 1,
93 'first': 'Tenant/Base Customer' 93 'first': 'Tenant/Base Customer'
94 }, 94 },
95 { 95 {
96 'id': 2, 96 'id': 2,
97 'first': 'FuelerLinx Customer' 97 'first': 'FuelerLinx Customer'
98 }, 98 },
99 { 99 {
100 'id': 3, 100 'id': 3,
101 'first': 'CAA Member' 101 'first': 'CAA Member'
102 } 102 }
103 ]; 103 ];
104 104
105 105
106 106
107 $scope.changeValue = function(selected) { 107 $scope.changeValue = function(selected) {
108 $scope.showUpdateBtn = true; 108 $scope.showUpdateBtn = true;
109 // console.log("data to be true", selected); 109 // console.log("data to be true", selected);
110 for (var i = 0; i < selected.length; i++) { 110 for (var i = 0; i < selected.length; i++) {
111 // console.log(selected[i]) 111 // console.log(selected[i])
112 if (selected[i] == 'Tenant/Base Customer') { 112 if (selected[i] == 'Tenant/Base Customer') {
113 $scope.companyData.baseTenant = true; 113 $scope.companyData.baseTenant = true;
114 } else { 114 } else {
115 $scope.companyData.baseTenant = false; 115 $scope.companyData.baseTenant = false;
116 } 116 }
117 if (selected[i] == 'FuelerLinx Customer') { 117 if (selected[i] == 'FuelerLinx Customer') {
118 $scope.companyData.fuelerlinxCustomer = true; 118 $scope.companyData.fuelerlinxCustomer = true;
119 } else { 119 } else {
120 $scope.companyData.fuelerlinxCustomer = false; 120 $scope.companyData.fuelerlinxCustomer = false;
121 } 121 }
122 122
123 if (selected[i] == 'CAA Member') { 123 if (selected[i] == 'CAA Member') {
124 $scope.companyData.contractFuelVendor = true; 124 $scope.companyData.contractFuelVendor = true;
125 } else { 125 } else {
126 $scope.companyData.contractFuelVendor = false; 126 $scope.companyData.contractFuelVendor = false;
127 } 127 }
128 128
129 // console.log($scope.companyData) 129 // console.log($scope.companyData)
130 130
131 } 131 }
132 132
133 } 133 }
134 134
135 // $scope.selected =[ 135 // $scope.selected =[
136 // {'id': 1, 'first': 'Tenant/Base Customer'}, 136 // {'id': 1, 'first': 'Tenant/Base Customer'},
137 // {'id': 2, 'first': 'FuelerLinx Customer'}, 137 // {'id': 2, 'first': 'FuelerLinx Customer'},
138 // {'id': 3, 'first': 'CAA Member'} 138 // {'id': 3, 'first': 'CAA Member'}
139 // ]; 139 // ];
140 140
141 // CustomersService.getMargin().then(function(result) { 141 // CustomersService.getMargin().then(function(result) {
142 // $scope.marginList = result; 142 // $scope.marginList = result;
143 // }) 143 // })
144 144
145 var value = ""; 145 var value = "";
146 var companyId = $stateParams.id; 146 var companyId = $stateParams.id;
147 147
148 $scope.companyData = {}; 148 $scope.companyData = {};
149 $scope.multipleMsg = false; 149 $scope.multipleMsg = false;
150 $scope.companyData.masterMargin = ""; 150 $scope.companyData.masterMargin = "";
151 $scope.isGlobal = false; 151 $scope.isGlobal = false;
152 $scope.fboPreffered = false; 152 $scope.fboPreffered = false;
153 getCompanyDetail(); 153 getCompanyDetail();
154 154
155 function getCompanyDetail() { 155 function getCompanyDetail() {
156 $scope.showLoader = true; 156 $scope.showLoader = true;
157 ViewCompanyService.getCompany(companyId).then(function(result) { 157 ViewCompanyService.getCompany(companyId).then(function(result) {
158 $scope.companyData = result; 158 $scope.companyData = result;
159 $scope.isGlobal = result.global; 159 $scope.isGlobal = result.global;
160 $scope.fboPreffered = result.fboPreferred; 160 $scope.fboPreffered = result.fboPreferred;
161 if (result.global == true) { 161 if (result.global == true) {
162 $scope.companyData.global = true; 162 $scope.companyData.global = true;
163 } 163 }
164 if (result.margin != null) { 164 if (result.margin != null) {
165 $scope.companyData.masterMargin = result.margin.id; 165 $scope.companyData.masterMargin = result.margin.id;
166 } 166 }
167 if (result.marginAVGAS != null) { 167 if (result.marginAVGAS != null) {
168 $scope.companyData.avgasMargin = result.marginAVGAS.id; 168 $scope.companyData.avgasMargin = result.marginAVGAS.id;
169 } 169 }
170 170
171 171
172 172
173 if ($scope.companyData.baseTenant) { 173 if ($scope.companyData.baseTenant) {
174 174
175 $scope.selected.push({ 175 $scope.selected.push({
176 'first': 'Tenant/Base Customer' 176 'first': 'Tenant/Base Customer'
177 }) 177 })
178 // console.log("$scope.selected",$scope.selected) 178 // console.log("$scope.selected",$scope.selected)
179 179
180 } 180 }
181 181
182 if ($scope.companyData.fuelerlinxCustomer) { 182 if ($scope.companyData.fuelerlinxCustomer) {
183 $scope.selected.push({ 183 $scope.selected.push({
184 'first': 'FuelerLinx Customer' 184 'first': 'FuelerLinx Customer'
185 }) 185 })
186 // console.log("$scope.selected",$scope.selected) 186 // console.log("$scope.selected",$scope.selected)
187 } 187 }
188 188
189 if ($scope.companyData.contractFuelVendor) { 189 if ($scope.companyData.contractFuelVendor) {
190 $scope.selected.push({ 190 $scope.selected.push({
191 'first': 'CAA Member' 191 'first': 'CAA Member'
192 }) 192 })
193 // console.log("$scope.selected",$scope.selected) 193 // console.log("$scope.selected",$scope.selected)
194 } 194 }
195 195
196 // console.log("$scope.companyData",$scope.companyData) 196 // console.log("$scope.companyData",$scope.companyData)
197 getAircraftList(); 197 getAircraftList();
198 $scope.order.companyName = $scope.companyData.companyName; 198 $scope.order.companyName = $scope.companyData.companyName;
199 $scope.getAircraft(result.companyName); 199 $scope.getAircraft(result.companyName);
200 $scope.showLoader = false; 200 $scope.showLoader = false;
201 }) 201 })
202 } 202 }
203 203
204 204
205 $scope.changeCompanyStatus = function() { 205 $scope.changeCompanyStatus = function() {
206 $('#delete3').css('display', 'block'); 206 $('#delete3').css('display', 'block');
207 if ($scope.companyData.activate == true) { 207 if ($scope.companyData.activate == true) {
208 $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this company?' 208 $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this company?'
209 } else { 209 } else {
210 $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this company?' 210 $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this company?'
211 } 211 }
212 } 212 }
213 213
214 $scope.companyStatus = function() { 214 $scope.companyStatus = function() {
215 $scope.showLoader = true; 215 $scope.showLoader = true;
216 var statusData = "status=" + $scope.companyData.activate; 216 var statusData = "status=" + $scope.companyData.activate;
217 ViewCompanyService.changeStatus(companyId, statusData).then(function(result) { 217 ViewCompanyService.changeStatus(companyId, statusData).then(function(result) {
218 if (result.success) { 218 if (result.success) {
219 $('#delete3').css('display', 'none'); 219 $('#delete3').css('display', 'none');
220 toastr.success('' + result.success + '', { 220 toastr.success('' + result.success + '', {
221 closeButton: true 221 closeButton: true
222 }) 222 })
223 getContactList(); 223 getContactList();
224 } 224 }
225 }) 225 })
226 $scope.showLoader = false; 226 $scope.showLoader = false;
227 } 227 }
228 228
229 229
230 $scope.cancelStatus = function() { 230 $scope.cancelStatus = function() {
231 $('#delete3').css('display', 'none'); 231 $('#delete3').css('display', 'none');
232 $scope.companyData.activate = !$scope.companyData.activate; 232 $scope.companyData.activate = !$scope.companyData.activate;
233 } 233 }
234 234
235 getContactList(); 235 getContactList();
236 236
237 function getContactList() { 237 function getContactList() {
238 ViewCompanyService.getContact(companyId).then(function(result) { 238 ViewCompanyService.getContact(companyId).then(function(result) {
239 $scope.companyContactList = result; 239 $scope.companyContactList = result;
240 }) 240 })
241 } 241 }
242 $scope.aircraftmargins = []; 242 $scope.aircraftmargins = [];
243 243
244 $scope.abc = false; 244 $scope.abc = false;
245 $scope.xyz = false; 245 $scope.xyz = false;
246 function getAircraftList() { 246 function getAircraftList() {
247 ViewCompanyService.getAircraft(companyId).then(function(result) { 247 ViewCompanyService.getAircraft(companyId).then(function(result) {
248 248
249 $scope.contactAircraftList = result; 249 $scope.contactAircraftList = result;
250 for (var i = 0; i < $scope.contactAircraftList.length; i++) { 250 for (var i = 0; i < $scope.contactAircraftList.length; i++) {
251 if ($scope.contactAircraftList[i].aircraftsMargin != null) { 251 if ($scope.contactAircraftList[i].aircraftsMargin != null) {
252 $scope.aircraftmargins.push({ 252 $scope.aircraftmargins.push({
253 'id': $scope.contactAircraftList[i].aircraftsMargin.id 253 'id': $scope.contactAircraftList[i].aircraftsMargin.id
254 }) 254 })
255 $scope.contactAircraftList[i].fuelType = "Jet-A"; 255 $scope.contactAircraftList[i].fuelType = "Jet-A";
256 $scope.contactAircraftList[i].marginValue = result[i].aircraftsMargin.marginValue; 256 $scope.contactAircraftList[i].marginValue = result[i].aircraftsMargin.marginValue;
257 $scope.abc = true; 257 $scope.abc = true;
258 258
259 }else{ 259 }else{
260 $scope.contactAircraftList[i].fuelType = "100LL"; 260 $scope.contactAircraftList[i].fuelType = "100LL";
261 if (result[i].aircraftsAVGASMargin != null) { 261 if (result[i].aircraftsAVGASMargin != null) {
262 $scope.contactAircraftList[i].marginValue = result[i].aircraftsAVGASMargin.marginValue; 262 $scope.contactAircraftList[i].marginValue = result[i].aircraftsAVGASMargin.marginValue;
263 $scope.xyz = true; 263 $scope.xyz = true;
264 264
265 } 265 }
266 } 266 }
267 267
268 } 268 }
269 if ($scope.aircraftmargins.length > 0) { 269 if ($scope.aircraftmargins.length > 0) {
270 for (var i = 0; i < $scope.aircraftmargins.length; i++) { 270 for (var i = 0; i < $scope.aircraftmargins.length; i++) {
271 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) { 271 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) {
272 $scope.multiple = true; 272 $scope.multiple = true;
273 $scope.multipleMsg = true; 273 $scope.multipleMsg = true;
274 if ($scope.multiple) { 274 if ($scope.multiple) {
275 $scope.companyData.masterMargin = "multiple"; 275 $scope.companyData.masterMargin = "multiple";
276 } 276 }
277 } 277 }
278 } 278 }
279 } 279 }
280 }) 280 })
281 } 281 }
282 282
283 283
284 284
285 $scope.contactData = {}; 285 $scope.contactData = {};
286 $scope.contactData.contactList = []; 286 $scope.contactData.contactList = [];
287 $scope.addContact = function() { 287 $scope.addContact = function() {
288 $scope.showLoader = true; 288 $scope.showLoader = true;
289 $scope.data.companyId = companyId; 289 $scope.data.companyId = companyId;
290 $scope.contactData.contactList.push($scope.data); 290 $scope.contactData.contactList.push($scope.data);
291 ViewCompanyService.addContact($scope.contactData).then(function(result) { 291 ViewCompanyService.addContact($scope.contactData).then(function(result) {
292 //console.log("data==",$scope.contactData) 292 //console.log("data==",$scope.contactData)
293 // console.log(result) 293 // console.log(result)
294 if (result.status == 200) { 294 if (result.status == 200) {
295 295
296 $('#contact-modal-3').modal('hide'); 296 $('#contact-modal-3').modal('hide');
297 $scope.primayData.id = result.data; 297 $scope.primayData.id = result.data;
298 $scope.data = {}; 298 $scope.data = {};
299 $scope.sendPrimaryContact(); 299 $scope.sendPrimaryContact();
300 getContactList(); 300 getContactList();
301 $scope.contactData.contactList = []; 301 $scope.contactData.contactList = [];
302 $scope.data.email = ''; 302 $scope.data.email = '';
303 toastr.success('Created Successfully', { 303 toastr.success('Created Successfully', {
304 closeButton: true 304 closeButton: true
305 }) 305 })
306 } else { 306 } else {
307 toastr.error('' + result.statusText + '', { 307 toastr.error('' + result.statusText + '', {
308 closeButton: true 308 closeButton: true
309 }) 309 })
310 } 310 }
311 }) 311 })
312 $scope.showLoader = false; 312 $scope.showLoader = false;
313 } 313 }
314 314
315 getData(); 315 getData();
316 316
317 function getData() { 317 function getData() {
318 $scope.showLoader = true; 318 $scope.showLoader = true;
319 CustomersService.getAircraftMake().then(function(result) { 319 CustomersService.getAircraftMake().then(function(result) {
320 $scope.aircraftMakeList = result; 320 $scope.aircraftMakeList = result;
321 // console.log("make",result) 321 // console.log("make",result)
322 }) 322 })
323 $scope.showLoader = false; 323 $scope.showLoader = false;
324 } 324 }
325 325
326 $scope.clearAircrafts = function() { 326 $scope.clearAircrafts = function() {
327 $scope.aircraftDetails = []; 327 $scope.aircraftDetails = [];
328 $scope.aircraftDetails = [{ 328 $scope.aircraftDetails = [{
329 'tail': '', 329 'tail': '',
330 'make': '', 330 'make': '',
331 'model': '', 331 'model': '',
332 'sizeId': '', 332 'sizeId': '',
333 'marginId': '', 333 'marginId': '',
334 'avgasMarginId': '' 334 'avgasMarginId': ''
335 }]; 335 }];
336 } 336 }
337 337
338 $scope.addNew = function() { 338 $scope.addNew = function() {
339 $scope.aircraftDetails.push({ 339 $scope.aircraftDetails.push({
340 'tail': '', 340 'tail': '',
341 'make': '', 341 'make': '',
342 'model': '', 342 'model': '',
343 'sizeId': '', 343 'sizeId': '',
344 'marginId': '', 344 'marginId': '',
345 'avgasMarginId': '' 345 'avgasMarginId': ''
346 }); 346 });
347 // console.log($scope.aircraftDetails) 347 // console.log($scope.aircraftDetails)
348 }; 348 };
349 349
350 $scope.getModal = function(makeId, index) { 350 $scope.getModal = function(makeId, index) {
351 $scope.showLoader = true; 351 $scope.showLoader = true;
352 $scope.aircraft.make = makeId; 352 $scope.aircraft.make = makeId;
353 CustomersService.getModal($scope.aircraft.make).then(function(result) { 353 CustomersService.getModal($scope.aircraft.make).then(function(result) {
354 $scope.showLoader = false; 354 $scope.showLoader = false;
355 $scope.aircraftDetails[index].aircraftModalList = result; 355 $scope.aircraftDetails[index].aircraftModalList = result;
356 //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0]; 356 //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0];
357 }) 357 })
358 } 358 }
359 359
360 $scope.selectedOption = ''; 360 $scope.selectedOption = '';
361 $scope.getSize = function(model, index) { 361 $scope.getSize = function(model, index) {
362 $scope.showLoader = true; 362 $scope.showLoader = true;
363 $scope.aircraft.model = model; 363 $scope.aircraft.model = model;
364 CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { 364 CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) {
365 $scope.showLoader = false; 365 $scope.showLoader = false;
366 $scope.aircraftDetails[index].aircraftSizeList = result; 366 $scope.aircraftDetails[index].aircraftSizeList = result;
367 $scope.getFuelType($scope.aircraftDetails[index].aircraftSizeList[0].aircraftSize.id,index); 367 $scope.getFuelType($scope.aircraftDetails[index].aircraftSizeList[0].aircraftSize.id,index);
368 368
369 369
370 }) 370 })
371 } 371 }
372 372
373 $scope.getFuelType = function(size, index) { 373 $scope.getFuelType = function(size, index) {
374 $scope.showLoader = true; 374 $scope.showLoader = true;
375 var data = "model="+$scope.aircraft.model+"&make="+$scope.aircraft.make+"&sizeId="+size; 375 var data = "model="+$scope.aircraft.model+"&make="+$scope.aircraft.make+"&sizeId="+size;
376 ViewCompanyService.checkFuelType(data).then(function(result){ 376 ViewCompanyService.checkFuelType(data).then(function(result){
377 $scope.showLoader = false; 377 $scope.showLoader = false;
378 if (result.type == "JetA") { 378 if (result.type == "JetA") {
379 $scope.jetShow[index] = false; 379 $scope.jetShow[index] = false;
380 $scope.marginShow[index] = true; 380 $scope.marginShow[index] = true;
381 } else if (result.type == "Avgas") { 381 } else if (result.type == "Avgas") {
382 $scope.jetShow[index] = true; 382 $scope.jetShow[index] = true;
383 $scope.marginShow[index] = false; 383 $scope.marginShow[index] = false;
384 }else { 384 }else {
385 $scope.jetShow[index] = true; 385 $scope.jetShow[index] = true;
386 $scope.marginShow[index] = true; 386 $scope.marginShow[index] = true;
387 } 387 }
388 }) 388 })
389 } 389 }
390 390
391 $scope.aircraftListData = {}; 391 $scope.aircraftListData = {};
392 $scope.addData = []; 392 $scope.addData = [];
393 $scope.tailArray = []; 393 $scope.tailArray = [];
394 function check(array){ 394 function check(array){
395 return (new Set(array)).size !== array.length; 395 return (new Set(array)).size !== array.length;
396 } 396 }
397 $scope.saveCompanyData = function() { 397 $scope.saveCompanyData = function() {
398 $scope.tailArray = []; 398 $scope.tailArray = [];
399 for (var i = 0; i < $scope.aircraftDetails.length; i++) { 399 for (var i = 0; i < $scope.aircraftDetails.length; i++) {
400 $scope.addData.push({ 400 $scope.addData.push({
401 'tail': $scope.aircraftDetails[i].tail, 401 'tail': $scope.aircraftDetails[i].tail,
402 'make': $scope.aircraftDetails[i].make, 402 'make': $scope.aircraftDetails[i].make,
403 'model': $scope.aircraftDetails[i].model, 403 'model': $scope.aircraftDetails[i].model,
404 'sizeId': $scope.aircraftDetails[i].sizeId, 404 'sizeId': $scope.aircraftDetails[i].sizeId,
405 'marginId': $scope.aircraftDetails[i].marginId, 405 'marginId': $scope.aircraftDetails[i].marginId,
406 'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId 406 'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId
407 }); 407 });
408 $scope.tailArray.push($scope.aircraftDetails[i].tail); 408 $scope.tailArray.push($scope.aircraftDetails[i].tail);
409 } 409 }
410 if (check($scope.tailArray)) { 410 if (check($scope.tailArray)) {
411 toastr.error('Duplicate Tail Added.', { 411 toastr.error('Duplicate Tail Added.', {
412 closeButton: true 412 closeButton: true
413 }) 413 })
414 }else{ 414 }else{
415 $scope.aircraftListData.aircraftList = $scope.addData; 415 $scope.aircraftListData.aircraftList = $scope.addData;
416 $scope.aircraftListData.accountId = companyId; 416 $scope.aircraftListData.accountId = companyId;
417 CustomersService.addAircraft($scope.aircraftListData).then(function(result) { 417 CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
418 if (result != null && result.success) { 418 if (result != null && result.success) {
419 toastr.success('' + result.success + '', { 419 toastr.success('' + result.success + '', {
420 closeButton: true 420 closeButton: true
421 }) 421 })
422 $scope.addData= []; 422 $scope.addData= [];
423 $scope.tailArray = []; 423 $scope.tailArray = [];
424 $scope.aircraftListData={}; 424 $scope.aircraftListData={};
425 $('#aircraft-modal-3').css('display', 'none'); 425 $('#aircraft-modal-3').css('display', 'none');
426 $('.modal-backdrop').css('display', 'none'); 426 $('.modal-backdrop').css('display', 'none');
427 $('#aircraft-modal-3').modal('hide'); 427 $('#aircraft-modal-3').modal('hide');
428 $('.modal-backdrop').modal('hide'); 428 $('.modal-backdrop').modal('hide');
429 getAircraftList(); 429 getAircraftList();
430 430
431 } else { 431 } else {
432 $('#aircraft-modal-3').css('display', 'none'); 432 $('#aircraft-modal-3').css('display', 'none');
433 $('.modal-backdrop').css('display', 'none'); 433 $('.modal-backdrop').css('display', 'none');
434 toastr.error('' + result.statusText + '', { 434 toastr.error('' + result.statusText + '', {
435 closeButton: true 435 closeButton: true
436 }) 436 })
437 } 437 }
438 }); 438 });
439 } 439 }
440 440
441 } 441 }
442 442
443 $scope.showNoteData = true; 443 $scope.showNoteData = true;
444 $scope.showCompanyName = true; 444 $scope.showCompanyName = true;
445 $scope.showAddress = true; 445 $scope.showAddress = true;
446 $scope.showNote = function() { 446 $scope.showNote = function() {
447 $scope.showNoteData = false; 447 $scope.showNoteData = false;
448 $scope.showUpdateBtn = true; 448 $scope.showUpdateBtn = true;
449 } 449 }
450 450
451 $scope.company = function() { 451 $scope.company = function() {
452 $scope.showCompanyName = false; 452 $scope.showCompanyName = false;
453 $scope.showUpdateBtn = true; 453 $scope.showUpdateBtn = true;
454 } 454 }
455 455
456 $scope.base = function() { 456 $scope.base = function() {
457 $scope.showUpdateBtn = true; 457 $scope.showUpdateBtn = true;
458 } 458 }
459 459
460 $scope.addressChange = function() { 460 $scope.addressChange = function() {
461 $scope.showAddress = false; 461 $scope.showAddress = false;
462 $scope.showUpdateBtn = true; 462 $scope.showUpdateBtn = true;
463 } 463 }
464 464
465 $scope.editData = function(inputName) { 465 $scope.editData = function(inputName) {
466 //console.log($scope.companyData) 466 //console.log($scope.companyData)
467 $scope.showLoader = true; 467 $scope.showLoader = true;
468 /*if(inputName == 'showNoteData'){ 468 /*if(inputName == 'showNoteData'){
469 $scope.showNoteData = true; 469 $scope.showNoteData = true;
470 }else if(inputName == 'showCompanyName'){ 470 }else if(inputName == 'showCompanyName'){
471 $scope.showCompanyName = true; 471 $scope.showCompanyName = true;
472 }else if(inputName == 'showAddress'){ 472 }else if(inputName == 'showAddress'){
473 $scope.showAddress = true; 473 $scope.showAddress = true;
474 }*/ 474 }*/
475 $scope.showNoteData = true; 475 $scope.showNoteData = true;
476 $scope.showCompanyName = true; 476 $scope.showCompanyName = true;
477 $scope.showAddress = true; 477 $scope.showAddress = true;
478 478
479 var companyData = "companyName=" + $scope.companyData.companyName + "&masterMargin=" + $scope.companyData.masterMargin + "&avgasMargin=" + $scope.companyData.avgasMargin + 479 var companyData = "companyName=" + $scope.companyData.companyName + "&masterMargin=" + $scope.companyData.masterMargin + "&avgasMargin=" + $scope.companyData.avgasMargin +
480 "&addressOne=" + $scope.companyData.addressOne + "&addressTwo=" + $scope.companyData.addressTwo + "&city=" + $scope.companyData.city + "&state=" + 480 "&addressOne=" + $scope.companyData.addressOne + "&addressTwo=" + $scope.companyData.addressTwo + "&city=" + $scope.companyData.city + "&state=" +
481 $scope.companyData.state + "&country=" + $scope.companyData.country + "&zipcode=" + $scope.companyData.zipcode + "&internalNote=" + 481 $scope.companyData.state + "&country=" + $scope.companyData.country + "&zipcode=" + $scope.companyData.zipcode + "&internalNote=" +
482 $scope.companyData.internalNote + "&certificateType=" + $scope.companyData.certificateType + "&baseTenant=" + $scope.companyData.baseTenant + 482 $scope.companyData.internalNote + "&certificateType=" + $scope.companyData.certificateType + "&baseTenant=" + $scope.companyData.baseTenant +
483 "&fuelerlinxCustomer=" + $scope.companyData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.companyData.contractFuelVendor + 483 "&fuelerlinxCustomer=" + $scope.companyData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.companyData.contractFuelVendor +
484 "&activate=" + $scope.companyData.activate + "&baseIcao=" + $scope.companyData.baseIcao + "&companyId=" + companyId + "&global=" + $scope.companyData.global; 484 "&activate=" + $scope.companyData.activate + "&baseIcao=" + $scope.companyData.baseIcao + "&companyId=" + companyId + "&global=" + $scope.companyData.global;
485 485
486 ViewCompanyService.updateCompany(companyData).then(function(result) { 486 ViewCompanyService.updateCompany(companyData).then(function(result) {
487 if (result != null && result.success) { 487 if (result != null && result.success) {
488 toastr.success('' + result.success + '', { 488 toastr.success('' + result.success + '', {
489 closeButton: true 489 closeButton: true
490 }) 490 })
491 $scope.showUpdateBtn = false; 491 $scope.showUpdateBtn = false;
492 getCompanyDetail(); 492 getCompanyDetail();
493 } else { 493 } else {
494 toastr.error('Error Updating Company', { 494 toastr.error('Error Updating Company', {
495 closeButton: true 495 closeButton: true
496 }) 496 })
497 $scope.showUpdateBtn = true; 497 $scope.showUpdateBtn = true;
498 } 498 }
499 $scope.showLoader = false; 499 $scope.showLoader = false;
500 }) 500 })
501 } 501 }
502 502
503 $scope.cancelUpdateData = function() { 503 $scope.cancelUpdateData = function() {
504 $scope.showNoteData = true; 504 $scope.showNoteData = true;
505 $scope.showCompanyName = true; 505 $scope.showCompanyName = true;
506 $scope.showAddress = true; 506 $scope.showAddress = true;
507 $scope.showUpdateBtn = false; 507 $scope.showUpdateBtn = false;
508 } 508 }
509 509
510 $scope.sendMail = function() { 510 $scope.sendMail = function() {
511 $scope.showLoader = true; 511 $scope.showLoader = true;
512 $('#confirm1').css('display', 'none'); 512 $('#confirm1').css('display', 'none');
513 ViewCompanyService.sendMail(companyId).then(function(result) { 513 ViewCompanyService.sendMail(companyId).then(function(result) {
514 if (result != null && result.success) { 514 if (result != null && result.success) {
515 toastr.success('' + result.success + '', { 515 toastr.success('' + result.success + '', {
516 closeButton: true 516 closeButton: true
517 }) 517 })
518 } else { 518 } else {
519 toastr.error('Error Sending Email', { 519 toastr.error('Error Sending Email', {
520 closeButton: true 520 closeButton: true
521 }) 521 })
522 } 522 }
523 $scope.showLoader = false; 523 $scope.showLoader = false;
524 }) 524 })
525 } 525 }
526 526
527 $scope.openConfirmMail = function() { 527 $scope.openConfirmMail = function() {
528 $('#confirm1').css('display', 'block'); 528 $('#confirm1').css('display', 'block');
529 } 529 }
530 530
531 531
532 $scope.cancelAndCloseConfirm = function() { 532 $scope.cancelAndCloseConfirm = function() {
533 $('#confirm1').css('display', 'none'); 533 $('#confirm1').css('display', 'none');
534 } 534 }
535 535
536 $scope.primaryContact = false; 536 $scope.primaryContact = false;
537 $scope.cancelPrimaryContact = function() { 537 $scope.cancelPrimaryContact = function() {
538 $('#primaryContact').css('display', 'none'); 538 $('#primaryContact').css('display', 'none');
539 $scope.primaryContact = false; 539 $scope.primaryContact = false;
540 } 540 }
541 541
542 $scope.checkPrimaryContact = function() { 542 $scope.checkPrimaryContact = function() {
543 if ($scope.primaryContact == true) { 543 if ($scope.primaryContact == true) {
544 $scope.primaryContact = true; 544 $scope.primaryContact = true;
545 ViewCompanyService.checkPrimaryContact(companyId).then(function(result) { 545 ViewCompanyService.checkPrimaryContact(companyId).then(function(result) {
546 //console.log(result) 546 //console.log(result)
547 if (result.status == 422) { 547 if (result.status == 422) {
548 $('#primaryContact').css('display', 'block'); 548 $('#primaryContact').css('display', 'block');
549 } 549 }
550 }) 550 })
551 } 551 }
552 } 552 }
553 553
554 $scope.sendPrimaryContact = function() { 554 $scope.sendPrimaryContact = function() {
555 $('#primaryContact').css('display', 'none'); 555 $('#primaryContact').css('display', 'none');
556 if ($scope.primayData.id != null || $scope.primayData.id != undefined) { 556 if ($scope.primayData.id != null || $scope.primayData.id != undefined) {
557 var priamryContactData = "companyContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact; 557 var priamryContactData = "companyContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact;
558 558
559 ViewCompanyService.addPrimaryContact(priamryContactData).then(function(result) { 559 ViewCompanyService.addPrimaryContact(priamryContactData).then(function(result) {
560 // console.log(result) 560 // console.log(result)
561 }) 561 })
562 } 562 }
563 563
564 } 564 }
565 565
566 $scope.updateData = "" 566 $scope.updateData = ""
567 $scope.showUpdateContact = function(data, value) { 567 $scope.showUpdateContact = function(data, value) {
568 $('#updateContact').css('display', 'block'); 568 $('#updateContact').css('display', 'block');
569 $scope.updateData = data; 569 $scope.updateData = data;
570 // console.log($scope.updateData) 570 // console.log($scope.updateData)
571 if ($scope.updateData.email == null) { 571 if ($scope.updateData.email == null) {
572 $scope.updateData.content = data.contactNumber; 572 $scope.updateData.content = data.contactNumber;
573 } else { 573 } else {
574 $scope.updateData.content = data.email; 574 $scope.updateData.content = data.email;
575 } 575 }
576 } 576 }
577 577
578 $scope.showUpdateEmail = function(data, value) { 578 $scope.showUpdateEmail = function(data, value) {
579 $('#updateEmail').css('display', 'block'); 579 $('#updateEmail').css('display', 'block');
580 $scope.updateData = data; 580 $scope.updateData = data;
581 // console.log($scope.updateData) 581 // console.log($scope.updateData)
582 if ($scope.updateData.email == null) { 582 if ($scope.updateData.email == null) {
583 $scope.updateData.content = data.contactNumber; 583 $scope.updateData.content = data.contactNumber;
584 } else { 584 } else {
585 $scope.updateData.content = data.email; 585 $scope.updateData.content = data.email;
586 } 586 }
587 } 587 }
588 588
589 $scope.acceptUpdateField = function(newContactName) { 589 $scope.acceptUpdateField = function(newContactName) {
590 // console.log($scope.updateData) 590 // console.log($scope.updateData)
591 if ($scope.updateData.content == undefined) { 591 if ($scope.updateData.content == undefined) {
592 toastr.error('Please add some content', { 592 toastr.error('Please add some content', {
593 closeButton: true 593 closeButton: true
594 }) 594 })
595 } else { 595 } else {
596 if (newContactName == 'phone') { 596 if (newContactName == 'phone') {
597 var updateCustomData = "companyId=" + companyId + "&contactNumber=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id + 597 var updateCustomData = "companyId=" + companyId + "&contactNumber=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id +
598 "&title=" + $scope.updateData.title; 598 "&title=" + $scope.updateData.title;
599 } else { 599 } else {
600 var updateCustomData = "companyId=" + companyId + "&email=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id + 600 var updateCustomData = "companyId=" + companyId + "&email=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id +
601 "&title=" + $scope.updateData.title; 601 "&title=" + $scope.updateData.title;
602 } 602 }
603 ViewCompanyService.updateCustomField(updateCustomData).then(function(result) { 603 ViewCompanyService.updateCustomField(updateCustomData).then(function(result) {
604 if (result != null && result.success) { 604 if (result != null && result.success) {
605 $('#updateContact').css('display', 'none'); 605 $('#updateContact').css('display', 'none');
606 $('#updateEmail').css('display', 'none'); 606 $('#updateEmail').css('display', 'none');
607 getCompanyDetail(); 607 getCompanyDetail();
608 } 608 }
609 }) 609 })
610 } 610 }
611 } 611 }
612 612
613 $scope.deleteContent = function(data){ 613 $scope.deleteContent = function(data){
614 ViewCompanyService.deleteCustomContact(data.id).then(function(result) { 614 ViewCompanyService.deleteCustomContact(data.id).then(function(result) {
615 if (result != null && result.success) { 615 if (result != null && result.success) {
616 toastr.success('' + result.success + '', { 616 toastr.success('' + result.success + '', {
617 closeButton: true 617 closeButton: true
618 }) 618 })
619 getCompanyDetail(); 619 getCompanyDetail();
620 } 620 }
621 }) 621 })
622 } 622 }
623 623
624 $scope.cancelUpdateField = function() { 624 $scope.cancelUpdateField = function() {
625 $('#updateContact').css('display', 'none'); 625 $('#updateContact').css('display', 'none');
626 $('#updateEmail').css('display', 'none'); 626 $('#updateEmail').css('display', 'none');
627 } 627 }
628 628
629 $scope.showEditTier2 = function(number) { 629 $scope.showEditTier2 = function(number) {
630 // console.log(number) 630 // console.log(number)
631 $scope.contactNumber = number; 631 $scope.contactNumber = number;
632 } 632 }
633 633
634 634
635 635
636 $scope.addCustomPhone = function(value) { 636 $scope.addCustomPhone = function(value) {
637 //console.log(value) 637 //console.log(value)
638 if (value != null) { 638 if (value != null) {
639 $('#customFieldPhone').css('display', 'block'); 639 $('#customFieldPhone').css('display', 'block');
640 } 640 }
641 $scope.custom = {}; 641 $scope.custom = {};
642 } 642 }
643 643
644 $scope.addCustomEmail = function(value) { 644 $scope.addCustomEmail = function(value) {
645 //console.log(value) 645 //console.log(value)
646 if (value != null) { 646 if (value != null) {
647 $('#customFieldEmail').css('display', 'block'); 647 $('#customFieldEmail').css('display', 'block');
648 } 648 }
649 $scope.custom = {}; 649 $scope.custom = {};
650 } 650 }
651 651
652 $scope.cancelCustomField = function() { 652 $scope.cancelCustomField = function() {
653 $('#customFieldEmail').css('display', 'none'); 653 $('#customFieldEmail').css('display', 'none');
654 $('#customFieldPhone').css('display', 'none'); 654 $('#customFieldPhone').css('display', 'none');
655 } 655 }
656 656
657 $scope.acceptCustomField = function(contactName) { 657 $scope.acceptCustomField = function(contactName) {
658 if ($scope.custom.content == undefined) { 658 if ($scope.custom.content == undefined) {
659 toastr.error('Please add some content', { 659 toastr.error('Please add some content', {
660 closeButton: true 660 closeButton: true
661 }) 661 })
662 } else { 662 } else {
663 if (contactName == 'phone') { 663 if (contactName == 'phone') {
664 var customData = "companyId=" + companyId + "&contactNumber=" + $scope.custom.content + 664 var customData = "companyId=" + companyId + "&contactNumber=" + $scope.custom.content +
665 "&title=" + $scope.custom.title; 665 "&title=" + $scope.custom.title;
666 } else { 666 } else {
667 var customData = "companyId=" + companyId + "&email=" + $scope.custom.content + 667 var customData = "companyId=" + companyId + "&email=" + $scope.custom.content +
668 "&title=" + $scope.custom.title; 668 "&title=" + $scope.custom.title;
669 } 669 }
670 // console.log(customData.email) 670 // console.log(customData.email)
671 ViewCompanyService.addCustomField(customData).then(function(result) { 671 ViewCompanyService.addCustomField(customData).then(function(result) {
672 // console.log(result) 672 // console.log(result)
673 if (result != null && result.success) { 673 if (result != null && result.success) {
674 $('#customFieldEmail').css('display', 'none'); 674 $('#customFieldEmail').css('display', 'none');
675 $('#customFieldPhone').css('display', 'none'); 675 $('#customFieldPhone').css('display', 'none');
676 $scope.custom = {}; 676 $scope.custom = {};
677 getCompanyDetail(); 677 getCompanyDetail();
678 } 678 }
679 }) 679 })
680 } 680 }
681 } 681 }
682 682
683 /* omit strike out*/ 683 /* omit strike out*/
684 updateFuelManagerService.getFuelPricingNew().then(function(result) { 684 updateFuelManagerService.getFuelPricingNew().then(function(result) {
685 $scope.fuelPricing = result; 685 $scope.fuelPricing = result;
686 console.log("==fuel pricing==",result)
686 $scope.omitData; 687 $scope.omitData;
687 ViewCompanyService.getOmitCompany($scope.compId).then(function(result){ 688 ViewCompanyService.getOmitCompany($scope.compId).then(function(result){
688 $scope.omitData = result; 689 $scope.omitData = result;
689 //console.log("omit data===", $scope.omitData); 690 console.log("omit data===", $scope.omitData);
690 for(var i = 0 ; i< $scope.fuelPricing.length; i++){ 691 for(var i = 0 ; i< $scope.fuelPricing.length; i++){
691 for(var j = 0; j<$scope.omitData.length; j++){ 692 for(var j = 0; j<$scope.omitData.length; j++){
692 if($scope.omitData[j].marginId == $scope.fuelPricing[i].fuelPricing.id){ 693 if($scope.omitData[j].marginId == $scope.fuelPricing[i].fuelPricing.id){
693 $scope.fuelPricing[i].fuelPricing.omit = $scope.omitData[j].omit; 694 $scope.fuelPricing[i].fuelPricing.omit = $scope.omitData[j].omit;
694 } 695 }
695 } 696 }
696 } 697 }
697 698
698 }) 699 })
699 700
700 // console.log("$scope.fuelPricing",$scope.fuelPricing) 701 // console.log("$scope.fuelPricing",$scope.fuelPricing)
701 for (var i = 0; i < $scope.fuelPricing.length; i++) { 702 for (var i = 0; i < $scope.fuelPricing.length; i++) {
702 // console.log('$scope.fuelPricing[i].fuelPricing', $scope.fuelPricing[i].fuelPricing); 703 // console.log('$scope.fuelPricing[i].fuelPricing', $scope.fuelPricing[i].fuelPricing);
703 //console.log("fuelid",$scope.fuelPricing[i].fuelPricing.id,"getid",$scope.omitData[j].id) 704 //console.log("fuelid",$scope.fuelPricing[i].fuelPricing.id,"getid",$scope.omitData[j].id)
704 if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) { 705 if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) {
705 $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); 706 $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
706 var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); 707 var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
707 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 708 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
708 var dday = newTime.getUTCDate(); 709 var dday = newTime.getUTCDate();
709 var dyear = newTime.getUTCFullYear(); 710 var dyear = newTime.getUTCFullYear();
710 $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth + '/' + dday + '/' + dyear; 711 $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth + '/' + dday + '/' + dyear;
711 } 712 }
712 // for (var j = 0; j<$scope.omitData.length; j++) { 713 // for (var j = 0; j<$scope.omitData.length; j++) {
713 // if($scope.fuelPricing[i].fuelPricing.id === $scope.omitData[j].id){ 714 // if($scope.fuelPricing[i].fuelPricing.id === $scope.omitData[j].id){
714 715
715 // } 716 // }
716 // } 717 // }
717 } 718 }
718 }) 719 })
719 720
720 var deleteAircraftId = ""; 721 var deleteAircraftId = "";
721 $scope.deleteAircraft = function(id) { 722 $scope.deleteAircraft = function(id) {
722 $('#delete1').css('display', 'block'); 723 $('#delete1').css('display', 'block');
723 deleteAircraftId = id; 724 deleteAircraftId = id;
724 } 725 }
725 726
726 $scope.aircraftDelete = function() { 727 $scope.aircraftDelete = function() {
727 ViewCompanyService.deleteAircraft(deleteAircraftId).then(function(result) { 728 ViewCompanyService.deleteAircraft(deleteAircraftId).then(function(result) {
728 // console.log(result) 729 // console.log(result)
729 getAircraftList(); 730 getAircraftList();
730 getCompanyDetail(); 731 getCompanyDetail();
731 $('#delete1').css('display', 'none'); 732 $('#delete1').css('display', 'none');
732 }) 733 })
733 } 734 }
734 735
735 $scope.cancelAircraft = function() { 736 $scope.cancelAircraft = function() {
736 $('#delete1').css('display', 'none'); 737 $('#delete1').css('display', 'none');
737 } 738 }
738 739
739 CustomersService.getJetMargin($scope.userProfileId).then(function(result) { 740 CustomersService.getJetMargin($scope.userProfileId).then(function(result) {
740 $scope.jetMarginList = result; 741 $scope.jetMarginList = result;
741 }) 742 })
742 743
743 CustomersService.getAvgMargin($scope.userProfileId).then(function(result) { 744 CustomersService.getAvgMargin($scope.userProfileId).then(function(result) {
744 $scope.avgsMarginList = result; 745 $scope.avgsMarginList = result;
745 }) 746 })
746 747
747 $scope.changePriceEmail = function(id, index) { 748 $scope.changePriceEmail = function(id, index) {
748 event.stopPropagation(); 749 event.stopPropagation();
749 var contactId = id; 750 var contactId = id;
750 var statusData = "status=" + $scope.companyContactList[index].priceEmail; 751 var statusData = "status=" + $scope.companyContactList[index].priceEmail;
751 ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) { 752 ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) {
752 if (result.success) { 753 if (result.success) {
753 $('#toogleMail').css('display', 'block'); 754 $('#toogleMail').css('display', 'block');
754 if ($scope.companyContactList[index].priceEmail == true) { 755 if ($scope.companyContactList[index].priceEmail == true) {
755 $scope.messageText = 'You have enabled price distribution for this contact'; 756 $scope.messageText = 'You have enabled price distribution for this contact';
756 } else { 757 } else {
757 $scope.messageText = 'You have disabled price distribution for this contact'; 758 $scope.messageText = 'You have disabled price distribution for this contact';
758 } 759 }
759 } 760 }
760 }) 761 })
761 } 762 }
762 763
763 $scope.cancelToogle = function() { 764 $scope.cancelToogle = function() {
764 $('#toogleMail').css('display', 'none'); 765 $('#toogleMail').css('display', 'none');
765 } 766 }
766 767
767 $scope.checkboxStatus = function(value) { 768 $scope.checkboxStatus = function(value) {
768 // console.log("checkbox",value) 769 // console.log("checkbox",value)
769 $scope.showUpdateBtn = true; 770 $scope.showUpdateBtn = true;
770 } 771 }
771 772
772 $scope.fuelercheckboxStatus = function(value) { 773 $scope.fuelercheckboxStatus = function(value) {
773 $('#fuelerchange').css('display', 'block'); 774 $('#fuelerchange').css('display', 'block');
774 if (value == true) { 775 if (value == true) {
775 $scope.statusMessage = 'Please confirm! Enabling FuelerLinx for this customer will enable price distribution web services and disable price emails for the contacts in this company' 776 $scope.statusMessage = 'Please confirm! Enabling FuelerLinx for this customer will enable price distribution web services and disable price emails for the contacts in this company'
776 } else { 777 } else {
777 $scope.statusMessage = 'Please confirm! Disabling FuelerLinx for this customer will disable price distribution web services into their FuelerLinx account. If you proceed then remember to enable price emails for the appropriate contacts in this company.' 778 $scope.statusMessage = 'Please confirm! Disabling FuelerLinx for this customer will disable price distribution web services into their FuelerLinx account. If you proceed then remember to enable price emails for the appropriate contacts in this company.'
778 } 779 }
779 780
780 781
781 } 782 }
782 783
783 $scope.fuelerCancelStatus = function() { 784 $scope.fuelerCancelStatus = function() {
784 $('#fuelerchange').css('display', 'none'); 785 $('#fuelerchange').css('display', 'none');
785 $scope.companyData.fuelerlinxCustomer = !$scope.companyData.fuelerlinxCustomer; 786 $scope.companyData.fuelerlinxCustomer = !$scope.companyData.fuelerlinxCustomer;
786 } 787 }
787 788
788 $scope.fuelerAcceptStatus = function() { 789 $scope.fuelerAcceptStatus = function() {
789 $('#fuelerchange').css('display', 'none'); 790 $('#fuelerchange').css('display', 'none');
790 $scope.showLoader = true; 791 $scope.showLoader = true;
791 var statusData; 792 var statusData;
792 if ($scope.companyData.fuelerlinxCustomer == false) { 793 if ($scope.companyData.fuelerlinxCustomer == false) {
793 statusData = "status=true"; 794 statusData = "status=true";
794 } else { 795 } else {
795 statusData = "status=false"; 796 statusData = "status=false";
796 } 797 }
797 ViewCompanyService.fuelerPricingChange(companyId, statusData).then(function(result) { 798 ViewCompanyService.fuelerPricingChange(companyId, statusData).then(function(result) {
798 if (result.success) { 799 if (result.success) {
799 $scope.showLoader = false; 800 $scope.showLoader = false;
800 801
801 $scope.editData(); 802 $scope.editData();
802 getContactList(); 803 getContactList();
803 804
804 } 805 }
805 }) 806 })
806 } 807 }
807 808
808 809
809 $scope.updateOmit = function(fuel, omit) { 810 $scope.updateOmit = function(fuel, omit) {
810 $scope.fuelData = {}; 811 $scope.fuelData = {};
811 $scope.fuelData.expirationDate = new Date(fuel.expirationDate); 812 $scope.fuelData.expirationDate = new Date(fuel.expirationDate);
812 $scope.fuelData.customMarginId = fuel.id; 813 $scope.fuelData.customMarginId = fuel.id;
813 $scope.fuelData.omit = fuel.omit; 814 $scope.fuelData.omit = fuel.omit;
814 $scope.fuelData.papMargin = fuel.papMargin; 815 $scope.fuelData.papMargin = fuel.papMargin;
815 $scope.fuelData.papTotal = fuel.papTotal; 816 $scope.fuelData.papTotal = fuel.papTotal;
816 $scope.fuelData.cost = fuel.cost; 817 $scope.fuelData.cost = fuel.cost;
817 $scope.fuelData.companyId = $scope.compId ; 818 $scope.fuelData.companyId = $scope.compId ;
818 if($scope.fuelData.omit == true) 819 if($scope.fuelData.omit == true)
819 { 820 {
820 var customData = "companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId; 821 var customData = "companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId;
821 // console.log(".") 822 // console.log(".")
822 ViewCompanyService.omitAddCompanyFuel(customData).then(function(result) { 823 ViewCompanyService.omitAddCompanyFuel(customData).then(function(result) {
823 if (result.success) { 824 if (result.success) {
824 toastr.success('' + result.success + '', { 825 toastr.success('' + result.success + '', {
825 closeButton: true 826 closeButton: true
826 }) 827 })
827 } else { 828 } else {
828 toastr.error('' + result.statusText + '', { 829 toastr.error('' + result.statusText + '', {
829 closeButton: true 830 closeButton: true
830 }) 831 })
831 } 832 }
832 }) 833 })
833 }else{ 834 }else{
834 var data ="companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId; 835 var data ="companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId;
835 ViewCompanyService.omitDeleteCompanyFuel(data).then(function(result){ 836 ViewCompanyService.omitDeleteCompanyFuel(data).then(function(result){
836 if (result.success) { 837 if (result.success) {
837 toastr.success('' + result.success + '', { 838 toastr.success('' + result.success + '', {
838 closeButton: true 839 closeButton: true
839 }) 840 })
840 } else { 841 } else {
841 toastr.error('' + result.statusText + '', { 842 toastr.error('' + result.statusText + '', {
842 closeButton: true 843 closeButton: true
843 }) 844 })
844 } 845 }
845 }) 846 })
846 } 847 }
847 } 848 }
848 849
849 850
850 //--fuel type based on tail is not in use-- 851 //--fuel type based on tail is not in use--
851 // $scope.aircraftData = {} 852 // $scope.aircraftData = {}
852 /*$scope.checkJetWithTail = function(tail, index) { 853 /*$scope.checkJetWithTail = function(tail, index) {
853 854
854 console.log("tail==============",tail, index) 855 console.log("tail==============",tail, index)
855 ViewCompanyService.checkJetType(tail).then(function(result) { 856 ViewCompanyService.checkJetType(tail).then(function(result) {
856 console.log("result",result) 857 console.log("result",result)
857 if (result.jetA == "true") { 858 if (result.jetA == "true") {
858 $scope.jetShow[index] = false; 859 $scope.jetShow[index] = false;
859 $scope.marginShow[index] = true; 860 $scope.marginShow[index] = true;
860 } else { 861 } else {
861 $scope.jetShow[index] = true; 862 $scope.jetShow[index] = true;
862 $scope.marginShow[index] = false; 863 $scope.marginShow[index] = false;
863 } 864 }
864 }) 865 })
865 }*/ 866 }*/
866 867
867 868
868 /*add a fuel order*/ 869 /*add a fuel order*/
869 870
870 871
871 $scope.getOrders = function() { 872 $scope.getOrders = function() {
872 fuelOrdersService.getOrders().then(function(result) { 873 fuelOrdersService.getOrders().then(function(result) {
873 874
874 $scope.orderdata = result; 875 $scope.orderdata = result;
875 for (var i = 0; i < $scope.orderdata.length; i++) { 876 for (var i = 0; i < $scope.orderdata.length; i++) {
876 $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate); 877 $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate);
877 878
878 // var str = "" + $scope.orderdata[i].upliftDateS.getDate() + "/" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getFullYear() 879 // var str = "" + $scope.orderdata[i].upliftDateS.getDate() + "/" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getFullYear()
879 var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear() 880 var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear()
880 // str = str.slice(4,16) 881 // str = str.slice(4,16)
881 $scope.orderdata[i].upliftDateString = str 882 $scope.orderdata[i].upliftDateString = str
882 // console.log(str); 883 // console.log(str);
883 884
884 } 885 }
885 886
886 $scope.displayFuelOrderList = new NgTableParams({ 887 $scope.displayFuelOrderList = new NgTableParams({
887 page: 1, 888 page: 1,
888 count: 10, 889 count: 10,
889 }, { 890 }, {
890 data: $scope.orderdata 891 data: $scope.orderdata
891 }); 892 });
892 $(document).ready(function() { 893 $(document).ready(function() {
893 var myselect = document.getElementsByClassName('colorfulSelectbox'); 894 var myselect = document.getElementsByClassName('colorfulSelectbox');
894 895
895 for (var i = 0; i < myselect.length; i++) { 896 for (var i = 0; i < myselect.length; i++) {
896 var colourIndex = $(myselect[i]).prop('selectedIndex'); 897 var colourIndex = $(myselect[i]).prop('selectedIndex');
897 colourIndex = colourIndex + 1; 898 colourIndex = colourIndex + 1;
898 // console.log(colourIndex); 899 // console.log(colourIndex);
899 var getColor = $('.colorfulSelectbox option:nth-child(' + colourIndex + ')').css('color'); 900 var getColor = $('.colorfulSelectbox option:nth-child(' + colourIndex + ')').css('color');
900 $(myselect[i]).css('background-color', getColor); 901 $(myselect[i]).css('background-color', getColor);
901 // console.log('colour', getColor); 902 // console.log('colour', getColor);
902 myselect[i].blur(); 903 myselect[i].blur();
903 } 904 }
904 905
905 }) 906 })
906 907
907 }) 908 })
908 } 909 }
909 910
910 $scope.getOrders(); 911 $scope.getOrders();
911 912
912 $scope.tiervalue=function(){ 913 $scope.tiervalue=function(){
913 $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak; 914 $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak;
914 } 915 }
915 916
916 $scope.setCost = function(cost){ 917 $scope.setCost = function(cost){
917 if(cost != null) { 918 if(cost != null) {
918 var obj =JSON.parse(cost); 919 var obj =JSON.parse(cost);
919 $scope.order.fboCost = obj.cost; 920 $scope.order.fboCost = obj.cost;
920 } 921 }
921 } 922 }
922 923
923 $scope.cancelOrder = function() { 924 $scope.cancelOrder = function() {
924 $scope.order = {}; 925 $scope.order = {};
925 } 926 }
926 927
927 $scope.dispatchFuel = function(){ 928 $scope.dispatchFuel = function(){
928 $scope.showLoader = true; 929 $scope.showLoader = true;
929 $scope.order.companyId = $scope.compId; 930 $scope.order.companyId = $scope.compId;
930 if ($scope.order.upliftDate != '') { 931 if ($scope.order.upliftDate != '') {
931 var currentDate = new Date(); 932 var currentDate = new Date();
932 var hours = currentDate.getHours(); 933 var hours = currentDate.getHours();
933 var min = currentDate.getMinutes(); 934 var min = currentDate.getMinutes();
934 var sec = currentDate.getSeconds(); 935 var sec = currentDate.getSeconds();
935 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec; 936 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec;
936 $scope.order.upliftDate = new Date($scope.order.upliftDate); 937 $scope.order.upliftDate = new Date($scope.order.upliftDate);
937 $scope.order.upliftDate = $scope.order.upliftDate.getTime(); 938 $scope.order.upliftDate = $scope.order.upliftDate.getTime();
938 } 939 }
939 $scope.order.status = 'pending'; 940 $scope.order.status = 'pending';
940 var obj =JSON.parse($scope.order.priceQuote); 941 var obj =JSON.parse($scope.order.priceQuote);
941 $scope.order.priceQuote = obj.papTotal; 942 $scope.order.priceQuote = obj.papTotal;
942 $scope.order.fboCost = obj.cost; 943 $scope.order.fboCost = obj.cost;
943 $scope.order.total = obj.papTotal * $scope.order.volume; 944 $scope.order.total = obj.papTotal * $scope.order.volume;
944 var aircraftObj =JSON.parse($scope.order.aircraftName); 945 var aircraftObj =JSON.parse($scope.order.aircraftName);
945 $scope.order.aircraftName = aircraftObj.tail; 946 $scope.order.aircraftName = aircraftObj.tail;
946 $scope.order.make = aircraftObj.make; 947 $scope.order.make = aircraftObj.make;
947 $scope.order.model = aircraftObj.model; 948 $scope.order.model = aircraftObj.model;
948 $scope.dispatchOrder.fuelOrderList.push($scope.order); 949 $scope.dispatchOrder.fuelOrderList.push($scope.order);
949 enterFuelOrderService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { 950 enterFuelOrderService.dispathFuelOrder($scope.dispatchOrder).then(function(result) {
950 $scope.showLoader = false; 951 $scope.showLoader = false;
951 $scope.order = {}; 952 $scope.order = {};
952 $('#demo-modal-4').css('display', ''); 953 $('#demo-modal-4').css('display', '');
953 toastr.success('Fuel Order Dispatched Successfully', { 954 toastr.success('Fuel Order Dispatched Successfully', {
954 closeButton: true 955 closeButton: true
955 }) 956 })
956 }) 957 })
957 } 958 }
958 959
959 $scope.addTotal = function(value, valueOf) { 960 $scope.addTotal = function(value, valueOf) {
960 if (valueOf == 'v') { 961 if (valueOf == 'v') {
961 $scope.order.total = value * $scope.order.invoiced 962 $scope.order.total = value * $scope.order.invoiced
962 } else if (valueOf == 'i') { 963 } else if (valueOf == 'i') {
963 $scope.order.total = $scope.order.volume * value 964 $scope.order.total = $scope.order.volume * value
964 } 965 }
965 } 966 }
966 967
967 $scope.getAircraft = function(company) { 968 $scope.getAircraft = function(company) {
968 $scope.selectedCompanyName = company; 969 $scope.selectedCompanyName = company;
969 970
970 if ($scope.companyData.margin != null && $scope.companyData.marginAVGAS != null) { 971 if ($scope.companyData.margin != null && $scope.companyData.marginAVGAS != null) {
971 fuelOrdersService.getFuelCost($scope.companyData.id).then(function(margins) { 972 fuelOrdersService.getFuelCost($scope.companyData.id).then(function(margins) {
972 $scope.marginList = margins; 973 $scope.marginList = margins;
973 //console.log('$scope.marginList', $scope.marginList); 974 //console.log('$scope.marginList', $scope.marginList);
974 }) 975 })
975 } else if ($scope.companyData.margin != null || $scope.companyData.marginAVGAS == null) { 976 } else if ($scope.companyData.margin != null || $scope.companyData.marginAVGAS == null) {
976 fuelOrdersService.getATypeFuelPricing($scope.companyData.id).then(function(margins) { 977 fuelOrdersService.getATypeFuelPricing($scope.companyData.id).then(function(margins) {
977 $scope.marginList = margins; 978 $scope.marginList = margins;
978 }) 979 })
979 } else if ($scope.companyData.margin == null || $scope.companyData.marginAVGAS != null) { 980 } else if ($scope.companyData.margin == null || $scope.companyData.marginAVGAS != null) {
980 fuelOrdersService.getVTypeFuelPricing($scope.companyData.id).then(function(margins) { 981 fuelOrdersService.getVTypeFuelPricing($scope.companyData.id).then(function(margins) {
981 $scope.marginList = margins; 982 $scope.marginList = margins;
982 }) 983 })
983 } 984 }
984 985
985 986
986 $scope.selectedCompanyId = $scope.companyData.id; 987 $scope.selectedCompanyId = $scope.companyData.id;
987 $scope.marginId = $scope.companyData.margin.id; 988 $scope.marginId = $scope.companyData.margin.id;
988 if ($scope.selectedCompanyId != '') { 989 if ($scope.selectedCompanyId != '') {
989 fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) { 990 fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) {
990 $scope.aircraftList = aircraft; 991 $scope.aircraftList = aircraft;
991 }) 992 })
992 } 993 }
993 if ($scope.marginId != '') { 994 if ($scope.marginId != '') {
994 fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) { 995 fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) {
995 $scope.tierList = tiers; 996 $scope.tierList = tiers;
996 // $scope.showLoader = false; 997 // $scope.showLoader = false;
997 }) 998 })
998 } 999 }
999 1000
1000 } 1001 }
1001 1002
1002 $scope.setCost = function(cost) { 1003 $scope.setCost = function(cost) {
1003 // console.log(cost); 1004 // console.log(cost);
1004 if (cost != null) { 1005 if (cost != null) {
1005 var obj = JSON.parse(cost); 1006 var obj = JSON.parse(cost);
1006 // console.log("0bj",obj) 1007 // console.log("0bj",obj)
1007 $scope.order.fboCost = obj.cost; 1008 $scope.order.fboCost = obj.cost;
1008 } 1009 }
1009 1010
1010 } 1011 }
1011 1012
1012 $scope.sourceList = [{ 1013 $scope.sourceList = [{
1013 source: "Direct Jet-A" 1014 source: "Direct Jet-A"
1014 }, { 1015 }, {
1015 source: "Direct AVGAS 100LL" 1016 source: "Direct AVGAS 100LL"
1016 }]; 1017 }];
1017 $scope.cancelData = function() { 1018 $scope.cancelData = function() {
1018 $('#demo-modal-4').css('display', ''); 1019 $('#demo-modal-4').css('display', '');
1019 } 1020 }
1020 1021
1021 $scope.setFuel = function() { 1022 $scope.setFuel = function() {
1022 $('#demo-modal-4').css('display', 'block'); 1023 $('#demo-modal-4').css('display', 'block');
1023 1024
1024 } 1025 }
1025 1026
1026 /*delete company*/ 1027 /*delete company*/
1027 var deletecompanyId = ""; 1028 var deletecompanyId = "";
1028 $scope.deleteComp = function(companyDataid) { 1029 $scope.deleteComp = function(companyDataid) {
1029 $('#delete2').css('display', 'block'); 1030 $('#delete2').css('display', 'block');
1030 //console.log("asda",companyDataid) 1031 //console.log("asda",companyDataid)
1031 deletecompanyId = companyDataid; 1032 deletecompanyId = companyDataid;
1032 } 1033 }
1033 $scope.aircraftIdx = ''; 1034 $scope.aircraftIdx = '';
1034 $scope.checkTail = function(tail, idx){ 1035 $scope.checkTail = function(tail, idx){
1035 var data = "tail=" + tail + "&id=" + companyId; 1036 var data = "tail=" + tail + "&id=" + companyId;
1036 $scope.aircraftIdx = idx; 1037 $scope.aircraftIdx = idx;
1037 ViewCompanyService.checkTail(data).then(function(result) { 1038 ViewCompanyService.checkTail(data).then(function(result) {
1038 if(result.error) { 1039 if(result.error) {
1039 $scope.aircraftMessage = result.error; 1040 $scope.aircraftMessage = result.error;
1040 $scope.openAddAirCraftError(); 1041 $scope.openAddAirCraftError();
1041 } else if(result.warning) { 1042 } else if(result.warning) {
1042 $scope.aircraftMessage = result.warning; 1043 $scope.aircraftMessage = result.warning;
1043 $scope.openAddAirCraftWarning(); 1044 $scope.openAddAirCraftWarning();
1044 } 1045 }
1045 }) 1046 })
1046 } 1047 }
1047 1048
1048 $scope.openAddAirCraftError = function() { 1049 $scope.openAddAirCraftError = function() {
1049 $('#addAirCraftError').css('display', 'block'); 1050 $('#addAirCraftError').css('display', 'block');
1050 } 1051 }
1051 1052
1052 $scope.openAddAirCraftWarning = function() { 1053 $scope.openAddAirCraftWarning = function() {
1053 $('#addAirCraftWarning').css('display', 'block'); 1054 $('#addAirCraftWarning').css('display', 'block');
1054 } 1055 }
1055 $scope.acceptAirCraftError = function() { 1056 $scope.acceptAirCraftError = function() {
1056 $('#addAirCraftWarning').css('display', 'none'); 1057 $('#addAirCraftWarning').css('display', 'none');
1057 } 1058 }
1058 1059
1059 $scope.cancelAirCraftError = function() { 1060 $scope.cancelAirCraftError = function() {
1060 $scope.aircraftDetails[$scope.aircraftIdx].tail = ''; 1061 $scope.aircraftDetails[$scope.aircraftIdx].tail = '';
1061 $('#addAirCraftWarning').css('display', 'none'); 1062 $('#addAirCraftWarning').css('display', 'none');
1062 $('#addAirCraftError').css('display', 'none'); 1063 $('#addAirCraftError').css('display', 'none');
1063 } 1064 }
1064 1065
1065 $scope.deleteCompanyData = function() { 1066 $scope.deleteCompanyData = function() {
1066 ViewCompanyService.deleteCompany(deletecompanyId).then(function(result) { 1067 ViewCompanyService.deleteCompany(deletecompanyId).then(function(result) {
1067 1068
1068 $('#delete2').css('display', 'none'); 1069 $('#delete2').css('display', 'none');
1069 if (result.success) { 1070 if (result.success) {
1070 toastr.success('' + result.success + '', { 1071 toastr.success('' + result.success + '', {
1071 closeButton: true 1072 closeButton: true
1072 1073
1073 }) 1074 })
1074 } else { 1075 } else {
1075 toastr.error('' + result.statusText + '', { 1076 toastr.error('' + result.statusText + '', {
1076 closeButton: true 1077 closeButton: true
1077 1078
1078 }) 1079 })
1079 } 1080 }
1080 $state.go('app.customers') 1081 $state.go('app.customers')
1081 }) 1082 })
1082 } 1083 }
1083 $scope.cancelDelete = function() { 1084 $scope.cancelDelete = function() {
1084 $('#delete2').css('display', 'none'); 1085 $('#delete2').css('display', 'none');
1085 } 1086 }
1086 1087
1087 1088
1088 $scope.editJetMargin = function(aircraftData, type) { 1089 $scope.editJetMargin = function(aircraftData, type) {
1089 $scope.showLoader = true; 1090 $scope.showLoader = true;
1090 if (type == 'jet') { 1091 if (type == 'jet') {
1091 1092
1092 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsMargin.id + "&type=" + type; 1093 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsMargin.id + "&type=" + type;
1093 1094
1094 } else { 1095 } else {
1095 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsAVGASMargin.id + "&type=" + type; 1096 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsAVGASMargin.id + "&type=" + type;
1096 } 1097 }
1097 1098
1098 var id = aircraftData.id; 1099 var id = aircraftData.id;
1099 ViewCompanyService.updateAircraftMargin(aircraftdataMargin, id).then(function(result) { 1100 ViewCompanyService.updateAircraftMargin(aircraftdataMargin, id).then(function(result) {
1100 if (result != null && result.success) { 1101 if (result != null && result.success) {
1101 $scope.showLoader = false; 1102 $scope.showLoader = false;
1102 toastr.success('' + result.success + '', { 1103 toastr.success('' + result.success + '', {
1103 closeButton: true 1104 closeButton: true
1104 }) 1105 })
1105 // getAircraftWithMarginList(); 1106 // getAircraftWithMarginList();
1106 getAircraftList(); 1107 getAircraftList();
1107 } else { 1108 } else {
1108 $scope.showLoader = false; 1109 $scope.showLoader = false;
1109 toastr.error('' + result.statusText + '', { 1110 toastr.error('' + result.statusText + '', {
1110 closeButton: true 1111 closeButton: true
1111 }) 1112 })
1112 } 1113 }
1113 }) 1114 })
1114 } 1115 }
1115 1116
1116 1117
1117 /* //not used currently 1118 /* //not used currently
1118 function getAircraftWithMarginList() { 1119 function getAircraftWithMarginList() {
1119 ViewCompanyService.getJetAMargin(companyId).then(function(result) { 1120 ViewCompanyService.getJetAMargin(companyId).then(function(result) {
1120 $scope.contactAircraftList = result; 1121 $scope.contactAircraftList = result;
1121 for (var i = 0; i < $scope.contactAircraftList.length; i++) { 1122 for (var i = 0; i < $scope.contactAircraftList.length; i++) {
1122 if ($scope.contactAircraftList[i].aircraftsMargin != null) { 1123 if ($scope.contactAircraftList[i].aircraftsMargin != null) {
1123 $scope.aircraftmargins.push({ 1124 $scope.aircraftmargins.push({
1124 'id': $scope.contactAircraftList[i].aircraftsMargin.id 1125 'id': $scope.contactAircraftList[i].aircraftsMargin.id
1125 }) 1126 })
1126 } 1127 }
1127 } 1128 }
1128 if ($scope.aircraftmargins.length > 0) { 1129 if ($scope.aircraftmargins.length > 0) {
1129 for (var i = 0; i < $scope.aircraftmargins.length; i++) { 1130 for (var i = 0; i < $scope.aircraftmargins.length; i++) {
1130 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) { 1131 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) {
1131 $scope.multiple = true; 1132 $scope.multiple = true;
1132 $scope.multipleMsg = true; 1133 $scope.multipleMsg = true;
1133 if ($scope.multiple) { 1134 if ($scope.multiple) {
1134 $scope.companyData.masterMargin = "multiple"; 1135 $scope.companyData.masterMargin = "multiple";
1135 } 1136 }
1136 } 1137 }
1137 } 1138 }
1138 } 1139 }
1139 }) 1140 })
1140 }*/ 1141 }*/
1141 1142
1142 1143
1143 }]); 1144 }]);