Commit 48ed0c7bb0a12432d10414ec40aaf50262eb4ade
1 parent
b1f6160d4d
Exists in
master
update company code implemented
Showing
3 changed files
with
86 additions
and
21 deletions
Show diff stats
app/partials/viewCompany/viewCompany.controller.js
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | // } |
18 | 18 | |
19 | 19 | $(function() { |
20 | - $('#toggle-one2').bootstrapToggle(); | |
20 | + $('#company-one2').bootstrapToggle(); | |
21 | 21 | }) |
22 | 22 | |
23 | 23 | $(function() { |
... | ... | @@ -41,14 +41,24 @@ |
41 | 41 | }) |
42 | 42 | }) |
43 | 43 | |
44 | + var value = ""; | |
44 | 45 | var companyId = $stateParams.id; |
45 | 46 | ViewCompanyService.getCompany(companyId).then(function(result) { |
46 | 47 | $scope.companyData = result; |
48 | + if($scope.companyData.activate == true){ | |
49 | + value = 'on'; | |
50 | + }else{ | |
51 | + value = 'off' | |
52 | + } | |
53 | + $('#company-one2').bootstrapToggle(value) | |
47 | 54 | }) |
48 | 55 | |
49 | - ViewCompanyService.getContact(companyId).then(function(result) { | |
50 | - $scope.companyContactList = result; | |
51 | - }) | |
56 | + getContactList(); | |
57 | + function getContactList(){ | |
58 | + ViewCompanyService.getContact(companyId).then(function(result) { | |
59 | + $scope.companyContactList = result; | |
60 | + }) | |
61 | + } | |
52 | 62 | |
53 | 63 | getAircraftList(); |
54 | 64 | function getAircraftList(){ |
... | ... | @@ -69,6 +79,7 @@ |
69 | 79 | closeButton: true |
70 | 80 | }) |
71 | 81 | $('#contact-modal-3').modal('hide'); |
82 | + getContactList(); | |
72 | 83 | }else{ |
73 | 84 | toastr.error(''+result.statusText+'', { |
74 | 85 | closeButton: true |
... | ... | @@ -147,6 +158,7 @@ |
147 | 158 | } |
148 | 159 | $scope.showNoteData = true; |
149 | 160 | $scope.showCompanyName = true; |
161 | + $scope.showAddress = true; | |
150 | 162 | $scope.showNote = function(){ |
151 | 163 | $scope.showNoteData = false; |
152 | 164 | } |
... | ... | @@ -155,12 +167,38 @@ |
155 | 167 | $scope.showCompanyName = false; |
156 | 168 | } |
157 | 169 | |
170 | + $scope.addressChange = function(){ | |
171 | + $scope.showAddress = false; | |
172 | + } | |
173 | + | |
158 | 174 | $scope.editData = function(inputName) { |
175 | + console.log($scope.companyData) | |
159 | 176 | if(inputName == 'showNoteData'){ |
160 | 177 | $scope.showNoteData = true; |
161 | 178 | }else if(inputName == 'showCompanyName'){ |
162 | 179 | $scope.showCompanyName = true; |
180 | + }else if(inputName == 'showAddress'){ | |
181 | + $scope.showAddress = true; | |
163 | 182 | } |
183 | + | |
184 | + var companyData = "companyName=" + $scope.companyData.companyName + "&masterMargin=" + $scope.companyData.masterMargin | |
185 | + + "&addressOne=" + $scope.companyData.addressOne + "&addressTwo=" + $scope.companyData.addressTwo + "&city=" + $scope.companyData.city + "&state=" | |
186 | + + $scope.companyData.state + "&country=" + $scope.companyData.country + "&zipcode=" + $scope.companyData.zipcode + "&internalNote=" | |
187 | + + $scope.companyData.internalNote + "&certificateType=" + $scope.companyData.certificateType + "&baseTenant=" + $scope.companyData.baseTenant | |
188 | + + "&fuelerlinxCustomer=" + $scope.companyData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.companyData.contractFuelVendor | |
189 | + + "&activate=" + $scope.companyData.activate + "&baseIcao=" + $scope.companyData.baseIcao + "&companyId=" + companyId; | |
190 | + | |
191 | + ViewCompanyService.updateContact(companyData).then(function(result) { | |
192 | + if(result != null && result.success){ | |
193 | + toastr.success(''+result.success+'', { | |
194 | + closeButton: true | |
195 | + }) | |
196 | + }else{ | |
197 | + toastr.error(''+result.statusText+'', { | |
198 | + closeButton: true | |
199 | + }) | |
200 | + } | |
201 | + }) | |
164 | 202 | |
165 | 203 | } |
166 | 204 | ... | ... |
app/partials/viewCompany/viewCompany.html
... | ... | @@ -136,35 +136,37 @@ |
136 | 136 | <i class="fa fa-building-o" aria-hidden="true"></i> |
137 | 137 | <h3>Company Details</h3> |
138 | 138 | <div class="pull-right my-toggle-switch" style="margin-top: 10px; margin-right: 10px;"> |
139 | - <div><input id="toggle-one2" checked type="checkbox" data-size="mini" data-width="55" data-toggle="toggle" data-on="Active" data-off="Dactive"> | |
139 | + <div><input id="company-one2" checked type="checkbox" data-size="mini" data-width="55" data-toggle="toggle" data-on="Active" data-off="Dactive"> | |
140 | 140 | </div> |
141 | 141 | </div> |
142 | 142 | </div> |
143 | 143 | <div class="widget-content"> |
144 | 144 | <div class="row" style="margin-left:0px;"> |
145 | - <div class="col-md-8" style="padding-left: 0;"> | |
145 | + <div class="col-md-7" style="padding-left: 0;"> | |
146 | 146 | <h4 ng-show="showCompanyName"> |
147 | 147 | <b style="color:#F90;">{{companyData.companyName}}</b> <i class="fa fa-pencil-square-o" ng-click="company()" style="font-size: 14px;" aria-hidden="true"></i> |
148 | 148 | </h4> |
149 | 149 | <input type="tel" ng-hide="showCompanyName" ng-model="companyData.companyName" class="form-control" ng-blur="editData('showCompanyName')"/> |
150 | 150 | </div> |
151 | - <div class="col-md-4"> | |
152 | - <select class="form-control" style="height:31px;background: #ebebeb;"> | |
151 | + <div class="col-md-5"> | |
152 | + <select class="form-control" style="padding: 4px 8px;background: #ebebeb;" ng-model="companyData.certificateType" ng-click="editData()"> | |
153 | 153 | <option class="optionclass" disabled selected>Certificate Type</option> |
154 | - <option class="Corporate">Part 91 (Corporate)</option> | |
155 | - <option class="Charter">Part 135 (Charter)</option> | |
156 | - <option class="Scheduled">Part 121 (Scheduled)</option> | |
157 | - <option class="Military">Military</option> | |
158 | - <option class="Government">Government</option> | |
154 | + <option class="optionclass" value="corporate">Part 91 (Corporate)</option> | |
155 | + <option class="optionclass" value="charter">Part 135 (Charter)</option> | |
156 | + <option class="optionclass" value="scheduled">Part 121 (Scheduled)</option> | |
157 | + <option class="optionclass" value="military">Military</option> | |
158 | + <option class="optionclass" value="government">Government</option> | |
159 | 159 | </select> |
160 | 160 | </div> |
161 | 161 | </div> |
162 | 162 | <div> |
163 | 163 | <p class="new-label"> |
164 | 164 | <span>Master Margin Setting </span> |
165 | - <select class="form-control" style="width: 100px;"> | |
166 | - <option>Margin1</option> | |
167 | - <option>Margin2</option> | |
165 | + <select class="form-control" style="width: 135px;padding: 4px 8px;" ng-model="companyData.masterMargin" ng-click="editData()"> | |
166 | + <option value="margin1">Margin1</option> | |
167 | + <option value="margin2">Margin2</option> | |
168 | + <option value="vendorsonly">Vendors Only</option> | |
169 | + <option value="margintenants">Margin Tenants</option> | |
168 | 170 | </select> |
169 | 171 | <span> See Aircrart List</span> |
170 | 172 | <div class="clearfix"></div> |
... | ... | @@ -172,23 +174,31 @@ |
172 | 174 | </div> |
173 | 175 | <div class="row" style="margin-left:0px;"> |
174 | 176 | <div class="col-md-5" style="padding-left: 0;"> |
175 | - <input type="checkbox" name="" ng-model="companyData.baseTenant"> Tenant/Base Customer | |
177 | + <input type="checkbox" name="" ng-click="editData()" ng-model="companyData.baseTenant"> Tenant/Base Customer | |
176 | 178 | </div> |
177 | 179 | <div class="col-md-5" style="padding-left: 0;"> |
178 | - <input type="checkbox" name="" ng-model="companyData.fuelerlinxCustomer"> FuelerLinx Customer | |
180 | + <input type="checkbox" name="" ng-click="editData()" ng-model="companyData.fuelerlinxCustomer"> FuelerLinx Customer | |
179 | 181 | </div> |
180 | 182 | </div> |
181 | 183 | <div> |
182 | - <input type="checkbox" name="" ng-model="companyData.contractFuelVendor"> CAA Member | |
184 | + <input type="checkbox" name="" ng-click="editData()" ng-model="companyData.contractFuelVendor"> CAA Member | |
183 | 185 | </div> |
184 | 186 | </br> |
185 | 187 | <div class="new-address"> |
186 | - <p><i class="fa fa-map-marker"></i> Reviera State Rd32 <i class="fa fa-pencil-square-o" aria-hidden="true"></i> </p> | |
188 | + <p ng-show="showAddress"><i class="fa fa-map-marker"></i> {{companyData.addressOne}} {{companyData.addressTwo}} <i class="fa fa-pencil-square-o" ng-click="addressChange()" aria-hidden="true"></i> </p> | |
189 | + | |
190 | + <div ng-hide="showAddress"> | |
191 | + <label>Address1</label> | |
192 | + <input type="tel" ng-hide="showAddress" ng-model="companyData.addressOne" class="form-control" ng-blur="editData('showAddress')"/> | |
193 | + <label>Address2</label> | |
194 | + <input type="tel" ng-hide="showAddress" ng-model="companyData.addressTwo" class="form-control" ng-blur="editData('showAddress')"/> | |
195 | + </div> | |
196 | + | |
187 | 197 | <p><i class="fa fa-phone"></i> (310) 2342-3433 <i class="fa fa-pencil-square-o" aria-hidden="true"></i></p> |
188 | 198 | <p><i class="fa fa-envelope"></i> freed@gmail.com <i class="fa fa-pencil-square-o" aria-hidden="true"></i></p> |
189 | 199 | </div> |
190 | 200 | <div class="new-add-select"> |
191 | - <select class="form-control" style="background: #ebebeb;"> | |
201 | + <select class="form-control" style="background: #ebebeb;padding: 4px 8px;width: 115px;"> | |
192 | 202 | <option disabled selected>Add Field</option> |
193 | 203 | <option class="optionclass">Add Phone</option> |
194 | 204 | <option class="optionclass">Add Email</option> | ... | ... |
app/partials/viewCompany/viewCompany.service.js
... | ... | @@ -54,6 +54,23 @@ |
54 | 54 | return deferred.promise; |
55 | 55 | } |
56 | 56 | |
57 | + this.updateContact = function(data) { | |
58 | + | |
59 | + var deferred = $q.defer(); | |
60 | + $http({ | |
61 | + method : 'PUT', | |
62 | + url : BASE_URL.url +'/company', | |
63 | + data : data, | |
64 | + headers : {'Content-Type': 'application/json'}, | |
65 | + }) | |
66 | + .then(function (result){ | |
67 | + deferred.resolve(result.data); | |
68 | + },function (result){ | |
69 | + deferred.resolve(result.data); | |
70 | + }) | |
71 | + return deferred.promise; | |
72 | + } | |
73 | + | |
57 | 74 | this.getAircraft = function(id) { |
58 | 75 | |
59 | 76 | var deferred = $q.defer(); | ... | ... |