Blame view
app/partials/viewCompany/viewCompany.controller.js
5.25 KB
feacde5ff
|
1 2 3 4 5 |
'use strict'; //Load controller angular.module('acufuel') |
b1f6160d4
|
6 |
.controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', function($scope , $uibModal, $stateParams, ViewCompanyService, CustomersService) { |
55e075d7e
|
7 8 |
$scope.data = {}; $scope.data.priceEmail = true; |
b1f6160d4
|
9 10 11 12 13 14 15 16 |
$scope.aircraft = {}; // $scope.open = function(){ // $scope.editSmsModal = $uibModal.open({ // templateUrl: 'partials/NewCompany/NewCompany.html', // backdrop: true, // scope: $scope, // }) // } |
55e075d7e
|
17 |
|
4bb02bb84
|
18 19 20 |
$(function() { $('#toggle-one2').bootstrapToggle(); }) |
feacde5ff
|
21 |
|
4bb02bb84
|
22 23 24 25 26 27 28 29 30 31 32 |
$(function() { $('#toggle-one1').bootstrapToggle(); }) $(function() { $('#toggle-two').bootstrapToggle(); }) $(function() { $('#toggle-three').bootstrapToggle(); }) $(function() { $('#toggle-four').bootstrapToggle(); |
55e075d7e
|
33 34 35 36 37 38 39 40 41 |
}) $(function() { $('#price-one2').bootstrapToggle(); $('#price-one2').change(function() { $('#console-event').html('Toggle: ' + $(this).prop('checked')); $scope.data.priceEmail = $(this).prop('checked'); }) }) |
feacde5ff
|
42 |
|
55e075d7e
|
43 |
var companyId = $stateParams.id; |
55e075d7e
|
44 |
ViewCompanyService.getCompany(companyId).then(function(result) { |
b1f6160d4
|
45 |
$scope.companyData = result; |
55e075d7e
|
46 47 48 |
}) ViewCompanyService.getContact(companyId).then(function(result) { |
b1f6160d4
|
49 |
$scope.companyContactList = result; |
55e075d7e
|
50 |
}) |
b1f6160d4
|
51 52 53 54 55 56 57 |
getAircraftList(); function getAircraftList(){ ViewCompanyService.getAircraft(companyId).then(function(result) { $scope.contactAircraftList = result; }) } |
55e075d7e
|
58 59 60 61 62 |
$scope.contactData = {}; $scope.contactData.contactList = []; $scope.addContact = function(){ $scope.data.companyId = companyId; $scope.contactData.contactList.push($scope.data); |
55e075d7e
|
63 64 65 66 67 68 69 70 71 72 73 74 75 |
ViewCompanyService.addContact($scope.contactData).then(function(result) { if(result.success){ toastr.success(''+result.success+'', { closeButton: true }) $('#contact-modal-3').modal('hide'); }else{ toastr.error(''+result.statusText+'', { closeButton: true }) } }) } |
feacde5ff
|
76 |
|
b1f6160d4
|
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
getData(); function getData(){ CustomersService.getAircraftMake().then(function(result) { $scope.aircraftMakeList = result; }) } $scope.aircraftDetails = [{ 'tail':'', 'make': '', 'model': '', 'size' : '' }]; $scope.addNew = function(){ $scope.aircraftDetails.push({ 'tail':'', 'make': '', 'model': '', 'size' : '' }); }; $scope.getModal = function(makeId, index){ $scope.aircraft.make = makeId; //var makeId = makeId; CustomersService.getModal($scope.aircraft.make).then(function(result) { $scope.aircraftDetails[index].aircraftModalList = result; //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0]; }) } $scope.getSize = function(model, index){ CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { $scope.aircraftDetails[index].aircraftSizeList = result; //$scope.aircraftDetails[index].size = $scope.aircraftSizeList[0]; }) } $scope.aircraftListData = {}; $scope.addData = []; $scope.saveCompanyData = function(){ 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, 'size' : $scope.aircraftDetails[i].size }); } $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 }) } }); } $scope.showNoteData = true; $scope.showCompanyName = true; $scope.showNote = function(){ $scope.showNoteData = false; } $scope.company = function(){ $scope.showCompanyName = false; } $scope.editData = function(inputName) { if(inputName == 'showNoteData'){ $scope.showNoteData = true; }else if(inputName == 'showCompanyName'){ $scope.showCompanyName = true; } } |
55e075d7e
|
163 |
}]); |