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){
a82cc73f8   Kuldeep Arora   sorted list
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){
52fea957f   Anchit Jindal   csv and search co...
107
              	$scope.showLoader = false;
3a9f4472b   Rishav   Implement contact...
108
109
110
111
                  toastr.success(''+result.success+'', {
                    closeButton: true
                  })
                }else{
52fea957f   Anchit Jindal   csv and search co...
112
              	$scope.showLoader = false;
3a9f4472b   Rishav   Implement contact...
113
114
115
116
117
118
                  toastr.error(''+result.statusText+'', {
                    closeButton: true
                  })
                }
              })
          }
4bb02bb84   Rishav   new integration w...
119
120
          getData();
      	function getData(){
05bfa28a2   Mr. Hot Foods   remove save butto...
121
  			$scope.showLoader = true;
4bb02bb84   Rishav   new integration w...
122
  			CustomersService.getAircraftMake().then(function(result) {
4bb02bb84   Rishav   new integration w...
123
  			  $scope.aircraftMakeList = result;
05bfa28a2   Mr. Hot Foods   remove save butto...
124
  			  $scope.showLoader = false;
4bb02bb84   Rishav   new integration w...
125
126
  			})
  		}
3a9f4472b   Rishav   Implement contact...
127
        	
a7a7cfeca   Rishav Singla   fuel vendor page ...
128
129
130
131
132
133
  
  		// CustomersService.getMargin().then(function(result) {
  		//   $scope.marginList = result;
  		// })
  		$scope.marginFilterOptions = [];
  		CustomersService.getJetMargin($scope.userProfileId).then(function(result) {
9aae3d136   Mr. Hot Foods   show loaders and ...
134
  			$scope.showLoader = true;
07328f442   Rishav Singla   new code added fo...
135
  			$scope.jetMarginList = result;
676250262   Kuldeep Arora   enhancement fuel ...
136
  			//console.log("jet margin",result,$scope.userProfileId)
07328f442   Rishav Singla   new code added fo...
137
138
139
140
141
142
143
144
145
146
  			$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 ...
147
  		})
c95befcd3   Swarn Singh   table issue, filt...
148

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

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

6efd9a0a8   Anchit Jindal   new desing changes
255
256
257
258
259
260
261
262
263
264
265
266
      	        	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...
267
      	        
6efd9a0a8   Anchit Jindal   new desing changes
268
269
            	})
        		
55e075d7e   Rishav   add contact, add ...
270
271
  	        
        	}
676250262   Kuldeep Arora   enhancement fuel ...
272
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
        	/*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 ...
439
440
441
442
443
  	    // $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...
444

67044e31e   Rishav Singla   modify changes an...
445
  	    $scope.setFuel = function(){
676250262   Kuldeep Arora   enhancement fuel ...
446
447
448
  	    	 $('#demo-modal-4').css('display', 'block');
  	    //	event.stopPropagation();
  	    //	$state.go('app.updateFuelManager');
67044e31e   Rishav Singla   modify changes an...
449
  	    }
eefc1c74d   Swarn Singh   minor updates
450
  	    /*  ng table  */
52fea957f   Anchit Jindal   csv and search co...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
  	    
  	    $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
466
467
468
  	    getCompanyName();
  	    function getCompanyName(){
  	        CustomersService.getCompanyName().then(function(result) {
a9aef0b1c   Anchit Jindal   new changes imple...
469
  	        	$scope.compNameList = result;
676250262   Kuldeep Arora   enhancement fuel ...
470
  	        	//console.log("kd",result)
a9aef0b1c   Anchit Jindal   new changes imple...
471
472
  	        })
        	}
eefc1c74d   Swarn Singh   minor updates
473

c2f3d77be   Rishav Singla   check with tail i...
474
        	$scope.checkJetWithTail = function(tail, index){
a82cc73f8   Kuldeep Arora   sorted list
475
            //console.log("tail==============",tail, index)
c2f3d77be   Rishav Singla   check with tail i...
476
            ViewCompanyService.checkJetType(tail).then(function(result) {
a82cc73f8   Kuldeep Arora   sorted list
477
              //console.log("result",result)
c2f3d77be   Rishav Singla   check with tail i...
478
479
480
481
482
483
484
485
486
              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...
487
488
  
      }