fuelManager.controller.js
10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
'use strict';
//Load controller
angular.module('acufuel')
//.controller('fuelManagerController', ['$scope', 'fuelManagerService',function($scope, fuelManagerService) {
.controller('fuelManagerController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'fuelManagerService', fuelManagerController]);
function fuelManagerController($scope, $rootScope, $uibModal, $filter, $http, fuelManagerService) {
$scope.currentUserData = JSON.parse(localStorage.getItem('userProfileId'));
fuelManagerService.getFullList().then(function(result) {
$scope.fullJetList = result;
})
$scope.avoidanceList = {};
$scope.updateList = function(fullJetList){
$scope.addData = [];
$scope.newJetList = fullJetList;
if ($scope.currentUserData == undefined || $scope.currentUserData == null) {
}else{
for(var i=0; i<$scope.newJetList.length;i++){
for(var j = 0; j < $scope.newJetList[i].aircraftsSize.length; j++){
if($scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance != null){
console.log('fullJetList', $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance);
$scope.addData.push({
//'aircraftType': $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.aircraftType,
'id': $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.id,
'aircraftSizeId': $scope.newJetList[i].aircraftsSize[j].id,
'rampFees': $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.rampFees,
'avoidance' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.avoidance,
'applicable' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.applicable,
'expirationDate' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.expirationDate,
'notes' : $scope.newJetList[i].aircraftsSize[j].rampFeesAndAvoidance.notes
});
}
}
}
$scope.avoidanceList.rampFeesAndAvoidanceList = $scope.addData;
$scope.avoidanceList.fboUserId = $scope.currentUserData;
console.log('data', $scope.avoidanceList);
fuelManagerService.updateFullList($scope.avoidanceList).then(function(result) {
fuelManagerService.getFullList().then(function(result) {
$scope.fullJetList = result;
})
})
}
}
fuelManagerService.getOptions().then(function(result) {
$scope.dropOptions = result;
})
//$scope.rampFeeType = '';
$scope.openRampModal = function(rampFeeType){
console.log('rampFeeType', rampFeeType);
}
$scope.parentOpen = function(index){
$('#parentOpen'+index).css('display', 'none');
$('#parentClose'+index).css('display', 'initial');
$('#parentTogglebody'+index).slideDown();
}
$scope.parentClose = function(index){
$('#parentOpen'+index).css('display', 'initial');
$('#parentClose'+index).css('display', 'none');
$('#parentTogglebody'+index).slideUp();
}
$scope.toggleChild = function(id){
if ($('.'+id).hasClass('fa-plus-circle')) {
$('.'+id).removeClass('fa-plus-circle');
$('.'+id).addClass('fa-minus-circle');
}else{
$('.'+id).removeClass('fa-minus-circle');
$('.'+id).addClass('fa-plus-circle');
}
$('#'+id).slideToggle();
}
$(document).ready(function(){
setInterval(function(){
var newHeight = $('.feeManagerLeft').height();
$('.feeManagerRight').css('height', newHeight);
}, 3);
$('#customTabToggle1').click(function(){
console.log('tab 1');
$('#customTabsBody1').slideDown();
$('#customTabsBody2').slideUp();
$('#customTabsBody3').slideUp();
$('#customTabsBody4').slideUp();
$('#customTabs1').addClass('customActive');
$('#customTabs2').removeClass('customActive');
$('#customTabs3').removeClass('customActive');
$('#customTabs4').removeClass('customActive');
$('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
$('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
$('#customTabs1 > .pull-right > .btn-default').css('display', 'none');
$('#customTabs1 > .pull-right > .btn-success').css('display', 'inline-block');
$('#customTabs1 > .pull-right > .btn-danger').css('display', 'inline-block');
$('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs2 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs2 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs3 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs3 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs4 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs4 > .pull-right > .btn-danger').css('display', 'none');
})
$('#customTabToggle2').click(function(){
console.log('tab 2');
$('#customTabsBody1').slideUp();
$('#customTabsBody2').slideDown();
$('#customTabsBody3').slideUp();
$('#customTabsBody4').slideUp();
$('#customTabs1').removeClass('customActive');
$('#customTabs2').addClass('customActive');
$('#customTabs3').removeClass('customActive');
$('#customTabs4').removeClass('customActive');
$('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
$('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
$('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs1 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs1 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs2 > .pull-right > .btn-default').css('display', 'none');
$('#customTabs2 > .pull-right > .btn-success').css('display', 'inline-block');
$('#customTabs2 > .pull-right > .btn-danger').css('display', 'inline-block');
$('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs3 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs3 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs4 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs4 > .pull-right > .btn-danger').css('display', 'none');
})
$('#customTabToggle3').click(function(){
console.log('tab 3');
$('#customTabsBody1').slideUp();
$('#customTabsBody2').slideUp();
$('#customTabsBody3').slideDown();
$('#customTabsBody4').slideUp();
$('#customTabs1').removeClass('customActive');
$('#customTabs2').removeClass('customActive');
$('#customTabs3').addClass('customActive');
$('#customTabs4').removeClass('customActive');
$('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
$('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
$('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs1 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs1 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs2 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs2 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs3 > .pull-right > .btn-default').css('display', 'none');
$('#customTabs3 > .pull-right > .btn-success').css('display', 'inline-block');
$('#customTabs3 > .pull-right > .btn-danger').css('display', 'inline-block');
$('#customTabs4 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs4 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs4 > .pull-right > .btn-danger').css('display', 'none');
})
$('#customTabToggle4').click(function(){
console.log('tab 4');
$('#customTabsBody1').slideUp();
$('#customTabsBody2').slideUp();
$('#customTabsBody3').slideUp();
$('#customTabsBody4').slideDown();
$('#customTabs1').removeClass('customActive');
$('#customTabs2').removeClass('customActive');
$('#customTabs3').removeClass('customActive');
$('#customTabs4').addClass('customActive');
$('.customAccordianHeader > select, .customAccordianHeader > input').prop("disabled", true);
$('.customAccordianHeader.customActive > select, .customAccordianHeader.customActive > input').prop("disabled", false);
$('#customTabs1 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs1 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs1 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs2 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs2 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs2 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs3 > .pull-right > .btn-default').css('display', 'inline-block');
$('#customTabs3 > .pull-right > .btn-success').css('display', 'none');
$('#customTabs3 > .pull-right > .btn-danger').css('display', 'none');
$('#customTabs4 > .pull-right > .btn-default').css('display', 'none');
$('#customTabs4 > .pull-right > .btn-success').css('display', 'inline-block');
$('#customTabs4 > .pull-right > .btn-danger').css('display', 'inline-block');
})
})
}