From b880b38ca92836f125007b71959bf7eb609b3f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Maur=C3=ADcio?= Date: Mon, 16 Jun 2014 13:35:54 +0000 Subject: [PATCH] git-svn-id: https://svn.coded.pt/svn/SIPRP@1943 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../static/html/app/Login/LoginController.js | 91 ++++++++++--------- .../static/html/app/Login/LoginView.html | 8 +- .../static/html/app/Main/MainController.js | 3 +- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js index e541dbec..dcae95c5 100644 --- a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js +++ b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js @@ -15,49 +15,54 @@ pass: '' }; - //login procedure ---> user clicks the Login button - $scope.login = function(arg) { - - $rootScope.$broadcast('loadingStatusActive'); - - $scope.selected = {}; - - $scope.iaLoginMessages.hide(); - - $scope.storeLogin.upsert({}, $scope.editing, function(response, selected, editing, isNewRecord){ - - $rootScope.$broadcast('loadingStatusInactive'); - - if(response.success) - { - if($scope.$parent.sessionTimeout) - { - //go to previous module before timeout... - var className = $scope.$parent.beforeSessionTimeoutModule.ClassName; - - $scope.$parent.loadModule({Controller: className}, function(className, scope, isNewModule){ - - $scope.$parent.sessionTimeout = false; - $scope.$parent.beforeSessionTimeoutModule = null; - }); - } - else - { - $rootScope.$emit('onloginsuccessfull', {response: response}); - } - } - else - { - if(response.messages.length > 0) - { - var firstMessage = response.messages[0].messageData; - - $scope.iaLoginMessages.message = firstMessage; - $scope.iaLoginMessages.cssClass = 'bg-danger'; - $scope.iaLoginMessages.show(); - } - } - }); + $scope.login = function(e) { + + var isValid = $scope.editForm.$isValid(); + + if(isValid) + { + $rootScope.$broadcast('loadingStatusActive'); + + $scope.selected = {}; + + $scope.iaLoginMessages.hide(); + + $scope.storeLogin.upsert({}, $scope.editing, function(response, selected, editing, isNewRecord){ + + $rootScope.$broadcast('loadingStatusInactive'); + + if(response.success) + { + if($scope.$parent.sessionTimeout) + { + //go to previous module before timeout... + var className = $scope.$parent.beforeSessionTimeoutModule.ClassName; + + $scope.$parent.loadModule({Controller: className}, function(className, scope, isNewModule){ + + $scope.$parent.sessionTimeout = false; + $scope.$parent.beforeSessionTimeoutModule = null; + }); + } + else + { + $rootScope.$emit('onloginsuccessfull', {response: response}); + } + } + else + { + if(response.messages.length > 0) + { + var firstMessage = response.messages[0].messageData; + + $scope.iaLoginMessages.message = firstMessage; + $scope.iaLoginMessages.cssClass = 'bg-danger'; + $scope.iaLoginMessages.show(); + } + } + }); + + } }; $scope.$on('afterrender', function(event, args){ diff --git a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html index ff878b8c..fe381774 100644 --- a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html +++ b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html @@ -5,6 +5,7 @@
+
@@ -21,11 +22,11 @@
- +
- +
@@ -37,10 +38,9 @@
- - +
diff --git a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Main/MainController.js b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Main/MainController.js index 0ca03ece..7d53c2ac 100644 --- a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Main/MainController.js +++ b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Main/MainController.js @@ -367,7 +367,8 @@ //$(args.mainPanel).hide(); }); - $scope.$on('onAfterMainPanelChange', function(event, args){ + $scope.$on('onAfterMainPanelChange', function(event, args){ + $timeout(function () {