Commit c5db803dddbc084c87a35131aef25038d01f28b2

Authored by Kuldeep Arora
1 parent 197a45df06
Exists in master

minor change

app/partials/fuelOrders/fuelOrders.controller.js
1 'use strict'; 1 'use strict';
2 2
3 angular.module('acufuel') 3 angular.module('acufuel')
4 4
5 .controller('fuelOrdersController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'NgTableParams','$stateParams','fuelOrdersService','CustomersService','ViewCompanyService', fuelOrdersController]); 5 .controller('fuelOrdersController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'NgTableParams','$stateParams','fuelOrdersService','CustomersService','ViewCompanyService', fuelOrdersController]);
6 6
7 function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgTableParams,$stateParams,fuelOrdersService,CustomersService,ViewCompanyService) { 7 function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgTableParams,$stateParams,fuelOrdersService,CustomersService,ViewCompanyService) {
8 8
9 $scope.showFuelOrderModal = false; 9 $scope.showFuelOrderModal = false;
10 $scope.optionSelected; 10 $scope.optionSelected;
11 $scope.orderdata = {}; 11 $scope.orderdata = {};
12 $scope.showLoader = false; 12 $scope.showLoader = false;
13 $scope.jetShow = []; 13 $scope.jetShow = [];
14 $scope.marginShow = []; 14 $scope.marginShow = [];
15 15
16 $scope.jetShow[0] = true; 16 $scope.jetShow[0] = true;
17 $scope.marginShow[0] = true; 17 $scope.marginShow[0] = true;
18 18
19 $scope.data = {}; 19 $scope.data = {};
20 $scope.order = {}; 20 $scope.order = {};
21 $scope.dispatchOrder = {}; 21 $scope.dispatchOrder = {};
22 $scope.dispatchOrder.fuelOrderList = []; 22 $scope.dispatchOrder.fuelOrderList = [];
23 $scope.defaultStatus = ''; 23 $scope.defaultStatus = '';
24 $scope.statusFilterOptions = []; 24 $scope.statusFilterOptions = [];
25 $scope.statusFilterOptions.push({ 25 $scope.statusFilterOptions.push({
26 'id': '', 'title': 'Show All' 26 'id': '', 'title': 'Show All'
27 },{ 27 },{
28 'id': 'pending', 'title': 'Pending' 28 'id': 'pending', 'title': 'Pending'
29 },{ 29 },{
30 'id': 'invoiced', 'title': 'Invoiced' 30 'id': 'invoiced', 'title': 'Invoiced'
31 },{ 31 },{
32 'id': 'paid', 'title': 'Paid' 32 'id': 'paid', 'title': 'Paid'
33 },{ 33 },{
34 'id': 'cancelled', 'title': 'Cancelled' 34 'id': 'cancelled', 'title': 'Cancelled'
35 },{ 35 },{
36 'id': 'archived', 'title': 'Archived' 36 'id': 'archived', 'title': 'Archived'
37 } 37 }
38 38
39 ); 39 );
40 40
41 if($stateParams.status =="paid"){ 41 if($stateParams.status =="paid"){
42 $scope.defaultStatus = "paid"; 42 $scope.defaultStatus = "paid";
43 } 43 }
44 44
45 getAllCompanies(); 45 getAllCompanies();
46 46
47 function getAllCompanies(){ 47 function getAllCompanies(){
48 fuelOrdersService.getAllCompanies().then(function(result) { 48 fuelOrdersService.getAllCompanies().then(function(result) {
49 $scope.companyList = result; 49 $scope.companyList = result;
50 for (var i = 0; i < $scope.companyList.length; i++) { 50 for (var i = 0; i < $scope.companyList.length; i++) {
51 if ($scope.companyList[i].companyContact != null) { 51 if ($scope.companyList[i].companyContact != null) {
52 if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) { 52 if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) {
53 $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber; 53 $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber;
54 } 54 }
55 } 55 }
56 if ($scope.companyList[i].primaryContact != null) { 56 if ($scope.companyList[i].primaryContact != null) {
57 if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) { 57 if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) {
58 $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName; 58 $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName;
59 } 59 }
60 } 60 }
61 if ($scope.companyList[i].margin != null) { 61 if ($scope.companyList[i].margin != null) {
62 if ($scope.companyList[i].margin.marginName != null) { 62 if ($scope.companyList[i].margin.marginName != null) {
63 $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id; 63 $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id;
64 } 64 }
65 } 65 }
66 } 66 }
67 $scope.displayCompanyList = new NgTableParams({ 67 $scope.displayCompanyList = new NgTableParams({
68 page: 1, 68 page: 1,
69 count: 10, 69 count: 10,
70 }, { 70 }, {
71 data: $scope.companyList 71 data: $scope.companyList
72 }); 72 });
73 $scope.showLoader = false; 73 $scope.showLoader = false;
74 }) 74 })
75 } 75 }
76 76
77 77
78 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')) 78 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'))
79 $scope.reset2 = function(){ 79 $scope.reset2 = function(){
80 $("input").val(""); 80 $("input").val("");
81 $scope.removeMarginValidation(); 81 $scope.removeMarginValidation();
82 } 82 }
83 83
84 function colourFunction() { 84 function colourFunction() {
85 var myselect = document.getElementById('colorfulSelectbox'), 85 var myselect = document.getElementById('colorfulSelectbox'),
86 colour = myselect.options[myselect.selectedIndex].className; 86 colour = myselect.options[myselect.selectedIndex].className;
87 myselect.style.background = colour; 87 myselect.style.background = colour;
88 myselect.blur(); 88 myselect.blur();
89 } 89 }
90 90
91 91
92 /*setInterval(function(){ 92 /*setInterval(function(){
93 colourFunction(); 93 colourFunction();
94 }, 1)*/ 94 }, 1)*/
95 95
96 96
97 $scope.attachmentFilterOptions = []; 97 $scope.attachmentFilterOptions = [];
98 $scope.attachmentFilterOptions.push({ 98 $scope.attachmentFilterOptions.push({
99 'id': '', 'title': 'Show All' 99 'id': '', 'title': 'Show All'
100 },{ 100 },{
101 'id': '!null', 'title': 'Attachments' 101 'id': '!null', 'title': 'Attachments'
102 },{ 102 },{
103 'id': 'null', 'title': 'No Attachments' 103 'id': 'null', 'title': 'No Attachments'
104 } 104 }
105 ); 105 );
106 106
107 // $(document).ready(function() { 107 // $(document).ready(function() {
108 // $scope.showLoader = true; 108 // $scope.showLoader = true;
109 // $('#example').DataTable(); 109 // $('#example').DataTable();
110 // $scope.showLoader = false; 110 // $scope.showLoader = false;
111 // }); 111 // });
112 112
113 $scope.getOrders = function() { 113 $scope.getOrders = function() {
114 fuelOrdersService.getOrders().then(function(result) { 114 fuelOrdersService.getOrders().then(function(result) {
115 $scope.orderdata = result; 115 $scope.orderdata = result;
116 for(var i=0 ; i < $scope.orderdata.length ; i++){ 116 for(var i=0 ; i < $scope.orderdata.length ; i++){
117 $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate); 117 $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate);
118 $scope.orderdata[i].departingDateS = new Date($scope.orderdata[i].departingDate); 118 $scope.orderdata[i].departingDateS = new Date($scope.orderdata[i].departingDate);
119 119
120 var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear(); 120 var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear();
121 var departingStr = "" + ($scope.orderdata[i].departingDateS.getMonth() + 1) + "/" + $scope.orderdata[i].departingDateS.getDate() + "/" + $scope.orderdata[i].departingDateS.getFullYear(); 121 var departingStr = "" + ($scope.orderdata[i].departingDateS.getMonth() + 1) + "/" + $scope.orderdata[i].departingDateS.getDate() + "/" + $scope.orderdata[i].departingDateS.getFullYear();
122 $scope.orderdata[i].upliftDateString = str; 122 $scope.orderdata[i].upliftDateString = str;
123 $scope.orderdata[i].departingDateString = departingStr; 123 $scope.orderdata[i].departingDateString = departingStr;
124 //not working in input type Time 124 //not working in input type Time
125 /*if ($scope.orderdata[i].etaTime != null) { 125 /*if ($scope.orderdata[i].etaTime != null) {
126 var now = new Date(); 126 var now = new Date();
127 127
128 var hr = $scope.orderdata[i].etaTime.slice(0, 2); 128 var hr = $scope.orderdata[i].etaTime.slice(0, 2);
129 var mm = $scope.orderdata[i].etaTime.slice(3, 5); 129 var mm = $scope.orderdata[i].etaTime.slice(3, 5);
130 now.setHours(hr); 130 now.setHours(hr);
131 now.setMinutes(mm); 131 now.setMinutes(mm);
132 $scope.orderdata[i].etaTime = now; 132 $scope.orderdata[i].etaTime = now;
133 console.log("===eta====", now, hr, mm); 133 console.log("===eta====", now, hr, mm);
134 }*/ 134 }*/
135 135
136 } 136 }
137 137
138 $scope.displayFuelOrderList = new NgTableParams({ 138 $scope.displayFuelOrderList = new NgTableParams({
139 page: 1, 139 page: 1,
140 count: 10, 140 count: 10,
141 }, { 141 }, {
142 data: $scope.orderdata 142 data: $scope.orderdata
143 }); 143 });
144 $(document).ready(function(){ 144 $(document).ready(function(){
145 function changeSelectboxBg(){ 145 function changeSelectboxBg(){
146 setInterval(function(){ 146 setInterval(function(){
147 if ($('.table select').is(':focus')) { 147 if ($('.table select').is(':focus')) {
148 148
149 }else{ 149 }else{
150 var myselect = document.getElementsByClassName('colorfulSelectbox'); 150 var myselect = document.getElementsByClassName('colorfulSelectbox');
151 151
152 for (var i = 0; i < myselect.length; i++) { 152 for (var i = 0; i < myselect.length; i++) {
153 var colourIndex = $(myselect[i]).prop('selectedIndex'); 153 var colourIndex = $(myselect[i]).prop('selectedIndex');
154 colourIndex = colourIndex + 1; 154 colourIndex = colourIndex + 1;
155 var getColor = $('.colorfulSelectbox option:nth-child('+colourIndex+')').css('color'); 155 var getColor = $('.colorfulSelectbox option:nth-child('+colourIndex+')').css('color');
156 $(myselect[i]).css('background-color', getColor); 156 $(myselect[i]).css('background-color', getColor);
157 myselect[i].blur(); 157 myselect[i].blur();
158 } 158 }
159 } 159 }
160 }, 1000) 160 }, 1000)
161 } 161 }
162 changeSelectboxBg(); 162 changeSelectboxBg();
163 163
164 /*$('.pagination , .recordCountSelect').click(function(){ 164 /*$('.pagination , .recordCountSelect').click(function(){
165 changeSelectboxBg(); 165 changeSelectboxBg();
166 }) 166 })
167 $('.input-filter').keydown(function(){ 167 $('.input-filter').keydown(function(){
168 console.log('function..........'); 168 console.log('function..........');
169 changeSelectboxBg(); 169 changeSelectboxBg();
170 })*/ 170 })*/
171 }) 171 })
172 }) 172 })
173 } 173 }
174 174
175 $scope.getOrders(); 175 $scope.getOrders();
176 $scope.optionSelected=''; 176 $scope.optionSelected='';
177 $scope.onFWSelect = function() { 177 $scope.onFWSelect = function() {
178 if($scope.optionSelected == 'dt'){ 178 if($scope.optionSelected == 'dt'){
179 $('#demo-modal-4').css('display', 'block'); 179 $('#demo-modal-4').css('display', 'block');
180 $scope.optionSelected=''; 180 $scope.optionSelected='';
181 181
182 } 182 }
183 if($scope.optionSelected == 'efo'){ 183 if($scope.optionSelected == 'efo'){
184 $scope.showLoader = true; 184 $scope.showLoader = true;
185 var fileName = "orders.csv"; 185 var fileName = "orders.csv";
186 var a = document.createElement("a"); 186 var a = document.createElement("a");
187 document.body.appendChild(a); 187 document.body.appendChild(a);
188 fuelOrdersService.exportCompany().then(function(result) { 188 fuelOrdersService.exportCompany().then(function(result) {
189 var file = new Blob([result], {type: 'application/csv'}); 189 var file = new Blob([result], {type: 'application/csv'});
190 var fileURL = URL.createObjectURL(file); 190 var fileURL = URL.createObjectURL(file);
191 a.href = fileURL; 191 a.href = fileURL;
192 a.download = fileName; 192 a.download = fileName;
193 a.click(); 193 a.click();
194 $scope.showLoader = false; 194 $scope.showLoader = false;
195 $scope.optionSelected=''; 195 $scope.optionSelected='';
196 }) 196 })
197 } 197 }
198 } 198 }
199 $scope.attachmentrowid = "" 199 $scope.attachmentrowid = ""
200 200
201 201
202 $scope.attachment = function(id, value, url) { 202 $scope.attachment = function(id, value, url) {
203 $scope.attachmentrowid = id 203 $scope.attachmentrowid = id
204 if(value == 'uploadAttachment'){ 204 if(value == 'uploadAttachment'){
205 $('#demo-modal-6').css('display', 'block'); 205 $('#demo-modal-6').css('display', 'block');
206 }else if(value == 'viewAttachment'){ 206 }else if(value == 'viewAttachment'){
207 var win = window.open(url, '_blank'); 207 var win = window.open(url, '_blank');
208 win.focus(); 208 win.focus();
209 }else if(value == 'deleteAttachment'){ 209 }else if(value == 'deleteAttachment'){
210 $('#delete1').css('display', 'block'); 210 $('#delete1').css('display', 'block');
211 } 211 }
212 } 212 }
213 213
214 $scope.cancelDeleteAttachment = function() { 214 $scope.cancelDeleteAttachment = function() {
215 $('#delete1').css('display', ''); 215 $('#delete1').css('display', '');
216 } 216 }
217 217
218 $scope.deleteAttachment = function() { 218 $scope.deleteAttachment = function() {
219 $scope.showLoader = true; 219 $scope.showLoader = true;
220 fuelOrdersService.deleteAttachment($scope.attachmentrowid).then(function(result) { 220 fuelOrdersService.deleteAttachment($scope.attachmentrowid).then(function(result) {
221 221
222 if(result.success){ 222 if(result.success){
223 toastr.success(''+result.success+'', { 223 toastr.success(''+result.success+'', {
224 closeButton: true 224 closeButton: true
225 }) 225 })
226 } 226 }
227 }) 227 })
228 $scope.showLoader = false; 228 $scope.showLoader = false;
229 $('#delete1').css('display', ''); 229 $('#delete1').css('display', '');
230 } 230 }
231 231
232 $scope.saveUploadAttachment = function(attachmentData) { 232 $scope.saveUploadAttachment = function(attachmentData) {
233 $scope.showLoader = true; 233 $scope.showLoader = true;
234 $scope.data.media = attachmentData 234 $scope.data.media = attachmentData
235 $scope.data.id = $scope.attachmentrowid 235 $scope.data.id = $scope.attachmentrowid
236 fuelOrdersService.uploadAttachment($scope.data).then(function(result) { 236 fuelOrdersService.uploadAttachment($scope.data).then(function(result) {
237 if(result){ 237 if(result){
238 toastr.success(''+"Upload Successful"+'', { 238 toastr.success(''+"Upload Successful"+'', {
239 closeButton: true 239 closeButton: true
240 }) 240 })
241 } 241 }
242 242
243 }) 243 })
244 $scope.showLoader = false; 244 $scope.showLoader = false;
245 $('#demo-modal-6').css('display', 'none'); 245 $('#demo-modal-6').css('display', 'none');
246 } 246 }
247 247
248 $scope.cancelUploadAttachment = function() { 248 $scope.cancelUploadAttachment = function() {
249 $('#demo-modal-6').css('display', 'none'); 249 $('#demo-modal-6').css('display', 'none');
250 } 250 }
251 251
252 $scope.editdata = {}; 252 $scope.editdata = {};
253 253
254 254
255 $scope.editTableRow = function(rowData){ 255 $scope.editTableRow = function(rowData){
256 //console.log('row data', rowData); 256 //console.log('row data', rowData);
257 $scope.editdata = rowData; 257 $scope.editdata = rowData;
258 $('#demo-modal-5').css('display', 'block'); 258 $('#demo-modal-5').css('display', 'block');
259 } 259 }
260 260
261 $scope.updateTotal = function(value, valueOf){ 261 $scope.updateTotal = function(value, valueOf){
262 if(valueOf == 'v'){ 262 if(valueOf == 'v'){
263 $scope.editdata.total = value * $scope.editdata.invoiced 263 $scope.editdata.total = value * $scope.editdata.invoiced
264 }else if(valueOf == 'i'){ 264 }else if(valueOf == 'i'){
265 $scope.editdata.total = $scope.editdata.requestedVolume * value 265 $scope.editdata.total = $scope.editdata.requestedVolume * value
266 } 266 }
267 } 267 }
268 268
269 $scope.setCost = function(cost){ 269 $scope.setCost = function(cost){
270 if(cost != null) { 270 if(cost != null) {
271 var obj =JSON.parse(cost); 271 var obj =JSON.parse(cost);
272 $scope.order.fboCost = obj.cost; 272 $scope.order.fboCost = obj.cost;
273 } 273 }
274 274
275 } 275 }
276 276
277 $scope.addTotal = function(value, valueOf) { 277 $scope.addTotal = function(value, valueOf) {
278 if (value != undefined && valueOf != undefined) { 278 if (value != undefined && valueOf != undefined) {
279 value = JSON.parse(value) 279 value = JSON.parse(value)
280 $scope.order.total = Math.abs(value.papTotal) * valueOf; 280 $scope.order.total = Math.abs(value.papTotal) * valueOf;
281 } 281 }
282 } 282 }
283 283
284 $scope.addFuelData = function() { 284 $scope.addFuelData = function() {
285 $scope.showLoader = true; 285 $scope.showLoader = true;
286 $scope.fuelData = {}; 286 $scope.fuelData = {};
287 $scope.fuelData.companyId = $scope.selectedCompanyId; 287 $scope.fuelData.companyId = $scope.selectedCompanyId;
288 288
289 $scope.fuelData.companyName = $scope.order.companyName; 289 $scope.fuelData.companyName = $scope.order.companyName;
290 var aircraftObj =JSON.parse($scope.order.aircraftName); 290 var aircraftObj =JSON.parse($scope.order.aircraftName);
291 $scope.fuelData.aircraftName = aircraftObj.tail; 291 $scope.fuelData.aircraftName = aircraftObj.tail;
292 $scope.fuelData.make = aircraftObj.make; 292 $scope.fuelData.make = aircraftObj.make;
293 $scope.fuelData.model = aircraftObj.model; 293 $scope.fuelData.model = aircraftObj.model;
294 $scope.fuelData.fuelOn = $scope.order.fuelOn; 294 $scope.fuelData.fuelOn = $scope.order.fuelOn;
295 $scope.fuelData.invoiced = $scope.order.invoiced; 295 $scope.fuelData.invoiced = $scope.order.invoiced;
296 $scope.fuelData.volume = $scope.order.volume; 296 $scope.fuelData.volume = $scope.order.volume;
297 // $scope.fuelData.source = $scope.order.source; 297 // $scope.fuelData.source = $scope.order.source;
298 298
299 $scope.fuelData.total = $scope.order.total; 299 $scope.fuelData.total = $scope.order.total;
300 //tier no use 300 //tier no use
301 $scope.fuelData.tierBreak = $scope.order.tierBreak; 301 $scope.fuelData.tierBreak = $scope.order.tierBreak;
302 302
303 var obj =JSON.parse($scope.order.priceQuote); 303 var obj =JSON.parse($scope.order.priceQuote);
304 $scope.fuelData.priceQuote = obj.papTotal; 304 $scope.fuelData.priceQuote = obj.papTotal;
305 $scope.fuelData.fboCost = obj.cost; 305 $scope.fuelData.fboCost = obj.cost;
306 $scope.fuelData.productName = obj.productName; 306 $scope.fuelData.productName = obj.productName;
307 307
308 $scope.fuelData.etaTime = $scope.order.etaTime; 308 $scope.fuelData.etaTime = $scope.order.etaTime;
309 $scope.fuelData.etdTime = $scope.order.etdTime; 309 $scope.fuelData.etdTime = $scope.order.etdTime;
310 $scope.fuelData.certificateType = $scope.order.certificateType; 310 $scope.fuelData.certificateType = $scope.order.certificateType;
311 var currentDate = new Date(); 311 var currentDate = new Date();
312 var hours = currentDate.getHours(); 312 var hours = currentDate.getHours();
313 var min = currentDate.getMinutes(); 313 var min = currentDate.getMinutes();
314 var sec = currentDate.getSeconds(); 314 var sec = currentDate.getSeconds();
315 if ($scope.order.upliftDate != '') { 315 if ($scope.order.upliftDate != '') {
316 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec; 316 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec;
317 $scope.order.upliftDate = new Date($scope.order.upliftDate); 317 $scope.order.upliftDate = new Date($scope.order.upliftDate);
318 $scope.fuelData.upliftDate = $scope.order.upliftDate.getTime(); 318 $scope.fuelData.upliftDate = $scope.order.upliftDate.getTime();
319 } 319 }
320 320
321 321
322 if ($scope.order.departingDate != '') { 322 if ($scope.order.departingDate != '') {
323 $scope.order.departingDate = $scope.order.departingDate + ' ' + hours + ':' + min + ':' + sec; 323 $scope.order.departingDate = $scope.order.departingDate + ' ' + hours + ':' + min + ':' + sec;
324 $scope.order.departingDate = new Date($scope.order.departingDate); 324 $scope.order.departingDate = new Date($scope.order.departingDate);
325 $scope.fuelData.departingDate = $scope.order.departingDate.getTime(); 325 $scope.fuelData.departingDate = $scope.order.departingDate.getTime();
326 } 326 }
327 327
328 if($scope.order.status === null || $scope.order.status === undefined){ 328 if($scope.order.status === null || $scope.order.status === undefined){
329 329
330 $scope.fuelData.status = "pending"; //default status 330 $scope.fuelData.status = "pending"; //default status
331 331
332 }else { 332 }else {
333 333
334 $scope.fuelData.status = $scope.order.status; 334 $scope.fuelData.status = $scope.order.status;
335 } 335 }
336 336
337 if($scope.baseTenant && $scope.contractFuelVendor ){ 337 if($scope.baseTenant && $scope.contractFuelVendor ){
338 $scope.fuelData.source = "Tenant/CAA" ; 338 $scope.fuelData.source = "Tenant/CAA" ;
339 }else if($scope.baseTenant) 339 }else if($scope.baseTenant)
340 { 340 {
341 $scope.fuelData.source = "Tenant/Base Customer"; 341 $scope.fuelData.source = "Tenant/Base Customer";
342 }else if($scope.contractFuelVendor){ 342 }else if($scope.contractFuelVendor){
343 $scope.fuelData.source = "CAA Member"; 343 $scope.fuelData.source = "CAA Member";
344 } 344 }
345 345
346 $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); 346 $scope.dispatchOrder.fuelOrderList.push($scope.fuelData);
347 // console.log("=====$scope.fueldata======",$scope.fuelData) 347 // console.log("=====$scope.fueldata======",$scope.fuelData)
348 fuelOrdersService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { 348 fuelOrdersService.dispathFuelOrder($scope.dispatchOrder).then(function(result) {
349 $scope.showLoader = false; 349 $scope.showLoader = false;
350 $scope.order = {}; 350 $scope.order = {};
351 $scope.dispatchOrder.fuelOrderList = []; 351 $scope.dispatchOrder.fuelOrderList = [];
352 $('#demo-modal-4').css('display', ''); 352 $('#demo-modal-4').css('display', '');
353 $scope.getOrders(); 353 $scope.getOrders();
354 toastr.success('Fuel Order Dispatched Successfully', { 354 toastr.success('Fuel Order Dispatched Successfully', {
355 closeButton: true 355 closeButton: true
356 }) 356 })
357 }) 357 })
358 358
359 359
360 } 360 }
361 361
362 $scope.updateStatus = function(row, status) { 362 $scope.updateStatus = function(row, status) {
363 363
364 $scope.showLoader = true; 364 $scope.showLoader = true;
365 $scope.fuelData = {}; 365 $scope.fuelData = {};
366 $scope.fuelData.aircraftName = row.aircraftName 366 $scope.fuelData.aircraftName = row.aircraftName
367 $scope.fuelData.companyName = row.companyName 367 $scope.fuelData.companyName = row.companyName
368 $scope.fuelData.departingDate = row.departingDate 368 $scope.fuelData.departingDate = row.departingDate
369 $scope.fuelData.fboCost = row.fboCost 369 $scope.fuelData.fboCost = row.fboCost
370 $scope.fuelData.id = row.id 370 $scope.fuelData.id = row.id
371 $scope.fuelData.invoiced = row.invoiced 371 $scope.fuelData.invoiced = row.invoiced
372 $scope.fuelData.priceQuote = row.priceQuote 372 $scope.fuelData.priceQuote = row.priceQuote
373 $scope.fuelData.volume = row.requestedVolume 373 $scope.fuelData.volume = row.requestedVolume
374 $scope.fuelData.source = row.source 374 $scope.fuelData.source = row.source
375 $scope.fuelData.status = status 375 $scope.fuelData.status = status
376 $scope.fuelData.tierBreak = row.tierBreak 376 $scope.fuelData.tierBreak = row.tierBreak
377 $scope.fuelData.total = row.total 377 $scope.fuelData.total = row.total
378 $scope.fuelData.upliftDate = row.upliftDate 378 $scope.fuelData.upliftDate = row.upliftDate
379 379
380 $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); 380 $scope.dispatchOrder.fuelOrderList.push($scope.fuelData);
381 fuelOrdersService.updateFuelOrder($scope.dispatchOrder).then(function(result) { 381 fuelOrdersService.updateFuelOrder($scope.dispatchOrder).then(function(result) {
382 $scope.showLoader = false; 382 $scope.showLoader = false;
383 $scope.editdata = {}; 383 $scope.editdata = {};
384 $scope.fuelData = {}; 384 $scope.fuelData = {};
385 $scope.dispatchOrder.fuelOrderList = []; 385 $scope.dispatchOrder.fuelOrderList = [];
386 $('#demo-modal-5').css('display', ''); 386 $('#demo-modal-5').css('display', '');
387 $scope.getOrders(); 387 $scope.getOrders();
388 toastr.success('Fuel Order Updated Successfully', { 388 toastr.success('Fuel Order Updated Successfully', {
389 closeButton: true 389 closeButton: true
390 }); 390 });
391 }) 391 })
392 392
393 } 393 }
394 $scope.fuelData = {}; 394 $scope.fuelData = {};
395 $scope.updateData = function() { 395 $scope.updateData = function() {
396 if($scope.editdata.etaTime != null && $scope.editdata.etdTime != null){ 396 if($scope.editdata.etaTime != null && $scope.editdata.etdTime != null){
397 if($scope.editdata.fuelOn != null || $scope.editdata.fuelOn != undefined) { 397 if($scope.editdata.fuelOn != null || $scope.editdata.fuelOn != undefined) {
398 $scope.showLoader = true; 398 $scope.showLoader = true;
399 $scope.fuelData.aircraftName = $scope.editdata.aircraftName; 399 $scope.fuelData.aircraftName = $scope.editdata.aircraftName;
400 $scope.fuelData.companyName = $scope.editdata.companyName; 400 $scope.fuelData.companyName = $scope.editdata.companyName;
401 $scope.fuelData.fboCost = $scope.editdata.fboCost; 401 $scope.fuelData.fboCost = $scope.editdata.fboCost;
402 $scope.fuelData.id = $scope.editdata.id; 402 $scope.fuelData.id = $scope.editdata.id;
403 $scope.fuelData.invoiced = $scope.editdata.invoiced; 403 $scope.fuelData.invoiced = $scope.editdata.invoiced;
404 $scope.fuelData.priceQuote = $scope.editdata.priceQuote; 404 $scope.fuelData.priceQuote = $scope.editdata.priceQuote;
405 $scope.fuelData.volume = $scope.editdata.requestedVolume; 405 $scope.fuelData.volume = $scope.editdata.requestedVolume;
406 $scope.fuelData.source = $scope.editdata.source; 406 $scope.fuelData.source = $scope.editdata.source;
407 $scope.fuelData.status = $scope.editdata.status; 407 $scope.fuelData.status = $scope.editdata.status;
408 $scope.fuelData.tierBreak = $scope.editdata.tierBreak; 408 $scope.fuelData.tierBreak = $scope.editdata.tierBreak;
409 $scope.fuelData.total = $scope.editdata.total; 409 $scope.fuelData.total = $scope.editdata.total;
410 410
411 var currentDate = new Date(); 411 var currentDate = new Date();
412 var hours = currentDate.getHours(); 412 var hours = currentDate.getHours();
413 var min = currentDate.getMinutes(); 413 var min = currentDate.getMinutes();
414 var sec = currentDate.getSeconds(); 414 var sec = currentDate.getSeconds();
415 $scope.editdata.upliftDateString = $scope.editdata.upliftDateString + ' ' + hours + ':' + min + ':' + sec; 415 $scope.editdata.upliftDateString = $scope.editdata.upliftDateString + ' ' + hours + ':' + min + ':' + sec;
416 $scope.editdata.upliftDateString = new Date($scope.editdata.upliftDateString); 416 $scope.editdata.upliftDateString = new Date($scope.editdata.upliftDateString);
417 $scope.editdata.upliftDateString = $scope.editdata.upliftDateString.getTime(); 417 $scope.editdata.upliftDateString = $scope.editdata.upliftDateString.getTime();
418 418
419 $scope.editdata.departingDateString = $scope.editdata.departingDateString + ' ' + hours + ':' + min + ':' + sec; 419 $scope.editdata.departingDateString = $scope.editdata.departingDateString + ' ' + hours + ':' + min + ':' + sec;
420 $scope.editdata.departingDateString = new Date($scope.editdata.departingDateString); 420 $scope.editdata.departingDateString = new Date($scope.editdata.departingDateString);
421 $scope.editdata.departingDateString = $scope.editdata.departingDateString.getTime(); 421 $scope.editdata.departingDateString = $scope.editdata.departingDateString.getTime();
422 422
423 $scope.fuelData.upliftDate = $scope.editdata.upliftDateString; 423 $scope.fuelData.upliftDate = $scope.editdata.upliftDateString;
424 $scope.fuelData.departingDate = $scope.editdata.departingDateString; 424 $scope.fuelData.departingDate = $scope.editdata.departingDateString;
425 $scope.fuelData.productName = $scope.editdata.productName; 425 $scope.fuelData.productName = $scope.editdata.productName;
426 /*$scope.fuelData.etaTime = $scope.editdata.etaTime.toLocaleTimeString(); 426 /*$scope.fuelData.etaTime = $scope.editdata.etaTime.toLocaleTimeString();
427 $scope.fuelData.etdTime = $scope.editdata.etdTime.toLocaleTimeString();*/ 427 $scope.fuelData.etdTime = $scope.editdata.etdTime.toLocaleTimeString();*/
428 $scope.fuelData.etaTime = $scope.editdata.etaTime; 428 $scope.fuelData.etaTime = $scope.editdata.etaTime;
429 $scope.fuelData.etdTime = $scope.editdata.etdTime; 429 $scope.fuelData.etdTime = $scope.editdata.etdTime;
430 $scope.fuelData.certificateType = $scope.editdata.certificateType; 430 $scope.fuelData.certificateType = $scope.editdata.certificateType;
431 $scope.fuelData.fuelOn = $scope.editdata.fuelOn; 431 $scope.fuelData.fuelOn = $scope.editdata.fuelOn;
432 432
433 $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); 433 $scope.dispatchOrder.fuelOrderList.push($scope.fuelData);
434 console.log("====fueldata===",$scope.dispatchOrder);
435 fuelOrdersService.updateFuelOrder($scope.dispatchOrder).then(function(result) { 434 fuelOrdersService.updateFuelOrder($scope.dispatchOrder).then(function(result) {
436 // console.log('result', result);
437 $scope.showLoader = false; 435 $scope.showLoader = false;
438 $scope.editdata = {}; 436 $scope.editdata = {};
439 $('#demo-modal-5').css('display', ''); 437 $('#demo-modal-5').css('display', '');
440 $scope.getOrders(); 438 $scope.getOrders();
441 toastr.success('Fuel Order Updated Successfully', { 439 toastr.success('Fuel Order Updated Successfully', {
442 closeButton: true 440 closeButton: true
443 }) 441 })
444 }) 442 })
445 443
446 444
447 } else{ 445 } else{
448 { 446 {
449 toastr.error('Please select fuelOn.', { 447 toastr.error('Please select fuelOn.', {
450 closeButton: true 448 closeButton: true
451 }) 449 })
452 } 450 }
453 } 451 }
454 452
455 }else 453 }else
456 { 454 {
457 toastr.error('Please select Arrival Time and Departure time both.', { 455 toastr.error('Please select Arrival Time and Departure time both.', {
458 closeButton: true 456 closeButton: true
459 }) 457 })
460 } 458 }
461 459
462 } 460 }
463 461
464 $scope.getAircraft = function(company){ 462 $scope.getAircraft = function(company){
465 463
466 $scope.selectedCompanyName = company; 464 $scope.selectedCompanyName = company;
467 //$scope.showLoader = true; 465 //$scope.showLoader = true;
468 for (var i = 0; i < $scope.companyList.length; i++) { 466 for (var i = 0; i < $scope.companyList.length; i++) {
469 if ($scope.companyList[i].companyName == company) { 467 if ($scope.companyList[i].companyName == company) {
470 $scope.order.certificateType = $scope.companyList[i].certificateType; 468 $scope.order.certificateType = $scope.companyList[i].certificateType;
471 $scope.baseTenant = $scope.companyList[i].baseTenant; 469 $scope.baseTenant = $scope.companyList[i].baseTenant;
472 $scope.contractFuelVendor = $scope.companyList[i].contractFuelVendor; 470 $scope.contractFuelVendor = $scope.companyList[i].contractFuelVendor;
473 $scope.fuelerlinxCustomer = $scope.companyList[i].fuelerlinxCustomer; 471 $scope.fuelerlinxCustomer = $scope.companyList[i].fuelerlinxCustomer;
474 472
475 if($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null){ 473 if($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null){
476 fuelOrdersService.getFuelCost($scope.companyList[i].id).then(function(margins) { 474 fuelOrdersService.getFuelCost($scope.companyList[i].id).then(function(margins) {
477 $scope.marginList = margins; 475 $scope.marginList = margins;
478 }) 476 })
479 } else if ($scope.companyList[i].margin != null || $scope.companyList[i].marginAVGAS == null) { 477 } else if ($scope.companyList[i].margin != null || $scope.companyList[i].marginAVGAS == null) {
480 fuelOrdersService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) { 478 fuelOrdersService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) {
481 $scope.marginList = margins; 479 $scope.marginList = margins;
482 }) 480 })
483 } else if ($scope.companyList[i].margin == null || $scope.companyList[i].marginAVGAS != null) { 481 } else if ($scope.companyList[i].margin == null || $scope.companyList[i].marginAVGAS != null) {
484 fuelOrdersService.getVTypeFuelPricing($scope.companyList[i].id).then(function(margins) { 482 fuelOrdersService.getVTypeFuelPricing($scope.companyList[i].id).then(function(margins) {
485 $scope.marginList = margins; 483 $scope.marginList = margins;
486 }) 484 })
487 } 485 }
488 $scope.selectedCompanyId = $scope.companyList[i].id; 486 $scope.selectedCompanyId = $scope.companyList[i].id;
489 $scope.marginId = $scope.companyList[i].margin.id; 487 $scope.marginId = $scope.companyList[i].margin.id;
490 if ($scope.selectedCompanyId != '') { 488 if ($scope.selectedCompanyId != '') {
491 fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) { 489 fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) {
492 $scope.aircraftList = aircraft; 490 $scope.aircraftList = aircraft;
493 }) 491 })
494 } 492 }
495 if ($scope.marginId != '') { 493 if ($scope.marginId != '') {
496 fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) { 494 fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) {
497 $scope.tierList = tiers; 495 $scope.tierList = tiers;
498 // $scope.showLoader = false; 496 // $scope.showLoader = false;
499 }) 497 })
500 }else{ 498 }else{
501 // $scope.showLoader = false; 499 // $scope.showLoader = false;
502 } 500 }
503 } 501 }
504 } 502 }
505 503
506 } 504 }
507 505
508 506
509 507
510 $scope.cancelData = function() { 508 $scope.cancelData = function() {
511 $('#demo-modal-4').css('display', ''); 509 $('#demo-modal-4').css('display', '');
512 } 510 }
513 $scope.canceleditdata = function() { 511 $scope.canceleditdata = function() {
514 $('#demo-modal-5').css('display', ''); 512 $('#demo-modal-5').css('display', '');
515 } 513 }
516 514
517 515
518 516
519 $scope.companyList = {}; 517 $scope.companyList = {};
520 518
521 fuelOrdersService.getAllCompanies().then(function(result) { 519 fuelOrdersService.getAllCompanies().then(function(result) {
522 $scope.showLoader = true; 520 $scope.showLoader = true;
523 $scope.companyList = result; 521 $scope.companyList = result;
524 $scope.showLoader = false; 522 $scope.showLoader = false;
525 }) 523 })
526 524
527 /*Add a company services API used from customersService */ 525 /*Add a company services API used from customersService */
528 getCompanyName(); 526 getCompanyName();
529 function getCompanyName(){ 527 function getCompanyName(){
530 CustomersService.getCompanyName().then(function(result) { 528 CustomersService.getCompanyName().then(function(result) {
531 $scope.showLoader = true; 529 $scope.showLoader = true;
532 $scope.compNameList = result; 530 $scope.compNameList = result;
533 $scope.showLoader = false; 531 $scope.showLoader = false;
534 }) 532 })
535 } 533 }
536 534
537 $scope.marginFilterOptions = []; 535 $scope.marginFilterOptions = [];
538 CustomersService.getJetMargin($scope.userProfileId).then(function(result) { 536 CustomersService.getJetMargin($scope.userProfileId).then(function(result) {
539 $scope.showLoader = true; 537 $scope.showLoader = true;
540 $scope.jetMarginList = result; 538 $scope.jetMarginList = result;
541 $scope.marginFilterOptions.push({ 539 $scope.marginFilterOptions.push({
542 'id': '', 'title': 'Show All' 540 'id': '', 'title': 'Show All'
543 }); 541 });
544 for (var i = 0; i < result.length; i++) { 542 for (var i = 0; i < result.length; i++) {
545 $scope.marginFilterOptions.push({ 543 $scope.marginFilterOptions.push({
546 'id': result[i].id, 544 'id': result[i].id,
547 'title': result[i].marginName 545 'title': result[i].marginName
548 }) 546 })
549 } 547 }
550 $scope.showLoader = false; 548 $scope.showLoader = false;
551 }) 549 })
552 550
553 CustomersService.getAvgMargin($scope.userProfileId).then(function(result) { 551 CustomersService.getAvgMargin($scope.userProfileId).then(function(result) {
554 $scope.avgsMarginList = result; 552 $scope.avgsMarginList = result;
555 }) 553 })
556 554
557 $scope.showCompanyError = false; 555 $scope.showCompanyError = false;
558 $scope.showMarginError = false; 556 $scope.showMarginError = false;
559 557
560 $scope.removeValidation = function(){ 558 $scope.removeValidation = function(){
561 $scope.showCompanyError = false; 559 $scope.showCompanyError = false;
562 $('.companyNameInput').removeClass('customErrorInput'); 560 $('.companyNameInput').removeClass('customErrorInput');
563 if($scope.data.companyName == 'undefined' || $scope.data.companyName == '') { 561 if($scope.data.companyName == 'undefined' || $scope.data.companyName == '') {
564 $('.companyNameInput').addClass('customErrorInput'); 562 $('.companyNameInput').addClass('customErrorInput');
565 $scope.showCompanyError = true; 563 $scope.showCompanyError = true;
566 } 564 }
567 } 565 }
568 566
569 $scope.removeMarginValidation = function(){ 567 $scope.removeMarginValidation = function(){
570 $scope.showMarginError = false; 568 $scope.showMarginError = false;
571 $('.marginSelectBox').removeClass('customErrorInput'); 569 $('.marginSelectBox').removeClass('customErrorInput');
572 } 570 }
573 571
574 getData(); 572 getData();
575 function getData(){ 573 function getData(){
576 $scope.showLoader = true; 574 $scope.showLoader = true;
577 CustomersService.getAircraftMake().then(function(result) { 575 CustomersService.getAircraftMake().then(function(result) {
578 $scope.aircraftMakeList = result; 576 $scope.aircraftMakeList = result;
579 $scope.showLoader = false; 577 $scope.showLoader = false;
580 }) 578 })
581 } 579 }
582 var companyData; 580 var companyData;
583 $scope.addFirstData = function(sel, step){ 581 $scope.addFirstData = function(sel, step){
584 $scope.showLoader = true; 582 $scope.showLoader = true;
585 if($scope.data.companyName == undefined){ 583 if($scope.data.companyName == undefined){
586 $scope.showCompanyError = true; 584 $scope.showCompanyError = true;
587 $('.companyNameInput').addClass('customErrorInput'); 585 $('.companyNameInput').addClass('customErrorInput');
588 }else if($scope.data.masterMargin == undefined){ 586 }else if($scope.data.masterMargin == undefined){
589 $scope.showMarginError = true; 587 $scope.showMarginError = true;
590 $('.marginSelectBox').addClass('customErrorInput'); 588 $('.marginSelectBox').addClass('customErrorInput');
591 }else{ 589 }else{
592 $scope.aircraftDetails = [{ 590 $scope.aircraftDetails = [{
593 'tail':'', 591 'tail':'',
594 'make': '', 592 'make': '',
595 'model': '', 593 'model': '',
596 'sizeId' : '', 594 'sizeId' : '',
597 'marginId': $scope.data.masterMargin, 595 'marginId': $scope.data.masterMargin,
598 'avgasMarginId': $scope.data.avgasMargin 596 'avgasMarginId': $scope.data.avgasMargin
599 }]; 597 }];
600 598
601 $(sel).trigger('next.m.' + step); 599 $(sel).trigger('next.m.' + step);
602 getData(); 600 getData();
603 } 601 }
604 $scope.showLoader = false; 602 $scope.showLoader = false;
605 } 603 }
606 $scope.addNew = function(){ 604 $scope.addNew = function(){
607 $scope.showLoader = true; 605 $scope.showLoader = true;
608 $scope.aircraftDetails.push({ 606 $scope.aircraftDetails.push({
609 'tail':'', 607 'tail':'',
610 'make': '', 608 'make': '',
611 'model': '', 609 'model': '',
612 'sizeId' : '', 610 'sizeId' : '',
613 'marginId': $scope.data.masterMargin, 611 'marginId': $scope.data.masterMargin,
614 'avgasMarginId': $scope.data.avgasMargin 612 'avgasMarginId': $scope.data.avgasMargin
615 }); 613 });
616 $scope.showLoader = false; 614 $scope.showLoader = false;
617 }; 615 };
618 616
619 $scope.aircraft = {}; 617 $scope.aircraft = {};
620 $scope.getModal = function(makeId, index){ 618 $scope.getModal = function(makeId, index){
621 $scope.showLoader = true; 619 $scope.showLoader = true;
622 $scope.aircraft.make = makeId; 620 $scope.aircraft.make = makeId;
623 CustomersService.getModal($scope.aircraft.make).then(function(result) { 621 CustomersService.getModal($scope.aircraft.make).then(function(result) {
624 $scope.showLoader = false; 622 $scope.showLoader = false;
625 $scope.aircraftDetails[index].aircraftModalList = result; 623 $scope.aircraftDetails[index].aircraftModalList = result;
626 //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0]; 624 //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0];
627 }) 625 })
628 } 626 }
629 627
630 $scope.getSize = function(model, index){ 628 $scope.getSize = function(model, index){
631 $scope.showLoader = true; 629 $scope.showLoader = true;
632 CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { 630 CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) {
633 $scope.showLoader = false; 631 $scope.showLoader = false;
634 $scope.aircraftDetails[index].aircraftSizeList = result; 632 $scope.aircraftDetails[index].aircraftSizeList = result;
635 //$scope.aircraftDetails[index].size = $scope.aircraftSizeList[0]; 633 //$scope.aircraftDetails[index].size = $scope.aircraftSizeList[0];
636 }) 634 })
637 } 635 }
638 636
639 $scope.aircraftListData = {}; 637 $scope.aircraftListData = {};
640 $scope.addData = []; 638 $scope.addData = [];
641 639
642 $scope.saveCompanyData = function(){ 640 $scope.saveCompanyData = function(){
643 CustomersService.addCompany($scope.data).then(function(result) { 641 CustomersService.addCompany($scope.data).then(function(result) {
644 $scope.accountId = result; 642 $scope.accountId = result;
645 $scope.aircraft.accountId = $scope.accountId; 643 $scope.aircraft.accountId = $scope.accountId;
646 644
647 for(var i=0; i<$scope.aircraftDetails.length;i++){ 645 for(var i=0; i<$scope.aircraftDetails.length;i++){
648 $scope.addData.push({ 646 $scope.addData.push({
649 'tail': $scope.aircraftDetails[i].tail, 647 'tail': $scope.aircraftDetails[i].tail,
650 'make': $scope.aircraftDetails[i].make, 648 'make': $scope.aircraftDetails[i].make,
651 'model': $scope.aircraftDetails[i].model, 649 'model': $scope.aircraftDetails[i].model,
652 'sizeId' : $scope.aircraftDetails[i].sizeId, 650 'sizeId' : $scope.aircraftDetails[i].sizeId,
653 'marginId': $scope.aircraftDetails[i].marginId, 651 'marginId': $scope.aircraftDetails[i].marginId,
654 'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId 652 'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId
655 }); 653 });
656 } 654 }
657 $scope.aircraftListData.aircraftList = $scope.addData; 655 $scope.aircraftListData.aircraftList = $scope.addData;
658 $scope.aircraftListData.accountId = $scope.aircraft.accountId; 656 $scope.aircraftListData.accountId = $scope.aircraft.accountId;
659 657
660 if($scope.aircraftListData.aircraftList[0].tail == "" || $scope.aircraftListData.aircraftList[0].make == null || $scope.aircraftListData.aircraftList[0].model == null){ 658 if($scope.aircraftListData.aircraftList[0].tail == "" || $scope.aircraftListData.aircraftList[0].make == null || $scope.aircraftListData.aircraftList[0].model == null){
661 $scope.aircraftListData.aircraftList = []; 659 $scope.aircraftListData.aircraftList = [];
662 } 660 }
663 661
664 CustomersService.addAircraft($scope.aircraftListData).then(function(result) { 662 CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
665 663
666 if(result != null && result.success){ 664 if(result != null && result.success){
667 toastr.success(''+result.success+'', { 665 toastr.success(''+result.success+'', {
668 closeButton: true 666 closeButton: true
669 }) 667 })
670 $('#demo-modal-3').modal('hide'); 668 $('#demo-modal-3').modal('hide');
671 getAllCompanies(); 669 getAllCompanies();
672 }else{ 670 }else{
673 toastr.error(''+result.statusText+'', { 671 toastr.error(''+result.statusText+'', {
674 closeButton: true 672 closeButton: true
675 }) 673 })
676 } 674 }
677 }); 675 });
678 676
679 }) 677 })
680 678
681 679
682 } 680 }
683 681
684 $scope.checkJetWithTail = function(tail, index){ 682 $scope.checkJetWithTail = function(tail, index){
685 683
686 ViewCompanyService.checkJetType(tail).then(function(result) { 684 ViewCompanyService.checkJetType(tail).then(function(result) {
687 if(result.jetA == "true"){ 685 if(result.jetA == "true"){
688 $scope.jetShow[index] = false; 686 $scope.jetShow[index] = false;
689 $scope.marginShow[index] = true; 687 $scope.marginShow[index] = true;
690 }else{ 688 }else{
691 $scope.jetShow[index] = true; 689 $scope.jetShow[index] = true;
692 $scope.marginShow[index] = false; 690 $scope.marginShow[index] = false;
693 } 691 }
694 }) 692 })
695 } 693 }
696 694
697 $scope.etaTimeList=[]; 695 $scope.etaTimeList=[];
698 $scope.etdTimeList =[]; 696 $scope.etdTimeList =[];
699 697
700 $scope.sourceList = [{source:"Direct Jet-A"},{source:"Direct AVGAS 100LL"}]; 698 $scope.sourceList = [{source:"Direct Jet-A"},{source:"Direct AVGAS 100LL"}];
701 $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"}, 699 $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"},
702 {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"}, 700 {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"},
703 {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"}, 701 {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"},
704 {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"}, 702 {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"},
705 {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"}, 703 {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"},
706 {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"},]; 704 {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"},];
707 705
708 $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"}, 706 $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"},
709 {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"}, 707 {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"},
710 {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"}, 708 {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"},
711 {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"}, 709 {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"},
712 {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"}, 710 {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"},
713 {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"},]; 711 {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"},];
714 712
715 $scope.data = {}; 713 $scope.data = {};
716 714
717 715
718 716
719 } 717 }