Blame view

app/partials/flightDepOrders/flightDepOrders.controller.js 2.26 KB
da04b5b2f   Mr. Hot Foods   flight Dep
1
2
3
  'use strict';
  
  angular.module('acufuel')
a9aef0b1c   Anchit Jindal   new changes imple...
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
  .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', '');
  	}
da04b5b2f   Mr. Hot Foods   flight Dep
67
68
69
70
71
72
  
  	$scope.companyList = {};
  
  	flightDepOrdersService.getAllCompanies().then(function(result) {
  		$scope.showLoader = false;
  		$scope.companyList = result;
a9aef0b1c   Anchit Jindal   new changes imple...
73
  		console.log(result)
da04b5b2f   Mr. Hot Foods   flight Dep
74
  	})
a9aef0b1c   Anchit Jindal   new changes imple...
75
76
77
78
79
  	$scope.sourceList = [ {
  		source : "Direct Jet-A"
  	}, {
  		source : "Direct AVGAS 100LL"
  	} ];
da04b5b2f   Mr. Hot Foods   flight Dep
80

a9aef0b1c   Anchit Jindal   new changes imple...
81
82
83
84
85
86
87
88
89
90
91
  	$scope.data = {};
  	
  	$scope.attachmentFilterOptions = [];
      $scope.attachmentFilterOptions.push({
  		  	'id': '', 'title': 'Show All'
  		  },{
  		  	'id': '!null', 'title': 'Attachments'
  		  },{
  		  	'id': 'null', 'title': 'No Attachments'
  		  }
       );
da04b5b2f   Mr. Hot Foods   flight Dep
92

a9aef0b1c   Anchit Jindal   new changes imple...
93
  }