flightDepOrders.controller.js
2.26 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
'use strict';
angular.module('acufuel')
.controller(
'flightDepOrdersController',
[ '$scope', '$rootScope', '$uibModal', '$filter', '$http',
'NgTableParams', 'flightDepOrdersService',
flightDepOrdersController ]);
function flightDepOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgTableParams, flightDepOrdersService) {
$scope.showFuelOrderModal = false;
$scope.optionSelected;
$scope.data = {};
flightDepOrdersService.getOrders().then(function(result) {
$scope.orderdata = result;
for (var i = 0; i < $scope.orderdata.length; i++) {
$scope.orderdata[i].departingDate = new Date(
$scope.orderdata[i].departingDate);
var str = "" + $scope.orderdata[i].departingDate;
str = str.slice(4, 16)
$scope.orderdata[i].departingDateString = str
console.log(str);
}
$scope.displayFuelOrderList = new NgTableParams({
page : 1,
count : 10,
}, {
data : $scope.orderdata
});
})
$scope.exportOrder = function() {
flightDepOrdersService.exportOrder().then(function(result) {
var file = new Blob([result], {type: 'application/csv'});
var fileURL = URL.createObjectURL(file);
a.href = fileURL;
a.download = fileName;
a.click();
$scope.showLoader = false;
})
}
$scope.onDTSelect = function() {
if ($scope.optionSelected == 'dt') {
$('#demo-modal-4').css('display', 'block');
}
}
$scope.editdata = {};
$scope.editTableRow = function(rowData) {
console.log('row data', rowData);
$scope.editdata = rowData;
$('#demo-modal-5').css('display', 'block');
}
$scope.cancelData = function() {
$('#demo-modal-4').css('display', '');
}
$scope.canceleditdata = function() {
$('#demo-modal-5').css('display', '');
}
$scope.companyList = {};
flightDepOrdersService.getAllCompanies().then(function(result) {
$scope.showLoader = false;
$scope.companyList = result;
console.log(result)
})
$scope.sourceList = [ {
source : "Direct Jet-A"
}, {
source : "Direct AVGAS 100LL"
} ];
$scope.data = {};
$scope.attachmentFilterOptions = [];
$scope.attachmentFilterOptions.push({
'id': '', 'title': 'Show All'
},{
'id': '!null', 'title': 'Attachments'
},{
'id': 'null', 'title': 'No Attachments'
}
);
}