fboClient.controller.js
2.93 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
'use strict';
//Load controller
angular.module('acuefuel')
.controller('fboClientsController', function($scope, $stateParams, FBOClient) {
$(document).ready(function(){
$('.tab-pane').slimScroll({
height: '600px'
});
});
$('#tab-2').css('display', 'none');
getAllFbo();
function getAllFbo(){
FBOClient.getALlFBOList().then(function(result) {
console.log(result)
$scope.fboClient = result;
$scope.clientLength = result.length;
})
}
$scope.searchData = function(){
var userType = $('#tabClient > li.active > a').attr('id');
searchClient($scope.searchQuery, userType);
}
function searchClient(searchData, userType){
console.log(userType)
if(searchData == null || searchData == undefined || searchData == "" && userType == 'fbo'){
getAllFbo();
}else if(searchData == null || searchData == undefined || searchData == "" && userType == 'flightDetp'){
$scope.fboDept();
}else{
var data = {
"query" : searchData,
"userType" : userType
}
FBOClient.getSearchClient(data).then(function(result) {
for(var i=0; i<result.length; i++){
result[i].user = [];
result[i].user.companyName = result[i].companyName;
result[i].user.firstName = result[i].firstName;
result[i].user.lastName = result[i].lastName;
result[i].user.id = result[i].id;
result[i].user.account = [];
result[i].user.account.user = [];
result[i].user.account.user.status = result[i].account.user.status;
}
if(userType == 'fbo'){
$scope.fboClient = result;
console.log(result)
$scope.clientLength = result.length;
}else{
$scope.fboDeptList = result;
$scope.clientLength = result.length;
}
})
}
}
$scope.fboAdmin = function(){
getAllFbo();
$('#tab-1').css('display', 'block');
$('#tab-2').css('display', 'none');
$('.customTab1').addClass('active');
$('.customTab2').removeClass('active');
$('.slimScrollDiv:first-child').css('display', 'block');
}
$scope.fboDept = function(){
FBOClient.getAllFlightDeptList().then(function(result) {
console.log(result)
$scope.fboDeptList = result;
$scope.clientLength = result.length;
})
$('#tab-1').css('display', 'none');
$('#tab-2').css('display', 'block');
$('.customTab2').addClass('active');
$('.customTab1').removeClass('active');
$('.slimScrollDiv:first-child').css('display', 'none');
}
});