Commit a858eca3e7f096fa998f513922f2e97dcdfe0306

Authored by Kuldeep Arora
1 parent 20b4aefe7f
Exists in master

css

1 /*------------------------------------------------------------------ 1 /*------------------------------------------------------------------
2 2
3 [Login/Signup Stylesheet] 3 [Login/Signup Stylesheet]
4 4
5 Project: Base Admin 5 Project: Base Admin
6 Version: 1.0 6 Version: 1.0
7 Last change: 05/21/2012 7 Last change: 05/21/2012
8 Assigned to: Rod Howard (rh) 8 Assigned to: Rod Howard (rh)
9 9
10 -------------------------------------------------------------------*/ 10 -------------------------------------------------------------------*/
11 11
12 12
13 13
14 14
15 /** Base Body Styles **/ 15 /** Base Body Styles **/
16 /*body{ color:#838383; font: 13px/1.7em 'Open Sans'; 16 /*body{ color:#838383; font: 13px/1.7em 'Open Sans';
17 */body{ 17 */body{
18 color:#838383; 18 color:#838383;
19 font-family: 'Open Sans', sans-serif; 19 font-family: 'Open Sans', sans-serif;
20 font: 13px/1.7em 'Open Sans' sans-serif; 20 font: 13px/1.7em 'Open Sans' sans-serif;
21 background: #f3f3f3; 21 background: #f3f3f3;
22 22
23 23
24 24
25 } 25 }
26 .nvd3 .tick text{ 26 .nvd3 .tick text{
27 transform: initial; 27 transform: initial;
28 } 28 }
29 .account-container { 29 .account-container {
30 width: 390px; 30 width: 390px;
31 display: block; 31 display: block;
32 margin: 60px auto 0 auto; 32 margin: 60px auto 0 auto;
33 33
34 background: #f9f9f9; 34 background: #f9f9f9;
35 35
36 border: 1px solid #d5d5d5; 36 border: 1px solid #d5d5d5;
37 37
38 -webkit-border-radius: 5px; 38 -webkit-border-radius: 5px;
39 -moz-border-radius: 5px; 39 -moz-border-radius: 5px;
40 border-radius: 5px; 40 border-radius: 5px;
41 41
42 42
43 } 43 }
44 /* login page css */ 44 /* login page css */
45 45
46 .login-action {float: right; margin-top: 18px;} 46 .login-action {float: right; margin-top: 18px;}
47 47
48 .content { 48 .content {
49 padding: 16px 28px 23px; 49 padding: 16px 28px 23px;
50 } 50 }
51 51
52 .login-fields { 52 .login-fields {
53 53
54 } 54 }
55 55
56 .login-fields .field { 56 .login-fields .field {
57 margin-bottom: 1.25em; 57 margin-bottom: 1.25em;
58 } 58 }
59 59
60 .login-fields label { 60 .login-fields label {
61 display: none; 61 display: none;
62 } 62 }
63 63
64 .login-fields input { 64 .login-fields input {
65 font-family: 'Open Sans'; 65 font-family: 'Open Sans';
66 font-size: 13px; 66 font-size: 13px;
67 color: #8e8d8d; 67 color: #8e8d8d;
68 padding: 11px 15px 10px 50px; 68 padding: 11px 15px 10px 50px;
69 background-color: #fdfdfd; 69 background-color: #fdfdfd;
70 width: 100%; 70 width: 100%;
71 display: block; 71 display: block;
72 margin: 0; 72 margin: 0;
73 box-shadow: inset 2px 2px 4px #f1f1f1; 73 box-shadow: inset 2px 2px 4px #f1f1f1;
74 height: 40px; 74 height: 40px;
75 } 75 }
76 76
77 .username-field { background: url(../../img/signin/user.png) no-repeat; } 77 .username-field { background: url(../../img/signin/user.png) no-repeat; }
78 78
79 .password-field { background: url(../../img/signin/password.png) no-repeat; } 79 .password-field { background: url(../../img/signin/password.png) no-repeat; }
80 80
81 .email-field { background: url(../../img/forgetPassword/forgetPassword.png) no-repeat; } 81 .email-field { background: url(../../img/forgetPassword/forgetPassword.png) no-repeat; }
82 82
83 83
84 84
85 .login-actions { 85 .login-actions {
86 float: left; 86 float: left;
87 87
88 width: 100%; 88 width: 100%;
89 89
90 margin-top: -1em; 90 margin-top: -1em;
91 margin-bottom: 1.25em; 91 margin-bottom: 1.25em;
92 } 92 }
93 .btn-primary-color { 93 .btn-primary-color {
94 color: #fff; 94 color: #fff;
95 background-color: #f79400; 95 background-color: #f79400;
96 border-color: #f79400; 96 border-color: #f79400;
97 } 97 }
98 98
99 .btn-primary-color : hover { 99 .btn-primary-color : hover {
100 color: #fff; 100 color: #fff;
101 background-color: #f79400; 101 background-color: #f79400;
102 border-color: #f79400; 102 border-color: #f79400;
103 } 103 }
104 104
105 .login-social { 105 .login-social {
106 float: left; 106 float: left;
107 107
108 padding: 10px 0 15px; 108 padding: 10px 0 15px;
109 109
110 border: 1px dotted #CCC; 110 border: 1px dotted #CCC;
111 border-right: none; 111 border-right: none;
112 border-left: none; 112 border-left: none;
113 } 113 }
114 114
115 .login-checkbox { 115 .login-checkbox {
116 float: left; 116 float: left;
117 margin-top: 31px; 117 margin-top: 31px;
118 } 118 }
119 119
120 .login-checkbox > input[type='checkbox'] { 120 .login-checkbox > input[type='checkbox'] {
121 opacity: 0; 121 opacity: 0;
122 float: left; 122 float: left;
123 width: 15px; 123 width: 15px;
124 } 124 }
125 125
126 .login-checkbox > input[type='checkbox'] + label { 126 .login-checkbox > input[type='checkbox'] + label {
127 clear: none; 127 clear: none;
128 128
129 height: 15px; 129 height: 15px;
130 display: block; 130 display: block;
131 padding: 0 0 0 22px; 131 padding: 0 0 0 22px;
132 margin: 0; 132 margin: 0;
133 133
134 font-size: 12px; 134 font-size: 12px;
135 line-height: 1.2em; 135 line-height: 1.2em;
136 136
137 background: url(../../img/signin/check.png) no-repeat 0 0; 137 background: url(../../img/signin/check.png) no-repeat 0 0;
138 138
139 cursor: pointer; 139 cursor: pointer;
140 } 140 }
141 141
142 .login-checkbox > input[type='checkbox']:checked + label { 142 .login-checkbox > input[type='checkbox']:checked + label {
143 background-position: 0 -15px; 143 background-position: 0 -15px;
144 } 144 }
145 145
146 /** Text Under Box**/ 146 /** Text Under Box**/
147 .login-extra { 147 .login-extra {
148 display: block; 148 display: block;
149 width: 300px; 149 width: 300px;
150 margin: 1.5em auto; 150 margin: 1.5em auto;
151 151
152 text-align: center; 152 text-align: center;
153 line-height: 19px; 153 line-height: 19px;
154 154
155 text-shadow: 1px 1px 0px #fff; 155 text-shadow: 1px 1px 0px #fff;
156 } 156 }
157 157
158 158
159 .account-container h1 { 159 .account-container h1 {
160 margin-bottom: .4em; 160 margin-bottom: .4em;
161 161
162 color: #f90; 162 color: #f90;
163 163
164 font-size: 32px; 164 font-size: 32px;
165 } 165 }
166 166
167 /** Buttons **/ 167 /** Buttons **/
168 .twitter, .fb { 168 .twitter, .fb {
169 position: relative; 169 position: relative;
170 170
171 height: 32px; 171 height: 32px;
172 width: 157px; 172 width: 157px;
173 display: block; 173 display: block;
174 174
175 background: url(../../img/signin/twitter_btn.png) no-repeat; 175 background: url(../../img/signin/twitter_btn.png) no-repeat;
176 176
177 } 177 }
178 178
179 .fb { 179 .fb {
180 width: 162px; 180 width: 162px;
181 181
182 background: url(../../img/signin/fb_btn.png) no-repeat; 182 background: url(../../img/signin/fb_btn.png) no-repeat;
183 } 183 }
184 184
185 .twitter:active, .fb:active { 185 .twitter:active, .fb:active {
186 top: 1px; 186 top: 1px;
187 } 187 }
188 188
189 .twitter:hover, .fb:hover { 189 .twitter:hover, .fb:hover {
190 background-position: 0 -32px; 190 background-position: 0 -32px;
191 } 191 }
192 192
193 .twitter a, .fb a { 193 .twitter a, .fb a {
194 padding: 5px 0 0 35px; 194 padding: 5px 0 0 35px;
195 text-shadow: -1px -1px 0px rgba(0,0,0,.3); 195 text-shadow: -1px -1px 0px rgba(0,0,0,.3);
196 color:#fff; 196 color:#fff;
197 font-weight: bold; 197 font-weight: bold;
198 font-size: 11px; 198 font-size: 11px;
199 height: 32px; 199 height: 32px;
200 display: block; 200 display: block;
201 } 201 }
202 202
203 .fb a { 203 .fb a {
204 padding: 5px 0 0 31px; 204 padding: 5px 0 0 31px;
205 205
206 } 206 }
207 207
208 .twitter, .fb { 208 .twitter, .fb {
209 display: inline-block; 209 display: inline-block;
210 } 210 }
211 211
212 .twitter a:hover, .fb a:hover { 212 .twitter a:hover, .fb a:hover {
213 color: #FFF; 213 color: #FFF;
214 text-decoration: none; 214 text-decoration: none;
215 } 215 }
216 216
217 .register .login-social { 217 .register .login-social {
218 margin-bottom: 1em; 218 margin-bottom: 1em;
219 } 219 }
220 220
221 .register .login-actions { 221 .register .login-actions {
222 margin-bottom: 0; 222 margin-bottom: 0;
223 } 223 }
224 224
225 .register .login-fields input { 225 .register .login-fields input {
226 width: 299px; 226 width: 299px;
227 padding-left: 6px; 227 padding-left: 6px;
228 } 228 }
229 229
230 .register h1 { 230 .register h1 {
231 color: #444; 231 color: #444;
232 } 232 }
233 233
234 .register span.login-checkbox { 234 .register span.login-checkbox {
235 position: relative; 235 position: relative;
236 top: -6px; 236 top: -6px;
237 237
238 width: 200px; 238 width: 200px;
239 } 239 }
240 240
241 .register span.login-checkbox > input[type="checkbox"] + label { 241 .register span.login-checkbox > input[type="checkbox"] + label {
242 242
243 position: relative; 243 position: relative;
244 244
245 line-height: 1.3em; 245 line-height: 1.3em;
246 } 246 }
247 247
248 248
249 249
250 @media (max-width: 480px) { 250 @media (max-width: 480px) {
251 251
252 .account-container { 252 .account-container {
253 width: 280px; 253 width: 280px;
254 margin-top: 35px; 254 margin-top: 35px;
255 } 255 }
256 256
257 .login-fields input { 257 .login-fields input {
258 width: 160px; 258 width: 160px;
259 } 259 }
260 260
261 .login-social { 261 .login-social {
262 width: 100%; 262 width: 100%;
263 } 263 }
264 264
265 .twitter { 265 .twitter {
266 display: block; 266 display: block;
267 margin-bottom: 1em; 267 margin-bottom: 1em;
268 } 268 }
269 269
270 .register .login-fields input { 270 .register .login-fields input {
271 width: 204px; 271 width: 204px;
272 padding-left: 6px; 272 padding-left: 6px;
273 } 273 }
274 274
275 }/**/ 275 }/**/
276 276
277 277
278 .bttn-clr{ 278 .bttn-clr{
279 background-color: #DD8500; 279 background-color: #DD8500;
280 border-color: #AA6500; 280 border-color: #AA6500;
281 background-image: linear-gradient(to bottom, #f1f1f1 0%, #cc7a00 100%); 281 background-image: linear-gradient(to bottom, #f1f1f1 0%, #cc7a00 100%);
282 282
283 } 283 }
284 284
285 285
286 286
287 .custom-widget-content{ 287 .custom-widget-content{
288 width: 100%; 288 width: 100%;
289 height: auto; 289 height: auto;
290 padding: 15px 0; 290 padding: 15px 0;
291 background-color: #fff; 291 background-color: #fff;
292 border: 1px solid #D5D5D5; 292 border: 1px solid #D5D5D5;
293 border-radius: 0 0 5px 5px; 293 border-radius: 0 0 5px 5px;
294 } 294 }
295 .hr{ 295 .hr{
296 margin: 5px 0; 296 margin: 5px 0;
297 } 297 }
298 .disableSelect:disabled{ 298 .disableSelect:disabled{
299 border: 0; 299 border: 0;
300 background-color: transparent; 300 background-color: transparent;
301 color: #f90; 301 color: #f90;
302 box-shadow: none; 302 box-shadow: none;
303 -webkit-appearance: none; 303 -webkit-appearance: none;
304 appearance: none; 304 appearance: none;
305 } 305 }
306 .disableInput:disabled{ 306 .disableInput:disabled{
307 border: 0; 307 border: 0;
308 background-color: transparent; 308 background-color: transparent;
309 color: #222; 309 color: #222;
310 box-shadow: none; 310 box-shadow: none;
311 } 311 }
312 .img-logo{ 312 .img-logo{
313 height: 25px; 313 height: 25px;
314 padding-left: 10%; 314 padding-left: 10%;
315 } 315 }
316 316
317 .font-company{ 317 .font-company{
318 font-size: 10px; 318 font-size: 10px;
319 } 319 }
320 320
321 .icon-tint-margin{ 321 .icon-tint-margin{
322 margin-bottom: 5px; 322 margin-bottom: 5px;
323 } 323 }
324 324
325 .forget-password{ 325 .forget-password{
326 color:#f90; 326 color:#f90;
327 font-size: 21px; 327 font-size: 21px;
328 328
329 } 329 }
330 330
331 .forget{ 331 .forget{
332 position:relative; 332 position:relative;
333 right: 120px; 333 right: 120px;
334 } 334 }
335 335
336 336
337 /* login page css */ 337 /* login page css */
338 338
339 .table.vertical-center > thead > tr > th, .table.vertical-center > tbody > tr > th, .table.vertical-center > tfoot > tr > th, .table.vertical-center > thead > tr > td, .table.vertical-center > tbody > tr > td, .table.vertical-center > tfoot > tr > td{ 339 .table.vertical-center > thead > tr > th, .table.vertical-center > tbody > tr > th, .table.vertical-center > tfoot > tr > th, .table.vertical-center > thead > tr > td, .table.vertical-center > tbody > tr > td, .table.vertical-center > tfoot > tr > td{
340 vertical-align: middle !important; 340 vertical-align: middle !important;
341 } 341 }
342 .checkLabel:last-child>span{ 342 .checkLabel:last-child>span{
343 display: none; 343 display: none;
344 } 344 }
345 345
346 346
347 .strikeTable { 347 .strikeTable {
348 border-collapse: collapse; 348 border-collapse: collapse;
349 } 349 }
350 350
351 .strikeTable td { 351 .strikeTable td {
352 position: relative; 352 position: relative;
353 padding: 5px 10px; 353 padding: 5px 10px;
354 } 354 }
355 355
356 .strikeTable tr.strikeout td:before { 356 .strikeTable tr.strikeout td:before {
357 content: " "; 357 content: " ";
358 position: absolute; 358 position: absolute;
359 top: 50%; 359 top: 50%;
360 left: 0; 360 left: 0;
361 border-bottom: 1px solid #111; 361 border-bottom: 1px solid #111;
362 width: 100%; 362 width: 100%;
363 } 363 }
364 tr.strikeout td{ 364 tr.strikeout td{
365 opacity: 0.5; 365 opacity: 0.5;
366 } 366 }
367 367
368 368
369 369
370 370
371 371
app/partials/viewCompany/viewCompany.controller.js
1 'use strict'; 1 'use strict';
2 2
3 //Load controller 3 //Load controller
4 angular.module('acufuel') 4 angular.module('acufuel')
5 5
6 .controller('viewCompanyController', ['$scope', '$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewFuelVendorService', 'ViewcontactService', '$state', 'fuelOrdersService', 'enterFuelOrderService', 'NgTableParams', function($scope, $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewFuelVendorService, ViewcontactService, $state, fuelOrdersService, enterFuelOrderService, NgTableParams) { 6 .controller('viewCompanyController', ['$scope', '$uibModal', '$stateParams', 'ViewCompanyService', 'CustomersService', 'updateFuelManagerService', 'ViewFuelVendorService', 'ViewcontactService', '$state', 'fuelOrdersService', 'enterFuelOrderService', 'NgTableParams', function($scope, $uibModal, $stateParams, ViewCompanyService, CustomersService, updateFuelManagerService, ViewFuelVendorService, ViewcontactService, $state, fuelOrdersService, enterFuelOrderService, NgTableParams) {
7 $scope.data = {}; 7 $scope.data = {};
8 $scope.data.priceEmail = true; 8 $scope.data.priceEmail = true;
9 $scope.aircraft = {}; 9 $scope.aircraft = {};
10 $scope.primayData = {}; 10 $scope.primayData = {};
11 $scope.showLoader = false; 11 $scope.showLoader = false;
12 $scope.showUpdateBtn = false; 12 $scope.showUpdateBtn = false;
13 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId')); 13 $scope.userProfileId = JSON.parse(localStorage.getItem('userProfileId'));
14 $scope.selected = []; 14 $scope.selected = [];
15 $scope.jetShow = []; 15 $scope.jetShow = [];
16 $scope.marginShow = []; 16 $scope.marginShow = [];
17 $scope.compId = $stateParams.id; 17 $scope.compId = $stateParams.id;
18 $scope.jetShow[0] = true; 18 $scope.jetShow[0] = true;
19 $scope.marginShow[0] = true; 19 $scope.marginShow[0] = true;
20 $scope.dispatchOrder = {}; 20 $scope.dispatchOrder = {};
21 $scope.dispatchOrder.fuelOrderList = []; 21 $scope.dispatchOrder.fuelOrderList = [];
22 $scope.statusFilterOptions = []; 22 $scope.statusFilterOptions = [];
23 $scope.companyList = {}; 23 $scope.companyList = {};
24 $scope.statusFilterOptions.push({ 24 $scope.statusFilterOptions.push({
25 'id': '', 25 'id': '',
26 'title': 'Show All' 26 'title': 'Show All'
27 }, { 27 }, {
28 'id': 'pending', 28 'id': 'pending',
29 'title': 'Pending' 29 'title': 'Pending'
30 }, { 30 }, {
31 'id': 'invoiced', 31 'id': 'invoiced',
32 'title': 'Invoiced' 32 'title': 'Invoiced'
33 }, { 33 }, {
34 'id': 'paid', 34 'id': 'paid',
35 'title': 'Paid' 35 'title': 'Paid'
36 }, { 36 }, {
37 'id': 'cancelled', 37 'id': 'cancelled',
38 'title': 'Cancelled' 38 'title': 'Cancelled'
39 }, { 39 }, {
40 'id': 'archived', 40 'id': 'archived',
41 'title': 'Archived' 41 'title': 'Archived'
42 } 42 }
43 43
44 ); 44 );
45 45
46 $scope.order = {}; 46 $scope.order = {};
47 $scope.order.companyName = ''; 47 $scope.order.companyName = '';
48 $scope.order.upliftDate = ''; 48 $scope.order.upliftDate = '';
49 /*Get AllCompany api is used from CustomersService*/ 49 /*Get AllCompany api is used from CustomersService*/
50 getAllCompanies(); 50 getAllCompanies();
51 51
52 function getAllCompanies() { 52 function getAllCompanies() {
53 CustomersService.getAllCompanies().then(function(result) { 53 CustomersService.getAllCompanies().then(function(result) {
54 //console.log('log', result[2].id); 54 //console.log('log', result[2].id);
55 $scope.companyList = result; 55 $scope.companyList = result;
56 56
57 for (var i = 0; i < $scope.companyList.length; i++) { 57 for (var i = 0; i < $scope.companyList.length; i++) {
58 if ($scope.companyList[i].companyContact != null) { 58 if ($scope.companyList[i].companyContact != null) {
59 if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) { 59 if ($scope.companyList[i].companyContact.contactNumber != null || $scope.companyList[i].companyContact.contactNumber != undefined) {
60 $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber; 60 $scope.companyList[i].newContactNumber = $scope.companyList[i].companyContact.contactNumber;
61 } 61 }
62 } 62 }
63 if ($scope.companyList[i].primaryContact != null) { 63 if ($scope.companyList[i].primaryContact != null) {
64 if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) { 64 if ($scope.companyList[i].primaryContact.firstName != null && $scope.companyList[i].primaryContact.lastName != null) {
65 $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName; 65 $scope.companyList[i].primaryContactName = $scope.companyList[i].primaryContact.firstName + ' ' + $scope.companyList[i].primaryContact.lastName;
66 } 66 }
67 } 67 }
68 if ($scope.companyList[i].margin != null) { 68 if ($scope.companyList[i].margin != null) {
69 if ($scope.companyList[i].margin.marginName != null) { 69 if ($scope.companyList[i].margin.marginName != null) {
70 $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id; 70 $scope.companyList[i].masterMargin = $scope.companyList[i].margin.id;
71 } 71 }
72 } 72 }
73 } 73 }
74 $scope.displayCompanyList = new NgTableParams({ 74 $scope.displayCompanyList = new NgTableParams({
75 page: 1, 75 page: 1,
76 count: 10, 76 count: 10,
77 }, { 77 }, {
78 data: $scope.companyList 78 data: $scope.companyList
79 }); 79 });
80 $scope.showLoader = false; 80 $scope.showLoader = false;
81 }) 81 })
82 } 82 }
83 83
84 84
85 $(document).ready(function() { 85 $(document).ready(function() {
86 $("#reset").click(function() { 86 $("#reset").click(function() {
87 $("input").val(""); 87 $("input").val("");
88 }); 88 });
89 }); 89 });
90 90
91 $scope.values = [{ 91 $scope.values = [{
92 'id': 1, 92 'id': 1,
93 'first': 'Tenant/Base Customer' 93 'first': 'Tenant/Base Customer'
94 }, 94 },
95 { 95 {
96 'id': 2, 96 'id': 2,
97 'first': 'FuelerLinx Customer' 97 'first': 'FuelerLinx Customer'
98 }, 98 },
99 { 99 {
100 'id': 3, 100 'id': 3,
101 'first': 'CAA Member' 101 'first': 'CAA Member'
102 } 102 }
103 ]; 103 ];
104 104
105 105
106 106
107 $scope.changeValue = function(selected) { 107 $scope.changeValue = function(selected) {
108 $scope.showUpdateBtn = true; 108 $scope.showUpdateBtn = true;
109 // console.log("data to be true", selected); 109 // console.log("data to be true", selected);
110 for (var i = 0; i < selected.length; i++) { 110 for (var i = 0; i < selected.length; i++) {
111 // console.log(selected[i]) 111 // console.log(selected[i])
112 if (selected[i] == 'Tenant/Base Customer') { 112 if (selected[i] == 'Tenant/Base Customer') {
113 $scope.companyData.baseTenant = true; 113 $scope.companyData.baseTenant = true;
114 } else { 114 } else {
115 $scope.companyData.baseTenant = false; 115 $scope.companyData.baseTenant = false;
116 } 116 }
117 if (selected[i] == 'FuelerLinx Customer') { 117 if (selected[i] == 'FuelerLinx Customer') {
118 $scope.companyData.fuelerlinxCustomer = true; 118 $scope.companyData.fuelerlinxCustomer = true;
119 } else { 119 } else {
120 $scope.companyData.fuelerlinxCustomer = false; 120 $scope.companyData.fuelerlinxCustomer = false;
121 } 121 }
122 122
123 if (selected[i] == 'CAA Member') { 123 if (selected[i] == 'CAA Member') {
124 $scope.companyData.contractFuelVendor = true; 124 $scope.companyData.contractFuelVendor = true;
125 } else { 125 } else {
126 $scope.companyData.contractFuelVendor = false; 126 $scope.companyData.contractFuelVendor = false;
127 } 127 }
128 128
129 // console.log($scope.companyData) 129 // console.log($scope.companyData)
130 130
131 } 131 }
132 132
133 } 133 }
134 134
135 // $scope.selected =[ 135 // $scope.selected =[
136 // {'id': 1, 'first': 'Tenant/Base Customer'}, 136 // {'id': 1, 'first': 'Tenant/Base Customer'},
137 // {'id': 2, 'first': 'FuelerLinx Customer'}, 137 // {'id': 2, 'first': 'FuelerLinx Customer'},
138 // {'id': 3, 'first': 'CAA Member'} 138 // {'id': 3, 'first': 'CAA Member'}
139 // ]; 139 // ];
140 140
141 // CustomersService.getMargin().then(function(result) { 141 // CustomersService.getMargin().then(function(result) {
142 // $scope.marginList = result; 142 // $scope.marginList = result;
143 // }) 143 // })
144 144
145 var value = ""; 145 var value = "";
146 var companyId = $stateParams.id; 146 var companyId = $stateParams.id;
147 147
148 $scope.companyData = {}; 148 $scope.companyData = {};
149 $scope.multipleMsg = false; 149 $scope.multipleMsg = false;
150 $scope.companyData.masterMargin = ""; 150 $scope.companyData.masterMargin = "";
151 $scope.isGlobal = false; 151 $scope.isGlobal = false;
152 $scope.fboPreffered = false; 152 $scope.fboPreffered = false;
153 getCompanyDetail(); 153 getCompanyDetail();
154 154
155 function getCompanyDetail() { 155 function getCompanyDetail() {
156 $scope.showLoader = true; 156 $scope.showLoader = true;
157 ViewCompanyService.getCompany(companyId).then(function(result) { 157 ViewCompanyService.getCompany(companyId).then(function(result) {
158 $scope.companyData = result; 158 $scope.companyData = result;
159 $scope.isGlobal = result.global; 159 $scope.isGlobal = result.global;
160 $scope.fboPreffered = result.fboPreferred; 160 $scope.fboPreffered = result.fboPreferred;
161 if (result.global == true) { 161 if (result.global == true) {
162 $scope.companyData.global = true; 162 $scope.companyData.global = true;
163 } 163 }
164 if (result.margin != null) { 164 if (result.margin != null) {
165 $scope.companyData.masterMargin = result.margin.id; 165 $scope.companyData.masterMargin = result.margin.id;
166 } 166 }
167 if (result.marginAVGAS != null) { 167 if (result.marginAVGAS != null) {
168 $scope.companyData.avgasMargin = result.marginAVGAS.id; 168 $scope.companyData.avgasMargin = result.marginAVGAS.id;
169 } 169 }
170 170
171 171
172 172
173 if ($scope.companyData.baseTenant) { 173 if ($scope.companyData.baseTenant) {
174 174
175 $scope.selected.push({ 175 $scope.selected.push({
176 'first': 'Tenant/Base Customer' 176 'first': 'Tenant/Base Customer'
177 }) 177 })
178 // console.log("$scope.selected",$scope.selected) 178 // console.log("$scope.selected",$scope.selected)
179 179
180 } 180 }
181 181
182 if ($scope.companyData.fuelerlinxCustomer) { 182 if ($scope.companyData.fuelerlinxCustomer) {
183 $scope.selected.push({ 183 $scope.selected.push({
184 'first': 'FuelerLinx Customer' 184 'first': 'FuelerLinx Customer'
185 }) 185 })
186 // console.log("$scope.selected",$scope.selected) 186 // console.log("$scope.selected",$scope.selected)
187 } 187 }
188 188
189 if ($scope.companyData.contractFuelVendor) { 189 if ($scope.companyData.contractFuelVendor) {
190 $scope.selected.push({ 190 $scope.selected.push({
191 'first': 'CAA Member' 191 'first': 'CAA Member'
192 }) 192 })
193 // console.log("$scope.selected",$scope.selected) 193 // console.log("$scope.selected",$scope.selected)
194 } 194 }
195 195
196 // console.log("$scope.companyData",$scope.companyData) 196 // console.log("$scope.companyData",$scope.companyData)
197 getAircraftList(); 197 getAircraftList();
198 $scope.order.companyName = $scope.companyData.companyName; 198 $scope.order.companyName = $scope.companyData.companyName;
199 $scope.getAircraft(result.companyName); 199 $scope.getAircraft(result.companyName);
200 $scope.showLoader = false; 200 $scope.showLoader = false;
201 }) 201 })
202 } 202 }
203 203
204 204
205 $scope.changeCompanyStatus = function() { 205 $scope.changeCompanyStatus = function() {
206 $('#delete3').css('display', 'block'); 206 $('#delete3').css('display', 'block');
207 if ($scope.companyData.activate == true) { 207 if ($scope.companyData.activate == true) {
208 $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this company?' 208 $scope.statusMessage = 'Please confirm! Are you sure you want to ACTIVATE this company?'
209 } else { 209 } else {
210 $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this company?' 210 $scope.statusMessage = 'Please confirm! Are you sure you want to DEACTIVATE this company?'
211 } 211 }
212 } 212 }
213 213
214 $scope.companyStatus = function() { 214 $scope.companyStatus = function() {
215 $scope.showLoader = true; 215 $scope.showLoader = true;
216 var statusData = "status=" + $scope.companyData.activate; 216 var statusData = "status=" + $scope.companyData.activate;
217 ViewCompanyService.changeStatus(companyId, statusData).then(function(result) { 217 ViewCompanyService.changeStatus(companyId, statusData).then(function(result) {
218 if (result.success) { 218 if (result.success) {
219 $('#delete3').css('display', 'none'); 219 $('#delete3').css('display', 'none');
220 toastr.success('' + result.success + '', { 220 toastr.success('' + result.success + '', {
221 closeButton: true 221 closeButton: true
222 }) 222 })
223 getContactList(); 223 getContactList();
224 } 224 }
225 }) 225 })
226 $scope.showLoader = false; 226 $scope.showLoader = false;
227 } 227 }
228 228
229 229
230 $scope.cancelStatus = function() { 230 $scope.cancelStatus = function() {
231 $('#delete3').css('display', 'none'); 231 $('#delete3').css('display', 'none');
232 $scope.companyData.activate = !$scope.companyData.activate; 232 $scope.companyData.activate = !$scope.companyData.activate;
233 } 233 }
234 234
235 getContactList(); 235 getContactList();
236 236
237 function getContactList() { 237 function getContactList() {
238 ViewCompanyService.getContact(companyId).then(function(result) { 238 ViewCompanyService.getContact(companyId).then(function(result) {
239 $scope.companyContactList = result; 239 $scope.companyContactList = result;
240 }) 240 })
241 } 241 }
242 $scope.aircraftmargins = []; 242 $scope.aircraftmargins = [];
243 243
244 $scope.abc = false; 244 $scope.abc = false;
245 $scope.xyz = false; 245 $scope.xyz = false;
246 function getAircraftList() { 246 function getAircraftList() {
247 ViewCompanyService.getAircraft(companyId).then(function(result) { 247 ViewCompanyService.getAircraft(companyId).then(function(result) {
248 248
249 $scope.contactAircraftList = result; 249 $scope.contactAircraftList = result;
250 for (var i = 0; i < $scope.contactAircraftList.length; i++) { 250 for (var i = 0; i < $scope.contactAircraftList.length; i++) {
251 if ($scope.contactAircraftList[i].aircraftsMargin != null) { 251 if ($scope.contactAircraftList[i].aircraftsMargin != null) {
252 $scope.aircraftmargins.push({ 252 $scope.aircraftmargins.push({
253 'id': $scope.contactAircraftList[i].aircraftsMargin.id 253 'id': $scope.contactAircraftList[i].aircraftsMargin.id
254 }) 254 })
255 $scope.contactAircraftList[i].fuelType = "Jet-A"; 255 $scope.contactAircraftList[i].fuelType = "Jet-A";
256 $scope.contactAircraftList[i].marginValue = result[i].aircraftsMargin.marginValue; 256 $scope.contactAircraftList[i].marginValue = result[i].aircraftsMargin.marginValue;
257 $scope.abc = true; 257 $scope.abc = true;
258 258
259 }else{ 259 }else{
260 $scope.contactAircraftList[i].fuelType = "100LL"; 260 $scope.contactAircraftList[i].fuelType = "100LL";
261 if (result[i].aircraftsAVGASMargin != null) {
261 $scope.contactAircraftList[i].marginValue = result[i].aircraftsAVGASMargin.marginValue; 262 $scope.contactAircraftList[i].marginValue = result[i].aircraftsAVGASMargin.marginValue;
262 $scope.xyz = true; 263 $scope.xyz = true;
264
265 }
263 } 266 }
264 267
265 } 268 }
266 if ($scope.aircraftmargins.length > 0) { 269 if ($scope.aircraftmargins.length > 0) {
267 for (var i = 0; i < $scope.aircraftmargins.length; i++) { 270 for (var i = 0; i < $scope.aircraftmargins.length; i++) {
268 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) { 271 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) {
269 $scope.multiple = true; 272 $scope.multiple = true;
270 $scope.multipleMsg = true; 273 $scope.multipleMsg = true;
271 if ($scope.multiple) { 274 if ($scope.multiple) {
272 $scope.companyData.masterMargin = "multiple"; 275 $scope.companyData.masterMargin = "multiple";
273 } 276 }
274 } 277 }
275 } 278 }
276 } 279 }
277 }) 280 })
278 } 281 }
279 282
280 283
281 284
282 $scope.contactData = {}; 285 $scope.contactData = {};
283 $scope.contactData.contactList = []; 286 $scope.contactData.contactList = [];
284 $scope.addContact = function() { 287 $scope.addContact = function() {
285 $scope.showLoader = true; 288 $scope.showLoader = true;
286 $scope.data.companyId = companyId; 289 $scope.data.companyId = companyId;
287 $scope.contactData.contactList.push($scope.data); 290 $scope.contactData.contactList.push($scope.data);
288 ViewCompanyService.addContact($scope.contactData).then(function(result) { 291 ViewCompanyService.addContact($scope.contactData).then(function(result) {
289 //console.log("data==",$scope.contactData) 292 //console.log("data==",$scope.contactData)
290 // console.log(result) 293 // console.log(result)
291 if (result.status == 200) { 294 if (result.status == 200) {
292 295
293 $('#contact-modal-3').modal('hide'); 296 $('#contact-modal-3').modal('hide');
294 $scope.primayData.id = result.data; 297 $scope.primayData.id = result.data;
295 $scope.data = {}; 298 $scope.data = {};
296 $scope.sendPrimaryContact(); 299 $scope.sendPrimaryContact();
297 getContactList(); 300 getContactList();
298 $scope.contactData.contactList = []; 301 $scope.contactData.contactList = [];
299 $scope.data.email = ''; 302 $scope.data.email = '';
300 toastr.success('Created Successfully', { 303 toastr.success('Created Successfully', {
301 closeButton: true 304 closeButton: true
302 }) 305 })
303 } else { 306 } else {
304 toastr.error('' + result.statusText + '', { 307 toastr.error('' + result.statusText + '', {
305 closeButton: true 308 closeButton: true
306 }) 309 })
307 } 310 }
308 }) 311 })
309 $scope.showLoader = false; 312 $scope.showLoader = false;
310 } 313 }
311 314
312 getData(); 315 getData();
313 316
314 function getData() { 317 function getData() {
315 $scope.showLoader = true; 318 $scope.showLoader = true;
316 CustomersService.getAircraftMake().then(function(result) { 319 CustomersService.getAircraftMake().then(function(result) {
317 $scope.aircraftMakeList = result; 320 $scope.aircraftMakeList = result;
318 // console.log("make",result) 321 // console.log("make",result)
319 }) 322 })
320 $scope.showLoader = false; 323 $scope.showLoader = false;
321 } 324 }
322 325
323 $scope.clearAircrafts = function() { 326 $scope.clearAircrafts = function() {
324 $scope.aircraftDetails = []; 327 $scope.aircraftDetails = [];
325 $scope.aircraftDetails = [{ 328 $scope.aircraftDetails = [{
326 'tail': '', 329 'tail': '',
327 'make': '', 330 'make': '',
328 'model': '', 331 'model': '',
329 'sizeId': '', 332 'sizeId': '',
330 'marginId': '', 333 'marginId': '',
331 'avgasMarginId': '' 334 'avgasMarginId': ''
332 }]; 335 }];
333 } 336 }
334 337
335 $scope.addNew = function() { 338 $scope.addNew = function() {
336 $scope.aircraftDetails.push({ 339 $scope.aircraftDetails.push({
337 'tail': '', 340 'tail': '',
338 'make': '', 341 'make': '',
339 'model': '', 342 'model': '',
340 'sizeId': '', 343 'sizeId': '',
341 'marginId': '', 344 'marginId': '',
342 'avgasMarginId': '' 345 'avgasMarginId': ''
343 }); 346 });
344 // console.log($scope.aircraftDetails) 347 // console.log($scope.aircraftDetails)
345 }; 348 };
346 349
347 $scope.getModal = function(makeId, index) { 350 $scope.getModal = function(makeId, index) {
348 $scope.showLoader = true; 351 $scope.showLoader = true;
349 $scope.aircraft.make = makeId; 352 $scope.aircraft.make = makeId;
350 CustomersService.getModal($scope.aircraft.make).then(function(result) { 353 CustomersService.getModal($scope.aircraft.make).then(function(result) {
351 $scope.showLoader = false; 354 $scope.showLoader = false;
352 $scope.aircraftDetails[index].aircraftModalList = result; 355 $scope.aircraftDetails[index].aircraftModalList = result;
353 //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0]; 356 //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0];
354 }) 357 })
355 } 358 }
356 359
357 $scope.selectedOption = ''; 360 $scope.selectedOption = '';
358 $scope.getSize = function(model, index) { 361 $scope.getSize = function(model, index) {
359 $scope.showLoader = true; 362 $scope.showLoader = true;
360 $scope.aircraft.model = model; 363 $scope.aircraft.model = model;
361 CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) { 364 CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) {
362 $scope.showLoader = false; 365 $scope.showLoader = false;
363 $scope.aircraftDetails[index].aircraftSizeList = result; 366 $scope.aircraftDetails[index].aircraftSizeList = result;
364 $scope.getFuelType($scope.aircraftDetails[index].aircraftSizeList[0].aircraftSize.id,index); 367 $scope.getFuelType($scope.aircraftDetails[index].aircraftSizeList[0].aircraftSize.id,index);
365 368
366 369
367 }) 370 })
368 } 371 }
369 372
370 $scope.getFuelType = function(size, index) { 373 $scope.getFuelType = function(size, index) {
371 $scope.showLoader = true; 374 $scope.showLoader = true;
372 var data = "model="+$scope.aircraft.model+"&make="+$scope.aircraft.make+"&sizeId="+size; 375 var data = "model="+$scope.aircraft.model+"&make="+$scope.aircraft.make+"&sizeId="+size;
373 ViewCompanyService.checkFuelType(data).then(function(result){ 376 ViewCompanyService.checkFuelType(data).then(function(result){
374 $scope.showLoader = false; 377 $scope.showLoader = false;
375 if (result.type == "JetA") { 378 if (result.type == "JetA") {
376 $scope.jetShow[index] = false; 379 $scope.jetShow[index] = false;
377 $scope.marginShow[index] = true; 380 $scope.marginShow[index] = true;
378 } else if (result.type == "Avgas") { 381 } else if (result.type == "Avgas") {
379 $scope.jetShow[index] = true; 382 $scope.jetShow[index] = true;
380 $scope.marginShow[index] = false; 383 $scope.marginShow[index] = false;
381 }else { 384 }else {
382 $scope.jetShow[index] = true; 385 $scope.jetShow[index] = true;
383 $scope.marginShow[index] = true; 386 $scope.marginShow[index] = true;
384 } 387 }
385 }) 388 })
386 } 389 }
387 390
388 $scope.aircraftListData = {}; 391 $scope.aircraftListData = {};
389 $scope.addData = []; 392 $scope.addData = [];
390 $scope.tailArray = []; 393 $scope.tailArray = [];
391 function check(array){ 394 function check(array){
392 return (new Set(array)).size !== array.length; 395 return (new Set(array)).size !== array.length;
393 } 396 }
394 $scope.saveCompanyData = function() { 397 $scope.saveCompanyData = function() {
395 $scope.tailArray = []; 398 $scope.tailArray = [];
396 for (var i = 0; i < $scope.aircraftDetails.length; i++) { 399 for (var i = 0; i < $scope.aircraftDetails.length; i++) {
397 $scope.addData.push({ 400 $scope.addData.push({
398 'tail': $scope.aircraftDetails[i].tail, 401 'tail': $scope.aircraftDetails[i].tail,
399 'make': $scope.aircraftDetails[i].make, 402 'make': $scope.aircraftDetails[i].make,
400 'model': $scope.aircraftDetails[i].model, 403 'model': $scope.aircraftDetails[i].model,
401 'sizeId': $scope.aircraftDetails[i].sizeId, 404 'sizeId': $scope.aircraftDetails[i].sizeId,
402 'marginId': $scope.aircraftDetails[i].marginId, 405 'marginId': $scope.aircraftDetails[i].marginId,
403 'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId 406 'avgasMarginId': $scope.aircraftDetails[i].avgasMarginId
404 }); 407 });
405 $scope.tailArray.push($scope.aircraftDetails[i].tail); 408 $scope.tailArray.push($scope.aircraftDetails[i].tail);
406 } 409 }
407 if (check($scope.tailArray)) { 410 if (check($scope.tailArray)) {
408 toastr.error('Duplicate Tail Added.', { 411 toastr.error('Duplicate Tail Added.', {
409 closeButton: true 412 closeButton: true
410 }) 413 })
411 }else{ 414 }else{
412 $scope.aircraftListData.aircraftList = $scope.addData; 415 $scope.aircraftListData.aircraftList = $scope.addData;
413 $scope.aircraftListData.accountId = companyId; 416 $scope.aircraftListData.accountId = companyId;
414 CustomersService.addAircraft($scope.aircraftListData).then(function(result) { 417 CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
415 if (result != null && result.success) { 418 if (result != null && result.success) {
416 toastr.success('' + result.success + '', { 419 toastr.success('' + result.success + '', {
417 closeButton: true 420 closeButton: true
418 }) 421 })
419 $scope.addData= []; 422 $scope.addData= [];
420 $scope.tailArray = []; 423 $scope.tailArray = [];
421 $scope.aircraftListData={}; 424 $scope.aircraftListData={};
422 $('#aircraft-modal-3').css('display', 'none'); 425 $('#aircraft-modal-3').css('display', 'none');
423 $('.modal-backdrop').css('display', 'none'); 426 $('.modal-backdrop').css('display', 'none');
424 $('#aircraft-modal-3').modal('hide'); 427 $('#aircraft-modal-3').modal('hide');
425 $('.modal-backdrop').modal('hide'); 428 $('.modal-backdrop').modal('hide');
426 getAircraftList(); 429 getAircraftList();
427 430
428 } else { 431 } else {
429 $('#aircraft-modal-3').css('display', 'none'); 432 $('#aircraft-modal-3').css('display', 'none');
430 $('.modal-backdrop').css('display', 'none'); 433 $('.modal-backdrop').css('display', 'none');
431 toastr.error('' + result.statusText + '', { 434 toastr.error('' + result.statusText + '', {
432 closeButton: true 435 closeButton: true
433 }) 436 })
434 } 437 }
435 }); 438 });
436 } 439 }
437 440
438 } 441 }
439 442
440 $scope.showNoteData = true; 443 $scope.showNoteData = true;
441 $scope.showCompanyName = true; 444 $scope.showCompanyName = true;
442 $scope.showAddress = true; 445 $scope.showAddress = true;
443 $scope.showNote = function() { 446 $scope.showNote = function() {
444 $scope.showNoteData = false; 447 $scope.showNoteData = false;
445 $scope.showUpdateBtn = true; 448 $scope.showUpdateBtn = true;
446 } 449 }
447 450
448 $scope.company = function() { 451 $scope.company = function() {
449 $scope.showCompanyName = false; 452 $scope.showCompanyName = false;
450 $scope.showUpdateBtn = true; 453 $scope.showUpdateBtn = true;
451 } 454 }
452 455
453 $scope.base = function() { 456 $scope.base = function() {
454 $scope.showUpdateBtn = true; 457 $scope.showUpdateBtn = true;
455 } 458 }
456 459
457 $scope.addressChange = function() { 460 $scope.addressChange = function() {
458 $scope.showAddress = false; 461 $scope.showAddress = false;
459 $scope.showUpdateBtn = true; 462 $scope.showUpdateBtn = true;
460 } 463 }
461 464
462 $scope.editData = function(inputName) { 465 $scope.editData = function(inputName) {
463 //console.log($scope.companyData) 466 //console.log($scope.companyData)
464 $scope.showLoader = true; 467 $scope.showLoader = true;
465 /*if(inputName == 'showNoteData'){ 468 /*if(inputName == 'showNoteData'){
466 $scope.showNoteData = true; 469 $scope.showNoteData = true;
467 }else if(inputName == 'showCompanyName'){ 470 }else if(inputName == 'showCompanyName'){
468 $scope.showCompanyName = true; 471 $scope.showCompanyName = true;
469 }else if(inputName == 'showAddress'){ 472 }else if(inputName == 'showAddress'){
470 $scope.showAddress = true; 473 $scope.showAddress = true;
471 }*/ 474 }*/
472 $scope.showNoteData = true; 475 $scope.showNoteData = true;
473 $scope.showCompanyName = true; 476 $scope.showCompanyName = true;
474 $scope.showAddress = true; 477 $scope.showAddress = true;
475 478
476 var companyData = "companyName=" + $scope.companyData.companyName + "&masterMargin=" + $scope.companyData.masterMargin + "&avgasMargin=" + $scope.companyData.avgasMargin + 479 var companyData = "companyName=" + $scope.companyData.companyName + "&masterMargin=" + $scope.companyData.masterMargin + "&avgasMargin=" + $scope.companyData.avgasMargin +
477 "&addressOne=" + $scope.companyData.addressOne + "&addressTwo=" + $scope.companyData.addressTwo + "&city=" + $scope.companyData.city + "&state=" + 480 "&addressOne=" + $scope.companyData.addressOne + "&addressTwo=" + $scope.companyData.addressTwo + "&city=" + $scope.companyData.city + "&state=" +
478 $scope.companyData.state + "&country=" + $scope.companyData.country + "&zipcode=" + $scope.companyData.zipcode + "&internalNote=" + 481 $scope.companyData.state + "&country=" + $scope.companyData.country + "&zipcode=" + $scope.companyData.zipcode + "&internalNote=" +
479 $scope.companyData.internalNote + "&certificateType=" + $scope.companyData.certificateType + "&baseTenant=" + $scope.companyData.baseTenant + 482 $scope.companyData.internalNote + "&certificateType=" + $scope.companyData.certificateType + "&baseTenant=" + $scope.companyData.baseTenant +
480 "&fuelerlinxCustomer=" + $scope.companyData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.companyData.contractFuelVendor + 483 "&fuelerlinxCustomer=" + $scope.companyData.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.companyData.contractFuelVendor +
481 "&activate=" + $scope.companyData.activate + "&baseIcao=" + $scope.companyData.baseIcao + "&companyId=" + companyId + "&global=" + $scope.companyData.global; 484 "&activate=" + $scope.companyData.activate + "&baseIcao=" + $scope.companyData.baseIcao + "&companyId=" + companyId + "&global=" + $scope.companyData.global;
482 485
483 ViewCompanyService.updateCompany(companyData).then(function(result) { 486 ViewCompanyService.updateCompany(companyData).then(function(result) {
484 if (result != null && result.success) { 487 if (result != null && result.success) {
485 toastr.success('' + result.success + '', { 488 toastr.success('' + result.success + '', {
486 closeButton: true 489 closeButton: true
487 }) 490 })
488 $scope.showUpdateBtn = false; 491 $scope.showUpdateBtn = false;
489 getCompanyDetail(); 492 getCompanyDetail();
490 } else { 493 } else {
491 toastr.error('Error Updating Company', { 494 toastr.error('Error Updating Company', {
492 closeButton: true 495 closeButton: true
493 }) 496 })
494 $scope.showUpdateBtn = true; 497 $scope.showUpdateBtn = true;
495 } 498 }
496 $scope.showLoader = false; 499 $scope.showLoader = false;
497 }) 500 })
498 } 501 }
499 502
500 $scope.cancelUpdateData = function() { 503 $scope.cancelUpdateData = function() {
501 $scope.showNoteData = true; 504 $scope.showNoteData = true;
502 $scope.showCompanyName = true; 505 $scope.showCompanyName = true;
503 $scope.showAddress = true; 506 $scope.showAddress = true;
504 $scope.showUpdateBtn = false; 507 $scope.showUpdateBtn = false;
505 } 508 }
506 509
507 $scope.sendMail = function() { 510 $scope.sendMail = function() {
508 $scope.showLoader = true; 511 $scope.showLoader = true;
509 $('#confirm1').css('display', 'none'); 512 $('#confirm1').css('display', 'none');
510 ViewCompanyService.sendMail(companyId).then(function(result) { 513 ViewCompanyService.sendMail(companyId).then(function(result) {
511 if (result != null && result.success) { 514 if (result != null && result.success) {
512 toastr.success('' + result.success + '', { 515 toastr.success('' + result.success + '', {
513 closeButton: true 516 closeButton: true
514 }) 517 })
515 } else { 518 } else {
516 toastr.error('Error Sending Email', { 519 toastr.error('Error Sending Email', {
517 closeButton: true 520 closeButton: true
518 }) 521 })
519 } 522 }
520 $scope.showLoader = false; 523 $scope.showLoader = false;
521 }) 524 })
522 } 525 }
523 526
524 $scope.openConfirmMail = function() { 527 $scope.openConfirmMail = function() {
525 $('#confirm1').css('display', 'block'); 528 $('#confirm1').css('display', 'block');
526 } 529 }
527 530
528 531
529 $scope.cancelAndCloseConfirm = function() { 532 $scope.cancelAndCloseConfirm = function() {
530 $('#confirm1').css('display', 'none'); 533 $('#confirm1').css('display', 'none');
531 } 534 }
532 535
533 $scope.primaryContact = false; 536 $scope.primaryContact = false;
534 $scope.cancelPrimaryContact = function() { 537 $scope.cancelPrimaryContact = function() {
535 $('#primaryContact').css('display', 'none'); 538 $('#primaryContact').css('display', 'none');
536 $scope.primaryContact = false; 539 $scope.primaryContact = false;
537 } 540 }
538 541
539 $scope.checkPrimaryContact = function() { 542 $scope.checkPrimaryContact = function() {
540 if ($scope.primaryContact == true) { 543 if ($scope.primaryContact == true) {
541 $scope.primaryContact = true; 544 $scope.primaryContact = true;
542 ViewCompanyService.checkPrimaryContact(companyId).then(function(result) { 545 ViewCompanyService.checkPrimaryContact(companyId).then(function(result) {
543 //console.log(result) 546 //console.log(result)
544 if (result.status == 422) { 547 if (result.status == 422) {
545 $('#primaryContact').css('display', 'block'); 548 $('#primaryContact').css('display', 'block');
546 } 549 }
547 }) 550 })
548 } 551 }
549 } 552 }
550 553
551 $scope.sendPrimaryContact = function() { 554 $scope.sendPrimaryContact = function() {
552 $('#primaryContact').css('display', 'none'); 555 $('#primaryContact').css('display', 'none');
553 if ($scope.primayData.id != null || $scope.primayData.id != undefined) { 556 if ($scope.primayData.id != null || $scope.primayData.id != undefined) {
554 var priamryContactData = "companyContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact; 557 var priamryContactData = "companyContactId=" + $scope.primayData.id + "&primary=" + $scope.primaryContact;
555 558
556 ViewCompanyService.addPrimaryContact(priamryContactData).then(function(result) { 559 ViewCompanyService.addPrimaryContact(priamryContactData).then(function(result) {
557 // console.log(result) 560 // console.log(result)
558 }) 561 })
559 } 562 }
560 563
561 } 564 }
562 565
563 $scope.updateData = "" 566 $scope.updateData = ""
564 $scope.showUpdateContact = function(data, value) { 567 $scope.showUpdateContact = function(data, value) {
565 $('#updateContact').css('display', 'block'); 568 $('#updateContact').css('display', 'block');
566 $scope.updateData = data; 569 $scope.updateData = data;
567 // console.log($scope.updateData) 570 // console.log($scope.updateData)
568 if ($scope.updateData.email == null) { 571 if ($scope.updateData.email == null) {
569 $scope.updateData.content = data.contactNumber; 572 $scope.updateData.content = data.contactNumber;
570 } else { 573 } else {
571 $scope.updateData.content = data.email; 574 $scope.updateData.content = data.email;
572 } 575 }
573 } 576 }
574 577
575 $scope.showUpdateEmail = function(data, value) { 578 $scope.showUpdateEmail = function(data, value) {
576 $('#updateEmail').css('display', 'block'); 579 $('#updateEmail').css('display', 'block');
577 $scope.updateData = data; 580 $scope.updateData = data;
578 // console.log($scope.updateData) 581 // console.log($scope.updateData)
579 if ($scope.updateData.email == null) { 582 if ($scope.updateData.email == null) {
580 $scope.updateData.content = data.contactNumber; 583 $scope.updateData.content = data.contactNumber;
581 } else { 584 } else {
582 $scope.updateData.content = data.email; 585 $scope.updateData.content = data.email;
583 } 586 }
584 } 587 }
585 588
586 $scope.acceptUpdateField = function(newContactName) { 589 $scope.acceptUpdateField = function(newContactName) {
587 // console.log($scope.updateData) 590 // console.log($scope.updateData)
588 if ($scope.updateData.content == undefined) { 591 if ($scope.updateData.content == undefined) {
589 toastr.error('Please add some content', { 592 toastr.error('Please add some content', {
590 closeButton: true 593 closeButton: true
591 }) 594 })
592 } else { 595 } else {
593 if (newContactName == 'phone') { 596 if (newContactName == 'phone') {
594 var updateCustomData = "companyId=" + companyId + "&contactNumber=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id + 597 var updateCustomData = "companyId=" + companyId + "&contactNumber=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id +
595 "&title=" + $scope.updateData.title; 598 "&title=" + $scope.updateData.title;
596 } else { 599 } else {
597 var updateCustomData = "companyId=" + companyId + "&email=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id + 600 var updateCustomData = "companyId=" + companyId + "&email=" + $scope.updateData.content + "&contactId=" + $scope.updateData.id +
598 "&title=" + $scope.updateData.title; 601 "&title=" + $scope.updateData.title;
599 } 602 }
600 ViewCompanyService.updateCustomField(updateCustomData).then(function(result) { 603 ViewCompanyService.updateCustomField(updateCustomData).then(function(result) {
601 if (result != null && result.success) { 604 if (result != null && result.success) {
602 $('#updateContact').css('display', 'none'); 605 $('#updateContact').css('display', 'none');
603 $('#updateEmail').css('display', 'none'); 606 $('#updateEmail').css('display', 'none');
604 getCompanyDetail(); 607 getCompanyDetail();
605 } 608 }
606 }) 609 })
607 } 610 }
608 } 611 }
609 612
610 $scope.deleteContent = function(data){ 613 $scope.deleteContent = function(data){
611 ViewCompanyService.deleteCustomContact(data.id).then(function(result) { 614 ViewCompanyService.deleteCustomContact(data.id).then(function(result) {
612 if (result != null && result.success) { 615 if (result != null && result.success) {
613 toastr.success('' + result.success + '', { 616 toastr.success('' + result.success + '', {
614 closeButton: true 617 closeButton: true
615 }) 618 })
616 getCompanyDetail(); 619 getCompanyDetail();
617 } 620 }
618 }) 621 })
619 } 622 }
620 623
621 $scope.cancelUpdateField = function() { 624 $scope.cancelUpdateField = function() {
622 $('#updateContact').css('display', 'none'); 625 $('#updateContact').css('display', 'none');
623 $('#updateEmail').css('display', 'none'); 626 $('#updateEmail').css('display', 'none');
624 } 627 }
625 628
626 $scope.showEditTier2 = function(number) { 629 $scope.showEditTier2 = function(number) {
627 // console.log(number) 630 // console.log(number)
628 $scope.contactNumber = number; 631 $scope.contactNumber = number;
629 } 632 }
630 633
631 634
632 635
633 $scope.addCustomPhone = function(value) { 636 $scope.addCustomPhone = function(value) {
634 //console.log(value) 637 //console.log(value)
635 if (value != null) { 638 if (value != null) {
636 $('#customFieldPhone').css('display', 'block'); 639 $('#customFieldPhone').css('display', 'block');
637 } 640 }
638 $scope.custom = {}; 641 $scope.custom = {};
639 } 642 }
640 643
641 $scope.addCustomEmail = function(value) { 644 $scope.addCustomEmail = function(value) {
642 //console.log(value) 645 //console.log(value)
643 if (value != null) { 646 if (value != null) {
644 $('#customFieldEmail').css('display', 'block'); 647 $('#customFieldEmail').css('display', 'block');
645 } 648 }
646 $scope.custom = {}; 649 $scope.custom = {};
647 } 650 }
648 651
649 $scope.cancelCustomField = function() { 652 $scope.cancelCustomField = function() {
650 $('#customFieldEmail').css('display', 'none'); 653 $('#customFieldEmail').css('display', 'none');
651 $('#customFieldPhone').css('display', 'none'); 654 $('#customFieldPhone').css('display', 'none');
652 } 655 }
653 656
654 $scope.acceptCustomField = function(contactName) { 657 $scope.acceptCustomField = function(contactName) {
655 if ($scope.custom.content == undefined) { 658 if ($scope.custom.content == undefined) {
656 toastr.error('Please add some content', { 659 toastr.error('Please add some content', {
657 closeButton: true 660 closeButton: true
658 }) 661 })
659 } else { 662 } else {
660 if (contactName == 'phone') { 663 if (contactName == 'phone') {
661 var customData = "companyId=" + companyId + "&contactNumber=" + $scope.custom.content + 664 var customData = "companyId=" + companyId + "&contactNumber=" + $scope.custom.content +
662 "&title=" + $scope.custom.title; 665 "&title=" + $scope.custom.title;
663 } else { 666 } else {
664 var customData = "companyId=" + companyId + "&email=" + $scope.custom.content + 667 var customData = "companyId=" + companyId + "&email=" + $scope.custom.content +
665 "&title=" + $scope.custom.title; 668 "&title=" + $scope.custom.title;
666 } 669 }
667 // console.log(customData.email) 670 // console.log(customData.email)
668 ViewCompanyService.addCustomField(customData).then(function(result) { 671 ViewCompanyService.addCustomField(customData).then(function(result) {
669 // console.log(result) 672 // console.log(result)
670 if (result != null && result.success) { 673 if (result != null && result.success) {
671 $('#customFieldEmail').css('display', 'none'); 674 $('#customFieldEmail').css('display', 'none');
672 $('#customFieldPhone').css('display', 'none'); 675 $('#customFieldPhone').css('display', 'none');
673 $scope.custom = {}; 676 $scope.custom = {};
674 getCompanyDetail(); 677 getCompanyDetail();
675 } 678 }
676 }) 679 })
677 } 680 }
678 } 681 }
679 682
680 /* omit strike out*/ 683 /* omit strike out*/
681 updateFuelManagerService.getFuelPricingNew().then(function(result) { 684 updateFuelManagerService.getFuelPricingNew().then(function(result) {
682 $scope.fuelPricing = result; 685 $scope.fuelPricing = result;
683 $scope.omitData; 686 $scope.omitData;
684 ViewCompanyService.getOmitCompany($scope.compId).then(function(result){ 687 ViewCompanyService.getOmitCompany($scope.compId).then(function(result){
685 $scope.omitData = result; 688 $scope.omitData = result;
686 //console.log("omit data===", $scope.omitData); 689 //console.log("omit data===", $scope.omitData);
687 for(var i = 0 ; i< $scope.fuelPricing.length; i++){ 690 for(var i = 0 ; i< $scope.fuelPricing.length; i++){
688 for(var j = 0; j<$scope.omitData.length; j++){ 691 for(var j = 0; j<$scope.omitData.length; j++){
689 if($scope.omitData[j].marginId == $scope.fuelPricing[i].fuelPricing.id){ 692 if($scope.omitData[j].marginId == $scope.fuelPricing[i].fuelPricing.id){
690 $scope.fuelPricing[i].fuelPricing.omit = $scope.omitData[j].omit; 693 $scope.fuelPricing[i].fuelPricing.omit = $scope.omitData[j].omit;
691 } 694 }
692 } 695 }
693 } 696 }
694 697
695 }) 698 })
696 699
697 // console.log("$scope.fuelPricing",$scope.fuelPricing) 700 // console.log("$scope.fuelPricing",$scope.fuelPricing)
698 for (var i = 0; i < $scope.fuelPricing.length; i++) { 701 for (var i = 0; i < $scope.fuelPricing.length; i++) {
699 // console.log('$scope.fuelPricing[i].fuelPricing', $scope.fuelPricing[i].fuelPricing); 702 // console.log('$scope.fuelPricing[i].fuelPricing', $scope.fuelPricing[i].fuelPricing);
700 //console.log("fuelid",$scope.fuelPricing[i].fuelPricing.id,"getid",$scope.omitData[j].id) 703 //console.log("fuelid",$scope.fuelPricing[i].fuelPricing.id,"getid",$scope.omitData[j].id)
701 if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) { 704 if ($scope.fuelPricing[i].fuelPricing.expirationDate != null) {
702 $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); 705 $scope.fuelPricing[i].fuelPricing.expirationDate = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
703 var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate); 706 var newTime = new Date($scope.fuelPricing[i].fuelPricing.expirationDate);
704 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 707 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
705 var dday = newTime.getUTCDate(); 708 var dday = newTime.getUTCDate();
706 var dyear = newTime.getUTCFullYear(); 709 var dyear = newTime.getUTCFullYear();
707 $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth + '/' + dday + '/' + dyear; 710 $scope.fuelPricing[i].fuelPricing.expirationDate = dmonth + '/' + dday + '/' + dyear;
708 } 711 }
709 // for (var j = 0; j<$scope.omitData.length; j++) { 712 // for (var j = 0; j<$scope.omitData.length; j++) {
710 // if($scope.fuelPricing[i].fuelPricing.id === $scope.omitData[j].id){ 713 // if($scope.fuelPricing[i].fuelPricing.id === $scope.omitData[j].id){
711 714
712 // } 715 // }
713 // } 716 // }
714 } 717 }
715 }) 718 })
716 719
717 var deleteAircraftId = ""; 720 var deleteAircraftId = "";
718 $scope.deleteAircraft = function(id) { 721 $scope.deleteAircraft = function(id) {
719 $('#delete1').css('display', 'block'); 722 $('#delete1').css('display', 'block');
720 deleteAircraftId = id; 723 deleteAircraftId = id;
721 } 724 }
722 725
723 $scope.aircraftDelete = function() { 726 $scope.aircraftDelete = function() {
724 ViewCompanyService.deleteAircraft(deleteAircraftId).then(function(result) { 727 ViewCompanyService.deleteAircraft(deleteAircraftId).then(function(result) {
725 // console.log(result) 728 // console.log(result)
726 getAircraftList(); 729 getAircraftList();
727 getCompanyDetail(); 730 getCompanyDetail();
728 $('#delete1').css('display', 'none'); 731 $('#delete1').css('display', 'none');
729 }) 732 })
730 } 733 }
731 734
732 $scope.cancelAircraft = function() { 735 $scope.cancelAircraft = function() {
733 $('#delete1').css('display', 'none'); 736 $('#delete1').css('display', 'none');
734 } 737 }
735 738
736 CustomersService.getJetMargin($scope.userProfileId).then(function(result) { 739 CustomersService.getJetMargin($scope.userProfileId).then(function(result) {
737 $scope.jetMarginList = result; 740 $scope.jetMarginList = result;
738 }) 741 })
739 742
740 CustomersService.getAvgMargin($scope.userProfileId).then(function(result) { 743 CustomersService.getAvgMargin($scope.userProfileId).then(function(result) {
741 $scope.avgsMarginList = result; 744 $scope.avgsMarginList = result;
742 }) 745 })
743 746
744 $scope.changePriceEmail = function(id, index) { 747 $scope.changePriceEmail = function(id, index) {
745 event.stopPropagation(); 748 event.stopPropagation();
746 var contactId = id; 749 var contactId = id;
747 var statusData = "status=" + $scope.companyContactList[index].priceEmail; 750 var statusData = "status=" + $scope.companyContactList[index].priceEmail;
748 ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) { 751 ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) {
749 if (result.success) { 752 if (result.success) {
750 $('#toogleMail').css('display', 'block'); 753 $('#toogleMail').css('display', 'block');
751 if ($scope.companyContactList[index].priceEmail == true) { 754 if ($scope.companyContactList[index].priceEmail == true) {
752 $scope.messageText = 'You have enabled price distribution for this contact'; 755 $scope.messageText = 'You have enabled price distribution for this contact';
753 } else { 756 } else {
754 $scope.messageText = 'You have disabled price distribution for this contact'; 757 $scope.messageText = 'You have disabled price distribution for this contact';
755 } 758 }
756 } 759 }
757 }) 760 })
758 } 761 }
759 762
760 $scope.cancelToogle = function() { 763 $scope.cancelToogle = function() {
761 $('#toogleMail').css('display', 'none'); 764 $('#toogleMail').css('display', 'none');
762 } 765 }
763 766
764 $scope.checkboxStatus = function(value) { 767 $scope.checkboxStatus = function(value) {
765 // console.log("checkbox",value) 768 // console.log("checkbox",value)
766 $scope.showUpdateBtn = true; 769 $scope.showUpdateBtn = true;
767 } 770 }
768 771
769 $scope.fuelercheckboxStatus = function(value) { 772 $scope.fuelercheckboxStatus = function(value) {
770 $('#fuelerchange').css('display', 'block'); 773 $('#fuelerchange').css('display', 'block');
771 if (value == true) { 774 if (value == true) {
772 $scope.statusMessage = 'Please confirm! Enabling FuelerLinx for this customer will enable price distribution web services and disable price emails for the contacts in this company' 775 $scope.statusMessage = 'Please confirm! Enabling FuelerLinx for this customer will enable price distribution web services and disable price emails for the contacts in this company'
773 } else { 776 } else {
774 $scope.statusMessage = 'Please confirm! Disabling FuelerLinx for this customer will disable price distribution web services into their FuelerLinx account. If you proceed then remember to enable price emails for the appropriate contacts in this company.' 777 $scope.statusMessage = 'Please confirm! Disabling FuelerLinx for this customer will disable price distribution web services into their FuelerLinx account. If you proceed then remember to enable price emails for the appropriate contacts in this company.'
775 } 778 }
776 779
777 780
778 } 781 }
779 782
780 $scope.fuelerCancelStatus = function() { 783 $scope.fuelerCancelStatus = function() {
781 $('#fuelerchange').css('display', 'none'); 784 $('#fuelerchange').css('display', 'none');
782 $scope.companyData.fuelerlinxCustomer = !$scope.companyData.fuelerlinxCustomer; 785 $scope.companyData.fuelerlinxCustomer = !$scope.companyData.fuelerlinxCustomer;
783 } 786 }
784 787
785 $scope.fuelerAcceptStatus = function() { 788 $scope.fuelerAcceptStatus = function() {
786 $('#fuelerchange').css('display', 'none'); 789 $('#fuelerchange').css('display', 'none');
787 $scope.showLoader = true; 790 $scope.showLoader = true;
788 var statusData; 791 var statusData;
789 if ($scope.companyData.fuelerlinxCustomer == false) { 792 if ($scope.companyData.fuelerlinxCustomer == false) {
790 statusData = "status=true"; 793 statusData = "status=true";
791 } else { 794 } else {
792 statusData = "status=false"; 795 statusData = "status=false";
793 } 796 }
794 ViewCompanyService.fuelerPricingChange(companyId, statusData).then(function(result) { 797 ViewCompanyService.fuelerPricingChange(companyId, statusData).then(function(result) {
795 if (result.success) { 798 if (result.success) {
796 $scope.showLoader = false; 799 $scope.showLoader = false;
797 800
798 $scope.editData(); 801 $scope.editData();
799 getContactList(); 802 getContactList();
800 803
801 } 804 }
802 }) 805 })
803 } 806 }
804 807
805 808
806 $scope.updateOmit = function(fuel, omit) { 809 $scope.updateOmit = function(fuel, omit) {
807 $scope.fuelData = {}; 810 $scope.fuelData = {};
808 $scope.fuelData.expirationDate = new Date(fuel.expirationDate); 811 $scope.fuelData.expirationDate = new Date(fuel.expirationDate);
809 $scope.fuelData.customMarginId = fuel.id; 812 $scope.fuelData.customMarginId = fuel.id;
810 $scope.fuelData.omit = fuel.omit; 813 $scope.fuelData.omit = fuel.omit;
811 $scope.fuelData.papMargin = fuel.papMargin; 814 $scope.fuelData.papMargin = fuel.papMargin;
812 $scope.fuelData.papTotal = fuel.papTotal; 815 $scope.fuelData.papTotal = fuel.papTotal;
813 $scope.fuelData.cost = fuel.cost; 816 $scope.fuelData.cost = fuel.cost;
814 $scope.fuelData.companyId = $scope.compId ; 817 $scope.fuelData.companyId = $scope.compId ;
815 if($scope.fuelData.omit == true) 818 if($scope.fuelData.omit == true)
816 { 819 {
817 var customData = "companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId; 820 var customData = "companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId;
818 // console.log(".") 821 // console.log(".")
819 ViewCompanyService.omitAddCompanyFuel(customData).then(function(result) { 822 ViewCompanyService.omitAddCompanyFuel(customData).then(function(result) {
820 if (result.success) { 823 if (result.success) {
821 toastr.success('' + result.success + '', { 824 toastr.success('' + result.success + '', {
822 closeButton: true 825 closeButton: true
823 }) 826 })
824 } else { 827 } else {
825 toastr.error('' + result.statusText + '', { 828 toastr.error('' + result.statusText + '', {
826 closeButton: true 829 closeButton: true
827 }) 830 })
828 } 831 }
829 }) 832 })
830 }else{ 833 }else{
831 var data ="companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId; 834 var data ="companyId=" + $scope.fuelData.companyId + "&customMarginId=" + $scope.fuelData.customMarginId;
832 ViewCompanyService.omitDeleteCompanyFuel(data).then(function(result){ 835 ViewCompanyService.omitDeleteCompanyFuel(data).then(function(result){
833 if (result.success) { 836 if (result.success) {
834 toastr.success('' + result.success + '', { 837 toastr.success('' + result.success + '', {
835 closeButton: true 838 closeButton: true
836 }) 839 })
837 } else { 840 } else {
838 toastr.error('' + result.statusText + '', { 841 toastr.error('' + result.statusText + '', {
839 closeButton: true 842 closeButton: true
840 }) 843 })
841 } 844 }
842 }) 845 })
843 } 846 }
844 } 847 }
845 848
846 849
847 //--fuel type based on tail is not in use-- 850 //--fuel type based on tail is not in use--
848 // $scope.aircraftData = {} 851 // $scope.aircraftData = {}
849 /*$scope.checkJetWithTail = function(tail, index) { 852 /*$scope.checkJetWithTail = function(tail, index) {
850 853
851 console.log("tail==============",tail, index) 854 console.log("tail==============",tail, index)
852 ViewCompanyService.checkJetType(tail).then(function(result) { 855 ViewCompanyService.checkJetType(tail).then(function(result) {
853 console.log("result",result) 856 console.log("result",result)
854 if (result.jetA == "true") { 857 if (result.jetA == "true") {
855 $scope.jetShow[index] = false; 858 $scope.jetShow[index] = false;
856 $scope.marginShow[index] = true; 859 $scope.marginShow[index] = true;
857 } else { 860 } else {
858 $scope.jetShow[index] = true; 861 $scope.jetShow[index] = true;
859 $scope.marginShow[index] = false; 862 $scope.marginShow[index] = false;
860 } 863 }
861 }) 864 })
862 }*/ 865 }*/
863 866
864 867
865 /*add a fuel order*/ 868 /*add a fuel order*/
866 869
867 870
868 $scope.getOrders = function() { 871 $scope.getOrders = function() {
869 fuelOrdersService.getOrders().then(function(result) { 872 fuelOrdersService.getOrders().then(function(result) {
870 873
871 $scope.orderdata = result; 874 $scope.orderdata = result;
872 for (var i = 0; i < $scope.orderdata.length; i++) { 875 for (var i = 0; i < $scope.orderdata.length; i++) {
873 $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate); 876 $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate);
874 877
875 // var str = "" + $scope.orderdata[i].upliftDateS.getDate() + "/" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getFullYear() 878 // var str = "" + $scope.orderdata[i].upliftDateS.getDate() + "/" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getFullYear()
876 var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear() 879 var str = "" + ($scope.orderdata[i].upliftDateS.getMonth() + 1) + "/" + $scope.orderdata[i].upliftDateS.getDate() + "/" + $scope.orderdata[i].upliftDateS.getFullYear()
877 // str = str.slice(4,16) 880 // str = str.slice(4,16)
878 $scope.orderdata[i].upliftDateString = str 881 $scope.orderdata[i].upliftDateString = str
879 // console.log(str); 882 // console.log(str);
880 883
881 } 884 }
882 885
883 $scope.displayFuelOrderList = new NgTableParams({ 886 $scope.displayFuelOrderList = new NgTableParams({
884 page: 1, 887 page: 1,
885 count: 10, 888 count: 10,
886 }, { 889 }, {
887 data: $scope.orderdata 890 data: $scope.orderdata
888 }); 891 });
889 $(document).ready(function() { 892 $(document).ready(function() {
890 var myselect = document.getElementsByClassName('colorfulSelectbox'); 893 var myselect = document.getElementsByClassName('colorfulSelectbox');
891 894
892 for (var i = 0; i < myselect.length; i++) { 895 for (var i = 0; i < myselect.length; i++) {
893 var colourIndex = $(myselect[i]).prop('selectedIndex'); 896 var colourIndex = $(myselect[i]).prop('selectedIndex');
894 colourIndex = colourIndex + 1; 897 colourIndex = colourIndex + 1;
895 // console.log(colourIndex); 898 // console.log(colourIndex);
896 var getColor = $('.colorfulSelectbox option:nth-child(' + colourIndex + ')').css('color'); 899 var getColor = $('.colorfulSelectbox option:nth-child(' + colourIndex + ')').css('color');
897 $(myselect[i]).css('background-color', getColor); 900 $(myselect[i]).css('background-color', getColor);
898 // console.log('colour', getColor); 901 // console.log('colour', getColor);
899 myselect[i].blur(); 902 myselect[i].blur();
900 } 903 }
901 904
902 }) 905 })
903 906
904 }) 907 })
905 } 908 }
906 909
907 $scope.getOrders(); 910 $scope.getOrders();
908 911
909 $scope.tiervalue=function(){ 912 $scope.tiervalue=function(){
910 $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak; 913 $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak;
911 } 914 }
912 915
913 $scope.setCost = function(cost){ 916 $scope.setCost = function(cost){
914 if(cost != null) { 917 if(cost != null) {
915 var obj =JSON.parse(cost); 918 var obj =JSON.parse(cost);
916 $scope.order.fboCost = obj.cost; 919 $scope.order.fboCost = obj.cost;
917 } 920 }
918 } 921 }
919 922
920 $scope.cancelOrder = function() { 923 $scope.cancelOrder = function() {
921 $scope.order = {}; 924 $scope.order = {};
922 } 925 }
923 926
924 $scope.dispatchFuel = function(){ 927 $scope.dispatchFuel = function(){
925 $scope.showLoader = true; 928 $scope.showLoader = true;
926 $scope.order.companyId = $scope.compId; 929 $scope.order.companyId = $scope.compId;
927 if ($scope.order.upliftDate != '') { 930 if ($scope.order.upliftDate != '') {
928 var currentDate = new Date(); 931 var currentDate = new Date();
929 var hours = currentDate.getHours(); 932 var hours = currentDate.getHours();
930 var min = currentDate.getMinutes(); 933 var min = currentDate.getMinutes();
931 var sec = currentDate.getSeconds(); 934 var sec = currentDate.getSeconds();
932 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec; 935 $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec;
933 $scope.order.upliftDate = new Date($scope.order.upliftDate); 936 $scope.order.upliftDate = new Date($scope.order.upliftDate);
934 $scope.order.upliftDate = $scope.order.upliftDate.getTime(); 937 $scope.order.upliftDate = $scope.order.upliftDate.getTime();
935 } 938 }
936 $scope.order.status = 'pending'; 939 $scope.order.status = 'pending';
937 var obj =JSON.parse($scope.order.priceQuote); 940 var obj =JSON.parse($scope.order.priceQuote);
938 $scope.order.priceQuote = obj.papTotal; 941 $scope.order.priceQuote = obj.papTotal;
939 $scope.order.fboCost = obj.cost; 942 $scope.order.fboCost = obj.cost;
940 $scope.order.total = obj.papTotal * $scope.order.volume; 943 $scope.order.total = obj.papTotal * $scope.order.volume;
941 var aircraftObj =JSON.parse($scope.order.aircraftName); 944 var aircraftObj =JSON.parse($scope.order.aircraftName);
942 $scope.order.aircraftName = aircraftObj.tail; 945 $scope.order.aircraftName = aircraftObj.tail;
943 $scope.order.make = aircraftObj.make; 946 $scope.order.make = aircraftObj.make;
944 $scope.order.model = aircraftObj.model; 947 $scope.order.model = aircraftObj.model;
945 $scope.dispatchOrder.fuelOrderList.push($scope.order); 948 $scope.dispatchOrder.fuelOrderList.push($scope.order);
946 enterFuelOrderService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { 949 enterFuelOrderService.dispathFuelOrder($scope.dispatchOrder).then(function(result) {
947 $scope.showLoader = false; 950 $scope.showLoader = false;
948 $scope.order = {}; 951 $scope.order = {};
949 $('#demo-modal-4').css('display', ''); 952 $('#demo-modal-4').css('display', '');
950 toastr.success('Fuel Order Dispatched Successfully', { 953 toastr.success('Fuel Order Dispatched Successfully', {
951 closeButton: true 954 closeButton: true
952 }) 955 })
953 }) 956 })
954 } 957 }
955 958
956 $scope.addTotal = function(value, valueOf) { 959 $scope.addTotal = function(value, valueOf) {
957 if (valueOf == 'v') { 960 if (valueOf == 'v') {
958 $scope.order.total = value * $scope.order.invoiced 961 $scope.order.total = value * $scope.order.invoiced
959 } else if (valueOf == 'i') { 962 } else if (valueOf == 'i') {
960 $scope.order.total = $scope.order.volume * value 963 $scope.order.total = $scope.order.volume * value
961 } 964 }
962 } 965 }
963 966
964 $scope.getAircraft = function(company) { 967 $scope.getAircraft = function(company) {
965 $scope.selectedCompanyName = company; 968 $scope.selectedCompanyName = company;
966 969
967 if ($scope.companyData.margin != null && $scope.companyData.marginAVGAS != null) { 970 if ($scope.companyData.margin != null && $scope.companyData.marginAVGAS != null) {
968 fuelOrdersService.getFuelCost($scope.companyData.id).then(function(margins) { 971 fuelOrdersService.getFuelCost($scope.companyData.id).then(function(margins) {
969 $scope.marginList = margins; 972 $scope.marginList = margins;
970 //console.log('$scope.marginList', $scope.marginList); 973 //console.log('$scope.marginList', $scope.marginList);
971 }) 974 })
972 } else if ($scope.companyData.margin != null || $scope.companyData.marginAVGAS == null) { 975 } else if ($scope.companyData.margin != null || $scope.companyData.marginAVGAS == null) {
973 fuelOrdersService.getATypeFuelPricing($scope.companyData.id).then(function(margins) { 976 fuelOrdersService.getATypeFuelPricing($scope.companyData.id).then(function(margins) {
974 $scope.marginList = margins; 977 $scope.marginList = margins;
975 }) 978 })
976 } else if ($scope.companyData.margin == null || $scope.companyData.marginAVGAS != null) { 979 } else if ($scope.companyData.margin == null || $scope.companyData.marginAVGAS != null) {
977 fuelOrdersService.getVTypeFuelPricing($scope.companyData.id).then(function(margins) { 980 fuelOrdersService.getVTypeFuelPricing($scope.companyData.id).then(function(margins) {
978 $scope.marginList = margins; 981 $scope.marginList = margins;
979 }) 982 })
980 } 983 }
981 984
982 985
983 $scope.selectedCompanyId = $scope.companyData.id; 986 $scope.selectedCompanyId = $scope.companyData.id;
984 $scope.marginId = $scope.companyData.margin.id; 987 $scope.marginId = $scope.companyData.margin.id;
985 if ($scope.selectedCompanyId != '') { 988 if ($scope.selectedCompanyId != '') {
986 fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) { 989 fuelOrdersService.getAircraft($scope.selectedCompanyId).then(function(aircraft) {
987 $scope.aircraftList = aircraft; 990 $scope.aircraftList = aircraft;
988 }) 991 })
989 } 992 }
990 if ($scope.marginId != '') { 993 if ($scope.marginId != '') {
991 fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) { 994 fuelOrdersService.getJetTiers($scope.marginId).then(function(tiers) {
992 $scope.tierList = tiers; 995 $scope.tierList = tiers;
993 // $scope.showLoader = false; 996 // $scope.showLoader = false;
994 }) 997 })
995 } 998 }
996 999
997 } 1000 }
998 1001
999 $scope.setCost = function(cost) { 1002 $scope.setCost = function(cost) {
1000 // console.log(cost); 1003 // console.log(cost);
1001 if (cost != null) { 1004 if (cost != null) {
1002 var obj = JSON.parse(cost); 1005 var obj = JSON.parse(cost);
1003 // console.log("0bj",obj) 1006 // console.log("0bj",obj)
1004 $scope.order.fboCost = obj.cost; 1007 $scope.order.fboCost = obj.cost;
1005 } 1008 }
1006 1009
1007 } 1010 }
1008 1011
1009 $scope.sourceList = [{ 1012 $scope.sourceList = [{
1010 source: "Direct Jet-A" 1013 source: "Direct Jet-A"
1011 }, { 1014 }, {
1012 source: "Direct AVGAS 100LL" 1015 source: "Direct AVGAS 100LL"
1013 }]; 1016 }];
1014 $scope.cancelData = function() { 1017 $scope.cancelData = function() {
1015 $('#demo-modal-4').css('display', ''); 1018 $('#demo-modal-4').css('display', '');
1016 } 1019 }
1017 1020
1018 $scope.setFuel = function() { 1021 $scope.setFuel = function() {
1019 $('#demo-modal-4').css('display', 'block'); 1022 $('#demo-modal-4').css('display', 'block');
1020 1023
1021 } 1024 }
1022 1025
1023 /*delete company*/ 1026 /*delete company*/
1024 var deletecompanyId = ""; 1027 var deletecompanyId = "";
1025 $scope.deleteComp = function(companyDataid) { 1028 $scope.deleteComp = function(companyDataid) {
1026 $('#delete2').css('display', 'block'); 1029 $('#delete2').css('display', 'block');
1027 //console.log("asda",companyDataid) 1030 //console.log("asda",companyDataid)
1028 deletecompanyId = companyDataid; 1031 deletecompanyId = companyDataid;
1029 } 1032 }
1030 $scope.aircraftIdx = ''; 1033 $scope.aircraftIdx = '';
1031 $scope.checkTail = function(tail, idx){ 1034 $scope.checkTail = function(tail, idx){
1032 var data = "tail=" + tail + "&id=" + companyId; 1035 var data = "tail=" + tail + "&id=" + companyId;
1033 $scope.aircraftIdx = idx; 1036 $scope.aircraftIdx = idx;
1034 ViewCompanyService.checkTail(data).then(function(result) { 1037 ViewCompanyService.checkTail(data).then(function(result) {
1035 if(result.error) { 1038 if(result.error) {
1036 $scope.aircraftMessage = result.error; 1039 $scope.aircraftMessage = result.error;
1037 $scope.openAddAirCraftError(); 1040 $scope.openAddAirCraftError();
1038 } else if(result.warning) { 1041 } else if(result.warning) {
1039 $scope.aircraftMessage = result.warning; 1042 $scope.aircraftMessage = result.warning;
1040 $scope.openAddAirCraftWarning(); 1043 $scope.openAddAirCraftWarning();
1041 } 1044 }
1042 }) 1045 })
1043 } 1046 }
1044 1047
1045 $scope.openAddAirCraftError = function() { 1048 $scope.openAddAirCraftError = function() {
1046 $('#addAirCraftError').css('display', 'block'); 1049 $('#addAirCraftError').css('display', 'block');
1047 } 1050 }
1048 1051
1049 $scope.openAddAirCraftWarning = function() { 1052 $scope.openAddAirCraftWarning = function() {
1050 $('#addAirCraftWarning').css('display', 'block'); 1053 $('#addAirCraftWarning').css('display', 'block');
1051 } 1054 }
1052 $scope.acceptAirCraftError = function() { 1055 $scope.acceptAirCraftError = function() {
1053 $('#addAirCraftWarning').css('display', 'none'); 1056 $('#addAirCraftWarning').css('display', 'none');
1054 } 1057 }
1055 1058
1056 $scope.cancelAirCraftError = function() { 1059 $scope.cancelAirCraftError = function() {
1057 $scope.aircraftDetails[$scope.aircraftIdx].tail = ''; 1060 $scope.aircraftDetails[$scope.aircraftIdx].tail = '';
1058 $('#addAirCraftWarning').css('display', 'none'); 1061 $('#addAirCraftWarning').css('display', 'none');
1059 $('#addAirCraftError').css('display', 'none'); 1062 $('#addAirCraftError').css('display', 'none');
1060 } 1063 }
1061 1064
1062 $scope.deleteCompanyData = function() { 1065 $scope.deleteCompanyData = function() {
1063 ViewCompanyService.deleteCompany(deletecompanyId).then(function(result) { 1066 ViewCompanyService.deleteCompany(deletecompanyId).then(function(result) {
1064 1067
1065 $('#delete2').css('display', 'none'); 1068 $('#delete2').css('display', 'none');
1066 if (result.success) { 1069 if (result.success) {
1067 toastr.success('' + result.success + '', { 1070 toastr.success('' + result.success + '', {
1068 closeButton: true 1071 closeButton: true
1069 1072
1070 }) 1073 })
1071 } else { 1074 } else {
1072 toastr.error('' + result.statusText + '', { 1075 toastr.error('' + result.statusText + '', {
1073 closeButton: true 1076 closeButton: true
1074 1077
1075 }) 1078 })
1076 } 1079 }
1077 $state.go('app.customers') 1080 $state.go('app.customers')
1078 }) 1081 })
1079 } 1082 }
1080 $scope.cancelDelete = function() { 1083 $scope.cancelDelete = function() {
1081 $('#delete2').css('display', 'none'); 1084 $('#delete2').css('display', 'none');
1082 } 1085 }
1083 1086
1084 1087
1085 $scope.editJetMargin = function(aircraftData, type) { 1088 $scope.editJetMargin = function(aircraftData, type) {
1086 $scope.showLoader = true; 1089 $scope.showLoader = true;
1087 if (type == 'jet') { 1090 if (type == 'jet') {
1088 1091
1089 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsMargin.id + "&type=" + type; 1092 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsMargin.id + "&type=" + type;
1090 1093
1091 } else { 1094 } else {
1092 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsAVGASMargin.id + "&type=" + type; 1095 var aircraftdataMargin = "marginId=" + aircraftData.aircraftsAVGASMargin.id + "&type=" + type;
1093 } 1096 }
1094 1097
1095 var id = aircraftData.id; 1098 var id = aircraftData.id;
1096 ViewCompanyService.updateAircraftMargin(aircraftdataMargin, id).then(function(result) { 1099 ViewCompanyService.updateAircraftMargin(aircraftdataMargin, id).then(function(result) {
1097 if (result != null && result.success) { 1100 if (result != null && result.success) {
1098 $scope.showLoader = false; 1101 $scope.showLoader = false;
1099 toastr.success('' + result.success + '', { 1102 toastr.success('' + result.success + '', {
1100 closeButton: true 1103 closeButton: true
1101 }) 1104 })
1102 // getAircraftWithMarginList(); 1105 // getAircraftWithMarginList();
1103 getAircraftList(); 1106 getAircraftList();
1104 } else { 1107 } else {
1105 $scope.showLoader = false; 1108 $scope.showLoader = false;
1106 toastr.error('' + result.statusText + '', { 1109 toastr.error('' + result.statusText + '', {
1107 closeButton: true 1110 closeButton: true
1108 }) 1111 })
1109 } 1112 }
1110 }) 1113 })
1111 } 1114 }
1112 1115
1113 1116
1114 /* //not used currently 1117 /* //not used currently
1115 function getAircraftWithMarginList() { 1118 function getAircraftWithMarginList() {
1116 ViewCompanyService.getJetAMargin(companyId).then(function(result) { 1119 ViewCompanyService.getJetAMargin(companyId).then(function(result) {
1117 $scope.contactAircraftList = result; 1120 $scope.contactAircraftList = result;
1118 for (var i = 0; i < $scope.contactAircraftList.length; i++) { 1121 for (var i = 0; i < $scope.contactAircraftList.length; i++) {
1119 if ($scope.contactAircraftList[i].aircraftsMargin != null) { 1122 if ($scope.contactAircraftList[i].aircraftsMargin != null) {
1120 $scope.aircraftmargins.push({ 1123 $scope.aircraftmargins.push({
1121 'id': $scope.contactAircraftList[i].aircraftsMargin.id 1124 'id': $scope.contactAircraftList[i].aircraftsMargin.id
1122 }) 1125 })
1123 } 1126 }
1124 } 1127 }
1125 if ($scope.aircraftmargins.length > 0) { 1128 if ($scope.aircraftmargins.length > 0) {
1126 for (var i = 0; i < $scope.aircraftmargins.length; i++) { 1129 for (var i = 0; i < $scope.aircraftmargins.length; i++) {
1127 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) { 1130 if ($scope.aircraftmargins[i].id != $scope.companyData.masterMargin) {
1128 $scope.multiple = true; 1131 $scope.multiple = true;
1129 $scope.multipleMsg = true; 1132 $scope.multipleMsg = true;
1130 if ($scope.multiple) { 1133 if ($scope.multiple) {
1131 $scope.companyData.masterMargin = "multiple"; 1134 $scope.companyData.masterMargin = "multiple";
1132 } 1135 }
1133 } 1136 }
1134 } 1137 }
1135 } 1138 }
1136 }) 1139 })
1137 }*/ 1140 }*/
1138 1141
1139 1142
1140 }]); 1143 }]);