(function () {
    'use strict';

    angular
        .module('doleticApp')
        .controller('DashboardController', DashboardController);

    DashboardController.$inject = ['$scope', '$state', 'SharedVariables', 'MessageBoxService', 'UserService'];

    function DashboardController($scope, $state, SharedVariables, MessageBoxService, UserService) {

        $scope.currentUser = UserService.getCurrentUser();
        $scope.currentUser.activePosition = _.find($scope.currentUser.positions, 'active');
        $scope.showEditProfileForm = showEditProfileForm;
        $scope.showEditPassForm = showEditPassForm;
        $scope.cancelPassForm = cancelPassForm;
        $scope.updatePassword = updatePassword;
        $scope.editState = false;
        $scope.olpass = "";
        $scope.nepass = "";
        $scope.confpass = "";

        function showEditProfileForm() {
            
        }

        function showEditPassForm() {
            $scope.editState = true;
        }

        function cancelPassForm() {
            $scope.olpass = "";
            $scope.nepass = "";
            $scope.confpass = "";
            $scope.editState = false;
        }

        function updatePassword(){
            UserService.updatePassword(
                $scope.olpass,
                $scope.nepass,
                $scope.confpass,
                function (data) {
                    if(data.code ==0){
                        MessageBoxService.showSuccess('Succès !', 'Mot de passe mis à jour avec succès !' );
                    } else {
                        MessageBoxService.handleServiceError(data);
                    }
                }
            );
        }
    }
})();
@@ -348,16 +348,98 @@
 ice) %7B%0A%0A
+        $scope.$state = $state;%0A        $scope.sharedVariables = SharedVariables;%0A
         
@@ -596,31 +596,98 @@
  $scope.
-showEditProfile
+editState = false;%0A        $scope.editProfile = false;%0A        $scope.showEditPass
 Form = s
@@ -690,30 +690,27 @@
  = showEditP
-rofile
+ass
 Form;%0A      
@@ -719,35 +719,38 @@
 $scope.showEditP
-ass
+rofile
 Form = showEditP
@@ -741,35 +741,38 @@
 Form = showEditP
-ass
+rofile
 Form;%0A        $s
@@ -799,32 +799,34 @@
 = cancelPassForm
+()
 ;%0A        $scope
@@ -830,41 +830,88 @@
 ope.
-updatePassword = update
+cancelProfileForm = cancelProfileForm;%0A%0A        function cancel
 Pass
-word;%0A
+Form() %7B%0A    
     
@@ -952,64 +952,60 @@
     
-$scope.olpass = %22%22;%0A        $scope.nepass = %22%22;%0A
+%7D%0A%0A        function cancelProfileForm()%7B%0A   
         
 $sco
@@ -1000,37 +1000,54 @@
         
+ 
 $scope.
-confpass = %22%22;
+editProfile = false;%0A        %7D
 %0A%0A      
@@ -1093,16 +1093,41 @@
         
+$scope.editProfile =true;
 %0A       
@@ -1220,704 +1220,8 @@
  %7D%0A%0A
-        function cancelPassForm() %7B%0A            $scope.olpass = %22%22;%0A            $scope.nepass = %22%22;%0A            $scope.confpass = %22%22;%0A            $scope.editState = false;%0A        %7D%0A%0A        function updatePassword()%7B%0A            UserService.updatePassword(%0A                $scope.olpass,%0A                $scope.nepass,%0A                $scope.confpass,%0A                function (data) %7B%0A                    if(data.code ==0)%7B%0A                        MessageBoxService.showSuccess('Succ%C3%A8s !', 'Mot de passe mis %C3%A0 jour avec succ%C3%A8s !' );%0A                    %7D else %7B%0A                        MessageBoxService.handleServiceError(data);%0A                    %7D%0A                %7D%0A            );%0A        %7D
 %0A   

update password and profile