Commit 2a564fddbaeea3a55939f44b196ad1b54ca377c4
1 parent
f27ed5abd2
Exists in
master
minor
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/partials/customers/customers.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 | .controller('customersController', [ '$scope', '$rootScope', '$uibModal', '$filter', '$http', '$state', 'CustomersService', 'ViewCompanyService', 'NgTableParams', 'fuelOrdersService', 'enterFuelOrderService', customersController ]); | 5 | .controller('customersController', [ '$scope', '$rootScope', '$uibModal', '$filter', '$http', '$state', 'CustomersService', 'ViewCompanyService', 'NgTableParams', 'fuelOrdersService', 'enterFuelOrderService', customersController ]); |
6 | 6 | ||
7 | function customersController($scope, $rootScope, $uibModal, $filter, $http, $state, CustomersService, ViewCompanyService, NgTableParams, fuelOrdersService, enterFuelOrderService) { | 7 | function customersController($scope, $rootScope, $uibModal, $filter, $http, $state, CustomersService, ViewCompanyService, NgTableParams, fuelOrdersService, enterFuelOrderService) { |
8 | $(document).ready(function() { | 8 | $(document).ready(function() { |
9 | // $('#example').DataTable(); | 9 | // $('#example').DataTable(); |
10 | }); | 10 | }); |
11 | $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')) | 11 | $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')) |
12 | $scope.reset2 = function() { | 12 | $scope.reset2 = function() { |
13 | $("input").val(""); | 13 | $("input").val(""); |
14 | $scope.removeMarginValidation(); | 14 | $scope.removeMarginValidation(); |
15 | } | 15 | } |
16 | 16 | ||
17 | $scope.order = {}; | 17 | $scope.order = {}; |
18 | $scope.order.upliftDate = ''; | 18 | $scope.order.upliftDate = ''; |
19 | $scope.data = {}; | 19 | $scope.data = {}; |
20 | $scope.aircraft = {}; | 20 | $scope.aircraft = {}; |
21 | $scope.data.activate = true; | 21 | $scope.data.activate = true; |
22 | $scope.showLoader = true; | 22 | $scope.showLoader = true; |
23 | $scope.jetShow = []; | 23 | $scope.jetShow = []; |
24 | $scope.marginShow = []; | 24 | $scope.marginShow = []; |
25 | 25 | ||
26 | $scope.jetShow[0] = true; | 26 | $scope.jetShow[0] = true; |
27 | $scope.marginShow[0] = true; | 27 | $scope.marginShow[0] = true; |
28 | $scope.dispatchOrder = {}; | 28 | $scope.dispatchOrder = {}; |
29 | $scope.dispatchOrder.fuelOrderList = []; | 29 | $scope.dispatchOrder.fuelOrderList = []; |
30 | $scope.statusFilterOptions = []; | 30 | $scope.statusFilterOptions = []; |
31 | $scope.companyList = {}; | 31 | $scope.companyList = {}; |
32 | $scope.statusFilterOptions.push({ | 32 | $scope.statusFilterOptions.push({ |
33 | 'id' : '', | 33 | 'id' : '', |
34 | 'title' : 'Show All' | 34 | 'title' : 'Show All' |
35 | }, { | 35 | }, { |
36 | 'id' : 'pending', | 36 | 'id' : 'pending', |
37 | 'title' : 'Pending' | 37 | 'title' : 'Pending' |
38 | }, { | 38 | }, { |
39 | 'id' : 'invoiced', | 39 | 'id' : 'invoiced', |
40 | 'title' : 'Invoiced' | 40 | 'title' : 'Invoiced' |
41 | }, { | 41 | }, { |
42 | 'id' : 'paid', | 42 | 'id' : 'paid', |
43 | 'title' : 'Paid' | 43 | 'title' : 'Paid' |
44 | }, { | 44 | }, { |
45 | 'id' : 'cancelled', | 45 | 'id' : 'cancelled', |
46 | 'title' : 'Cancelled' | 46 | 'title' : 'Cancelled' |
47 | }, { | 47 | }, { |
48 | 'id' : 'archived', | 48 | 'id' : 'archived', |
49 | 'title' : 'Archived' | 49 | 'title' : 'Archived' |
50 | } | 50 | } |
51 | 51 | ||
52 | ); | 52 | ); |
53 | 53 | ||
54 | /*function getAllCompanies(){ | 54 | /*function getAllCompanies(){ |
55 | CustomersService.getAllCompanies().then(function(result) { | 55 | CustomersService.getAllCompanies().then(function(result) { |
56 | $scope.companyList = result; | 56 | $scope.companyList = result; |
57 | for(var i=0; i<$scope.companyList.length; i++){ | 57 | for(var i=0; i<$scope.companyList.length; i++){ |
58 | $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id; | 58 | $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id; |
59 | } | 59 | } |
60 | }) | 60 | }) |
61 | 61 | ||
62 | }*/ | 62 | }*/ |
63 | 63 | ||
64 | $scope.statusFilter = [ | 64 | $scope.statusFilter = [ |
65 | { | 65 | { |
66 | id : "", | 66 | id : "", |
67 | title : "Show All" | 67 | title : "Show All" |
68 | }, | 68 | }, |
69 | { | 69 | { |
70 | id : "true", | 70 | id : "true", |
71 | title : "Active" | 71 | title : "Active" |
72 | }, | 72 | }, |
73 | { | 73 | { |
74 | id : "false", | 74 | id : "false", |
75 | title : "Inactive" | 75 | title : "Inactive" |
76 | } | 76 | } |
77 | ] | 77 | ] |
78 | 78 | ||
79 | function getAllCompanies() { | 79 | function getAllCompanies() { |
80 | CustomersService.getAllCompanies().then(function(result) { | 80 | CustomersService.getAllCompanies().then(function(result) { |
81 | $scope.companyList = result; | 81 | $scope.companyList = result; |
82 | console.log("result",result) | 82 | //console.log("result",result) |
83 | for (var i = 0; i < $scope.companyList.length; i++) { | 83 | for (var i = 0; i < $scope.companyList.length; i++) { |
84 | if ($scope.companyList[i].companyContact != null) { | 84 | if ($scope.companyList[i].companyContact != null) { |
85 | if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) { | 85 | if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) { |
86 | $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber; | 86 | $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | if ($scope.companyList[i].primaryContact != null) { | 89 | if ($scope.companyList[i].primaryContact != null) { |
90 | if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) { | 90 | if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) { |
91 | $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName; | 91 | $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | if ($scope.companyList[i].margin != null) { | 94 | if ($scope.companyList[i].margin != null) { |
95 | if ($scope.companyList[i].margin.marginName != null) { | 95 | if ($scope.companyList[i].margin.marginName != null) { |
96 | $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id; | 96 | $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | } | 99 | } |
100 | $scope.displayCompanyList = new NgTableParams({ | 100 | $scope.displayCompanyList = new NgTableParams({ |
101 | page : 1, | 101 | page : 1, |
102 | count : 10, | 102 | count : 10, |
103 | }, { | 103 | }, { |
104 | data : $scope.companyList | 104 | data : $scope.companyList |
105 | }); | 105 | }); |
106 | $scope.showLoader = false; | 106 | $scope.showLoader = false; |
107 | }) | 107 | }) |
108 | } | 108 | } |
109 | 109 | ||
110 | getAllCompanies(); | 110 | getAllCompanies(); |
111 | 111 | ||
112 | $scope.editMargin = function(customer) { | 112 | $scope.editMargin = function(customer) { |
113 | //console.log('customer', customer); | 113 | //console.log('customer', customer); |
114 | $scope.showLoader = true; | 114 | $scope.showLoader = true; |
115 | event.stopPropagation(); | 115 | event.stopPropagation(); |
116 | 116 | ||
117 | var companyMargin = "companyName=" + customer.companyName + "&masterMargin=" + customer.masterMargin | 117 | var companyMargin = "companyName=" + customer.companyName + "&masterMargin=" + customer.masterMargin |
118 | + "&addressOne=" + customer.addressOne + "&addressTwo=" + customer.addressTwo + "&city=" + customer.city + "&state=" | 118 | + "&addressOne=" + customer.addressOne + "&addressTwo=" + customer.addressTwo + "&city=" + customer.city + "&state=" |
119 | + customer.state + "&country=" + customer.country + "&zipcode=" + customer.zipcode + "&internalNote=" | 119 | + customer.state + "&country=" + customer.country + "&zipcode=" + customer.zipcode + "&internalNote=" |
120 | + customer.internalNote + "&certificateType=" + customer.certificateType + "&baseTenant=" + customer.baseTenant | 120 | + customer.internalNote + "&certificateType=" + customer.certificateType + "&baseTenant=" + customer.baseTenant |
121 | + "&fuelerlinxCustomer=" + customer.fuelerlinxCustomer + "&contractFuelVendor=" + customer.contractFuelVendor | 121 | + "&fuelerlinxCustomer=" + customer.fuelerlinxCustomer + "&contractFuelVendor=" + customer.contractFuelVendor |
122 | + "&activate=" + customer.activate + "&baseIcao=" + customer.baseIcao + "&companyId=" + customer.id; | 122 | + "&activate=" + customer.activate + "&baseIcao=" + customer.baseIcao + "&companyId=" + customer.id; |
123 | 123 | ||
124 | ViewCompanyService.updateCompany(companyMargin).then(function(result) { | 124 | ViewCompanyService.updateCompany(companyMargin).then(function(result) { |
125 | if (result != null && result.success) { | 125 | if (result != null && result.success) { |
126 | $scope.showLoader = false; | 126 | $scope.showLoader = false; |
127 | toastr.success('' + result.success + '', { | 127 | toastr.success('' + result.success + '', { |
128 | closeButton : true | 128 | closeButton : true |
129 | }) | 129 | }) |
130 | getAllCompanies(); | 130 | getAllCompanies(); |
131 | } else { | 131 | } else { |
132 | $scope.showLoader = false; | 132 | $scope.showLoader = false; |
133 | toastr.error('' + result.statusText + '', { | 133 | toastr.error('' + result.statusText + '', { |
134 | closeButton : true | 134 | closeButton : true |
135 | }) | 135 | }) |
136 | } | 136 | } |
137 | }) | 137 | }) |
138 | } | 138 | } |
139 | 139 | ||
140 | getData(); | 140 | getData(); |
141 | function getData() { | 141 | function getData() { |
142 | $scope.showLoader = true; | 142 | $scope.showLoader = true; |
143 | CustomersService.getAircraftMake().then(function(result) { | 143 | CustomersService.getAircraftMake().then(function(result) { |
144 | //console.log("==aircrafts===",result) | 144 | //console.log("==aircrafts===",result) |
145 | $scope.aircraftMakeList = result; | 145 | $scope.aircraftMakeList = result; |
146 | $scope.showLoader = false; | 146 | $scope.showLoader = false; |
147 | }) | 147 | }) |
148 | } | 148 | } |
149 | // CustomersService.getMargin().then(function(result) { | 149 | // CustomersService.getMargin().then(function(result) { |
150 | // $scope.marginList = result; | 150 | // $scope.marginList = result; |
151 | // }) | 151 | // }) |
152 | $scope.marginFilterOptions = []; | 152 | $scope.marginFilterOptions = []; |
153 | CustomersService.getJetMargin($scope.userProfileId).then(function(result) { | 153 | CustomersService.getJetMargin($scope.userProfileId).then(function(result) { |
154 | $scope.showLoader = true; | 154 | $scope.showLoader = true; |
155 | $scope.jetMarginList = result; | 155 | $scope.jetMarginList = result; |
156 | //console.log("jet margin",result,$scope.userProfileId) | 156 | //console.log("jet margin",result,$scope.userProfileId) |
157 | $scope.marginFilterOptions.push({ | 157 | $scope.marginFilterOptions.push({ |
158 | 'id' : '', | 158 | 'id' : '', |
159 | 'title' : 'Show All' | 159 | 'title' : 'Show All' |
160 | }); | 160 | }); |
161 | for (var i = 0; i < result.length; i++) { | 161 | for (var i = 0; i < result.length; i++) { |
162 | $scope.marginFilterOptions.push({ | 162 | $scope.marginFilterOptions.push({ |
163 | 'id' : result[i].id, | 163 | 'id' : result[i].id, |
164 | 'title' : result[i].marginName | 164 | 'title' : result[i].marginName |
165 | }) | 165 | }) |
166 | } | 166 | } |
167 | $scope.showLoader = false; | 167 | $scope.showLoader = false; |
168 | }) | 168 | }) |
169 | 169 | ||
170 | CustomersService.getAvgMargin($scope.userProfileId).then(function(result) { | 170 | CustomersService.getAvgMargin($scope.userProfileId).then(function(result) { |
171 | $scope.avgsMarginList = result; | 171 | $scope.avgsMarginList = result; |
172 | // console.log('avgsMarginList',result) | 172 | // console.log('avgsMarginList',result) |
173 | }) | 173 | }) |
174 | 174 | ||
175 | 175 | ||
176 | $scope.showCompanyError = false; | 176 | $scope.showCompanyError = false; |
177 | $scope.showMarginError = false; | 177 | $scope.showMarginError = false; |
178 | 178 | ||
179 | $scope.removeValidation = function() { | 179 | $scope.removeValidation = function() { |
180 | $scope.showCompanyError = false; | 180 | $scope.showCompanyError = false; |
181 | $('.companyNameInput').removeClass('customErrorInput'); | 181 | $('.companyNameInput').removeClass('customErrorInput'); |
182 | if ($scope.data.companyName == 'undefined' || $scope.data.companyName == '') { | 182 | if ($scope.data.companyName == 'undefined' || $scope.data.companyName == '') { |
183 | $('.companyNameInput').addClass('customErrorInput'); | 183 | $('.companyNameInput').addClass('customErrorInput'); |
184 | $scope.showCompanyError = true; | 184 | $scope.showCompanyError = true; |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | $scope.removeMarginValidation = function() { | 188 | $scope.removeMarginValidation = function() { |
189 | $scope.showMarginError = false; | 189 | $scope.showMarginError = false; |
190 | $('.marginSelectBox').removeClass('customErrorInput'); | 190 | $('.marginSelectBox').removeClass('customErrorInput'); |
191 | } | 191 | } |
192 | 192 | ||
193 | var companyData; | 193 | var companyData; |
194 | $scope.addFirstData = function(sel, step) { | 194 | $scope.addFirstData = function(sel, step) { |
195 | $scope.showLoader = true; | 195 | $scope.showLoader = true; |
196 | if ($scope.data.companyName == undefined) { | 196 | if ($scope.data.companyName == undefined) { |
197 | $scope.showCompanyError = true; | 197 | $scope.showCompanyError = true; |
198 | $('.companyNameInput').addClass('customErrorInput'); | 198 | $('.companyNameInput').addClass('customErrorInput'); |
199 | } else if ($scope.data.masterMargin == undefined) { | 199 | } else if ($scope.data.masterMargin == undefined) { |
200 | $scope.showMarginError = true; | 200 | $scope.showMarginError = true; |
201 | $('.marginSelectBox').addClass('customErrorInput'); | 201 | $('.marginSelectBox').addClass('customErrorInput'); |
202 | } else { | 202 | } else { |
203 | $scope.aircraftDetails = [ { | 203 | $scope.aircraftDetails = [ { |
204 | 'tail' : '', | 204 | 'tail' : '', |
205 | 'make' : '', | 205 | 'make' : '', |
206 | 'model' : '', | 206 | 'model' : '', |
207 | 'sizeId' : '', | 207 | 'sizeId' : '', |
208 | 'marginId' : $scope.data.masterMargin, | 208 | 'marginId' : $scope.data.masterMargin, |
209 | 'avgasMarginId' : $scope.data.avgasMargin | 209 | 'avgasMarginId' : $scope.data.avgasMargin |
210 | } ]; | 210 | } ]; |
211 | 211 | ||
212 | $(sel).trigger('next.m.' + step); | 212 | $(sel).trigger('next.m.' + step); |
213 | getData(); | 213 | getData(); |
214 | } | 214 | } |
215 | $scope.showLoader = false; | 215 | $scope.showLoader = false; |
216 | } | 216 | } |
217 | 217 | ||
218 | $scope.addNew = function() { | 218 | $scope.addNew = function() { |
219 | $scope.showLoader = true; | 219 | $scope.showLoader = true; |
220 | $scope.aircraftDetails.push({ | 220 | $scope.aircraftDetails.push({ |
221 | 'tail' : '', | 221 | 'tail' : '', |
222 | 'make' : '', | 222 | 'make' : '', |
223 | 'model' : '', | 223 | 'model' : '', |
224 | 'sizeId' : '', | 224 | 'sizeId' : '', |
225 | 'marginId' : $scope.data.masterMargin, | 225 | 'marginId' : $scope.data.masterMargin, |
226 | 'avgasMarginId' : $scope.data.avgasMargin | 226 | 'avgasMarginId' : $scope.data.avgasMargin |
227 | }); | 227 | }); |
228 | $scope.showLoader = false; | 228 | $scope.showLoader = false; |
229 | }; | 229 | }; |
230 | 230 | ||
231 | $scope.aircraftIdx = ''; | 231 | $scope.aircraftIdx = ''; |
232 | $scope.checkTail = function(tail, idx){ | 232 | $scope.checkTail = function(tail, idx){ |
233 | var data = "tail=" + tail; | 233 | var data = "tail=" + tail; |
234 | $scope.aircraftIdx = idx; | 234 | $scope.aircraftIdx = idx; |
235 | CustomersService.checkTailRegistration(data).then(function(result) { | 235 | CustomersService.checkTailRegistration(data).then(function(result) { |
236 | if(result.error) { | 236 | if(result.error) { |
237 | $scope.aircraftMessage = result.error; | 237 | $scope.aircraftMessage = result.error; |
238 | $scope.openAddAirCraftError(); | 238 | $scope.openAddAirCraftError(); |
239 | } else if(result.warning) { | 239 | } else if(result.warning) { |
240 | $scope.aircraftMessage = result.warning; | 240 | $scope.aircraftMessage = result.warning; |
241 | $scope.openAddAirCraftWarning(); | 241 | $scope.openAddAirCraftWarning(); |
242 | } | 242 | } |
243 | }) | 243 | }) |
244 | } | 244 | } |
245 | 245 | ||
246 | $scope.openAddAirCraftError = function() { | 246 | $scope.openAddAirCraftError = function() { |
247 | $('#addAirCraftError').css('display', 'block'); | 247 | $('#addAirCraftError').css('display', 'block'); |
248 | } | 248 | } |
249 | 249 | ||
250 | $scope.openAddAirCraftWarning = function() { | 250 | $scope.openAddAirCraftWarning = function() { |
251 | $('#addAirCraftWarning').css('display', 'block'); | 251 | $('#addAirCraftWarning').css('display', 'block'); |
252 | } | 252 | } |
253 | $scope.acceptAirCraftError = function() { | 253 | $scope.acceptAirCraftError = function() { |
254 | $('#addAirCraftWarning').css('display', 'none'); | 254 | $('#addAirCraftWarning').css('display', 'none'); |
255 | } | 255 | } |
256 | 256 | ||
257 | $scope.cancelAirCraftError = function() { | 257 | $scope.cancelAirCraftError = function() { |
258 | $scope.aircraftDetails[$scope.aircraftIdx].tail = ''; | 258 | $scope.aircraftDetails[$scope.aircraftIdx].tail = ''; |
259 | $('#addAirCraftWarning').css('display', 'none'); | 259 | $('#addAirCraftWarning').css('display', 'none'); |
260 | $('#addAirCraftError').css('display', 'none'); | 260 | $('#addAirCraftError').css('display', 'none'); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | /*$scope.getModal = function(makeId, index) { | 264 | /*$scope.getModal = function(makeId, index) { |
265 | $scope.showLoader = true; | 265 | $scope.showLoader = true; |
266 | CustomersService.getModal($scope.aircraft.make).then(function(result) { | 266 | CustomersService.getModal($scope.aircraft.make).then(function(result) { |
267 | $scope.showLoader = false; | 267 | $scope.showLoader = false; |
268 | $scope.aircraftDetails[index].aircraftModalList = result; | 268 | $scope.aircraftDetails[index].aircraftModalList = result; |
269 | }) | 269 | }) |
270 | }*/ | 270 | }*/ |
271 | $scope.getModal = function(makeId, index) { | 271 | $scope.getModal = function(makeId, index) { |
272 | $scope.showLoader = true; | 272 | $scope.showLoader = true; |
273 | $scope.aircraft.make = makeId; | 273 | $scope.aircraft.make = makeId; |
274 | CustomersService.getModal($scope.aircraft.make).then(function(result) { | 274 | CustomersService.getModal($scope.aircraft.make).then(function(result) { |
275 | $scope.showLoader = false; | 275 | $scope.showLoader = false; |
276 | $scope.aircraftDetails[index].aircraftModalList = result; | 276 | $scope.aircraftDetails[index].aircraftModalList = result; |
277 | }) | 277 | }) |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | $scope.selectedOption = ''; | 281 | $scope.selectedOption = ''; |
282 | $scope.getSize = function(model, index) { | 282 | $scope.getSize = function(model, index) { |
283 | $scope.showLoader = true; | 283 | $scope.showLoader = true; |
284 | $scope.aircraft.model = model; | 284 | $scope.aircraft.model = model; |
285 | CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { | 285 | CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { |
286 | $scope.showLoader = false; | 286 | $scope.showLoader = false; |
287 | $scope.aircraftDetails[index].aircraftSizeList = result; | 287 | $scope.aircraftDetails[index].aircraftSizeList = result; |
288 | $scope.getFuelType($scope.aircraftDetails[index].aircraftSizeList[0].aircraftSize.id,index); | 288 | $scope.getFuelType($scope.aircraftDetails[index].aircraftSizeList[0].aircraftSize.id,index); |
289 | 289 | ||
290 | }) | 290 | }) |
291 | } | 291 | } |
292 | 292 | ||
293 | /*$scope.getSize = function(model, index) { | 293 | /*$scope.getSize = function(model, index) { |
294 | $scope.showLoader = true; | 294 | $scope.showLoader = true; |
295 | CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { | 295 | CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { |
296 | $scope.showLoader = false; | 296 | $scope.showLoader = false; |
297 | $scope.aircraftDetails[index].aircraftSizeList = result; | 297 | $scope.aircraftDetails[index].aircraftSizeList = result; |
298 | }) | 298 | }) |
299 | }*/ | 299 | }*/ |
300 | 300 | ||
301 | $scope.getFuelType = function(size, index) { | 301 | $scope.getFuelType = function(size, index) { |
302 | $scope.showLoader = true; | 302 | $scope.showLoader = true; |
303 | var data = "model="+$scope.aircraft.model+"&make="+$scope.aircraft.make+"&sizeId="+size; | 303 | var data = "model="+$scope.aircraft.model+"&make="+$scope.aircraft.make+"&sizeId="+size; |
304 | ViewCompanyService.checkFuelType(data).then(function(result){ | 304 | ViewCompanyService.checkFuelType(data).then(function(result){ |
305 | $scope.showLoader = false; | 305 | $scope.showLoader = false; |
306 | if (result.type == "JetA") { | 306 | if (result.type == "JetA") { |
307 | $scope.jetShow[index] = false; | 307 | $scope.jetShow[index] = false; |
308 | $scope.marginShow[index] = true; | 308 | $scope.marginShow[index] = true; |
309 | } else if (result.type == "Avgas") { | 309 | } else if (result.type == "Avgas") { |
310 | $scope.jetShow[index] = true; | 310 | $scope.jetShow[index] = true; |
311 | $scope.marginShow[index] = false; | 311 | $scope.marginShow[index] = false; |
312 | }else { | 312 | }else { |
313 | $scope.jetShow[index] = true; | 313 | $scope.jetShow[index] = true; |
314 | $scope.marginShow[index] = true; | 314 | $scope.marginShow[index] = true; |
315 | } | 315 | } |
316 | }) | 316 | }) |
317 | } | 317 | } |
318 | 318 | ||
319 | $scope.aircraftListData = {}; | 319 | $scope.aircraftListData = {}; |
320 | $scope.addData = []; | 320 | $scope.addData = []; |
321 | $scope.tailArray = []; | 321 | $scope.tailArray = []; |
322 | function check(array){ | 322 | function check(array){ |
323 | return (new Set(array)).size !== array.length; | 323 | return (new Set(array)).size !== array.length; |
324 | } | 324 | } |
325 | $scope.saveCompanyData = function() { | 325 | $scope.saveCompanyData = function() { |
326 | // console.log("company data --",$scope.data) | 326 | // console.log("company data --",$scope.data) |
327 | CustomersService.addCompany($scope.data).then(function(result) { | 327 | CustomersService.addCompany($scope.data).then(function(result) { |
328 | $scope.tailArray = []; | 328 | $scope.tailArray = []; |
329 | $scope.addData =[]; | 329 | $scope.addData =[]; |
330 | $scope.accountId = result; | 330 | $scope.accountId = result; |
331 | $scope.aircraft.accountId = $scope.accountId; | 331 | $scope.aircraft.accountId = $scope.accountId; |
332 | 332 | ||
333 | for (var i = 0; i < $scope.aircraftDetails.length; i++) { | 333 | for (var i = 0; i < $scope.aircraftDetails.length; i++) { |
334 | $scope.addData.push({ | 334 | $scope.addData.push({ |
335 | 'tail' : $scope.aircraftDetails[i].tail, | 335 | 'tail' : $scope.aircraftDetails[i].tail, |
336 | 'make' : $scope.aircraftDetails[i].make, | 336 | 'make' : $scope.aircraftDetails[i].make, |
337 | 'model' : $scope.aircraftDetails[i].model, | 337 | 'model' : $scope.aircraftDetails[i].model, |
338 | 'sizeId' : $scope.aircraftDetails[i].sizeId, | 338 | 'sizeId' : $scope.aircraftDetails[i].sizeId, |
339 | 'marginId' : $scope.aircraftDetails[i].marginId, | 339 | 'marginId' : $scope.aircraftDetails[i].marginId, |
340 | 'avgasMarginId' : $scope.aircraftDetails[i].avgasMarginId | 340 | 'avgasMarginId' : $scope.aircraftDetails[i].avgasMarginId |
341 | }); | 341 | }); |
342 | $scope.tailArray.push($scope.aircraftDetails[i].tail); | 342 | $scope.tailArray.push($scope.aircraftDetails[i].tail); |
343 | } | 343 | } |
344 | 344 | ||
345 | if (check($scope.tailArray)) { | 345 | if (check($scope.tailArray)) { |
346 | toastr.error('Duplicate Tail Added.', { | 346 | toastr.error('Duplicate Tail Added.', { |
347 | closeButton: true | 347 | closeButton: true |
348 | }) | 348 | }) |
349 | }else{ | 349 | }else{ |
350 | $scope.aircraftListData.aircraftList = $scope.addData; | 350 | $scope.aircraftListData.aircraftList = $scope.addData; |
351 | $scope.aircraftListData.accountId = $scope.aircraft.accountId; | 351 | $scope.aircraftListData.accountId = $scope.aircraft.accountId; |
352 | /*if ($scope.aircraftListData.aircraftList[0].tail == "" || $scope.aircraftListData.aircraftList[0].make == null || $scope.aircraftListData.aircraftList[0].model == null) { | 352 | /*if ($scope.aircraftListData.aircraftList[0].tail == "" || $scope.aircraftListData.aircraftList[0].make == null || $scope.aircraftListData.aircraftList[0].model == null) { |
353 | $scope.aircraftListData.aircraftList = []; | 353 | $scope.aircraftListData.aircraftList = []; |
354 | }*/ | 354 | }*/ |
355 | 355 | ||
356 | CustomersService.addAircraft($scope.aircraftListData).then(function(result) { | 356 | CustomersService.addAircraft($scope.aircraftListData).then(function(result) { |
357 | 357 | ||
358 | if (result != null && result.success) { | 358 | if (result != null && result.success) { |
359 | 359 | ||
360 | toastr.success('' + result.success + '', { | 360 | toastr.success('' + result.success + '', { |
361 | closeButton : true | 361 | closeButton : true |
362 | }) | 362 | }) |
363 | $('#demo-modal-3').css('display', 'none'); | 363 | $('#demo-modal-3').css('display', 'none'); |
364 | $('.modal-backdrop').css('display', 'none'); | 364 | $('.modal-backdrop').css('display', 'none'); |
365 | getAllCompanies(); | 365 | getAllCompanies(); |
366 | location.reload(); | 366 | location.reload(); |
367 | } else { | 367 | } else { |
368 | toastr.error('' + result.statusText + '', { | 368 | toastr.error('' + result.statusText + '', { |
369 | closeButton : true | 369 | closeButton : true |
370 | }) | 370 | }) |
371 | } | 371 | } |
372 | }); | 372 | }); |
373 | } | 373 | } |
374 | }) | 374 | }) |
375 | } | 375 | } |
376 | 376 | ||
377 | /*add a fuel order*/ | 377 | /*add a fuel order*/ |
378 | $scope.getOrders = function() { | 378 | $scope.getOrders = function() { |
379 | fuelOrdersService.getOrders().then(function(result) { | 379 | fuelOrdersService.getOrders().then(function(result) { |
380 | $scope.orderdata = result; | 380 | $scope.orderdata = result; |
381 | for (var i = 0; i < $scope.orderdata.length; i++) { | 381 | for (var i = 0; i < $scope.orderdata.length; i++) { |
382 | $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate); | 382 | $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate); |
383 | 383 | ||
384 | // var str = "" + $scope.orderdata[i].upliftDateS.getDate() + "/" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getFullYear() | 384 | // var str = "" + $scope.orderdata[i].upliftDateS.getDate() + "/" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getFullYear() |
385 | var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear() | 385 | var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear() |
386 | // str = str.slice(4,16) | 386 | // str = str.slice(4,16) |
387 | $scope.orderdata[i].upliftDateString = str | 387 | $scope.orderdata[i].upliftDateString = str |
388 | // console.log(str); | 388 | // console.log(str); |
389 | 389 | ||
390 | } | 390 | } |
391 | 391 | ||
392 | $scope.displayFuelOrderList = new NgTableParams({ | 392 | $scope.displayFuelOrderList = new NgTableParams({ |
393 | page : 1, | 393 | page : 1, |
394 | count : 10, | 394 | count : 10, |
395 | }, { | 395 | }, { |
396 | data : $scope.orderdata | 396 | data : $scope.orderdata |
397 | }); | 397 | }); |
398 | $(document).ready(function() { | 398 | $(document).ready(function() { |
399 | var myselect = document.getElementsByClassName('colorfulSelectbox'); | 399 | var myselect = document.getElementsByClassName('colorfulSelectbox'); |
400 | 400 | ||
401 | for (var i = 0; i < myselect.length; i++) { | 401 | for (var i = 0; i < myselect.length; i++) { |
402 | var colourIndex = $(myselect[i]).prop('selectedIndex'); | 402 | var colourIndex = $(myselect[i]).prop('selectedIndex'); |
403 | colourIndex = colourIndex + 1; | 403 | colourIndex = colourIndex + 1; |
404 | // console.log(colourIndex); | 404 | // console.log(colourIndex); |
405 | var getColor = $('.colorfulSelectbox option:nth-child(' + colourIndex + ')').css('color'); | 405 | var getColor = $('.colorfulSelectbox option:nth-child(' + colourIndex + ')').css('color'); |
406 | $(myselect[i]).css('background-color', getColor); | 406 | $(myselect[i]).css('background-color', getColor); |
407 | // console.log('colour', getColor); | 407 | // console.log('colour', getColor); |
408 | myselect[i].blur(); | 408 | myselect[i].blur(); |
409 | } | 409 | } |
410 | 410 | ||
411 | }) | 411 | }) |
412 | 412 | ||
413 | }) | 413 | }) |
414 | } | 414 | } |
415 | 415 | ||
416 | $scope.getOrders(); | 416 | $scope.getOrders(); |
417 | $scope.tiervalue=function(){ | 417 | $scope.tiervalue=function(){ |
418 | $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak; | 418 | $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak; |
419 | } | 419 | } |
420 | 420 | ||
421 | $scope.setCost = function(cost){ | 421 | $scope.setCost = function(cost){ |
422 | if(cost != null) { | 422 | if(cost != null) { |
423 | var obj =JSON.parse(cost); | 423 | var obj =JSON.parse(cost); |
424 | $scope.order.fboCost = obj.cost; | 424 | $scope.order.fboCost = obj.cost; |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | $scope.cancelOrder = function() { | 428 | $scope.cancelOrder = function() { |
429 | $scope.order = {}; | 429 | $scope.order = {}; |
430 | } | 430 | } |
431 | 431 | ||
432 | $scope.dispatchFuel = function(){ | 432 | $scope.dispatchFuel = function(){ |
433 | $scope.showLoader = true; | 433 | $scope.showLoader = true; |
434 | $scope.fuelData = {}; | 434 | $scope.fuelData = {}; |
435 | $scope.fuelData.companyId = $scope.selectedCompanyId; | 435 | $scope.fuelData.companyId = $scope.selectedCompanyId; |
436 | $scope.fuelData.companyName =$scope.order.defaultCompanyName; | 436 | $scope.fuelData.companyName =$scope.order.defaultCompanyName; |
437 | var aircraftObj =JSON.parse($scope.order.aircraftName); | 437 | var aircraftObj =JSON.parse($scope.order.aircraftName); |
438 | $scope.fuelData.aircraftName = aircraftObj.tail; | 438 | $scope.fuelData.aircraftName = aircraftObj.tail; |
439 | $scope.fuelData.make = aircraftObj.make; | 439 | $scope.fuelData.make = aircraftObj.make; |
440 | $scope.fuelData.model = aircraftObj.model; | 440 | $scope.fuelData.model = aircraftObj.model; |
441 | //$scope.fuelData.fuelOn = $scope.order.fuelOn; | 441 | //$scope.fuelData.fuelOn = $scope.order.fuelOn; |
442 | $scope.fuelData.invoiced = $scope.order.invoiced; | 442 | $scope.fuelData.invoiced = $scope.order.invoiced; |
443 | $scope.fuelData.volume = $scope.order.volume; | 443 | $scope.fuelData.volume = $scope.order.volume; |
444 | // $scope.fuelData.source = $scope.order.source; | 444 | // $scope.fuelData.source = $scope.order.source; |
445 | 445 | ||
446 | $scope.fuelData.total = $scope.order.total; | 446 | $scope.fuelData.total = $scope.order.total; |
447 | //tier no use | 447 | //tier no use |
448 | $scope.fuelData.tierBreak = $scope.order.tierBreak; | 448 | $scope.fuelData.tierBreak = $scope.order.tierBreak; |
449 | 449 | ||
450 | var obj =JSON.parse($scope.order.priceQuote); | 450 | var obj =JSON.parse($scope.order.priceQuote); |
451 | $scope.fuelData.priceQuote = obj.papTotal; | 451 | $scope.fuelData.priceQuote = obj.papTotal; |
452 | $scope.fuelData.fboCost = obj.cost; | 452 | $scope.fuelData.fboCost = obj.cost; |
453 | $scope.fuelData.productName = obj.productName; | 453 | $scope.fuelData.productName = obj.productName; |
454 | 454 | ||
455 | $scope.fuelData.etaTime = $scope.order.etaTime; | 455 | $scope.fuelData.etaTime = $scope.order.etaTime; |
456 | $scope.fuelData.etdTime = $scope.order.etdTime; | 456 | $scope.fuelData.etdTime = $scope.order.etdTime; |
457 | $scope.fuelData.certificateType = $scope.order.certificateType; | 457 | $scope.fuelData.certificateType = $scope.order.certificateType; |
458 | var currentDate = new Date(); | 458 | var currentDate = new Date(); |
459 | var hours = currentDate.getHours(); | 459 | var hours = currentDate.getHours(); |
460 | var min = currentDate.getMinutes(); | 460 | var min = currentDate.getMinutes(); |
461 | var sec = currentDate.getSeconds(); | 461 | var sec = currentDate.getSeconds(); |
462 | if ($scope.order.upliftDate != '') { | 462 | if ($scope.order.upliftDate != '') { |
463 | $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec; | 463 | $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec; |
464 | $scope.order.upliftDate = new Date($scope.order.upliftDate); | 464 | $scope.order.upliftDate = new Date($scope.order.upliftDate); |
465 | $scope.fuelData.upliftDate = $scope.order.upliftDate.getTime(); | 465 | $scope.fuelData.upliftDate = $scope.order.upliftDate.getTime(); |
466 | } | 466 | } |
467 | 467 | ||
468 | 468 | ||
469 | if ($scope.order.departingDate != '') { | 469 | if ($scope.order.departingDate != '') { |
470 | $scope.order.departingDate = $scope.order.departingDate + ' ' + hours + ':' + min + ':' + sec; | 470 | $scope.order.departingDate = $scope.order.departingDate + ' ' + hours + ':' + min + ':' + sec; |
471 | $scope.order.departingDate = new Date($scope.order.departingDate); | 471 | $scope.order.departingDate = new Date($scope.order.departingDate); |
472 | $scope.fuelData.departingDate = $scope.order.departingDate.getTime(); | 472 | $scope.fuelData.departingDate = $scope.order.departingDate.getTime(); |
473 | } | 473 | } |
474 | 474 | ||
475 | if($scope.order.status === null || $scope.order.status === undefined){ | 475 | if($scope.order.status === null || $scope.order.status === undefined){ |
476 | 476 | ||
477 | $scope.fuelData.status = "pending"; //default status | 477 | $scope.fuelData.status = "pending"; //default status |
478 | 478 | ||
479 | }else { | 479 | }else { |
480 | 480 | ||
481 | $scope.fuelData.status = $scope.order.status; | 481 | $scope.fuelData.status = $scope.order.status; |
482 | } | 482 | } |
483 | if($scope.fuelData.fuelOn === null || $scope.fuelData.fuelOn ===undefined){ | 483 | if($scope.fuelData.fuelOn === null || $scope.fuelData.fuelOn ===undefined){ |
484 | $scope.fuelData.fuelOn = "Arrival"; //default fuelon | 484 | $scope.fuelData.fuelOn = "Arrival"; //default fuelon |
485 | }else { | 485 | }else { |
486 | $scope.fuelData.fuelOn = $scope.order.fuelOn ; | 486 | $scope.fuelData.fuelOn = $scope.order.fuelOn ; |
487 | } | 487 | } |
488 | if($scope.baseTenant && $scope.contractFuelVendor ){ | 488 | if($scope.baseTenant && $scope.contractFuelVendor ){ |
489 | $scope.fuelData.source = "Tenant/CAA" ; | 489 | $scope.fuelData.source = "Tenant/CAA" ; |
490 | }else if($scope.baseTenant) | 490 | }else if($scope.baseTenant) |
491 | { | 491 | { |
492 | $scope.fuelData.source = "Tenant/Base Customer"; | 492 | $scope.fuelData.source = "Tenant/Base Customer"; |
493 | }else if($scope.contractFuelVendor){ | 493 | }else if($scope.contractFuelVendor){ |
494 | $scope.fuelData.source = "CAA Member"; | 494 | $scope.fuelData.source = "CAA Member"; |
495 | } | 495 | } |
496 | 496 | ||
497 | $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); | 497 | $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); |
498 | //console.log("=====$scope.fueldata======",$scope.fuelData) | 498 | //console.log("=====$scope.fueldata======",$scope.fuelData) |
499 | fuelOrdersService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { | 499 | fuelOrdersService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { |
500 | $scope.showLoader = false; | 500 | $scope.showLoader = false; |
501 | $scope.order = {}; | 501 | $scope.order = {}; |
502 | $scope.dispatchOrder.fuelOrderList = []; | 502 | $scope.dispatchOrder.fuelOrderList = []; |
503 | $('#demo-modal-4').css('display', ''); | 503 | $('#demo-modal-4').css('display', ''); |
504 | $scope.getOrders(); | 504 | $scope.getOrders(); |
505 | toastr.success('Fuel Order Dispatched Successfully', { | 505 | toastr.success('Fuel Order Dispatched Successfully', { |
506 | closeButton: true | 506 | closeButton: true |
507 | }) | 507 | }) |
508 | }) | 508 | }) |
509 | } | 509 | } |
510 | 510 | ||
511 | $scope.addTotal = function(value, valueOf) { | 511 | $scope.addTotal = function(value, valueOf) { |
512 | if (value != undefined && valueOf != undefined) { | 512 | if (value != undefined && valueOf != undefined) { |
513 | value = JSON.parse(value) | 513 | value = JSON.parse(value) |
514 | $scope.order.total = Math.abs(value.papTotal) * valueOf; | 514 | $scope.order.total = Math.abs(value.papTotal) * valueOf; |
515 | } | 515 | } |
516 | } | 516 | } |
517 | 517 | ||
518 | $scope.getAircraft = function(company) { | 518 | $scope.getAircraft = function(company) { |
519 | $scope.selectedCompanyName = company; | 519 | $scope.selectedCompanyName = company; |
520 | //$scope.showLoader = true; | 520 | //$scope.showLoader = true; |
521 | // console.log("id",company) | 521 | // console.log("id",company) |
522 | for (var i = 0; i < $scope.companyList.length; i++) { | 522 | for (var i = 0; i < $scope.companyList.length; i++) { |
523 | if ($scope.companyList[i].companyName == company) { | 523 | if ($scope.companyList[i].companyName == company) { |
524 | if ($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null) { | 524 | if ($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null) { |
525 | fuelOrdersService.getFuelCost($scope.companyList[i].id).then(function(margins) { | 525 | fuelOrdersService.getFuelCost($scope.companyList[i].id).then(function(margins) { |
526 | $scope.marginList = margins; | 526 | $scope.marginList = margins; |
527 | //console.log('$scope.marginList', $scope.marginList); | 527 | //console.log('$scope.marginList', $scope.marginList); |
528 | }) | 528 | }) |
529 | } else if ($scope.companyList[i].margin != null || $scope.companyList[i].marginAVGAS == null) { | 529 | } else if ($scope.companyList[i].margin != null || $scope.companyList[i].marginAVGAS == null) { |
530 | fuelOrdersService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) { | 530 | fuelOrdersService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) { |
531 | $scope.marginList = margins; | 531 | $scope.marginList = margins; |
532 | }) | 532 | }) |
533 | } else if ($scope.companyList[i].margin == null || $scope.companyList[i].marginAVGAS != null) { | 533 | } else if ($scope.companyList[i].margin == null || $scope.companyList[i].marginAVGAS != null) { |
534 | fuelOrdersService.getVTypeFuelPricing($scope.companyList[i].id).then(function(margins) { | 534 | fuelOrdersService.getVTypeFuelPricing($scope.companyList[i].id).then(function(margins) { |
535 | $scope.marginList = margins; | 535 | $scope.marginList = margins; |
536 | }) | 536 | }) |
537 | } | 537 | } |
538 | $scope.selectedCompanyId = $scope.companyList[i].id; | 538 | $scope.selectedCompanyId = $scope.companyList[i].id; |
539 | $scope.marginId = $scope.companyList[i].margin.id; | 539 | $scope.marginId = $scope.companyList[i].margin.id; |
540 | if ($scope.selectedCompanyId != '') { | 540 | if ($scope.selectedCompanyId != '') { |
541 | fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) { | 541 | fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) { |
542 | $scope.aircraftList = aircraft; | 542 | $scope.aircraftList = aircraft; |
543 | //console.log("===tail search====",aircraft); | 543 | //console.log("===tail search====",aircraft); |
544 | }) | 544 | }) |
545 | } | 545 | } |
546 | if ($scope.marginId != '') { | 546 | if ($scope.marginId != '') { |
547 | fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) { | 547 | fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) { |
548 | $scope.tierList = tiers; | 548 | $scope.tierList = tiers; |
549 | // $scope.showLoader = false; | 549 | // $scope.showLoader = false; |
550 | }) | 550 | }) |
551 | } else { | 551 | } else { |
552 | // $scope.showLoader = false; | 552 | // $scope.showLoader = false; |
553 | } | 553 | } |
554 | } | 554 | } |
555 | } | 555 | } |
556 | 556 | ||
557 | } | 557 | } |
558 | 558 | ||
559 | $scope.sourceList = [ { | 559 | $scope.sourceList = [ { |
560 | source : "Direct Jet-A" | 560 | source : "Direct Jet-A" |
561 | }, { | 561 | }, { |
562 | source : "Direct AVGAS 100LL" | 562 | source : "Direct AVGAS 100LL" |
563 | } ]; | 563 | } ]; |
564 | $scope.cancelData = function() { | 564 | $scope.cancelData = function() { |
565 | $scope.order = {}; | 565 | $scope.order = {}; |
566 | $('#demo-modal-4').css('display', ''); | 566 | $('#demo-modal-4').css('display', ''); |
567 | } | 567 | } |
568 | 568 | ||
569 | $scope.setFuel = function(companyName,baseTenant,contractFuelVendor,fuelerlinxCustomer,certificateType) { | 569 | $scope.setFuel = function(companyName,baseTenant,contractFuelVendor,fuelerlinxCustomer,certificateType) { |
570 | $('#demo-modal-4').css('display', 'block'); | 570 | $('#demo-modal-4').css('display', 'block'); |
571 | $scope.order.defaultCompanyName = companyName; | 571 | $scope.order.defaultCompanyName = companyName; |
572 | $scope.order.certificateType = certificateType; | 572 | $scope.order.certificateType = certificateType; |
573 | $scope.baseTenant = baseTenant; | 573 | $scope.baseTenant = baseTenant; |
574 | $scope.contractFuelVendor = contractFuelVendor; | 574 | $scope.contractFuelVendor = contractFuelVendor; |
575 | $scope.fuelerlinxCustomer = fuelerlinxCustomer; | 575 | $scope.fuelerlinxCustomer = fuelerlinxCustomer; |
576 | //console.log("===values of checkbox===",baseTenant,contractFuelVendor,fuelerlinxCustomer) | 576 | //console.log("===values of checkbox===",baseTenant,contractFuelVendor,fuelerlinxCustomer) |
577 | $scope.getAircraft(companyName); | 577 | $scope.getAircraft(companyName); |
578 | // event.stopPropagation(); | 578 | // event.stopPropagation(); |
579 | // $state.go('app.updateFuelManager'); | 579 | // $state.go('app.updateFuelManager'); |
580 | } | 580 | } |
581 | 581 | ||
582 | /* ng table */ | 582 | /* ng table */ |
583 | 583 | ||
584 | $scope.exportCompany = function() { | 584 | $scope.exportCompany = function() { |
585 | $scope.showLoader = true; | 585 | $scope.showLoader = true; |
586 | var fileName = "companies.csv"; | 586 | var fileName = "companies.csv"; |
587 | var a = document.createElement("a"); | 587 | var a = document.createElement("a"); |
588 | document.body.appendChild(a); | 588 | document.body.appendChild(a); |
589 | CustomersService.exportCompany().then(function(result) { | 589 | CustomersService.exportCompany().then(function(result) { |
590 | var file = new Blob([ result ], { | 590 | var file = new Blob([ result ], { |
591 | type : 'application/csv' | 591 | type : 'application/csv' |
592 | }); | 592 | }); |
593 | var fileURL = URL.createObjectURL(file); | 593 | var fileURL = URL.createObjectURL(file); |
594 | a.href = fileURL; | 594 | a.href = fileURL; |
595 | a.download = fileName; | 595 | a.download = fileName; |
596 | a.click(); | 596 | a.click(); |
597 | $scope.showLoader = false; | 597 | $scope.showLoader = false; |
598 | }) | 598 | }) |
599 | } | 599 | } |
600 | getCompanyName(); | 600 | getCompanyName(); |
601 | function getCompanyName() { | 601 | function getCompanyName() { |
602 | CustomersService.getCompanyName().then(function(result) { | 602 | CustomersService.getCompanyName().then(function(result) { |
603 | $scope.compNameList = result; | 603 | $scope.compNameList = result; |
604 | //console.log("kd",result) | 604 | //console.log("kd",result) |
605 | }) | 605 | }) |
606 | } | 606 | } |
607 | 607 | ||
608 | // old api not use | 608 | // old api not use |
609 | /*$scope.checkJetWithTail = function(tail, index) { | 609 | /*$scope.checkJetWithTail = function(tail, index) { |
610 | ViewCompanyService.checkJetType(tail).then(function(result) { | 610 | ViewCompanyService.checkJetType(tail).then(function(result) { |
611 | if (result.jetA == "true") { | 611 | if (result.jetA == "true") { |
612 | $scope.jetShow[index] = false; | 612 | $scope.jetShow[index] = false; |
613 | $scope.marginShow[index] = true; | 613 | $scope.marginShow[index] = true; |
614 | } else { | 614 | } else { |
615 | $scope.jetShow[index] = true; | 615 | $scope.jetShow[index] = true; |
616 | $scope.marginShow[index] = false; | 616 | $scope.marginShow[index] = false; |
617 | } | 617 | } |
618 | }) | 618 | }) |
619 | }*/ | 619 | }*/ |
620 | 620 | ||
621 | 621 | ||
622 | $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"}, | 622 | $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"}, |
623 | {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"}, | 623 | {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"}, |
624 | {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"}, | 624 | {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"}, |
625 | {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"}, | 625 | {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"}, |
626 | {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"}, | 626 | {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"}, |
627 | {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"},]; | 627 | {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"},]; |
628 | 628 | ||
629 | $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"}, | 629 | $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"}, |
630 | {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"}, | 630 | {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"}, |
631 | {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"}, | 631 | {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"}, |
632 | {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"}, | 632 | {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"}, |
633 | {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"}, | 633 | {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"}, |
634 | {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"},]; | 634 | {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"},]; |
635 | 635 | ||
636 | } | 636 | } |