Commit cdf775224389a0de18162c35ed9ee5995291143b

Authored by Anchit Jindal
1 parent 52fea957fd
Exists in master

fixed company and vendor detail page issues

app/partials/ContactView/ContactView.controller.js
... ... @@ -83,7 +83,7 @@
83 83 data: $scope.contactList
84 84 });
85 85 })
86   - }
  86 + }
87 87  
88 88  
89 89 ContactViewService.getCompanies().then(function(result) {
... ...
app/partials/FuelVendors/FuelVendors.controller.js
... ... @@ -53,7 +53,6 @@
53 53 }
54 54  
55 55 $scope.editMargin = function(vendor){
56   - console.log(vendor.masterMargin)
57 56 $scope.showLoader = true;
58 57 var companyMargin = "vendorName=" + vendor.vendorName + "&masterMargin=" + vendor.masterMargin
59 58 + "&addressOne=" + vendor.addressOne + "&addressTwo=" + vendor.addressTwo + "&city=" + vendor.city + "&state="
... ... @@ -132,8 +131,7 @@
132 131 + "&fuelerlinxCustomer=" + $scope.data.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.data.contractFuelVendor
133 132 + "&activate=" + $scope.data.activate + "&baseIcao=" + $scope.data.baseIcao;
134 133  
135   - FuelVendorsService.addVendor(vendorData).then(function(result) {
136   - console.log("result",result)
  134 + FuelVendorsService.addVendor($scope.data).then(function(result) {
137 135 $scope.accountId = result;
138 136 $('#vendor-modal-3').modal('hide');
139 137 getAllVendor();
... ...
app/partials/customers/customers.controller.js
... ... @@ -102,7 +102,7 @@
102 102 + "&fuelerlinxCustomer=" + customer.fuelerlinxCustomer + "&contractFuelVendor=" + customer.contractFuelVendor
103 103 + "&activate=" + customer.activate + "&baseIcao=" + customer.baseIcao + "&companyId=" + customer.id;
104 104  
105   - ViewCompanyService.updateContact(companyMargin).then(function(result) {
  105 + ViewCompanyService.updateCompany(companyMargin).then(function(result) {
106 106 if(result != null && result.success){
107 107 $scope.showLoader = false;
108 108 toastr.success(''+result.success+'', {
... ... @@ -169,29 +169,19 @@
169 169 $scope.showMarginError = true;
170 170 $('.marginSelectBox').addClass('customErrorInput');
171 171 }else{
172   - console.log($scope.data);
173   - companyData = "companyName=" + $scope.data.companyName + "&masterMargin=" + $scope.data.masterMargin
174   - + "&addressOne=" + $scope.data.addressOne + "&addressTwo=" + $scope.data.addressTwo + "&city=" + $scope.data.city + "&state="
175   - + $scope.data.state + "&country=" + $scope.data.country + "&zipcode=" + $scope.data.zipcode + "&internalNote="
176   - + $scope.data.internalNote + "&certificateType=" + $scope.data.certificateType + "&baseTenant=" + $scope.data.baseTenant
177   - + "&fuelerlinxCustomer=" + $scope.data.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.data.contractFuelVendor
178   - + "&activate=" + $scope.data.activate + "&baseIcao=" + $scope.data.baseIcao + "&avgasMargin=" + $scope.data.avgasMargin;
179   -
180   -
  172 + $scope.aircraftDetails = [{
  173 + 'tail':'',
  174 + 'make': '',
  175 + 'model': '',
  176 + 'sizeId' : '',
  177 + 'marginId': $scope.data.masterMargin,
  178 + 'avgasMarginId': $scope.data.avgasMargin
  179 + }];
  180 +
181 181 $(sel).trigger('next.m.' + step);
182 182 getData();
183 183 }
184 184 }
185   -
186   - $scope.aircraftDetails = [{
187   - 'tail':'',
188   - 'make': '',
189   - 'model': '',
190   - 'sizeId' : '',
191   - 'marginId': $scope.data.masterMargin,
192   - 'avgasMarginId': $scope.data.avgasMargin
193   - }];
194   -
195 185 $scope.addNew = function(){
196 186 $scope.aircraftDetails.push({
197 187 'tail':'',
... ... @@ -226,7 +216,7 @@
226 216 $scope.aircraftListData = {};
227 217 $scope.addData = [];
228 218 $scope.saveCompanyData = function(){
229   - CustomersService.addCompany(companyData).then(function(result) {
  219 + CustomersService.addCompany($scope.data).then(function(result) {
230 220 $scope.accountId = result;
231 221 $scope.aircraft.accountId = $scope.accountId;
232 222  
... ... @@ -243,6 +233,10 @@
243 233 $scope.aircraftListData.aircraftList = $scope.addData;
244 234 $scope.aircraftListData.accountId = $scope.aircraft.accountId;
245 235  
  236 + if($scope.aircraftListData.aircraftList[0].tail == "" || $scope.aircraftListData.aircraftList[0].make == null || $scope.aircraftListData.aircraftList[0].model == null){
  237 + $scope.aircraftListData.aircraftList = [];
  238 + }
  239 +
246 240 CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
247 241  
248 242 if(result != null && result.success){
... ... @@ -257,6 +251,7 @@
257 251 })
258 252 }
259 253 });
  254 +
260 255 })
261 256  
262 257  
... ...
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', 'ViewcontactService', function($scope , $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewcontactService) {
  7 + .controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewFuelVendorService', 'ViewcontactService', function($scope , $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewFuelVendorService, ViewcontactService) {
8 8 $scope.data = {};
9 9 $scope.data.priceEmail = true;
10 10 $scope.aircraft = {};
... ... @@ -255,12 +255,13 @@
255 255 + "&fuelerlinxCustomer=" + $scope.companyData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.companyData.contractFuelVendor
256 256 + "&activate=" + $scope.companyData.activate + "&baseIcao=" + $scope.companyData.baseIcao + "&companyId=" + companyId;
257 257  
258   - ViewCompanyService.updateContact(companyData).then(function(result) {
  258 + ViewCompanyService.updateCompany(companyData).then(function(result) {
259 259 if(result != null && result.success){
260 260 toastr.success(''+result.success+'', {
261 261 closeButton: true
262 262 })
263 263 $scope.showUpdateBtn = false;
  264 + getCompanyDetail();
264 265 }else{
265 266 toastr.error(''+result.statusText+'', {
266 267 closeButton: true
... ... @@ -505,6 +506,8 @@
505 506 }
506 507  
507 508 $scope.fuelerAcceptStatus = function(){
  509 + $('#fuelerchange').css('display', 'none');
  510 + $scope.showLoader = true;
508 511 var statusData;
509 512 if($scope.companyData.fuelerlinxCustomer == false){
510 513 statusData = "status=true";
... ... @@ -513,7 +516,7 @@
513 516 }
514 517 ViewCompanyService.fuelerPricingChange(companyId, statusData).then(function(result) {
515 518 if(result.success){
516   - $('#fuelerchange').css('display', 'none');
  519 + $scope.showLoader = false;
517 520  
518 521 $scope.editData();
519 522 getContactList();
... ... @@ -522,4 +525,25 @@
522 525 })
523 526 }
524 527  
  528 + $scope.updateOmit = function(fuel, omit) {
  529 + $scope.fuelData = {};
  530 + $scope.fuelData.expirationDate = new Date(fuel.expirationDate);
  531 + $scope.fuelData.id = fuel.id;
  532 + $scope.fuelData.omit = fuel.omit;
  533 + $scope.fuelData.papMargin = fuel.papMargin;
  534 + $scope.fuelData.papTotal = fuel.papTotal;
  535 + $scope.fuelData.cost = fuel.cost;
  536 + ViewFuelVendorService.omitFuelPricing($scope.fuelData).then(function(result) {
  537 + if(result.success){
  538 + toastr.success(''+result.success+'', {
  539 + closeButton: true
  540 + })
  541 + }else{
  542 + toastr.error(''+result.statusText+'', {
  543 + closeButton: true
  544 + })
  545 + }
  546 + })
  547 + }
  548 +
525 549 }]);
526 550 \ No newline at end of file
... ...
app/partials/viewCompany/viewCompany.html
... ... @@ -354,14 +354,14 @@
354 354 </tr>
355 355 </thead>
356 356 <tbody>
357   - <tr ng-repeat="fuel in fuelPricing">
358   - <td><input type="checkbox" ng-model="fuel.status"></td>
359   - <td>{{fuel.name}}</td>
360   - <td>${{fuel.fuelPricing.cost}}</td>
361   - <td>${{fuel.fuelPricing.papMargin}}</td>
362   - <td style="color:#55AF8B;">${{fuel.fuelPricing.papTotal}}</td>
363   - <td style="color:#F90">{{fuel.fuelPricing.expirationDate}}</td>
364   - </tr>
  357 + <tr ng-repeat="fuel in fuelPricing">
  358 + <td><input type="checkbox" ng-model="fuel.fuelPricing.omit" ng-change="updateOmit(fuel.fuelPricing, fuel.status)"></td>
  359 + <td>{{fuel.name}}</td>
  360 + <td>${{fuel.fuelPricing.cost}}</td>
  361 + <td>${{fuel.fuelPricing.papMargin}}</td>
  362 + <td style="color:#55AF8B;">${{fuel.fuelPricing.papTotal}}</td>
  363 + <td style="color:#F90">{{fuel.fuelPricing.expirationDate}}</td>
  364 + </tr>
365 365 </tbody>
366 366 </table>
367 367 </div>
... ...
app/partials/viewCompany/viewCompany.service.js
... ... @@ -150,7 +150,7 @@
150 150 return deferred.promise;
151 151 }
152 152  
153   - this.updateContact = function(data) {
  153 + this.updateCompany = function(data) {
154 154  
155 155 var deferred = $q.defer();
156 156 $http({
... ...
app/partials/viewFuelVendor/viewFuelVendor.controller.js
... ... @@ -38,9 +38,9 @@
38 38 $scope.changeCompanyStatus = function(){
39 39 $('#deleteVendor').css('display', 'block');
40 40 if($scope.vendorData.activate == true){
41   - $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this company?'
  41 + $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this Vendor?'
42 42 }else{
43   - $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this company?'
  43 + $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this Vendor?'
44 44 }
45 45 }
46 46  
... ... @@ -334,5 +334,26 @@
334 334 $scope.cancelToogle = function(){
335 335 $('#toogleMail').css('display', 'none');
336 336 }
  337 +
  338 + $scope.updateOmit = function(fuel, omit) {
  339 + $scope.fuelData = {};
  340 + $scope.fuelData.expirationDate = new Date(fuel.expirationDate);
  341 + $scope.fuelData.id = fuel.id;
  342 + $scope.fuelData.omit = fuel.omit;
  343 + $scope.fuelData.papMargin = fuel.papMargin;
  344 + $scope.fuelData.papTotal = fuel.papTotal;
  345 + $scope.fuelData.cost = fuel.cost;
  346 + ViewFuelVendorService.omitFuelPricing($scope.fuelData).then(function(result) {
  347 + if(result.success){
  348 + toastr.success(''+result.success+'', {
  349 + closeButton: true
  350 + })
  351 + }else{
  352 + toastr.error(''+result.statusText+'', {
  353 + closeButton: true
  354 + })
  355 + }
  356 + })
  357 + }
337 358  
338 359 }]);
339 360 \ No newline at end of file
... ...
app/partials/viewFuelVendor/viewFuelVendor.html
... ... @@ -129,7 +129,7 @@
129 129 <div class="widget-header">
130 130 <i class="fa fa-building-o" aria-hidden="true"></i>
131 131 <h3>{{vendorData.vendorName}} <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteVendor(vendorData.id)" aria-hidden="true"></i></h3>
132   - <i class="fa fa-times timess" ui-sref="app.customers" aria-hidden="true"></i>
  132 + <i class="fa fa-times timess" ui-sref="app.FuelVendors" aria-hidden="true"></i>
133 133 </div>
134 134 <!-- /widget-header -->
135 135 <div class="widget-content">
... ... @@ -232,7 +232,7 @@
232 232 </thead>
233 233 <tbody>
234 234 <tr ng-repeat="fuel in fuelPricing">
235   - <td><input type="checkbox" ng-model="fuel.status"></td>
  235 + <td><input type="checkbox" ng-model="fuel.fuelPricing.omit" ng-change="updateOmit(fuel.fuelPricing, fuel.status)"></td>
236 236 <td>{{fuel.name}}</td>
237 237 <td>${{fuel.fuelPricing.cost}}</td>
238 238 <td>${{fuel.fuelPricing.papMargin}}</td>
... ...
app/partials/viewFuelVendor/viewFuelVendor.service.js
... ... @@ -198,6 +198,23 @@
198 198 return deferred.promise;
199 199 }
200 200  
  201 + this.omitFuelPricing = function(data) {
  202 +
  203 + var deferred = $q.defer();
  204 + $http({
  205 + method : 'PUT',
  206 + url : BASE_URL.url +'/fuelPricing/omitFuelPricing',
  207 + headers : {'Content-Type': 'application/json'},
  208 + data: data
  209 + })
  210 + .then(function (result){
  211 + deferred.resolve(result.data);
  212 + },function (result){
  213 + deferred.resolve(result.data);
  214 + })
  215 + return deferred.promise;
  216 + }
  217 +
201 218 }
202 219  
203 220 })();
204 221 \ No newline at end of file
... ...