Commit 32286a73a1911394b6683bd7d0997e14969f19ba

Authored by Swarn Singh
1 parent ba1d39503c
Exists in master

tier issue resolved

app/css/custom.css
... ... @@ -690,4 +690,13 @@ font-size: 10px !important;
690 690 .myLoader img{
691 691 position: relative;
692 692 top: calc(50% - 25px);
  693 +}
  694 +.customErrorInput{
  695 + background-color: rgb(251, 227, 228);
  696 + border: 1px solid #fbc2c4;
  697 + color: #8a1f11;
  698 +}
  699 +.customErrorMessage{
  700 + color: #8a1f11;
  701 + font-weight: bold;
693 702 }
694 703 \ No newline at end of file
... ...
app/partials/customers/customers.controller.js
... ... @@ -61,17 +61,28 @@
61 61 CustomersService.getMargin().then(function(result) {
62 62 $scope.marginList = result;
63 63 })
  64 + $scope.showCompanyError = false;
  65 + $scope.showMarginError = false;
  66 +
  67 + $scope.removeValidation = function(){
  68 + console.log('key up');
  69 + $scope.showCompanyError = false;
  70 + $('.companyNameInput').removeClass('customErrorInput');
  71 + }
  72 +
  73 + $scope.removeMarginValidation = function(){
  74 + $scope.showMarginError = false;
  75 + $('.marginSelectBox').removeClass('customErrorInput');
  76 + }
64 77  
65 78 $scope.addFirstData = function(sel, step){
66 79 // console.log($scope.data)
67 80 if($scope.data.companyName == undefined){
68   - toastr.error('Please enter Company Name', {
69   - closeButton: true
70   - })
  81 + $scope.showCompanyError = true;
  82 + $('.companyNameInput').addClass('customErrorInput');
71 83 }else if($scope.data.masterMargin == undefined){
72   - toastr.error('Please select Master Margin', {
73   - closeButton: true
74   - })
  84 + $scope.showMarginError = true;
  85 + $('.marginSelectBox').addClass('customErrorInput');
75 86 }else{
76 87 var companyData = "companyName=" + $scope.data.companyName + "&masterMargin=" + $scope.data.masterMargin
77 88 + "&addressOne=" + $scope.data.addressOne + "&addressTwo=" + $scope.data.addressTwo + "&city=" + $scope.data.city + "&state="
... ...
app/partials/customers/customers.html
... ... @@ -238,14 +238,15 @@
238 238 <label class="new-input-label"><b>Company Name</b></label>
239 239 </div>
240 240 <div class="pull-left" style="margin-left: 15px;">
241   - <input type="text" ng-model="data.companyName" class="form-control" id="Address" placeholder="" required>
  241 + <input type="text" ng-model="data.companyName" class="form-control companyNameInput" ng-keyup="removeValidation()" placeholder="" required>
  242 + <label class="customErrorMessage" ng-show="showCompanyError">This field is required.</label>
242 243 </div>
243 244 <div class="clearfix"></div>
244 245 </div>
245 246 <div class="col-md-4">
246 247  
247 248 <div class="pull-right">
248   - <input type="text" ng-model="data.baseIcao" style="width: 100px;" class="form-control" id="Address" placeholder="">
  249 + <input type="text" ng-model="data.baseIcao" style="width: 100px;" class="form-control" placeholder="">
249 250 </div>
250 251 <div class="pull-right">
251 252 <label style="margin-right: 15px;" class="new-input-label"><b>Base ICAO</b></label>
... ... @@ -275,7 +276,8 @@
275 276 <b>Master Margin</b>
276 277 </div>
277 278 <div class="pull-left">
278   - <select class="form-control" ng-model="data.masterMargin" ng-options="margin.id as margin.marginName for margin in marginList" required></select>
  279 + <select class="form-control marginSelectBox" ng-model="data.masterMargin" ng-options="margin.id as margin.marginName for margin in marginList" required ng-change="removeMarginValidation()"></select>
  280 + <label ng-show="showMarginError" class="customErrorMessage">This field is required.</label>
279 281  
280 282 <!-- <select required class="form-control" style="max-width: 250px;" ng-model="data.masterMargin">
281 283 <option value="" disabled selected hidden>Select </option>
... ... @@ -310,7 +312,7 @@
310 312 <label class="new-input-label"><b>Address</b></label>
311 313 </div>
312 314 <div class="pull-left" style="width: calc(100% - 110px);">
313   - <input type="text" class="form-control" ng-model="data.addressOne" id="Address" placeholder="">
  315 + <input type="text" class="form-control" ng-model="data.addressOne" placeholder="">
314 316 </div>
315 317 <div class="clearfix"></div>
316 318 </div>
... ... @@ -323,7 +325,7 @@
323 325 <label class="new-input-label"><b>Address2</b></label>
324 326 </div>
325 327 <div class="pull-left" style="width: calc(100% - 110px);">
326   - <input type="text" ng-model="data.addressTwo" class="form-control" id="Address" placeholder="">
  328 + <input type="text" ng-model="data.addressTwo" class="form-control" placeholder="">
327 329 </div>
328 330 <div class="clearfix"></div>
329 331 </div>
... ... @@ -337,7 +339,7 @@
337 339 <label class="new-input-label"><b>City</b></label>
338 340 </div>
339 341 <div class="pull-left" style="width: calc(100% - 110px);">
340   - <input type="text" ng-model="data.city" class="form-control" id="Address" placeholder="">
  342 + <input type="text" ng-model="data.city" class="form-control" placeholder="">
341 343 </div>
342 344 <div class="clearfix"></div>
343 345 </div>
... ... @@ -346,7 +348,7 @@
346 348 <label class="new-input-label"><b>State</b></label>
347 349 </div>
348 350 <div class="pull-left" style="width: calc(100% - 110px);">
349   - <input type="text" ng-model="data.state" class="form-control" id="Address" placeholder="">
  351 + <input type="text" ng-model="data.state" class="form-control" placeholder="">
350 352 </div>
351 353 <div class="clearfix"></div>
352 354 </div>
... ... @@ -355,7 +357,7 @@
355 357 <label class="new-input-label"><b>Zip Code</b></label>
356 358 </div>
357 359 <div class="pull-right" style="width: calc(100% - 60px);">
358   - <input type="tel" ng-model="data.zipcode" class="form-control" id="Address" placeholder="">
  360 + <input type="tel" ng-model="data.zipcode" class="form-control" placeholder="">
359 361 </div>
360 362 <div class="clearfix"></div>
361 363 </div>
... ... @@ -369,7 +371,7 @@
369 371 <label class="new-input-label"><b>Country</b></label>
370 372 </div>
371 373 <div class="pull-left" style="width: calc(100% - 110px);">
372   - <input type="text" ng-model="data.country" class="form-control" id="Address" placeholder="">
  374 + <input type="text" ng-model="data.country" class="form-control" placeholder="">
373 375 </div>
374 376 <div class="clearfix"></div>
375 377 </div>
... ...
app/partials/updateFuelManager/updateFuelManager.controller.js
... ... @@ -6,7 +6,7 @@
6 6  
7 7  
8 8 .controller('updateFuelManagerController', ['$scope','$uibModal', 'updateFuelManagerService', function($scope , $uibModal, updateFuelManagerService) {
9   -
  9 + $scope.showLoader = true;
10 10 $scope.yes = function(data){
11 11 console.log('========');
12 12 console.log('value', data);
... ... @@ -21,12 +21,14 @@
21 21  
22 22 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
23 23 $scope.aTypeJets = result;
  24 + $scope.showLoader = false;
24 25 })
25 26 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) {
26 27 $scope.vTypeJets = result;
27   - console.log('second jets', result);
  28 + $scope.showLoader = false;
28 29 })
29 30 $scope.toggleJestAccordian = function(id, index){
  31 + $scope.showLoader = true;
30 32 $('.'+id).slideDown();
31 33 $('#'+id).addClass('customActive');
32 34 $('#'+id+' select, #'+id+' input').prop("disabled", false);
... ... @@ -35,9 +37,11 @@
35 37  
36 38 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
37 39 $scope.aTypeJets[index].tierList = tiers;
  40 + $scope.showLoader = false;
38 41 })
39 42 }
40 43 $scope.toggleVtypeJestAccordian = function(id, index){
  44 + $scope.showLoader = true;
41 45 $('.'+id).slideDown();
42 46 $('#'+id).addClass('customActive');
43 47 $('#'+id+' select, #'+id+' input').prop("disabled", false);
... ... @@ -46,10 +50,12 @@
46 50  
47 51 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
48 52 $scope.vTypeJets[index].tierList = tiers;
  53 + $scope.showLoader = false;
49 54 })
50 55 }
51 56 //$scope.trData = {};
52 57 $scope.addNewTier = function(id, trData, index){
  58 + $scope.showLoader = true;
53 59 $scope.tr = {};
54 60 $scope.tr[index] = {};
55 61 $scope.tr[index].minTierBreak = trData[index].minTierBreak;
... ... @@ -68,13 +74,16 @@
68 74 trData[index].minTierBreak = '';
69 75 trData[index].maxTierBreak = '';
70 76 trData[index].margin = '';
  77 +
71 78 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
72 79 $scope.aTypeJets[index].tierList = tiers;
  80 + $scope.showLoader = false;
73 81 })
74 82 })
75 83 }
76 84  
77 85 $scope.addNewVtypeTier = function(id, vtrData, index){
  86 + $scope.showLoader = true;
78 87 $scope.tr = {};
79 88 $scope.tr[index] = {};
80 89 $scope.tr[index].minTierBreak = vtrData[index].minTierBreak;
... ... @@ -95,11 +104,13 @@
95 104 vtrData[index].margin = '';
96 105 updateFuelManagerService.getJetTiers(id).then(function(tiers) {
97 106 $scope.vTypeJets[index].tierList = tiers;
  107 + $scope.showLoader = false;
98 108 })
99 109 })
100 110 }
101 111  
102   - $scope.editTier = function(tier){
  112 + $scope.editTier = function(tier, index){
  113 + $scope.showLoader = true;
103 114 var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+
104 115 '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id;
105 116  
... ... @@ -108,24 +119,58 @@
108 119 closeButton: true
109 120 })
110 121 updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) {
111   - $scope.tierList = tiers;
  122 + $scope.aTypeJets[index].tierList = tiers;
  123 + $scope.showLoader = false;
112 124 })
113 125 })
114 126  
115 127 }
116 128  
117   - $scope.deleteTier = function(id, jetid){
  129 + $scope.editVtypeTier = function(tier, index){
  130 + $scope.showLoader = true;
  131 + var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+
  132 + '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id;
  133 +
  134 + updateFuelManagerService.editTier(editTierData).then(function(result) {
  135 + toastr.success('Successfully Updated', {
  136 + closeButton: true
  137 + })
  138 + updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) {
  139 + $scope.vTypeJets[index].tierList = tiers;
  140 + $scope.showLoader = false;
  141 + })
  142 + })
  143 +
  144 + }
  145 +
  146 + $scope.deleteTier = function(id, jetid, index){
  147 + $scope.showLoader = true;
118 148 updateFuelManagerService.deleteTier(id).then(function(result) {
119 149 toastr.success(''+result.success+'', {
120 150 closeButton: true
121 151 })
122 152 updateFuelManagerService.getJetTiers(jetid).then(function(tiers) {
123   - $scope.tierList = tiers;
  153 + $scope.aTypeJets[index].tierList = tiers;
  154 + $scope.showLoader = false;
  155 + })
  156 + })
  157 + }
  158 +
  159 + $scope.deleteVtypeTier = function(id, jetid, index){
  160 + $scope.showLoader = true;
  161 + updateFuelManagerService.deleteTier(id).then(function(result) {
  162 + toastr.success(''+result.success+'', {
  163 + closeButton: true
  164 + })
  165 + updateFuelManagerService.getJetTiers(jetid).then(function(tiers) {
  166 + $scope.vTypeJets[index].tierList = tiers;
  167 + $scope.showLoader = false;
124 168 })
125 169 })
126 170 }
127 171  
128 172 $scope.saveJetAccordian = function(jets){
  173 + $scope.showLoader = true;
129 174 $scope.jetsDetail = jets;
130 175 $scope.jetsDetail.userProfileId = $scope.userProfileId;
131 176 //console.log('jets', $scope.jetsDetail);
... ... @@ -145,12 +190,14 @@
145 190 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
146 191 console.log('result', result);
147 192 $scope.aTypeJets = result;
  193 + $scope.showLoader = false;
148 194 })
149 195 })
150 196  
151 197 }
152 198  
153 199 $scope.saveVtypeJetAccordian = function(jets){
  200 + $scope.showLoader = true;
154 201 $scope.jetsDetail = jets;
155 202 $scope.jetsDetail.userProfileId = $scope.userProfileId;
156 203 //console.log('jets', $scope.jetsDetail);
... ... @@ -170,6 +217,7 @@
170 217 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) {
171 218 $scope.vTypeJets = result;
172 219 console.log('second jets', result);
  220 + $scope.showLoader = false;
173 221 })
174 222 })
175 223  
... ... @@ -188,6 +236,7 @@
188 236 //$scope.newJet.productType = '';
189 237  
190 238 $scope.addNewATypeJet = function(){
  239 + $scope.showLoader = true;
191 240 $scope.newJet.productType = 'JET-A';
192 241 $scope.newJet.userProfileId = $scope.userProfileId;
193 242  
... ... @@ -202,6 +251,7 @@
202 251 updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
203 252 console.log('result', result);
204 253 $scope.aTypeJets = result;
  254 + $scope.showLoader = false;
205 255 })
206 256 })
207 257 }
... ... @@ -217,6 +267,7 @@
217 267 }
218 268  
219 269 $scope.addNewVTypeJet = function(){
  270 + $scope.showLoader = true;
220 271 $scope.newVtypeJet.productType = 'AVGAS';
221 272 $scope.newVtypeJet.userProfileId = $scope.userProfileId;
222 273  
... ... @@ -230,7 +281,7 @@
230 281 $('.addNewVtype').css('display', 'none');
231 282 updateFuelManagerService.getVTypeJets($scope.userProfileId).then(function(result) {
232 283 $scope.vTypeJets = result;
233   -
  284 + $scope.showLoader = false;
234 285 })
235 286 })
236 287  
... ...
app/partials/updateFuelManager/updateFuelManager.html
... ... @@ -3,6 +3,9 @@
3 3 color: #ff9900;
4 4 }
5 5 </style>
  6 +<div class="myLoader" ng-show="showLoader">
  7 + <img src="../img/hourglass.gif" width="50px;">
  8 +</div>
6 9 <div class="container">
7 10 <div class="row">
8 11 <div class="col-md-5">
... ... @@ -112,9 +115,9 @@
112 115  
113 116 <span class="pull-right maxTierSpan" ng-hide="showEditTier">(${{tier.marginTotal}})</span>
114 117  
115   - <button class="addTierBtn" ng-click="editTier(tier)" ng-show="showEditTier">Save</button>
  118 + <button class="addTierBtn" ng-click="editTier(tier, $parent.$index)" ng-show="showEditTier">Save</button>
116 119  
117   - <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteTier(tier.id, jets.id)" aria-hidden="true" ng-show="showEditTier"></i>
  120 + <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteTier(tier.id, jets.id, $parent.$index)" aria-hidden="true" ng-show="showEditTier"></i>
118 121  
119 122 <div class="clearfix"></div>
120 123 </div>
... ... @@ -268,9 +271,9 @@
268 271  
269 272 <span class="pull-right maxTierSpan" ng-hide="showEditTier">(${{tier.marginTotal}})</span>
270 273  
271   - <button class="addTierBtn" ng-click="editTier(tier)" ng-show="showEditTier">Save</button>
  274 + <button class="addTierBtn" ng-click="editVtypeTier(tier, $parent.$index)" ng-show="showEditTier">Save</button>
272 275  
273   - <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteTier(tier.id, jets.id)" aria-hidden="true" ng-show="showEditTier"></i>
  276 + <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteVtypeTier(tier.id, jets.id, $parent.$index)" aria-hidden="true" ng-show="showEditTier"></i>
274 277  
275 278 <div class="clearfix"></div>
276 279 </div>
... ...