Commit 1097c2ce17125431bbec6768b8c1ab6e7ee37878

Authored by Swarn Singh
1 parent e8983332d0
Exists in master

margin module add, edit and ui done

app/partials/fuelManager/fuelManager.service.js
... ... @@ -54,7 +54,7 @@
54 54 }
55 55  
56 56 this.updateFullList = function(data){
57   - console.log('service data', data);
  57 +
58 58 var deferred = $q.defer();
59 59 $http({
60 60 method : 'POST',
... ...
app/partials/updateFuelManager/updateFuelManager.controller.js
... ... @@ -5,8 +5,8 @@
5 5 angular.module('acufuel')
6 6  
7 7  
8   - .controller('updateFuelManagerController', ['$scope','$uibModal', function($scope , $uibModal) {
9   - console.log("$uibModal",$uibModal);
  8 + .controller('updateFuelManagerController', ['$scope','$uibModal', 'updateFuelManagerService', function($scope , $uibModal, updateFuelManagerService) {
  9 +
10 10 $scope.yes = function(data){
11 11 console.log('========');
12 12 console.log('value', data);
... ... @@ -17,128 +17,93 @@
17 17 })
18 18 }
19 19  
20   - $(document).ready(function(){
21   - $('#customTabToggle1').click(function(){
22   - console.log('tab 1');
23   - $('#customTabsBody1').slideDown();
24   - $('#customTabsBody2').slideUp();
25   - $('#customTabsBody3').slideUp();
26   - $('#customTabsBody4').slideUp();
27   - $('#customTabs1').addClass('customActive');
28   - $('#customTabs2').removeClass('customActive');
29   - $('#customTabs3').removeClass('customActive');
30   - $('#customTabs4').removeClass('customActive');
31   - $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
32   - $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
33   -
34   - $('#customTabs1 > .pull-right > .btn-default').css('display', 'none');
35   - $('#customTabs1 > .pull-right > .btn-success').css('display', 'inline-block');
36   - $('#customTabs1 > .pull-right > .btn-danger').css('display', 'inline-block');
37   -
38   - $('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block');
39   - $('#customTabs2 > .pull-right > .btn-success').css('display', 'none');
40   - $('#customTabs2 > .pull-right > .btn-danger').css('display', 'none');
41   -
42   - $('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block');
43   - $('#customTabs3 > .pull-right > .btn-success').css('display', 'none');
44   - $('#customTabs3 > .pull-right > .btn-danger').css('display', 'none');
45   -
46   - $('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block');
47   - $('#customTabs4 > .pull-right > .btn-success').css('display', 'none');
48   - $('#customTabs4 > .pull-right > .btn-danger').css('display', 'none');
  20 + $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'));
49 21  
50   - })
51   - $('#customTabToggle2').click(function(){
52   - console.log('tab 2');
53   - $('#customTabsBody1').slideUp();
54   - $('#customTabsBody2').slideDown();
55   - $('#customTabsBody3').slideUp();
56   - $('#customTabsBody4').slideUp();
57   - $('#customTabs1').removeClass('customActive');
58   - $('#customTabs2').addClass('customActive');
59   - $('#customTabs3').removeClass('customActive');
60   - $('#customTabs4').removeClass('customActive');
61   - $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
62   - $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
63   -
64   - $('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block');
65   - $('#customTabs1 > .pull-right > .btn-success').css('display', 'none');
66   - $('#customTabs1 > .pull-right > .btn-danger').css('display', 'none');
67   -
68   - $('#customTabs2 > .pull-right > .btn-default').css('display', 'none');
69   - $('#customTabs2 > .pull-right > .btn-success').css('display', 'inline-block');
70   - $('#customTabs2 > .pull-right > .btn-danger').css('display', 'inline-block');
71   -
72   - $('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block');
73   - $('#customTabs3 > .pull-right > .btn-success').css('display', 'none');
74   - $('#customTabs3 > .pull-right > .btn-danger').css('display', 'none');
75   -
76   - $('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block');
77   - $('#customTabs4 > .pull-right > .btn-success').css('display', 'none');
78   - $('#customTabs4 > .pull-right > .btn-danger').css('display', 'none');
  22 + updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
  23 + console.log('result', result);
  24 + $scope.aTypeJets = result;
  25 + })
  26 +
  27 + $scope.toggleJestAccordian = function(id){
  28 + $('.'+id).slideDown();
  29 + $('#'+id).addClass('customActive');
  30 + $('#'+id+' select, #'+id+' input').prop("disabled", false);
  31 + $('#'+id+' .btn-success, #'+id+' .btn-danger').css('display', 'inline-block');
  32 + $('#'+id+' .btn-default').css('display', 'none');
  33 + }
79 34  
  35 + $scope.saveJetAccordian = function(jets){
  36 + $scope.jetsDetail = jets;
  37 + $scope.jetsDetail.userProfileId = $scope.userProfileId;
  38 + //console.log('jets', $scope.jetsDetail);
  39 + $('.'+$scope.jetsDetail.id).slideUp();
  40 + $('#'+$scope.jetsDetail.id).removeClass('customActive');
  41 + $('#'+$scope.jetsDetail.id+' select, #'+$scope.jetsDetail.id+' input').prop("disabled", true);
  42 + $('#'+$scope.jetsDetail.id+' .btn-success, #'+$scope.jetsDetail.id+' .btn-danger').css('display', 'none');
  43 + $('#'+$scope.jetsDetail.id+' .btn-default').css('display', 'inline-block');
  44 +
  45 + var editJetData = 'productType='+$scope.jetsDetail.productType+'&marginName='+$scope.jetsDetail.marginName+'&pricingStructure='+$scope.jetsDetail.pricingStructure+'&marginValue='+$scope.jetsDetail.marginValue+'&userProfileId='+$scope.jetsDetail.userProfileId+'&marginId='+$scope.jetsDetail.id;
  46 +
  47 + updateFuelManagerService.editAtypeJetMargin(editJetData).then(function(result) {
  48 + console.log('newJet', editJetData);
  49 + toastr.success('Successfully Updated', {
  50 + closeButton: true
  51 + })
  52 + updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
  53 + console.log('result', result);
  54 + $scope.aTypeJets = result;
  55 + })
80 56 })
81   - $('#customTabToggle3').click(function(){
82   - console.log('tab 3');
83   - $('#customTabsBody1').slideUp();
84   - $('#customTabsBody2').slideUp();
85   - $('#customTabsBody3').slideDown();
86   - $('#customTabsBody4').slideUp();
87   - $('#customTabs1').removeClass('customActive');
88   - $('#customTabs2').removeClass('customActive');
89   - $('#customTabs3').addClass('customActive');
90   - $('#customTabs4').removeClass('customActive');
91   - $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
92   - $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
93   -
94   - $('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block');
95   - $('#customTabs1 > .pull-right > .btn-success').css('display', 'none');
96   - $('#customTabs1 > .pull-right > .btn-danger').css('display', 'none');
97   -
98   - $('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block');
99   - $('#customTabs2 > .pull-right > .btn-success').css('display', 'none');
100   - $('#customTabs2 > .pull-right > .btn-danger').css('display', 'none');
101   -
102   - $('#customTabs3 > .pull-right > .btn-default').css('display', 'none');
103   - $('#customTabs3 > .pull-right > .btn-success').css('display', 'inline-block');
104   - $('#customTabs3 > .pull-right > .btn-danger').css('display', 'inline-block');
105   -
106   - $('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block');
107   - $('#customTabs4 > .pull-right > .btn-success').css('display', 'none');
108   - $('#customTabs4 > .pull-right > .btn-danger').css('display', 'none');
109 57  
  58 + }
  59 +
  60 + $scope.addNewMarginBtn = function(){
  61 + $('.addNewMargin').css('display', 'block');
  62 + }
  63 + $scope.closeMarginPopup = function(){
  64 + $('.addNewMargin').css('display', 'none');
  65 + }
  66 +
  67 + $scope.newJet = {};
  68 + $scope.newJet.productType = '';
  69 +
  70 + $scope.addNewATypeJet = function(){
  71 + $scope.newJet.productType = 'JET-A';
  72 + $scope.newJet.userProfileId = $scope.userProfileId;
  73 +
  74 + var jetData = 'productType='+$scope.newJet.productType+'&marginName='+$scope.newJet.marginName+'&pricingStructure='+$scope.newJet.pricingStructure+'&marginValue='+$scope.newJet.marginValue+'&userProfileId='+$scope.newJet.userProfileId;
  75 +
  76 + updateFuelManagerService.addNewAtypeJetMargin(jetData).then(function(result) {
  77 + console.log('newJet', jetData);
  78 + toastr.success('Successfully Added', {
  79 + closeButton: true
  80 + })
  81 + $('.addNewMargin').css('display', 'none');
  82 + updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
  83 + console.log('result', result);
  84 + $scope.aTypeJets = result;
  85 + })
110 86 })
111   - $('#customTabToggle4').click(function(){
112   - console.log('tab 4');
113   - $('#customTabsBody1').slideUp();
114   - $('#customTabsBody2').slideUp();
115   - $('#customTabsBody3').slideUp();
116   - $('#customTabsBody4').slideDown();
117   - $('#customTabs1').removeClass('customActive');
118   - $('#customTabs2').removeClass('customActive');
119   - $('#customTabs3').removeClass('customActive');
120   - $('#customTabs4').addClass('customActive');
121   - $('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
122   - $('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
123   -
124   - $('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block');
125   - $('#customTabs1 > .pull-right > .btn-success').css('display', 'none');
126   - $('#customTabs1 > .pull-right > .btn-danger').css('display', 'none');
127   -
128   - $('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block');
129   - $('#customTabs2 > .pull-right > .btn-success').css('display', 'none');
130   - $('#customTabs2 > .pull-right > .btn-danger').css('display', 'none');
131   -
132   - $('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block');
133   - $('#customTabs3 > .pull-right > .btn-success').css('display', 'none');
134   - $('#customTabs3 > .pull-right > .btn-danger').css('display', 'none');
135   -
136   - $('#customTabs4 > .pull-right > .btn-default').css('display', 'none');
137   - $('#customTabs4 > .pull-right > .btn-success').css('display', 'inline-block');
138   - $('#customTabs4 > .pull-right > .btn-danger').css('display', 'inline-block');
  87 + }
139 88  
  89 + /* $scope.addNewATypeJet = function(){
  90 + $scope.newJet.productType = 'JET-A';
  91 + $scope.newJet.userProfileId = $scope.userProfileId;
  92 +
  93 + var jetData = 'productType='+$scope.newJet.productType+'&marginName='+$scope.newJet.marginName+'&pricingStructure='+$scope.newJet.pricingStructure+'&marginValue='+$scope.newJet.marginValue+'&userProfileId='+$scope.newJet.userProfileId;
  94 +
  95 + updateFuelManagerService.addNewAtypeJetMargin(jetData).then(function(result) {
  96 + console.log('newJet', jetData);
  97 + toastr.success('Successfully Added', {
  98 + closeButton: true
  99 + })
  100 + $('.addNewMargin').css('display', 'none');
  101 + updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) {
  102 + console.log('result', result);
  103 + $scope.aTypeJets = result;
  104 + })
140 105 })
141   - })
  106 + }*/
142 107  
143 108  
144 109 }]);
... ...
app/partials/updateFuelManager/updateFuelManager.html
... ... @@ -64,7 +64,7 @@
64 64 <i class="fa fa-pencil"></i>
65 65 <h3><b>JET-A</b> Customer Margin Template</h3>
66 66 <div class="pull-right">
67   - <button type="submit" class="btn btn-success btn-sm"><i class="icon-ok"></i>+ &nbsp Add Aircraft</button>
  67 + <button type="submit" class="btn btn-success btn-sm" ng-click="addNewMarginBtn()" style="margin-top: 4px; margin-right: 10px;"><i class="icon-ok"></i>+ &nbsp Add Aircraft</button>
68 68 </div>
69 69 </div>
70 70 <!-- /widget-header -->
... ... @@ -72,69 +72,72 @@
72 72 <section id="accordions">
73 73 <div class="newCustomAccordian">
74 74 <!-- tab 1 -->
75   - <div class="customAccordianHeader customActive" id="customTabs1">
76   - <span>Jet Aircraft</span>
77   - <select class="form-control">
78   - <option>Pricing Structure</option>
79   - <option>Retail-(minus)</option>
80   - <option>Cost+(plus)</option>
81   - <option>Direct=(equals)</option>
82   - </select>
83   - <input type="text" name="" class="form-control" value="$1.7500">
84   - <div class="pull-right">
85   - <button class="btn btn-success">Save</button>
86   - <button class="btn btn-danger">Delete</button>
87   - <button class="btn btn-default" id="customTabToggle1" style="display: none;">Edit</button>
  75 + <div ng-repeat="jets in aTypeJets">
  76 + <div class="customAccordianHeader" id="{{jets.id}}">
  77 + <span>{{jets.marginName}}</span>
  78 + <select class="form-control" disabled="true" ng-model="jets.pricingStructure">
  79 + <option value="" disabled selected>Pricing Structure</option>
  80 + <option value="minus">Retail-(minus)</option>
  81 + <option value="plus">Cost+(plus)</option>
  82 + <option value="equal">Direct=(equal)</option>
  83 + </select>
  84 + <span style="margin-right: 0;">$</span>
  85 + <input type="text" disabled="true" class="form-control" ng-model="jets.marginValue">
  86 + <div class="pull-right">
  87 + <button class="btn btn-success" style="display: none;" ng-click="saveJetAccordian(jets)">Save</button>
  88 + <button class="btn btn-danger" style="display: none;" ng-click="deleteJetAccordian(jets.id)">Delete</button>
  89 + <button class="btn btn-default" ng-click="toggleJestAccordian(jets.id)">Edit</button>
  90 + </div>
  91 + <div class="clearfix"></div>
  92 + </div>
  93 + <div class="customAccordianTabBody {{jets.id}}" style="display: none;">
  94 + <table class="customTableWithFilter">
  95 + <thead>
  96 + <tr>
  97 + <th>
  98 + <span class="pull-left">1-250 gal.</span>
  99 + <i class="fa fa-pencil-square-o pull-right" aria-hidden="true"></i>
  100 + </th>
  101 + <th>
  102 + <span class="pull-left">1-250 gal.</span>
  103 + <i class="fa fa-pencil-square-o pull-right" aria-hidden="true"></i>
  104 + </th>
  105 + <th>
  106 + <input type="text" placeholder="min" name=""> -
  107 + <input type="text" placeholder="max" name="">
  108 + <span>gal.</span>
  109 + </th>
  110 + <th> &nbsp; </th>
  111 + </tr>
  112 + </thead>
  113 + <tbody>
  114 + <tr>
  115 + <td>
  116 + <span class="pull-left">-$0.0000</span> &nbsp;
  117 + <span class="pull-right">($1.7500)</span>
  118 + </td>
  119 + <td>
  120 + <span class="pull-left">-$0.0000</span> &nbsp;
  121 + <span class="pull-right">($1.7500)</span>
  122 + </td>
  123 + <td>
  124 + <span>$</span>
  125 + <input type="text" placeholder="margin" class="tierTextBox" name="">
  126 + <button class="addTierButton">Add Tier</button>
  127 + </td>
  128 + <td>
  129 + <i class="fa fa-trash-o" aria-hidden="true"></i>
  130 + </td>
  131 + </tr>
  132 + </tbody>
  133 + </table>
  134 + <textarea class="form-control resizeTextarea" placeholder="Message..."></textarea>
88 135 </div>
89   - <div class="clearfix"></div>
90   - </div>
91   - <div class="customAccordianTabBody" id="customTabsBody1">
92   - <table class="customTableWithFilter">
93   - <thead>
94   - <tr>
95   - <th>
96   - <span class="pull-left">1-250 gal.</span>
97   - <i class="fa fa-pencil-square-o pull-right" aria-hidden="true"></i>
98   - </th>
99   - <th>
100   - <span class="pull-left">1-250 gal.</span>
101   - <i class="fa fa-pencil-square-o pull-right" aria-hidden="true"></i>
102   - </th>
103   - <th>
104   - <input type="text" placeholder="min" name=""> -
105   - <input type="text" placeholder="max" name="">
106   - <span>gal.</span>
107   - </th>
108   - <th> &nbsp; </th>
109   - </tr>
110   - </thead>
111   - <tbody>
112   - <tr>
113   - <td>
114   - <span class="pull-left">-$0.0000</span> &nbsp;
115   - <span class="pull-right">($1.7500)</span>
116   - </td>
117   - <td>
118   - <span class="pull-left">-$0.0000</span> &nbsp;
119   - <span class="pull-right">($1.7500)</span>
120   - </td>
121   - <td>
122   - <span>$</span>
123   - <input type="text" placeholder="margin" class="tierTextBox" name="">
124   - <button class="addTierButton">Add Tier</button>
125   - </td>
126   - <td>
127   - <i class="fa fa-trash-o" aria-hidden="true"></i>
128   - </td>
129   - </tr>
130   - </tbody>
131   - </table>
132   - <textarea class="form-control resizeTextarea" placeholder="Message..."></textarea>
133 136 </div>
134 137  
135 138 <!-- tab 2 -->
136 139  
137   - <div class="customAccordianHeader" id="customTabs2">
  140 + <!-- <div class="customAccordianHeader" id="customTabs2">
138 141 <span>Jet Aircraft</span>
139 142 <select class="form-control" disabled="true">
140 143 <option>Pricing Structure</option>
... ... @@ -192,11 +195,11 @@
192 195 </tbody>
193 196 </table>
194 197 <textarea class="form-control resizeTextarea" placeholder="Message..."></textarea>
195   - </div>
  198 + </div> -->
196 199  
197 200 <!-- tab 3 -->
198 201  
199   - <div class="customAccordianHeader" id="customTabs3">
  202 + <!-- <div class="customAccordianHeader" id="customTabs3">
200 203 <span>Jet Aircraft</span>
201 204 <select class="form-control" disabled="true">
202 205 <option>Pricing Structure</option>
... ... @@ -254,11 +257,11 @@
254 257 </tbody>
255 258 </table>
256 259 <textarea class="form-control resizeTextarea" placeholder="Message..."></textarea>
257   - </div>
  260 + </div> -->
258 261  
259 262 <!-- tab 4 -->
260 263  
261   - <div class="customAccordianHeader" id="customTabs4">
  264 + <!-- <div class="customAccordianHeader" id="customTabs4">
262 265 <span>Jet Aircraft</span>
263 266 <select class="form-control" disabled="true">
264 267 <option>Pricing Structure</option>
... ... @@ -316,7 +319,7 @@
316 319 </tbody>
317 320 </table>
318 321 <textarea class="form-control resizeTextarea" placeholder="Message..."></textarea>
319   - </div>
  322 + </div> -->
320 323  
321 324  
322 325 </div>
... ... @@ -574,6 +577,49 @@
574 577 </div>
575 578 </div>
576 579 </div> <!-- /container -->
  580 +
  581 +
  582 +<div class="addNewMargin" style="display: none;">
  583 + <div class="customBackdrop">
  584 + <div class="customModalInner" style="max-width: 700px;">
  585 + <div class="customModelHead">
  586 + <p class="pull-left">
  587 + <i class="fa fa-list-alt" aria-hidden="true"></i>
  588 + Add New JET-A Customer Margin
  589 + </p>
  590 + <p class="pull-right">
  591 + <i class="fa fa-times" aria-hidden="true" style="cursor: pointer;" ng-click="closeMarginPopup()"></i>
  592 + </p>
  593 + <div class="clearfix"></div>
  594 + </div>
  595 + <div class="customModelBody">
  596 +
  597 + <div class="customAccordianHeader customActive">
  598 + <input type="text" class="form-control" style="width: 120px; margin-right: 10px;" placeholder="Margin Name" ng-model="newJet.marginName">
  599 + <select class="form-control" ng-model="newJet.pricingStructure">
  600 + <option value="" disabled selected>Pricing Structure</option>
  601 + <option value="minus">Retail-(minus)</option>
  602 + <option value="plus">Cost+(plus)</option>
  603 + <option value="equal">Direct=(equal)</option>
  604 + </select>
  605 + <span style="margin-right: 0;">$</span>
  606 + <input type="text" class="form-control" style="width: 120px;" placeholder="Margin Price" ng-model="newJet.marginValue">
  607 + <div class="clearfix"></div>
  608 + </div>
  609 + <div class="customAccordianTabBody">
  610 + <textarea class="form-control resizeTextarea" placeholder="Message..."></textarea>
  611 + </div>
  612 +
  613 + </div>
  614 + <div class="customModelFooter text-center">
  615 + <input type="submit" value="Save" class="btn" ng-click="addNewATypeJet()">
  616 + <button class="btn" ng-click="closeMarginPopup()">Cancel</button>
  617 + </div>
  618 + </div>
  619 + </div>
  620 +</div>
  621 +
  622 +
577 623 <!-- Le javascript
578 624 ================================================== -->
579 625 <!-- Placed at the end of the document so the pages load faster -->
... ...
app/partials/updateFuelManager/updateFuelManager.service.js
1 1 (function(){
2 2 'use strict';
3 3 angular.module('acufuel')
4   - .service('updateFuelManagerService', ['$q', '$http', 'BE', updateFuelManagerService]);
  4 + .service('updateFuelManagerService', ['$q', '$http', 'BASE_URL', updateFuelManagerService]);
5 5  
6   - function updateFuelManagerService($q, $http, BE) {
  6 + function updateFuelManagerService($q, $http, BASE_URL) {
7 7 var temp = {};
8 8  
9   -
  9 + this.getATypeJets = function(id) {
  10 +
  11 + var deferred = $q.defer();
  12 + $http({
  13 + method : 'GET',
  14 + url : BASE_URL.url +'/margin/getJetAType/'+id,
  15 + headers : {'Content-Type': 'application/json'},
  16 + })
  17 + .then(function (result){
  18 + deferred.resolve(result.data);
  19 + },function (result){
  20 + deferred.resolve(result.data);
  21 + })
  22 + return deferred.promise;
  23 + }
  24 +
  25 + this.addNewAtypeJetMargin = function(data){
  26 + var deferred = $q.defer();
  27 + $http({
  28 + method : 'POST',
  29 + url : BASE_URL.url +'/margin',
  30 + headers : {'Content-Type': 'application/json'},
  31 + data: data
  32 + })
  33 + .then(function (result){
  34 + deferred.resolve(result.data);
  35 + },function (result){
  36 + deferred.resolve(result.data);
  37 + })
  38 + return deferred.promise;
  39 + }
  40 +
  41 + this.editAtypeJetMargin = function(data){
  42 + var deferred = $q.defer();
  43 + $http({
  44 + method : 'PUT',
  45 + url : BASE_URL.url +'/margin',
  46 + headers : {'Content-Type': 'application/json'},
  47 + data: data
  48 + })
  49 + .then(function (result){
  50 + deferred.resolve(result.data);
  51 + },function (result){
  52 + deferred.resolve(result.data);
  53 + })
  54 + return deferred.promise;
  55 + }
10 56  
11 57 }
12 58  
... ...