Blame view

app/partials/viewCompany/viewCompany.controller.js 18.6 KB
feacde5ff   Rishav   setup acuefuel in...
1
2
3
4
5
  
  'use strict';
  
   //Load controller
    angular.module('acufuel')
da24c95c8   Rishav Singla   confirmation mess...
6
  	.controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewcontactService', function($scope , $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewcontactService) {
55e075d7e   Rishav   add contact, add ...
7
8
          $scope.data = {};
          $scope.data.priceEmail = true;
b1f6160d4   Rishav   add contact and a...
9
          $scope.aircraft = {};
3a9f4472b   Rishav   Implement contact...
10
          $scope.primayData = {};
d24318592   Rishav   changes and new i...
11
          $scope.showLoader = false;
ba1d39503   Swarn Singh   view company form...
12
          $scope.showUpdateBtn = false;
28af27a3f   Rishav   add fuelPriceapi
13
          $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'));
3a9f4472b   Rishav   Implement contact...
14

7152ff131   Rishav   model handle
15
16
17
18
19
          $(document).ready(function() {
              $("#reset").click(function() {
                  $("input").val("");
              });
          });
d1fe89776   Rishav Singla   view fuel vendor ...
20
21
22
          // CustomersService.getMargin().then(function(result) {
          //   $scope.marginList = result;
          // })
3a9f4472b   Rishav   Implement contact...
23

48ed0c7bb   Rishav   update company co...
24
          var value = "";
55e075d7e   Rishav   add contact, add ...
25
          var companyId = $stateParams.id;
a9a8f570d   Anchit Jindal   new desing implem...
26
27
28
          $scope.companyData = {};
          $scope.multipleMsg = false;
          $scope.companyData.masterMargin = "";
e9a2edf03   Rishav   update custom field
29
30
31
32
33
34
35
          getCompanyDetail();
          function getCompanyDetail(){
            ViewCompanyService.getCompany(companyId).then(function(result) {
              $scope.companyData = result;
              if(result.margin != null){
                 $scope.companyData.masterMargin = result.margin.id;
              }
a9a8f570d   Anchit Jindal   new desing implem...
36
37
38
              if(result.marginAVGAS != null){
                  $scope.companyData.avgasMargin = result.marginAVGAS.id;
               }
7ee64838c   Anchit Jindal   new desing implem...
39
              getAircraftList();
e9a2edf03   Rishav   update custom field
40
41
42
43
              $scope.showLoader = false;
            })
          }
          
55e075d7e   Rishav   add contact, add ...
44

74c8ae4bb   Rishav   remove old toogle...
45
          $scope.changeCompanyStatus = function(){
da24c95c8   Rishav Singla   confirmation mess...
46
47
48
49
50
51
52
53
54
              $('#delete3').css('display', 'block');
              if($scope.companyData.activate == true){
                $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this company?'
              }else{
                $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this company?'
              }
          }
  
          $scope.companyStatus = function(){
3a9f4472b   Rishav   Implement contact...
55
56
              var statusData = "status=" + $scope.companyData.activate;
              ViewCompanyService.changeStatus(companyId, statusData).then(function(result) {
c555af312   Rishav   price email, comp...
57
                if(result.success){
da24c95c8   Rishav Singla   confirmation mess...
58
                    $('#delete3').css('display', 'none');
c555af312   Rishav   price email, comp...
59
60
61
                    toastr.success(''+result.success+'', {
                        closeButton: true
                    })
6efd9a0a8   Anchit Jindal   new desing changes
62
                    getContactList();
c555af312   Rishav   price email, comp...
63
                }
3a9f4472b   Rishav   Implement contact...
64
              })
c555af312   Rishav   price email, comp...
65
          }
3a9f4472b   Rishav   Implement contact...
66

8670c5905   Jaideep Singh   new changes
67
          
da24c95c8   Rishav Singla   confirmation mess...
68
69
70
71
          $scope.cancelStatus = function(){
              $('#delete3').css('display', 'none');
              $scope.companyData.activate =  !$scope.companyData.activate;
          }
3a9f4472b   Rishav   Implement contact...
72
          
48ed0c7bb   Rishav   update company co...
73
74
75
76
77
78
          getContactList();
          function getContactList(){
            ViewCompanyService.getContact(companyId).then(function(result) {
              $scope.companyContactList = result;
            })
          }
a9a8f570d   Anchit Jindal   new desing implem...
79
          $scope.aircraftmargins = [];
7ee64838c   Anchit Jindal   new desing implem...
80
         
b1f6160d4   Rishav   add contact and a...
81
82
83
          function getAircraftList(){
            ViewCompanyService.getAircraft(companyId).then(function(result) {
              $scope.contactAircraftList = result;
a9a8f570d   Anchit Jindal   new desing implem...
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
              for (var i = 0; i < $scope.contactAircraftList.length; i++) {
              	if($scope.contactAircraftList[i].aircraftsMargin != null){
              		$scope.aircraftmargins.push({
              			'id': $scope.contactAircraftList[i].aircraftsMargin.id
              		})
              	}
              }
              if($scope.aircraftmargins.length > 0) {
              	for (var i = 0; i < $scope.aircraftmargins.length; i++) {
                  	if($scope.aircraftmargins[i].id != $scope.companyData.masterMargin){
                  		$scope.multiple = true;
                  		$scope.multipleMsg = true;
                          if($scope.multiple) {
                        		$scope.companyData.masterMargin = "multiple";
                          }
                  	}
                  }
              }
b1f6160d4   Rishav   add contact and a...
102
103
            })
          }
b1f6160d4   Rishav   add contact and a...
104

55e075d7e   Rishav   add contact, add ...
105
106
107
108
109
          $scope.contactData = {};
          $scope.contactData.contactList = [];
          $scope.addContact = function(){
            $scope.data.companyId = companyId;
            $scope.contactData.contactList.push($scope.data);
55e075d7e   Rishav   add contact, add ...
110
            ViewCompanyService.addContact($scope.contactData).then(function(result) {
3a9f4472b   Rishav   Implement contact...
111
112
113
114
115
              console.log(result)
              if(result.status == 200){
                  // toastr.success(''+result.success+'', {
                  //   closeButton: true
                  // })
55e075d7e   Rishav   add contact, add ...
116
                  $('#contact-modal-3').modal('hide');
3a9f4472b   Rishav   Implement contact...
117
                  $scope.primayData.id = result.data;
d1fe89776   Rishav Singla   view fuel vendor ...
118
                  $scope.data = {};
3a9f4472b   Rishav   Implement contact...
119
                  $scope.sendPrimaryContact();
48ed0c7bb   Rishav   update company co...
120
                  getContactList();
55e075d7e   Rishav   add contact, add ...
121
122
123
124
125
126
127
              }else{
                toastr.error(''+result.statusText+'', {
                    closeButton: true
                  })
              }
            })
          }
feacde5ff   Rishav   setup acuefuel in...
128

b1f6160d4   Rishav   add contact and a...
129
130
131
132
133
134
135
        getData();
        function getData(){
          CustomersService.getAircraftMake().then(function(result) {
            $scope.aircraftMakeList = result;
          })
        }
        
a4884cfe7   Rishav   add aircraft issu...
136
137
138
        $scope.clearAircrafts = function(){
          $scope.aircraftDetails = [];
          $scope.aircraftDetails = [{ 
b1f6160d4   Rishav   add contact and a...
139
140
141
              'tail':'',
              'make': '',
              'model': '',
3a9f4472b   Rishav   Implement contact...
142
              'sizeId' : '',
7ee64838c   Anchit Jindal   new desing implem...
143
144
              'marginId': '',
          	'avgasMarginId': ''
b1f6160d4   Rishav   add contact and a...
145
          }];
a4884cfe7   Rishav   add aircraft issu...
146
        }
b1f6160d4   Rishav   add contact and a...
147
      
a4884cfe7   Rishav   add aircraft issu...
148
149
150
151
152
153
        $scope.addNew = function(){
            $scope.aircraftDetails.push({ 
              'tail':'',
              'make': '',
              'model': '',
              'sizeId' : '',
7ee64838c   Anchit Jindal   new desing implem...
154
155
              'marginId': '',
          	'avgasMarginId': ''
a4884cfe7   Rishav   add aircraft issu...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
            });
            console.log($scope.aircraftDetails)
        };
  
        $scope.getModal = function(makeId, index){
        $scope.showLoader = true;
        $scope.aircraft.make = makeId;
          //var makeId = makeId;
          CustomersService.getModal($scope.aircraft.make).then(function(result) {
            $scope.showLoader = false;
            $scope.aircraftDetails[index].aircraftModalList = result;
            //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0];
          })
        }
b1f6160d4   Rishav   add contact and a...
170

a4884cfe7   Rishav   add aircraft issu...
171
        $scope.getSize = function(model, index){
d24318592   Rishav   changes and new i...
172
          $scope.showLoader = true;
a4884cfe7   Rishav   add aircraft issu...
173
174
175
176
177
178
          CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) {
            $scope.showLoader = false;
            $scope.aircraftDetails[index].aircraftSizeList = result;
            //$scope.aircraftDetails[index].size = $scope.aircraftSizeList[0];
          })
        }
b1f6160d4   Rishav   add contact and a...
179

a4884cfe7   Rishav   add aircraft issu...
180
181
182
183
184
185
186
187
188
189
        $scope.aircraftListData = {};
        //$scope.addData = [];
        $scope.saveCompanyData = function(){
          for(var i=0; i<$scope.aircraftDetails.length;i++){
            $scope.addData = [];
            $scope.addData.push({ 
                'tail': $scope.aircraftDetails[i].tail,
                'make': $scope.aircraftDetails[i].make,
                'model': $scope.aircraftDetails[i].model,
                'sizeId' : $scope.aircraftDetails[i].sizeId,
7ee64838c   Anchit Jindal   new desing implem...
190
191
                'marginId': $scope.aircraftDetails[i].marginId,
  	          'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId
a4884cfe7   Rishav   add aircraft issu...
192
              });
b1f6160d4   Rishav   add contact and a...
193
          }
a4884cfe7   Rishav   add aircraft issu...
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
          console.log($scope.addData)
          $scope.aircraftListData.aircraftList = $scope.addData;
          $scope.aircraftListData.accountId = companyId;
          
          CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
            if(result != null && result.success){
              toastr.success(''+result.success+'', {
                  closeButton: true
                })
                $('#aircraft-modal-3').modal('hide');
                getAircraftList();
            }else{
              toastr.error(''+result.statusText+'', {
                  closeButton: true
                })
b1f6160d4   Rishav   add contact and a...
209
            }
a4884cfe7   Rishav   add aircraft issu...
210
          });
b1f6160d4   Rishav   add contact and a...
211
            
a4884cfe7   Rishav   add aircraft issu...
212
213
214
215
216
217
218
219
220
221
222
223
224
        }
        $scope.showNoteData = true;
        $scope.showCompanyName = true;
        $scope.showAddress = true;
        $scope.showNote = function(){
          $scope.showNoteData = false;
          $scope.showUpdateBtn = true;
        }
  
        $scope.company = function(){
          $scope.showCompanyName = false;
          $scope.showUpdateBtn = true;
        }
7152ff131   Rishav   model handle
225
226
227
        $scope.base = function(){
          $scope.showUpdateBtn = true;
        }
a4884cfe7   Rishav   add aircraft issu...
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
        $scope.addressChange = function(){
          $scope.showAddress = false;
          $scope.showUpdateBtn = true;
        }
  
        $scope.editData = function(inputName) {
            console.log($scope.companyData)
            $scope.showLoader = true;
            /*if(inputName == 'showNoteData'){
              $scope.showNoteData = true;
            }else if(inputName == 'showCompanyName'){
              $scope.showCompanyName = true;
            }else if(inputName == 'showAddress'){
              $scope.showAddress = true;              
            }*/
            $scope.showNoteData = true;
            $scope.showCompanyName = true;
            $scope.showAddress = true;
a9a8f570d   Anchit Jindal   new desing implem...
246
            var companyData = "companyName=" + $scope.companyData.companyName + "&masterMargin=" + $scope.companyData.masterMargin + "&avgasMargin=" + $scope.companyData.avgasMargin
a4884cfe7   Rishav   add aircraft issu...
247
248
249
250
251
252
253
              + "&addressOne=" + $scope.companyData.addressOne + "&addressTwo=" + $scope.companyData.addressTwo + "&city=" + $scope.companyData.city + "&state=" 
              + $scope.companyData.state + "&country=" + $scope.companyData.country + "&zipcode=" + $scope.companyData.zipcode + "&internalNote=" 
              + $scope.companyData.internalNote + "&certificateType=" + $scope.companyData.certificateType + "&baseTenant=" + $scope.companyData.baseTenant
              + "&fuelerlinxCustomer=" + $scope.companyData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.companyData.contractFuelVendor 
              + "&activate=" + $scope.companyData.activate + "&baseIcao=" + $scope.companyData.baseIcao + "&companyId=" + companyId;
  
            ViewCompanyService.updateContact(companyData).then(function(result) {
b1f6160d4   Rishav   add contact and a...
254
255
              if(result != null && result.success){
                toastr.success(''+result.success+'', {
a4884cfe7   Rishav   add aircraft issu...
256
257
258
                  closeButton: true
                })
                $scope.showUpdateBtn = false;
b1f6160d4   Rishav   add contact and a...
259
260
              }else{
                toastr.error(''+result.statusText+'', {
a4884cfe7   Rishav   add aircraft issu...
261
262
263
                  closeButton: true
                })
                $scope.showUpdateBtn = true;
b1f6160d4   Rishav   add contact and a...
264
              }
a4884cfe7   Rishav   add aircraft issu...
265
266
              $scope.showLoader = false;
            })
8670c5905   Jaideep Singh   new changes
267
268
  
            
b1f6160d4   Rishav   add contact and a...
269
            
a4884cfe7   Rishav   add aircraft issu...
270
        }
b1f6160d4   Rishav   add contact and a...
271

7152ff131   Rishav   model handle
272
273
274
275
276
277
        $scope.cancelData = function(){
            $scope.showNoteData = true;
            $scope.showCompanyName = true;
            $scope.showAddress = true;
            $scope.showUpdateBtn = false;
        }
a4884cfe7   Rishav   add aircraft issu...
278
        $scope.sendMail = function(){
d1fe89776   Rishav Singla   view fuel vendor ...
279
          $('#confirm1').css('display', 'none');
a4884cfe7   Rishav   add aircraft issu...
280
281
282
283
284
          ViewCompanyService.sendMail(companyId).then(function(result) {
              if(result != null && result.success){
                toastr.success(''+result.success+'', {
                  closeButton: true
                })
a4884cfe7   Rishav   add aircraft issu...
285
286
287
288
289
290
291
              }else{
                toastr.error(''+result.statusText+'', {
                  closeButton: true
                })
              }
          })
        }
b1f6160d4   Rishav   add contact and a...
292

a4884cfe7   Rishav   add aircraft issu...
293
294
295
        $scope.openConfirmMail = function(){
          $('#confirm1').css('display', 'block');
        }
48ed0c7bb   Rishav   update company co...
296

b1f6160d4   Rishav   add contact and a...
297

a4884cfe7   Rishav   add aircraft issu...
298
299
300
        $scope.cancelAndCloseConfirm = function(){
          $('#confirm1').css('display', 'none');
        }
6efd9a0a8   Anchit Jindal   new desing changes
301
302
        
        $scope.primaryContact = false;
a4884cfe7   Rishav   add aircraft issu...
303
304
305
306
        $scope.cancelPrimaryContact = function(){
          $('#primaryContact').css('display', 'none');
          $scope.primaryContact = false;
        }
3a9f4472b   Rishav   Implement contact...
307

a4884cfe7   Rishav   add aircraft issu...
308
309
        $scope.checkPrimaryContact = function(){
          if($scope.primaryContact == true){
6efd9a0a8   Anchit Jindal   new desing changes
310
311
312
313
314
315
316
          	$scope.primaryContact = true;
          	ViewCompanyService.checkPrimaryContact(companyId).then(function(result) {
          		console.log(result)
  				if(result.status == 422){
  				  $('#primaryContact').css('display', 'block');
  				}
          	})
3a9f4472b   Rishav   Implement contact...
317
          }
a4884cfe7   Rishav   add aircraft issu...
318
        }
3a9f4472b   Rishav   Implement contact...
319

a4884cfe7   Rishav   add aircraft issu...
320
        $scope.sendPrimaryContact = function(){
a4884cfe7   Rishav   add aircraft issu...
321
322
323
          $('#primaryContact').css('display', 'none');
          if($scope.primayData.id != null || $scope.primayData.id != undefined){
            var priamryContactData = "companyContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact;
3a9f4472b   Rishav   Implement contact...
324

a4884cfe7   Rishav   add aircraft issu...
325
326
327
            ViewCompanyService.addPrimaryContact(priamryContactData).then(function(result) {
              console.log(result)
            })
3a9f4472b   Rishav   Implement contact...
328
          }
a4884cfe7   Rishav   add aircraft issu...
329
330
          
        }
3a9f4472b   Rishav   Implement contact...
331

a4884cfe7   Rishav   add aircraft issu...
332
333
334
335
336
337
338
339
340
341
342
        var newContactName = "";
        $scope.updateData = ""
        $scope.showContact = function(data, value){
          $('#updateContact').css('display', 'block');
          $scope.updateData = data;
          newContactName = value;
          console.log($scope.updateData)
          if($scope.updateData.email == null){
            $scope.updateData.content = data.contactNumber;
          }else{
            $scope.updateData.content = data.email;
3a9f4472b   Rishav   Implement contact...
343
          }
a4884cfe7   Rishav   add aircraft issu...
344
        }
3a9f4472b   Rishav   Implement contact...
345

a4884cfe7   Rishav   add aircraft issu...
346
347
348
349
350
351
352
353
354
355
        $scope.acceptUpdateField = function(){
          console.log($scope.updateData)
          if($scope.updateData.content == undefined){
            toastr.error('Please add some content', {
              closeButton: true
            })
          }else{
            if(newContactName == 'phone'){
              var updateCustomData = "companyId=" + companyId + "&contactNumber=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id
                + "&title=" + $scope.updateData.title;
e9a2edf03   Rishav   update custom field
356
            }else{
a4884cfe7   Rishav   add aircraft issu...
357
358
              var updateCustomData = "companyId=" + companyId + "&email=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id
                + "&title=" + $scope.updateData.title;
e9a2edf03   Rishav   update custom field
359
            }
a4884cfe7   Rishav   add aircraft issu...
360
361
362
363
364
            ViewCompanyService.updateCustomField(updateCustomData).then(function(result) {
              console.log(result)
              if(result != null && result.success){
                $('#updateContact').css('display', 'none');
                getCompanyDetail();
e9a2edf03   Rishav   update custom field
365
              }
a4884cfe7   Rishav   add aircraft issu...
366
            })
e9a2edf03   Rishav   update custom field
367
          }
a4884cfe7   Rishav   add aircraft issu...
368
        }
e9a2edf03   Rishav   update custom field
369

a4884cfe7   Rishav   add aircraft issu...
370
371
372
        $scope.cancelUpdateField = function(){
          $('#updateContact').css('display', 'none');
        }
e9a2edf03   Rishav   update custom field
373

a4884cfe7   Rishav   add aircraft issu...
374
375
376
377
        $scope.showEditTier2 = function(number){
          console.log(number)
          $scope.contactNumber = number;
        }
8f88e39ed   Rishav   add custom field ...
378

e9a2edf03   Rishav   update custom field
379

a4884cfe7   Rishav   add aircraft issu...
380
381
382
383
384
385
        var contactName = '';
        $scope.addCustom = function(value){
          console.log(value)
          if(value != null){
            contactName = value;
            $('#customField').css('display', 'block');
3a9f4472b   Rishav   Implement contact...
386
          }
7152ff131   Rishav   model handle
387
          $scope.custom = {};
a4884cfe7   Rishav   add aircraft issu...
388
        }
8f88e39ed   Rishav   add custom field ...
389

a4884cfe7   Rishav   add aircraft issu...
390
391
392
        $scope.cancelCustomField = function(){
          $('#customField').css('display', 'none');
        }
7152ff131   Rishav   model handle
393
        
a4884cfe7   Rishav   add aircraft issu...
394
395
396
397
398
399
400
401
402
        $scope.acceptCustomField = function(){
          if($scope.custom.content == undefined){
            toastr.error('Please add some content', {
              closeButton: true
            })
          }else{
            if(contactName == 'phone'){
              var customData = "companyId=" + companyId + "&contactNumber=" + $scope.custom.content 
                + "&title=" + $scope.custom.title;
3a9f4472b   Rishav   Implement contact...
403
            }else{
a4884cfe7   Rishav   add aircraft issu...
404
405
              var customData = "companyId=" + companyId + "&email=" + $scope.custom.content 
                + "&title=" + $scope.custom.title;
d24318592   Rishav   changes and new i...
406
            }
a4884cfe7   Rishav   add aircraft issu...
407
408
409
410
411
412
413
414
            console.log(customData.email)
            ViewCompanyService.addCustomField(customData).then(function(result) {
              console.log(result)
              if(result != null && result.success){
                $('#customField').css('display', 'none');
                getCompanyDetail();
              }
            })
3a9f4472b   Rishav   Implement contact...
415
          }
a4884cfe7   Rishav   add aircraft issu...
416
        }
28af27a3f   Rishav   add fuelPriceapi
417

7152ff131   Rishav   model handle
418
        updateFuelManagerService.getFuelPricingNew().then(function(result) {
28af27a3f   Rishav   add fuelPriceapi
419
420
          $scope.fuelPricing = result;
          for (var i = 0; i<$scope.fuelPricing.length; i++) {
7152ff131   Rishav   model handle
421
            if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) {
a9e3a7365   Swarn Singh   fix issues on vie...
422
423
424
425
426
427
                $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
                var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
                var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
                var dday = newTime.getUTCDate();
                var dyear = newTime.getUTCFullYear();
                $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth+'/'+dday+'/'+dyear;
28af27a3f   Rishav   add fuelPriceapi
428
429
430
            }
          }
        })
67044e31e   Rishav Singla   modify changes an...
431

da24c95c8   Rishav Singla   confirmation mess...
432
        var deleteAircraftId = "";
67044e31e   Rishav Singla   modify changes an...
433
        $scope.deleteAircraft = function(id){
da24c95c8   Rishav Singla   confirmation mess...
434
435
436
437
438
439
            $('#delete1').css('display', 'block');
            deleteAircraftId = id;
        }
  
        $scope.aircraftDelete = function(){
            ViewCompanyService.deleteAircraft(deleteAircraftId).then(function(result) {
67044e31e   Rishav Singla   modify changes an...
440
441
              console.log(result)
              getAircraftList();
6efd9a0a8   Anchit Jindal   new desing changes
442
              getCompanyDetail();
da24c95c8   Rishav Singla   confirmation mess...
443
              $('#delete1').css('display', 'none');
67044e31e   Rishav Singla   modify changes an...
444
445
            })
        }
da24c95c8   Rishav Singla   confirmation mess...
446
447
448
449
  
        $scope.cancelDelete = function(){
          $('#delete1').css('display', 'none');
        }
a9a8f570d   Anchit Jindal   new desing implem...
450
        
da24c95c8   Rishav Singla   confirmation mess...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
      	CustomersService.getJetMargin($scope.userProfileId).then(function(result) {
    		  $scope.jetMarginList = result;
    		})
  
    		CustomersService.getAvgMargin($scope.userProfileId).then(function(result) {
    		  $scope.avgsMarginList = result;
    		})
  
         $scope.changePriceEmail = function(id, index){
            event.stopPropagation();
            var contactId = id;
            var statusData = "status=" + $scope.companyContactList[index].priceEmail;
            ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) {
                if(result.success){
                    $('#toogleMail').css('display', 'block');
                    if($scope.companyContactList[index].priceEmail == true){
                      $scope.messageText = 'You have enabled price distribution for this contact';
                    }else{
                      $scope.messageText = 'You have disabled price distribution for this contact';
                    }
                }
            })
          }
a9a8f570d   Anchit Jindal   new desing implem...
474

da24c95c8   Rishav Singla   confirmation mess...
475
476
477
          $scope.cancelToogle = function(){
            $('#toogleMail').css('display', 'none');
          }
8670c5905   Jaideep Singh   new changes
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
  
           $scope.checkboxStatus = function(value){
             console.log("checkbox",value)
             $scope.showUpdateBtn = true;
          }
  
          $scope.fuelercheckboxStatus = function(value){
             $('#fuelerchange').css('display', 'block');
              if(value == true){
                $scope.statusMessage = 'Please confirm! Enabling FuelerLinx for this customer will enable price distribution web services and disable price emails for the contacts in this company'
              }else{
                $scope.statusMessage = 'Please confirm! Disabling FuelerLinx for this customer will disable price distribution web services into their FuelerLinx account. If you proceed then remember to enable price emails for the appropriate contacts in this company.'
              }
  
              
          }
  
         $scope.fuelerCancelStatus = function(){
              $('#fuelerchange').css('display', 'none');
              $scope.companyData.fuelerlinxCustomer =  !$scope.companyData.fuelerlinxCustomer;
          }
  
          $scope.fuelerAcceptStatus = function(){
            var statusData;
            if($scope.companyData.fuelerlinxCustomer == false){
              statusData = "status=true";
            } else {
              statusData = "status=false";
            }
            ViewCompanyService.fuelerPricingChange(companyId, statusData).then(function(result) {
              if(result.success){
                    $('#fuelerchange').css('display', 'none');
                    
                    $scope.editData();
                    getContactList();
                    
                }
            })
          }
a4884cfe7   Rishav   add aircraft issu...
517
          
55e075d7e   Rishav   add contact, add ...
518
    }]);