Blame view

app/partials/customers/customers.controller.js 18.5 KB
feacde5ff   Rishav   setup acuefuel in...
1
2
3
4
  'use strict';
  
   //Load controller
    angular.module('acufuel')
676250262   Kuldeep Arora   enhancement fuel ...
5
  	.controller('customersController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', '$state', 'CustomersService', 'ViewCompanyService', 'NgTableParams','fuelOrdersService', customersController]);
feacde5ff   Rishav   setup acuefuel in...
6

676250262   Kuldeep Arora   enhancement fuel ...
7
   	function customersController($scope, $rootScope, $uibModal, $filter, $http, $state, CustomersService, ViewCompanyService, NgTableParams,fuelOrdersService) {
4bb02bb84   Rishav   new integration w...
8
  		$(document).ready(function() {
05bfa28a2   Mr. Hot Foods   remove save butto...
9
  		    // $('#example').DataTable();
4bb02bb84   Rishav   new integration w...
10
  		});
a7a7cfeca   Rishav Singla   fuel vendor page ...
11
  		$scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'))
7152ff131   Rishav   model handle
12
13
  		$scope.reset2 = function(){
  			$("input").val("");
49676befb   Anchit Jindal   new changes applied
14
  			$scope.removeMarginValidation();
7152ff131   Rishav   model handle
15
  		}
05bfa28a2   Mr. Hot Foods   remove save butto...
16

7152ff131   Rishav   model handle
17
  		
4bb02bb84   Rishav   new integration w...
18
19
20
  		$scope.data = {};
  		$scope.aircraft = {};
  		$scope.data.activate = true;
05bfa28a2   Mr. Hot Foods   remove save butto...
21
  		$scope.showLoader = true;
c2f3d77be   Rishav Singla   check with tail i...
22
23
24
25
26
  		$scope.jetShow = [];
          $scope.marginShow = [];
  
          $scope.jetShow[0] = true;
          $scope.marginShow[0] = true;
676250262   Kuldeep Arora   enhancement fuel ...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
          $scope.dispatchOrder = {};
          $scope.dispatchOrder.fuelOrderList = [];
          $scope.statusFilterOptions = [];
          $scope.companyList = {};
          $scope.statusFilterOptions.push({
  		  	'id': '', 'title': 'Show All'
  		  },{
  		  	'id': 'pending', 'title': 'Pending'
  		  },{
  		  	'id': 'invoiced', 'title': 'Invoiced'
  		  },{
  		  	'id': 'paid', 'title': 'Paid'
  		  },{
  		  	'id': 'cancelled', 'title': 'Cancelled'
  		  },{
  		  	'id': 'archived', 'title': 'Archived'
  		  }
       
        );
c2f3d77be   Rishav Singla   check with tail i...
46
          
b6f0311a3   Rishav   get Company api i...
47
  		getAllCompanies();
eefc1c74d   Swarn Singh   minor updates
48
  		/*function getAllCompanies(){
b6f0311a3   Rishav   get Company api i...
49
  			CustomersService.getAllCompanies().then(function(result) {
b6f0311a3   Rishav   get Company api i...
50
  				$scope.companyList = result;
3a9f4472b   Rishav   Implement contact...
51
52
53
  				for(var i=0; i<$scope.companyList.length; i++){
  					$scope.companyList[i].masterMargin = $scope.companyList[i].margin.id;
  				}
b6f0311a3   Rishav   get Company api i...
54
  			})
eefc1c74d   Swarn Singh   minor updates
55
56
57
58
59
60
61
62
  
  		}*/
  
  		$scope.statusFilter = [
  			{id: "", title: "Show All"},
  			{id: "true", title: "Active"},
  			{id: "false", title: "Inactive"}
  		]
b97bc56e0   Swarn Singh   table search and ...
63
64
  		function getAllCompanies(){
  			CustomersService.getAllCompanies().then(function(result) {
a82cc73f8   Kuldeep Arora   sorted list
65
  				//console.log('log', result);
b97bc56e0   Swarn Singh   table search and ...
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  				$scope.companyList = result;
  				for (var i = 0; i < $scope.companyList.length; i++) {
  					if ($scope.companyList[i].companyContact != null) {
  						if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) {
  							$scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber;
  						}
  					}
  					if ($scope.companyList[i].primaryContact != null) {
  						if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) {
  							$scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName;
  						}
  					}
  					if ($scope.companyList[i].margin != null) {
  						if ($scope.companyList[i].margin.marginName != null) {
  							$scope.companyList[i].masterMargin = $scope.companyList[i].margin.id;
  						}
  					}
  				}
  				$scope.displayCompanyList = new NgTableParams({
  		        page: 1,
  		        count: 10,
  		      }, {
  		        data: $scope.companyList
  		      });
05bfa28a2   Mr. Hot Foods   remove save butto...
90
  			  $scope.showLoader = false;
b97bc56e0   Swarn Singh   table search and ...
91
  			})
b6f0311a3   Rishav   get Company api i...
92
  		}
feacde5ff   Rishav   setup acuefuel in...
93

3a9f4472b   Rishav   Implement contact...
94
          $scope.editMargin = function(customer){
f49ed758a   Kuldeep Arora   marginsetting fixed
95
          	console.log('customer', customer);
52fea957f   Anchit Jindal   csv and search co...
96
          	$scope.showLoader = true;
d24318592   Rishav   changes and new i...
97
          	event.stopPropagation();
3a9f4472b   Rishav   Implement contact...
98
99
100
101
102
103
104
  
          	var companyMargin = "companyName=" + customer.companyName + "&masterMargin=" + customer.masterMargin 
                + "&addressOne=" + customer.addressOne + "&addressTwo=" + customer.addressTwo + "&city=" + customer.city + "&state=" 
                + customer.state + "&country=" + customer.country + "&zipcode=" + customer.zipcode + "&internalNote=" 
                + customer.internalNote + "&certificateType=" + customer.certificateType + "&baseTenant=" + customer.baseTenant
                + "&fuelerlinxCustomer=" + customer.fuelerlinxCustomer + "&contractFuelVendor=" + customer.contractFuelVendor 
                + "&activate=" + customer.activate + "&baseIcao=" + customer.baseIcao + "&companyId=" + customer.id;
cdf775224   Anchit Jindal   fixed company and...
105
          	ViewCompanyService.updateCompany(companyMargin).then(function(result) {
3a9f4472b   Rishav   Implement contact...
106
                if(result != null && result.success){
fb35aa6c4   Kuldeep Arora   marginsetting
107
              	  $scope.showLoader = false;
3a9f4472b   Rishav   Implement contact...
108
109
110
                  toastr.success(''+result.success+'', {
                    closeButton: true
                  })
fb35aa6c4   Kuldeep Arora   marginsetting
111
                    getAllCompanies();
3a9f4472b   Rishav   Implement contact...
112
                }else{
52fea957f   Anchit Jindal   csv and search co...
113
              	$scope.showLoader = false;
3a9f4472b   Rishav   Implement contact...
114
115
116
117
118
119
                  toastr.error(''+result.statusText+'', {
                    closeButton: true
                  })
                }
              })
          }
4bb02bb84   Rishav   new integration w...
120
121
          getData();
      	function getData(){
05bfa28a2   Mr. Hot Foods   remove save butto...
122
  			$scope.showLoader = true;
4bb02bb84   Rishav   new integration w...
123
  			CustomersService.getAircraftMake().then(function(result) {
4bb02bb84   Rishav   new integration w...
124
  			  $scope.aircraftMakeList = result;
05bfa28a2   Mr. Hot Foods   remove save butto...
125
  			  $scope.showLoader = false;
4bb02bb84   Rishav   new integration w...
126
127
  			})
  		}
3a9f4472b   Rishav   Implement contact...
128
        	
a7a7cfeca   Rishav Singla   fuel vendor page ...
129
130
131
132
133
134
  
  		// CustomersService.getMargin().then(function(result) {
  		//   $scope.marginList = result;
  		// })
  		$scope.marginFilterOptions = [];
  		CustomersService.getJetMargin($scope.userProfileId).then(function(result) {
9aae3d136   Mr. Hot Foods   show loaders and ...
135
  			$scope.showLoader = true;
07328f442   Rishav Singla   new code added fo...
136
  			$scope.jetMarginList = result;
676250262   Kuldeep Arora   enhancement fuel ...
137
  			//console.log("jet margin",result,$scope.userProfileId)
07328f442   Rishav Singla   new code added fo...
138
139
140
141
142
143
144
145
146
147
  			$scope.marginFilterOptions.push({
  				'id': '', 'title': 'Show All'
  			});
  			for (var i = 0; i < result.length; i++) {
  				$scope.marginFilterOptions.push({
  					'id': result[i].id,
  					'title': result[i].marginName
  				})
  			}
  		  	$scope.showLoader = false;
a7a7cfeca   Rishav Singla   fuel vendor page ...
148
  		})
c95befcd3   Swarn Singh   table issue, filt...
149

a7a7cfeca   Rishav Singla   fuel vendor page ...
150
151
  		CustomersService.getAvgMargin($scope.userProfileId).then(function(result) {
  		  $scope.avgsMarginList = result;
676250262   Kuldeep Arora   enhancement fuel ...
152
  		 // console.log('avgsMarginList',result)
3a9f4472b   Rishav   Implement contact...
153
  		})
a7a7cfeca   Rishav Singla   fuel vendor page ...
154

32286a73a   Swarn Singh   tier issue resolved
155
156
157
158
  		$scope.showCompanyError = false;
  		$scope.showMarginError = false;
  
  		$scope.removeValidation = function(){
32286a73a   Swarn Singh   tier issue resolved
159
160
  			$scope.showCompanyError = false;
  	    	$('.companyNameInput').removeClass('customErrorInput');
5e7aae2d2   Anchit Jindal   new changes
161
162
163
164
  	    	if($scope.data.companyName == 'undefined' || $scope.data.companyName == '') {
  	    		$('.companyNameInput').addClass('customErrorInput');
  	    		$scope.showCompanyError = true;
  	    	}
32286a73a   Swarn Singh   tier issue resolved
165
166
167
168
169
170
  		}
  
  		$scope.removeMarginValidation = function(){
  			$scope.showMarginError = false;
  	    	$('.marginSelectBox').removeClass('customErrorInput');
  		}
6efd9a0a8   Anchit Jindal   new desing changes
171
172
  		
  		var companyData;
4bb02bb84   Rishav   new integration w...
173
  	    $scope.addFirstData = function(sel, step){
9aae3d136   Mr. Hot Foods   show loaders and ...
174
  			$scope.showLoader = true;
3a9f4472b   Rishav   Implement contact...
175
  	    	if($scope.data.companyName == undefined){
32286a73a   Swarn Singh   tier issue resolved
176
177
  	    		$scope.showCompanyError = true;
  	    		$('.companyNameInput').addClass('customErrorInput');
3a9f4472b   Rishav   Implement contact...
178
  	    	}else if($scope.data.masterMargin == undefined){
32286a73a   Swarn Singh   tier issue resolved
179
180
  	    		$scope.showMarginError = true;
  	    		$('.marginSelectBox').addClass('customErrorInput');
3a9f4472b   Rishav   Implement contact...
181
  	    	}else{
cdf775224   Anchit Jindal   fixed company and...
182
183
184
185
186
187
188
189
190
  	    		$scope.aircraftDetails = [{ 
  	                'tail':'',
  	                'make': '',
  	                'model': '',
  	                'sizeId' : '',
  	                'marginId': $scope.data.masterMargin,
  	                'avgasMarginId': $scope.data.avgasMargin
  	            }];
  	    	    
3a9f4472b   Rishav   Implement contact...
191
192
193
  	    	 	$(sel).trigger('next.m.' + step);
  	    	 	getData();
  	    	}
9aae3d136   Mr. Hot Foods   show loaders and ...
194
  			$scope.showLoader = false;
4bb02bb84   Rishav   new integration w...
195
  	    }
55e075d7e   Rishav   add contact, add ...
196
          $scope.addNew = function(){
9aae3d136   Mr. Hot Foods   show loaders and ...
197
  			$scope.showLoader = true;
55e075d7e   Rishav   add contact, add ...
198
199
200
201
              $scope.aircraftDetails.push({ 
                  'tail':'',
  	            'make': '',
  	            'model': '',
3a9f4472b   Rishav   Implement contact...
202
  	            'sizeId' : '',
a7a7cfeca   Rishav Singla   fuel vendor page ...
203
204
  	            'marginId': $scope.data.masterMargin,
              	'avgasMarginId': $scope.data.avgasMargin
55e075d7e   Rishav   add contact, add ...
205
              });
9aae3d136   Mr. Hot Foods   show loaders and ...
206
  			$scope.showLoader = false;
55e075d7e   Rishav   add contact, add ...
207
208
209
          };
  
          $scope.getModal = function(makeId, index){
d24318592   Rishav   changes and new i...
210
          	$scope.showLoader = true;
676250262   Kuldeep Arora   enhancement fuel ...
211
          	//console.log(makeId)
55e075d7e   Rishav   add contact, add ...
212
213
214
  	  		$scope.aircraft.make = makeId;
  	        //var makeId = makeId;
  	        CustomersService.getModal($scope.aircraft.make).then(function(result) {
d24318592   Rishav   changes and new i...
215
  	        	$scope.showLoader = false;
55e075d7e   Rishav   add contact, add ...
216
217
218
219
  	          $scope.aircraftDetails[index].aircraftModalList = result;
  	          //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0];
  	        })
        	}
676250262   Kuldeep Arora   enhancement fuel ...
220
        
55e075d7e   Rishav   add contact, add ...
221
        	$scope.getSize = function(model, index){
d24318592   Rishav   changes and new i...
222
        		$scope.showLoader = true;
55e075d7e   Rishav   add contact, add ...
223
  	        CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) {
d24318592   Rishav   changes and new i...
224
  	        	$scope.showLoader = false;
7152ff131   Rishav   model handle
225
  	          	$scope.aircraftDetails[index].aircraftSizeList = result;
676250262   Kuldeep Arora   enhancement fuel ...
226
  	           
55e075d7e   Rishav   add contact, add ...
227
228
  	        })
        	}
676250262   Kuldeep Arora   enhancement fuel ...
229
        	 
55e075d7e   Rishav   add contact, add ...
230
231
232
        	$scope.aircraftListData = {};
        	$scope.addData = [];
        	$scope.saveCompanyData = function(){
cdf775224   Anchit Jindal   fixed company and...
233
        		CustomersService.addCompany($scope.data).then(function(result) {
6efd9a0a8   Anchit Jindal   new desing changes
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
              	$scope.accountId = result;
        			$scope.aircraft.accountId = $scope.accountId;
        			
        			for(var i=0; i<$scope.aircraftDetails.length;i++){
            			$scope.addData.push({ 
      	                'tail': $scope.aircraftDetails[i].tail,
      		            'make': $scope.aircraftDetails[i].make,
      		            'model': $scope.aircraftDetails[i].model,
      		            'sizeId' : $scope.aircraftDetails[i].sizeId,
      		            'marginId': $scope.aircraftDetails[i].marginId,
      		            'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId
      	            });
            		}
      	        $scope.aircraftListData.aircraftList = $scope.addData;
      	        $scope.aircraftListData.accountId = $scope.aircraft.accountId;
      	        
cdf775224   Anchit Jindal   fixed company and...
250
251
252
253
      	        if($scope.aircraftListData.aircraftList[0].tail == "" || $scope.aircraftListData.aircraftList[0].make == null || $scope.aircraftListData.aircraftList[0].model == null){
      	        	$scope.aircraftListData.aircraftList = [];
      	        }
      	        
6efd9a0a8   Anchit Jindal   new desing changes
254
      	        CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
b6f0311a3   Rishav   get Company api i...
255

6efd9a0a8   Anchit Jindal   new desing changes
256
257
258
259
260
261
262
263
264
265
266
267
      	        	if(result != null && result.success){
      	        		toastr.success(''+result.success+'', {
      		            	closeButton: true
      		          	})
      		          	$('#demo-modal-3').modal('hide');
      		          	getAllCompanies();
      	        	}else{
      	        		toastr.error(''+result.statusText+'', {
      		            	closeButton: true
      		          	})
      	        	}
      	        });
cdf775224   Anchit Jindal   fixed company and...
268
      	        
6efd9a0a8   Anchit Jindal   new desing changes
269
270
            	})
        		
55e075d7e   Rishav   add contact, add ...
271
272
  	        
        	}
676250262   Kuldeep Arora   enhancement fuel ...
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
        	/*add a fuel order*/
        	
  
       $scope.getOrders = function() {
            fuelOrdersService.getOrders().then(function(result) {
             
              $scope.orderdata = result;
              for(var i=0;i<$scope.orderdata.length;i++){
                  $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate);
  
                  // var str = "" + $scope.orderdata[i].upliftDateS.getDate() + "/" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getFullYear()
                  var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear()
                  //  str = str.slice(4,16)
                  $scope.orderdata[i].upliftDateString = str
                 // console.log(str);
  
              }
             
               $scope.displayFuelOrderList = new NgTableParams({
                page: 1,
                count: 10,
              }, {
                data: $scope.orderdata
              });
              $(document).ready(function(){
                var myselect = document.getElementsByClassName('colorfulSelectbox');
  
                for (var i = 0; i < myselect.length; i++) {
                  var colourIndex = $(myselect[i]).prop('selectedIndex');
                  colourIndex = colourIndex + 1;
                 // console.log(colourIndex);
                  var getColor = $('.colorfulSelectbox option:nth-child('+colourIndex+')').css('color');
                  $(myselect[i]).css('background-color', getColor);
                 // console.log('colour', getColor);
                  myselect[i].blur();
                }
  
              })
             
            })
       }
       
       $scope.getOrders();
  
      $scope.addFuelData = function() {
      	 $scope.showLoader = true;
  
       if ($scope.order.priceQuote === null || $scope.order.priceQuote == '') {
           //  console.log("valid");
             $scope.showLoader = false;
             toastr.error('Please select Company and Price Quote.', {
                closeButton: true
              })
       }else{
  
        if ($scope.order.upliftDate != '') {
            $scope.order.upliftDate = new Date($scope.order.upliftDate);
            $scope.order.upliftDate = $scope.order.upliftDate.getTime();
          }
          if ($scope.order.departingDate != '') {
            $scope.order.departingDate = new Date($scope.order.departingDate);
            $scope.order.departingDate = $scope.order.departingDate.getTime();
          }
         // console.log($scope.order.quotePrice);
          var obj =JSON.parse($scope.order.priceQuote);
         // console.log('obj.papMargin',obj.papMargin);
          $scope.order.priceQuote = obj.papMargin;
  
          $scope.fuelData = {};
          $scope.fuelData.aircraftName = $scope.order.aircraftName 
          $scope.fuelData.companyName = $scope.order.companyName 
          $scope.fuelData.departingDate = $scope.order.departingDate 
          $scope.fuelData.fboCost = $scope.order.fboCost 
          $scope.fuelData.id = $scope.order.id 
          $scope.fuelData.invoiced = $scope.order.invoiced 
          $scope.fuelData.priceQuote = $scope.order.priceQuote 
          $scope.fuelData.volume = $scope.order.volume 
          $scope.fuelData.source = $scope.order.source 
          $scope.fuelData.status = $scope.order.status 
          $scope.fuelData.tierBreak = $scope.order.tierBreak 
          $scope.fuelData.total = $scope.order.total 
          $scope.fuelData.upliftDate = $scope.order.upliftDate 
          $scope.fuelData.companyId = $scope.selectedCompanyId;
            
        
        
        $scope.dispatchOrder.fuelOrderList.push($scope.fuelData);
      //  console.log('$scope.order', $scope.dispatchOrder);
        fuelOrdersService.dispathFuelOrder($scope.dispatchOrder).then(function(result) {
          //console.log("fuel data---",$scope.fuelData)
          //console.log("oder data",$scope.dispatchOrder)
          //console.log('result', result);
          $scope.showLoader = false;
          $scope.order = {};
          $('#demo-modal-4').css('display', '');
          $scope.getOrders();
          toastr.success('Fuel Order Dispatched Successfully', {
                  closeButton: true
                })
        })
  
       }
     }
  
     	$scope.addTotal = function(value, valueOf){
        if(valueOf == 'v'){
          $scope.order.total = value * $scope.order.invoiced
        }else if(valueOf == 'i'){
          $scope.order.total = $scope.order.volume * value 
        }
      } 
  
      $scope.getAircraft = function(company){
  
        $scope.selectedCompanyName = company;
        //$scope.showLoader = true;
      //  console.log("id",company)
        for (var i = 0; i < $scope.companyList.length; i++) {
          if ($scope.companyList[i].companyName == company) {
            if($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null){
              fuelOrdersService.getFuelCost($scope.companyList[i].id).then(function(margins) {
                $scope.marginList = margins;
                //console.log('$scope.marginList', $scope.marginList);
              })
            } else if ($scope.companyList[i].margin != null || $scope.companyList[i].marginAVGAS == null) {
              fuelOrdersService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) {
                $scope.marginList = margins;
                  })
            } else if ($scope.companyList[i].margin == null || $scope.companyList[i].marginAVGAS != null) {
              fuelOrdersService.getVTypeFuelPricing($scope.companyList[i].id).then(function(margins) {
                    $scope.marginList = margins;
                  })
            }
            $scope.selectedCompanyId = $scope.companyList[i].id;
            $scope.marginId = $scope.companyList[i].margin.id;
            if ($scope.selectedCompanyId != '') {
              fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) {
                $scope.aircraftList = aircraft;
              })
            }
            if ($scope.marginId != '') {
              fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) {
                        $scope.tierList = tiers;
          //              $scope.showLoader = false;
                    })
            }else{
            //  $scope.showLoader = false;
            }
          }
        }
  
      }
  
       $scope.setCost = function(cost){
  	    //  console.log(cost);
  	      if(cost != null) {
  	        var obj =JSON.parse(cost);
           // console.log("0bj",obj)
  	        $scope.order.fboCost = obj.cost;
  	      }
  	        
  	    }
  
       $scope.sourceList = [{source:"Direct Jet-A"},{source:"Direct AVGAS 100LL"}];
       $scope.cancelData = function() {
              $('#demo-modal-4').css('display', '');
        }
55e075d7e   Rishav   add contact, add ...
440
441
442
443
444
  	    // $scope.appendText = function() {
       //      getData();
  	    //   var newRow =  $('<tr> <td> <input type="text" style="width:100px;" ng-model="aircraft.tail" class="form-control"> </td> <td style="width: 25%;"> <select class="form-control" ng-model="aircraft.make" ng-change="getModal()"> <option ng-repeat="make in aircraftMakeList">{{make}}</option> </select> </td> <td style="width: 20%;"> <select class="form-control" ng-model="aircraft.model" ng-change="getSize()"> <option ng-repeat="model in aircraftModalList">{{model}}</option> </select> </td> <td style="width: 25%;"> <select class="form-control" ng-model="aircraft.size"> <option ng-repeat="size in aircraftSizeList">{{size}}</option> </select> </td> <td> <select class="form-control"> <option>Margin1</option> <option>Margin2</option> </select> </td> </tr>');  
  	    //   $('table.addRow').append(newRow);
  	    // }
4bb02bb84   Rishav   new integration w...
445

67044e31e   Rishav Singla   modify changes an...
446
  	    $scope.setFuel = function(){
676250262   Kuldeep Arora   enhancement fuel ...
447
448
449
  	    	 $('#demo-modal-4').css('display', 'block');
  	    //	event.stopPropagation();
  	    //	$state.go('app.updateFuelManager');
67044e31e   Rishav Singla   modify changes an...
450
  	    }
eefc1c74d   Swarn Singh   minor updates
451
  	    /*  ng table  */
52fea957f   Anchit Jindal   csv and search co...
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
  	    
  	    $scope.exportCompany = function() {
  	    	$scope.showLoader = true;
  	    	var fileName = "companies.csv";
  	    	var a = document.createElement("a");
  	    	document.body.appendChild(a);
  	    	 CustomersService.exportCompany().then(function(result) {
      	        var file = new Blob([result], {type: 'application/csv'});
      	        var fileURL = URL.createObjectURL(file);
      	        a.href = fileURL;
      	        a.download = fileName;
      	        a.click();
      	        $scope.showLoader = false;
  	    	 })
  	    }
5e7aae2d2   Anchit Jindal   new changes
467
468
469
  	    getCompanyName();
  	    function getCompanyName(){
  	        CustomersService.getCompanyName().then(function(result) {
a9aef0b1c   Anchit Jindal   new changes imple...
470
  	        	$scope.compNameList = result;
676250262   Kuldeep Arora   enhancement fuel ...
471
  	        	//console.log("kd",result)
a9aef0b1c   Anchit Jindal   new changes imple...
472
473
  	        })
        	}
eefc1c74d   Swarn Singh   minor updates
474

c2f3d77be   Rishav Singla   check with tail i...
475
        	$scope.checkJetWithTail = function(tail, index){
a82cc73f8   Kuldeep Arora   sorted list
476
            //console.log("tail==============",tail, index)
c2f3d77be   Rishav Singla   check with tail i...
477
            ViewCompanyService.checkJetType(tail).then(function(result) {
a82cc73f8   Kuldeep Arora   sorted list
478
              //console.log("result",result)
c2f3d77be   Rishav Singla   check with tail i...
479
480
481
482
483
484
485
486
487
              if(result.jetA == "true"){
                $scope.jetShow[index] = false;
                $scope.marginShow[index] = true;
              }else{
                $scope.jetShow[index] = true;
                $scope.marginShow[index] = false;
              }
            })
          }
4bb02bb84   Rishav   new integration w...
488
489
  
      }