Commit b6f0311a3528f84f6531d2005e822fe7f5d71041
1 parent
1926e07b60
Exists in
master
get Company api implementation
Showing
4 changed files
with
24 additions
and
15 deletions
Show diff stats
app/partials/customers/customers.controller.js
... | ... | @@ -12,10 +12,14 @@ |
12 | 12 | $scope.aircraft = {}; |
13 | 13 | $scope.data.activate = true; |
14 | 14 | |
15 | - CustomersService.getAllCompanies().then(function(result) { | |
16 | - console.log(result) | |
17 | - $scope.companyList = result; | |
18 | - }) | |
15 | + getAllCompanies(); | |
16 | + | |
17 | + function getAllCompanies(){ | |
18 | + CustomersService.getAllCompanies().then(function(result) { | |
19 | + console.log(result) | |
20 | + $scope.companyList = result; | |
21 | + }) | |
22 | + } | |
19 | 23 | |
20 | 24 | $(function() { |
21 | 25 | $('#toggle-one2').bootstrapToggle(); |
... | ... | @@ -57,7 +61,7 @@ |
57 | 61 | 'tail':'', |
58 | 62 | 'make': '', |
59 | 63 | 'model': '', |
60 | - 'size' : '' | |
64 | + 'sizeId' : '' | |
61 | 65 | }]; |
62 | 66 | |
63 | 67 | $scope.addNew = function(){ |
... | ... | @@ -65,7 +69,7 @@ |
65 | 69 | 'tail':'', |
66 | 70 | 'make': '', |
67 | 71 | 'model': '', |
68 | - 'size' : '' | |
72 | + 'sizeId' : '' | |
69 | 73 | }); |
70 | 74 | console.log($scope.aircraftDetails) |
71 | 75 | }; |
... | ... | @@ -95,7 +99,7 @@ |
95 | 99 | 'tail': $scope.aircraftDetails[i].tail, |
96 | 100 | 'make': $scope.aircraftDetails[i].make, |
97 | 101 | 'model': $scope.aircraftDetails[i].model, |
98 | - 'size' : $scope.aircraftDetails[i].size | |
102 | + 'sizeId' : $scope.aircraftDetails[i].sizeId | |
99 | 103 | }); |
100 | 104 | } |
101 | 105 | $scope.aircraftListData.aircraftList = $scope.addData; |
... | ... | @@ -103,11 +107,13 @@ |
103 | 107 | |
104 | 108 | CustomersService.addAircraft($scope.aircraftListData).then(function(result) { |
105 | 109 | console.log(result) |
110 | + | |
106 | 111 | if(result != null && result.success){ |
107 | 112 | toastr.success(''+result.success+'', { |
108 | 113 | closeButton: true |
109 | 114 | }) |
110 | 115 | $('#demo-modal-3').modal('hide'); |
116 | + getAllCompanies(); | |
111 | 117 | }else{ |
112 | 118 | toastr.error(''+result.statusText+'', { |
113 | 119 | closeButton: true | ... | ... |
app/partials/customers/customers.html
... | ... | @@ -154,7 +154,6 @@ |
154 | 154 | <button type="button" ng-if="customer.activate == true" class="btn btn-success btn-xs">Active</button> |
155 | 155 | <button type="button" ng-if="customer.activate == false" class="btn btn-warning btn-xs">InActive</button> |
156 | 156 | </td> |
157 | - </td> | |
158 | 157 | <td class="font-company"> |
159 | 158 | <select class="form-control" style="height:31px;"> |
160 | 159 | <option>Margin1</option> |
... | ... | @@ -577,9 +576,10 @@ |
577 | 576 | </select> |
578 | 577 | </td> |
579 | 578 | <td style="width: 20%"> |
580 | - <select class="form-control" ng-model="aircraftData.size"> | |
579 | + <select class="form-control" ng-model="aircraftData.sizeId" ng-options="size.aircraftSize.id as size.aircraftSize.size for size in aircraftData.aircraftSizeList"></select> | |
580 | + <!-- <select class="form-control" ng-model="aircraftData.size"> | |
581 | 581 | <option ng-repeat="size in aircraftData.aircraftSizeList">{{size}}</option> |
582 | - </select> | |
582 | + </select> --> | |
583 | 583 | </td> |
584 | 584 | </tr> |
585 | 585 | </tbody> | ... | ... |
app/partials/viewCompany/viewCompany.controller.js
... | ... | @@ -103,7 +103,7 @@ |
103 | 103 | 'tail':'', |
104 | 104 | 'make': '', |
105 | 105 | 'model': '', |
106 | - 'size' : '' | |
106 | + 'sizeId' : '' | |
107 | 107 | }]; |
108 | 108 | |
109 | 109 | $scope.addNew = function(){ |
... | ... | @@ -111,8 +111,9 @@ |
111 | 111 | 'tail':'', |
112 | 112 | 'make': '', |
113 | 113 | 'model': '', |
114 | - 'size' : '' | |
114 | + 'sizeId' : '' | |
115 | 115 | }); |
116 | + console.log($scope.aircraftDetails) | |
116 | 117 | }; |
117 | 118 | |
118 | 119 | $scope.getModal = function(makeId, index){ |
... | ... | @@ -139,9 +140,10 @@ |
139 | 140 | 'tail': $scope.aircraftDetails[i].tail, |
140 | 141 | 'make': $scope.aircraftDetails[i].make, |
141 | 142 | 'model': $scope.aircraftDetails[i].model, |
142 | - 'size' : $scope.aircraftDetails[i].size | |
143 | + 'sizeId' : $scope.aircraftDetails[i].sizeId | |
143 | 144 | }); |
144 | 145 | } |
146 | + console.log($scope.addData) | |
145 | 147 | $scope.aircraftListData.aircraftList = $scope.addData; |
146 | 148 | $scope.aircraftListData.accountId = companyId; |
147 | 149 | ... | ... |
app/partials/viewCompany/viewCompany.html
... | ... | @@ -589,9 +589,10 @@ |
589 | 589 | </select> |
590 | 590 | </td> |
591 | 591 | <td style="width: 20%"> |
592 | - <select class="form-control" ng-model="aircraftData.size"> | |
592 | + <select class="form-control" ng-model="aircraftData.sizeId" ng-options="size.aircraftSize.id as size.aircraftSize.size for size in aircraftData.aircraftSizeList"></select> | |
593 | + <!-- <select class="form-control" ng-model="aircraftData.size"> | |
593 | 594 | <option ng-repeat="size in aircraftData.aircraftSizeList">{{size}}</option> |
594 | - </select> | |
595 | + </select> --> | |
595 | 596 | </td> |
596 | 597 | </tr> |
597 | 598 | </tbody> | ... | ... |