Commit 05c2f6fb3bcf2961c17df3d0439d64c0078bab4d
1 parent
1097c2ce17
Exists in
master
margin module and tier module Done
Showing
4 changed files
with
218 additions
and
42 deletions
Show diff stats
app/css/custom.css
... | ... | @@ -611,4 +611,61 @@ font-size: 10px !important; |
611 | 611 | } |
612 | 612 | .customConfirmPopBackdrop .customModalInner{ |
613 | 613 | top: 30%; |
614 | +} | |
615 | + | |
616 | + | |
617 | + | |
618 | +/* tier list table */ | |
619 | + | |
620 | +.tierListWrap{ | |
621 | + width: 120px; | |
622 | + height: auto; | |
623 | + float: left; | |
624 | +} | |
625 | +.tierListHead{ | |
626 | + width: 100%; | |
627 | + padding: 5px; | |
628 | + background-color: #f3f3f3; | |
629 | + border: 1px solid #ddd; | |
630 | + border-right: none; | |
631 | +} | |
632 | +.tierListBody{ | |
633 | + width: 100%; | |
634 | + padding: 5px; | |
635 | + border: 1px solid #ddd; | |
636 | + border-top: none; | |
637 | + border-right: none; | |
638 | +} | |
639 | +.minTierSpan{ | |
640 | + color: #449d44; | |
641 | + font-weight: bold; | |
642 | + font-size: 11px; | |
643 | +} | |
644 | +.maxTierSpan{ | |
645 | + color: #c9302c; | |
646 | + font-style: italic; | |
647 | + font-size: 11px; | |
648 | + font-weight: bold; | |
649 | +} | |
650 | +.tierHeadingSpan{ | |
651 | + font-size: 11px; | |
652 | + color: #222; | |
653 | + font-weight: bold; | |
654 | +} | |
655 | +.tierListHead input{ | |
656 | + width: 50px; | |
657 | + height: 24px; | |
658 | +} | |
659 | +.addTierBtn{ | |
660 | + color: #fff; | |
661 | + background-color: #2196f3; | |
662 | + border: none; | |
663 | + padding: 1px 5px; | |
664 | +} | |
665 | +.deleteTierIcon{ | |
666 | + color: #fff; | |
667 | + background-color: #c9302c; | |
668 | + padding: 5px; | |
669 | + border-radius: 3px; | |
670 | + cursor: pointer; | |
614 | 671 | } |
615 | 672 | \ No newline at end of file | ... | ... |
app/partials/updateFuelManager/updateFuelManager.controller.js
... | ... | @@ -20,16 +20,63 @@ |
20 | 20 | $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')); |
21 | 21 | |
22 | 22 | updateFuelManagerService.getATypeJets($scope.userProfileId).then(function(result) { |
23 | - console.log('result', result); | |
24 | 23 | $scope.aTypeJets = result; |
25 | 24 | }) |
26 | - | |
27 | 25 | $scope.toggleJestAccordian = function(id){ |
28 | 26 | $('.'+id).slideDown(); |
29 | 27 | $('#'+id).addClass('customActive'); |
30 | 28 | $('#'+id+' select, #'+id+' input').prop("disabled", false); |
31 | 29 | $('#'+id+' .btn-success, #'+id+' .btn-danger').css('display', 'inline-block'); |
32 | 30 | $('#'+id+' .btn-default').css('display', 'none'); |
31 | + | |
32 | + updateFuelManagerService.getJetTiers(id).then(function(tiers) { | |
33 | + $scope.tierList = tiers; | |
34 | + }) | |
35 | + } | |
36 | + $scope.tr = {}; | |
37 | + $scope.addNewTier = function(id){ | |
38 | + $scope.tr.marginTotal = '1.00'; | |
39 | + $scope.tr.marginTemplateId = id; | |
40 | + | |
41 | + var tierData = 'minTierBreak='+$scope.tr.minTierBreak+'&maxTierBreak='+$scope.tr.maxTierBreak+'&margin='+$scope.tr.margin+ | |
42 | + '&marginTotal='+$scope.tr.marginTotal+'&marginTemplateId='+$scope.tr.marginTemplateId; | |
43 | + | |
44 | + updateFuelManagerService.addNewTier(tierData).then(function(result) { | |
45 | + toastr.success('Successfully Added', { | |
46 | + closeButton: true | |
47 | + }) | |
48 | + $scope.tr = {}; | |
49 | + updateFuelManagerService.getJetTiers(id).then(function(tiers) { | |
50 | + $scope.tierList = tiers; | |
51 | + }) | |
52 | + }) | |
53 | + } | |
54 | + | |
55 | + $scope.editTier = function(tier){ | |
56 | + var editTierData = 'minTierBreak='+tier.minTierBreak+'&maxTierBreak='+tier.maxTierBreak+'&margin='+tier.margin+ | |
57 | + '&marginTotal='+tier.marginTotal+'&marginTemplateId='+tier.marginTemplate.id+'&marginId='+tier.id; | |
58 | + | |
59 | + updateFuelManagerService.editTier(editTierData).then(function(result) { | |
60 | + toastr.success('Successfully Updated', { | |
61 | + closeButton: true | |
62 | + }) | |
63 | + updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) { | |
64 | + $scope.tierList = tiers; | |
65 | + }) | |
66 | + }) | |
67 | + | |
68 | + } | |
69 | + | |
70 | + $scope.deleteTier = function(id){ | |
71 | + console.log('delete id', id); | |
72 | + updateFuelManagerService.deleteTier(id).then(function(result) { | |
73 | + toastr.success('Successfully Deleted', { | |
74 | + closeButton: true | |
75 | + }) | |
76 | + updateFuelManagerService.getJetTiers(tier.marginTemplate.id).then(function(tiers) { | |
77 | + $scope.tierList = tiers; | |
78 | + }) | |
79 | + }) | |
33 | 80 | } |
34 | 81 | |
35 | 82 | $scope.saveJetAccordian = function(jets){ | ... | ... |
app/partials/updateFuelManager/updateFuelManager.html
... | ... | @@ -91,46 +91,54 @@ |
91 | 91 | <div class="clearfix"></div> |
92 | 92 | </div> |
93 | 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> </th> | |
111 | - </tr> | |
112 | - </thead> | |
113 | - <tbody> | |
114 | - <tr> | |
115 | - <td> | |
116 | - <span class="pull-left">-$0.0000</span> | |
117 | - <span class="pull-right">($1.7500)</span> | |
118 | - </td> | |
119 | - <td> | |
120 | - <span class="pull-left">-$0.0000</span> | |
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> | |
94 | + <div class="tierListWrap" ng-repeat="tier in tierList"> | |
95 | + <div class="tierListHead" style="height: 36px;"> | |
96 | + <span class="pull-left tierHeadingSpan" ng-hide="showEditTier">{{tier.minTierBreak}}-{{tier.maxTierBreak}} gal. | |
97 | + </span> | |
98 | + <i class="fa fa-pencil-square-o pull-right" ng-click="showEditTier = ! showEditTier" ng-hide="showEditTier" style="margin-top: 5px; cursor: pointer;" aria-hidden="true"></i> | |
99 | + | |
100 | + <input type="text" placeholder="min" style="width: 36px;" ng-model="tier.minTierBreak" ng-show="showEditTier"> | |
101 | + <span ng-show="showEditTier">-</span> | |
102 | + <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.maxTierBreak" ng-show="showEditTier"> <b ng-show="showEditTier">gal.</b> | |
103 | + <div class="clearfix"></div> | |
104 | + </div> | |
105 | + <div class="tierListBody" style="height: 35px;"> | |
106 | + <span class="pull-left minTierSpan" ng-hide="showEditTier">-${{tier.margin}}</span> | |
107 | + | |
108 | + <input type="text" placeholder="max" style="width: 36px;" ng-model="tier.margin" ng-show="showEditTier"> | |
109 | + | |
110 | + <span class="pull-right maxTierSpan" ng-hide="showEditTier">(${{tier.marginTotal}})</span> | |
111 | + | |
112 | + <button class="addTierBtn" ng-click="editTier(tier)" ng-show="showEditTier">Save</button> | |
113 | + | |
114 | + <i class="fa fa-trash-o deleteTierIcon" ng-click="deleteTier(tier.id)" aria-hidden="true" ng-show="showEditTier"></i> | |
115 | + | |
116 | + <div class="clearfix"></div> | |
117 | + </div> | |
118 | + </div> | |
119 | + <div class="tierListWrap" style="width: 160px;"> | |
120 | + <div class="tierListHead" style="border-right: 1px solid #ddd;"> | |
121 | + <input type="text" placeholder="min" ng-model="tr.minTierBreak"> | |
122 | + <span>-</span> | |
123 | + <input type="text" placeholder="max" ng-model="tr.maxTierBreak"> <b>gal.</b> | |
124 | + <div class="clearfix"></div> | |
125 | + </div> | |
126 | + <div class="tierListBody" style="border-right: 1px solid #ddd;"> | |
127 | + <span style="color: #449d44;">$</span> | |
128 | + <input type="text" placeholder="margin" ng-model="tr.margin" class="tierTextBox" style="width: 70px; height: 24px;"> | |
129 | + <button class="addTierBtn" ng-click="addNewTier(jets.id)">Add Tier</button> | |
130 | + <div class="clearfix"></div> | |
131 | + </div> | |
132 | + </div> | |
133 | + <!-- <div class="tierListWrap" style="width: 32px;"> | |
134 | + <div class="tierListHead" style="height: 36px; border-right: 1px solid #ddd;"> | |
135 | + | |
136 | + </div> | |
137 | + <div class="tierListBody" style="height: 35px; border-right: 1px solid #ddd;"> | |
138 | + <i class="fa fa-trash-o deleteTierIcon" aria-hidden="true"></i> | |
139 | + </div> | |
140 | + </div> --> | |
141 | + <div class="clearfix"></div> | |
134 | 142 | <textarea class="form-control resizeTextarea" placeholder="Message..."></textarea> |
135 | 143 | </div> |
136 | 144 | </div> | ... | ... |
app/partials/updateFuelManager/updateFuelManager.service.js
... | ... | @@ -53,6 +53,70 @@ |
53 | 53 | }) |
54 | 54 | return deferred.promise; |
55 | 55 | } |
56 | + | |
57 | + this.getJetTiers = function(id) { | |
58 | + | |
59 | + var deferred = $q.defer(); | |
60 | + $http({ | |
61 | + method : 'GET', | |
62 | + url : BASE_URL.url +'/margin/getCustomMargins/'+id, | |
63 | + headers : {'Content-Type': 'application/json'}, | |
64 | + }) | |
65 | + .then(function (result){ | |
66 | + deferred.resolve(result.data); | |
67 | + },function (result){ | |
68 | + deferred.resolve(result.data); | |
69 | + }) | |
70 | + return deferred.promise; | |
71 | + } | |
72 | + | |
73 | + this.addNewTier = function(data){ | |
74 | + var deferred = $q.defer(); | |
75 | + $http({ | |
76 | + method : 'POST', | |
77 | + url : BASE_URL.url +'/margin/custom', | |
78 | + headers : {'Content-Type': 'application/json'}, | |
79 | + data: data | |
80 | + }) | |
81 | + .then(function (result){ | |
82 | + deferred.resolve(result.data); | |
83 | + },function (result){ | |
84 | + deferred.resolve(result.data); | |
85 | + }) | |
86 | + return deferred.promise; | |
87 | + } | |
88 | + | |
89 | + this.editTier = function(data){ | |
90 | + var deferred = $q.defer(); | |
91 | + $http({ | |
92 | + method : 'PUT', | |
93 | + url : BASE_URL.url +'/margin/custom', | |
94 | + headers : {'Content-Type': 'application/json'}, | |
95 | + data: data | |
96 | + }) | |
97 | + .then(function (result){ | |
98 | + deferred.resolve(result.data); | |
99 | + },function (result){ | |
100 | + deferred.resolve(result.data); | |
101 | + }) | |
102 | + return deferred.promise; | |
103 | + } | |
104 | + | |
105 | + this.deleteTier = function(id) { | |
106 | + | |
107 | + var deferred = $q.defer(); | |
108 | + $http({ | |
109 | + method : 'DELETE', | |
110 | + url : BASE_URL.url +'/margin/customMargins/'+id, | |
111 | + headers : {'Content-Type': 'application/json'}, | |
112 | + }) | |
113 | + .then(function (result){ | |
114 | + deferred.resolve(result.data); | |
115 | + },function (result){ | |
116 | + deferred.resolve(result.data); | |
117 | + }) | |
118 | + return deferred.promise; | |
119 | + } | |
56 | 120 | |
57 | 121 | } |
58 | 122 | ... | ... |