Commit cf43d578ac4ccf826a2ad2fbfdbb724515ece04c
1 parent
e33b4556c4
Exists in
master
delete company update
Showing
3 changed files
with
98 additions
and
28 deletions
Show diff stats
app/partials/viewCompany/viewCompany.controller.js
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | //Load controller |
5 | 5 | angular.module('acufuel') |
6 | 6 | |
7 | - .controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewFuelVendorService', 'ViewcontactService', function($scope , $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewFuelVendorService, ViewcontactService) { | |
7 | + .controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewFuelVendorService', 'ViewcontactService','$state', function($scope , $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewFuelVendorService, ViewcontactService,$state) { | |
8 | 8 | $scope.data = {}; |
9 | 9 | $scope.data.priceEmail = true; |
10 | 10 | $scope.aircraft = {}; |
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | $scope.companyData.contractFuelVendor = false; |
54 | 54 | } |
55 | 55 | |
56 | - console.log($scope.companyData) | |
56 | + // console.log($scope.companyData) | |
57 | 57 | |
58 | 58 | } |
59 | 59 | |
... | ... | @@ -96,21 +96,21 @@ |
96 | 96 | if($scope.companyData.baseTenant){ |
97 | 97 | |
98 | 98 | $scope.selected.push({'first': 'Tenant/Base Customer'}) |
99 | - console.log("$scope.selected",$scope.selected) | |
99 | + // console.log("$scope.selected",$scope.selected) | |
100 | 100 | |
101 | 101 | } |
102 | 102 | |
103 | 103 | if($scope.companyData.fuelerlinxCustomer){ |
104 | 104 | $scope.selected.push({'first': 'FuelerLinx Customer'}) |
105 | - console.log("$scope.selected",$scope.selected) | |
105 | + // console.log("$scope.selected",$scope.selected) | |
106 | 106 | } |
107 | 107 | |
108 | 108 | if($scope.companyData.contractFuelVendor){ |
109 | 109 | $scope.selected.push({'first': 'CAA Member'}) |
110 | - console.log("$scope.selected",$scope.selected) | |
110 | + // console.log("$scope.selected",$scope.selected) | |
111 | 111 | } |
112 | 112 | |
113 | - console.log("$scope.companyData",$scope.companyData) | |
113 | + // console.log("$scope.companyData",$scope.companyData) | |
114 | 114 | getAircraftList(); |
115 | 115 | $scope.showLoader = false; |
116 | 116 | }) |
... | ... | @@ -186,16 +186,18 @@ |
186 | 186 | $scope.data.companyId = companyId; |
187 | 187 | $scope.contactData.contactList.push($scope.data); |
188 | 188 | ViewCompanyService.addContact($scope.contactData).then(function(result) { |
189 | - console.log(result) | |
189 | + console.log(result) | |
190 | 190 | if(result.status == 200){ |
191 | - // toastr.success(''+result.success+'', { | |
192 | - // closeButton: true | |
193 | - // }) | |
191 | + | |
194 | 192 | $('#contact-modal-3').modal('hide'); |
195 | 193 | $scope.primayData.id = result.data; |
196 | 194 | $scope.data = {}; |
197 | 195 | $scope.sendPrimaryContact(); |
198 | 196 | getContactList(); |
197 | + // toastr.success(''+result.success+'', { | |
198 | + toastr.success('Created Successfully',{ | |
199 | + closeButton: true | |
200 | + }) | |
199 | 201 | }else{ |
200 | 202 | toastr.error(''+result.statusText+'', { |
201 | 203 | closeButton: true |
... | ... | @@ -235,7 +237,7 @@ |
235 | 237 | 'marginId': '', |
236 | 238 | 'avgasMarginId': '' |
237 | 239 | }); |
238 | - console.log($scope.aircraftDetails) | |
240 | + // console.log($scope.aircraftDetails) | |
239 | 241 | }; |
240 | 242 | |
241 | 243 | $scope.getModal = function(makeId, index){ |
... | ... | @@ -272,7 +274,7 @@ |
272 | 274 | 'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId |
273 | 275 | }); |
274 | 276 | } |
275 | - console.log($scope.addData) | |
277 | + //console.log($scope.addData) | |
276 | 278 | $scope.aircraftListData.aircraftList = $scope.addData; |
277 | 279 | $scope.aircraftListData.accountId = companyId; |
278 | 280 | |
... | ... | @@ -314,7 +316,7 @@ |
314 | 316 | } |
315 | 317 | |
316 | 318 | $scope.editData = function(inputName) { |
317 | - console.log($scope.companyData) | |
319 | + //console.log($scope.companyData) | |
318 | 320 | $scope.showLoader = true; |
319 | 321 | /*if(inputName == 'showNoteData'){ |
320 | 322 | $scope.showNoteData = true; |
... | ... | @@ -392,7 +394,7 @@ |
392 | 394 | if($scope.primaryContact == true){ |
393 | 395 | $scope.primaryContact = true; |
394 | 396 | ViewCompanyService.checkPrimaryContact(companyId).then(function(result) { |
395 | - console.log(result) | |
397 | + //console.log(result) | |
396 | 398 | if(result.status == 422){ |
397 | 399 | $('#primaryContact').css('display', 'block'); |
398 | 400 | } |
... | ... | @@ -406,7 +408,7 @@ |
406 | 408 | var priamryContactData = "companyContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact; |
407 | 409 | |
408 | 410 | ViewCompanyService.addPrimaryContact(priamryContactData).then(function(result) { |
409 | - console.log(result) | |
411 | + // console.log(result) | |
410 | 412 | }) |
411 | 413 | } |
412 | 414 | |
... | ... | @@ -418,7 +420,7 @@ |
418 | 420 | $('#updateContact').css('display', 'block'); |
419 | 421 | $scope.updateData = data; |
420 | 422 | newContactName = value; |
421 | - console.log($scope.updateData) | |
423 | + // console.log($scope.updateData) | |
422 | 424 | if($scope.updateData.email == null){ |
423 | 425 | $scope.updateData.content = data.contactNumber; |
424 | 426 | }else{ |
... | ... | @@ -427,7 +429,7 @@ |
427 | 429 | } |
428 | 430 | |
429 | 431 | $scope.acceptUpdateField = function(){ |
430 | - console.log($scope.updateData) | |
432 | + // console.log($scope.updateData) | |
431 | 433 | if($scope.updateData.content == undefined){ |
432 | 434 | toastr.error('Please add some content', { |
433 | 435 | closeButton: true |
... | ... | @@ -441,7 +443,7 @@ |
441 | 443 | + "&title=" + $scope.updateData.title; |
442 | 444 | } |
443 | 445 | ViewCompanyService.updateCustomField(updateCustomData).then(function(result) { |
444 | - console.log(result) | |
446 | + //console.log(result) | |
445 | 447 | if(result != null && result.success){ |
446 | 448 | $('#updateContact').css('display', 'none'); |
447 | 449 | getCompanyDetail(); |
... | ... | @@ -455,7 +457,7 @@ |
455 | 457 | } |
456 | 458 | |
457 | 459 | $scope.showEditTier2 = function(number){ |
458 | - console.log(number) | |
460 | + // console.log(number) | |
459 | 461 | $scope.contactNumber = number; |
460 | 462 | } |
461 | 463 | |
... | ... | @@ -463,7 +465,7 @@ |
463 | 465 | |
464 | 466 | var contactName = ''; |
465 | 467 | $scope.addCustom = function(value){ |
466 | - console.log(value) | |
468 | + //console.log(value) | |
467 | 469 | if(value != null){ |
468 | 470 | contactName = value; |
469 | 471 | $('#customField').css('display', 'block'); |
... | ... | @@ -488,9 +490,9 @@ |
488 | 490 | var customData = "companyId=" + companyId + "&email=" + $scope.custom.content |
489 | 491 | + "&title=" + $scope.custom.title; |
490 | 492 | } |
491 | - console.log(customData.email) | |
493 | + // console.log(customData.email) | |
492 | 494 | ViewCompanyService.addCustomField(customData).then(function(result) { |
493 | - console.log(result) | |
495 | + // console.log(result) | |
494 | 496 | if(result != null && result.success){ |
495 | 497 | $('#customField').css('display', 'none'); |
496 | 498 | getCompanyDetail(); |
... | ... | @@ -521,7 +523,7 @@ |
521 | 523 | |
522 | 524 | $scope.aircraftDelete = function(){ |
523 | 525 | ViewCompanyService.deleteAircraft(deleteAircraftId).then(function(result) { |
524 | - console.log(result) | |
526 | + // console.log(result) | |
525 | 527 | getAircraftList(); |
526 | 528 | getCompanyDetail(); |
527 | 529 | $('#delete1').css('display', 'none'); |
... | ... | @@ -561,7 +563,7 @@ |
561 | 563 | } |
562 | 564 | |
563 | 565 | $scope.checkboxStatus = function(value){ |
564 | - console.log("checkbox",value) | |
566 | + // console.log("checkbox",value) | |
565 | 567 | $scope.showUpdateBtn = true; |
566 | 568 | } |
567 | 569 | |
... | ... | @@ -625,9 +627,9 @@ |
625 | 627 | // $scope.aircraftData = {} |
626 | 628 | $scope.checkJetWithTail = function(tail, index){ |
627 | 629 | |
628 | - console.log("tail==============",tail, index) | |
630 | + // console.log("tail==============",tail, index) | |
629 | 631 | ViewCompanyService.checkJetType(tail).then(function(result) { |
630 | - console.log("result",result) | |
632 | + // console.log("result",result) | |
631 | 633 | if(result.jetA == "true"){ |
632 | 634 | $scope.jetShow[index] = false; |
633 | 635 | $scope.marginShow[index] = true; |
... | ... | @@ -637,5 +639,37 @@ |
637 | 639 | } |
638 | 640 | }) |
639 | 641 | } |
642 | + | |
643 | + | |
644 | + | |
645 | + /*delete company*/ | |
646 | + var deletecompanyId = ""; | |
647 | + $scope.deleteComp = function(companyDataid){ | |
648 | + $('#delete2').css('display', 'block'); | |
649 | + //console.log("asda",companyDataid) | |
650 | + deletecompanyId = companyDataid; | |
651 | + } | |
652 | + | |
653 | + $scope.deleteCompanyData = function(){ | |
654 | + ViewCompanyService.deleteCompany(deletecompanyId).then(function(result) { | |
655 | + | |
656 | + $('#delete2').css('display', 'none'); | |
657 | + if(result.success){ | |
658 | + toastr.success(''+result.success+'', { | |
659 | + closeButton: true | |
660 | + | |
661 | + }) | |
662 | + }else{ | |
663 | + toastr.error(''+result.statusText+'', { | |
664 | + closeButton: true | |
665 | + | |
666 | + }) | |
667 | + } | |
668 | + $state.go('app.customers') | |
669 | + }) | |
670 | + } | |
671 | + $scope.cancelDelete = function(){ | |
672 | + $('#delete2').css('display', 'none'); | |
673 | + } | |
640 | 674 | |
641 | 675 | }]); |
642 | 676 | \ No newline at end of file | ... | ... |
app/partials/viewCompany/viewCompany.html
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 | <div class="widget"> |
130 | 130 | <div class="widget-header"> |
131 | 131 | <i class="fa fa-building-o" aria-hidden="true"></i> |
132 | - <h3>{{companyData.companyName}} <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteCompany(companyData.id)" aria-hidden="true"></i></h3> | |
132 | + <h3>{{companyData.companyName}} <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteComp(companyData.id)" aria-hidden="true"></i></h3> | |
133 | 133 | <i class="fa fa-times timess" ui-sref="app.customers" aria-hidden="true"></i> |
134 | 134 | </div> |
135 | 135 | <!-- /widget-header --> |
... | ... | @@ -852,6 +852,27 @@ |
852 | 852 | </div> |
853 | 853 | </div> |
854 | 854 | </div> |
855 | +<div class="customConfirmPopBackdrop" id="delete2"> | |
856 | + <div class="customModalInner" style="max-width: 400px;"> | |
857 | + <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> | |
858 | + <table> | |
859 | + <tr> | |
860 | + <td> | |
861 | + <img src="img/info.png" style="width: 50px;"> | |
862 | + </td> | |
863 | + <td> | |
864 | + <p style="padding: 5px 10px; margin-bottom: 0;">Please confirm! Are you sure you want to DELETE this Company & its related data?</p> | |
865 | + </td> | |
866 | + </tr> | |
867 | + </table> | |
868 | + </div> | |
869 | + <div class="customModelFooter text-right" style="border-radius: 0 0 5px 5px;"> | |
870 | + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="deleteCompanyData()">Accept</button> | |
871 | + <button class="btn" style="padding: 4px 0; width: 80px;" ng-click="cancelDelete()">Cancel</button> | |
872 | + </div> | |
873 | + </div> | |
874 | +</div> | |
875 | + | |
855 | 876 | <div class="customConfirmPopBackdrop" id="delete3"> |
856 | 877 | <div class="customModalInner" style="max-width: 400px;"> |
857 | 878 | <div class="customModelBody" style="border-radius: 5px 5px 0 0;"> | ... | ... |
app/partials/viewCompany/viewCompany.service.js
... | ... | @@ -229,8 +229,23 @@ |
229 | 229 | return deferred.promise; |
230 | 230 | } |
231 | 231 | |
232 | - } | |
233 | 232 | |
233 | + this.deleteCompany = function(id) { | |
234 | + | |
235 | + var deferred = $q.defer(); | |
236 | + $http({ | |
237 | + method : 'DELETE', | |
238 | + url : BASE_URL.url +'/company/cid/'+id, | |
239 | + headers : {'Content-Type': 'application/json'}, | |
240 | + }) | |
241 | + .then(function (result){ | |
242 | + deferred.resolve(result.data); | |
243 | + },function (result){ | |
244 | + deferred.resolve(result.data); | |
245 | + }) | |
246 | + return deferred.promise; | |
247 | + } | |
234 | 248 | |
249 | + } | |
235 | 250 | |
236 | 251 | })(); |
237 | 252 | \ No newline at end of file | ... | ... |