Blame view
app/partials/main/main.controller.js
2.53 KB
feacde5ff
|
1 2 3 4 5 |
(function() { 'use strict' angular.module('acufuel') |
e33b4556c
|
6 |
.controller('MainController', [ '$scope', '$filter','$rootScope','$state', '$window', '$interval', MainController]); |
feacde5ff
|
7 |
|
e33b4556c
|
8 |
function MainController($scope, $filter, $rootScope,$state, $window, $interval) { |
dd378d69f
|
9 |
|
e196b9b74
|
10 |
$scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName')); |
8041a48e1
|
11 |
$scope.companyName = JSON.parse(localStorage.getItem('companyName')); |
429786996
|
12 |
|
e33b4556c
|
13 |
|
3c77051a2
|
14 15 |
$scope.testFunction = function(){ $scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName')); |
8041a48e1
|
16 |
$scope.companyName = JSON.parse(localStorage.getItem('companyName')); |
3c77051a2
|
17 |
} |
e33b4556c
|
18 19 |
/** |
24fce0949
|
20 |
Automatic logout session after 2 hours |
e33b4556c
|
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
**/ 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'); |
24fce0949
|
35 |
}, 7200000); |
e33b4556c
|
36 37 38 39 40 41 42 43 44 45 46 47 |
$(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'); |
24fce0949
|
48 |
}, 7200000); |
e33b4556c
|
49 50 51 |
}) |
3c77051a2
|
52 |
|
da40330c8
|
53 |
// Flight Tracking page code |
bfb1a2a46
|
54 |
/*$scope.reloadPage = function(){ |
429786996
|
55 56 57 58 59 60 |
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"){ |
bfb1a2a46
|
61 |
$window.location.href = '/#!/flightTracking'; |
429786996
|
62 63 64 65 66 67 68 69 |
setInterval(function(){ console.log("come") $window.location.reload() },10); }else{ console.log("flight tracking state found====="); $window.location.reload(); } |
bfb1a2a46
|
70 71 |
}*/ |
e33b4556c
|
72 |
// Set timeout variables. |
bfb1a2a46
|
73 |
|
feacde5ff
|
74 |
} |
e33b4556c
|
75 76 77 78 |
//var timoutWarning = 840000; // Display warning in 14 Mins. //var timoutNow = 900000; // Timeout in 15 mins. |
da40330c8
|
79 |
|
feacde5ff
|
80 |
})(); |
da40330c8
|
81 |