Commit 6d8b1f26cefcc0534a536b89c59df5f916d873b9

Authored by Kuldeep Arora
1 parent bb8754ed9e
Exists in master

minor

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