parent
5b27710f38
commit
b01a553873
@ -10,7 +10,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
App.request(App.service + 'config', function(r) {
|
||||
App.request( App.service + 'config', function(r) {
|
||||
App._remoteConfig = true;
|
||||
App.init(r);
|
||||
}, function() {
|
||||
|
||||
@ -65,7 +65,7 @@ var NGApp = angular.module('NGApp', [ 'ngRoute', 'ngResource'], function( $httpP
|
||||
|
||||
return query.length ? query.substr(0, query.length - 1) : query;
|
||||
};
|
||||
|
||||
|
||||
// Override $http service's default transformRequest
|
||||
$httpProvider.defaults.transformRequest = [function(data) {
|
||||
return angular.isObject(data) && String(data) !== '[object File]' ? param(data) : data;
|
||||
@ -191,7 +191,6 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams,
|
||||
$scope.$on('$routeChangeSuccess', function ($currentRoute, $previousRoute) {
|
||||
// Store the actual page
|
||||
MainNavigationService.page = $route.current.action;
|
||||
console.log($route.current.action);
|
||||
App.rootScope.current = MainNavigationService.page;
|
||||
App.track('page', $route.current.action);
|
||||
|
||||
@ -220,6 +219,9 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams,
|
||||
|
||||
// Litle hack to don't show the templates till angularjs finish running
|
||||
$scope.angularLoaded = true;
|
||||
|
||||
$rootScope.account.checkUser();
|
||||
|
||||
});
|
||||
|
||||
// Check user's auth
|
||||
@ -229,6 +231,9 @@ NGApp.run( function ( $rootScope, $location, MainNavigationService ) {
|
||||
if ( $location.url() != '/login' && !$rootScope.account.isLoggedIn() ) {
|
||||
MainNavigationService.link( '/login' );
|
||||
}
|
||||
if ( $location.url() == '/login' && $rootScope.account.isLoggedIn() ) {
|
||||
MainNavigationService.link( '/' );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -252,7 +257,6 @@ App.confirm = function(txt, title, fn, buttons) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
App.connectionError = function() {
|
||||
App.rootScope.$broadcast( 'connectionError' );
|
||||
App.rootScope.$broadcast('notificationAlert', 'Connection Error', 'Sorry! We could not reach the server right now. Try again when your internet is back!');
|
||||
@ -403,9 +407,7 @@ App.init = function(config) {
|
||||
App._firstPageShowHasHappened = true;
|
||||
}, false );
|
||||
|
||||
// window.addEventListener( 'pagehide', function(){}, false );
|
||||
|
||||
$(window).trigger('nginit');
|
||||
$( window ).trigger( 'nginit' );
|
||||
|
||||
/*
|
||||
if (!App.isPhoneGap) {
|
||||
|
||||
@ -73,7 +73,7 @@ NGApp.controller('DriversOrderCtrl', function ( $scope, DriverOrdersService ) {
|
||||
};
|
||||
|
||||
// Just run if the user is loggedin
|
||||
if( account.isLoggedIn() ){
|
||||
if( $scope.account.isLoggedIn() ){
|
||||
load();
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ NGApp.controller('DriversOrdersCtrl', function ( $scope, DriverOrdersService, Ma
|
||||
if( $scope.show.all ){
|
||||
return true;
|
||||
} else {
|
||||
if( order.lastStatus.id_admin == $scope.account.user.id_admin ){
|
||||
if( order.lastStatus.id_admin == $scope.$scope.account.user.id_admin ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ NGApp.controller('DriversOrdersCtrl', function ( $scope, DriverOrdersService, Ma
|
||||
}
|
||||
|
||||
// Just run if the user is loggedin
|
||||
if( account.isLoggedIn() ){
|
||||
if( $scope.account.isLoggedIn() ){
|
||||
$scope.list();
|
||||
}
|
||||
} );
|
||||
@ -159,7 +159,7 @@ NGApp.controller( 'DriversShiftsCtrl', function ( $scope, DriverShiftsService )
|
||||
}
|
||||
|
||||
// Just run if the user is loggedin
|
||||
if( account.isLoggedIn() ){
|
||||
if( $scope.account.isLoggedIn() ){
|
||||
$scope.list();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user