main.controller.js
2.36 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
(function() {
'use strict'
angular.module('acufuel')
.controller('MainController', [ '$scope', '$filter','$rootScope','$state', '$window', '$interval', MainController]);
function MainController($scope, $filter, $rootScope,$state, $window, $interval) {
$scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName'));
$scope.testFunction = function(){
$scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName'));
}
/**
Automatic logout session
**/
var resetTime;
/*function warning(){
//setTimeout(function(){
$('.warning-message').delay(5000).css('display', 'block');
//}, 5000);
}*/
resetTime = setInterval(function(){
// $('.warning-message').delay(5000).css('display', 'block');
//console.log('out');
localStorage.clear();
$state.go('login');
}, 600000);
$(document).mousemove(function(event){
clearInterval(resetTime);
//$('.warning-message').delay(5000).css('display', 'none');
// warning();
//console.log('restart');
resetTime = setInterval(function(){
//console.log('out');
//warning();
localStorage.clear();
$state.go('login');
}, 600000);
})
// Flight Tracking page code
/*$scope.reloadPage = function(){
console.log("if",$state)
console.log("=========state name",$state.current.name);
// $state.go('app.flightTracking', {}, {reload: 'app.flightTracking'})
//$state.go($state.current, {}, {reload: true});
if($state.current.name != "app.flightTracking"){
$window.location.href = '/#!/flightTracking';
setInterval(function(){
console.log("come")
$window.location.reload()
},10);
}else{
console.log("flight tracking state found=====");
$window.location.reload();
}
}*/
// Set timeout variables.
}
//var timoutWarning = 840000; // Display warning in 14 Mins.
//var timoutNow = 900000; // Timeout in 15 mins.
})();