diff --git a/angular_app/js/controllers.js b/angular_app/js/controllers.js index dd8f03c..3f1d916 100644 --- a/angular_app/js/controllers.js +++ b/angular_app/js/controllers.js @@ -998,16 +998,46 @@ eventManControllers.controller('UsersCtrl', ['$scope', '$rootScope', '$state', ' $scope.updateUserInfo = {}; $scope.users = []; $scope.usersOrderProp = 'username'; + $scope.query = ""; + $scope.currentPage = 1; + $scope.itemsPerPage = 10; + $scope.filteredLength = 0; + $scope.maxPaginationSize = 10; + $scope.shownItems = []; $scope.userQuery = ""; $scope.userCurrentPage = 1; $scope.userItemsPerPage = 10; $scope.userFilteredLength = 0; $scope.userMaxPaginationSize = 10; - $scope.userMaxAllPersons = 10; $scope.userShownItems = []; + $scope.filterUsers = function() { + var users = $scope.users || []; + users = $filter('splittedFilter')(users, $scope.query); + users = $filter('orderBy')(users, $scope.usersOrderProp); + $scope.filteredUsers = angular.copy(users); + $scope.filteredUsersLength = $scope.filteredUsers.length; + users = $filter('pagination')(users, $scope.currentPage, $scope.itemsPerPage); + $scope.shownItems = users; + }; + + $scope.$watch('query', function() { + if (!$scope.query) { + $scope.currentPage = 1; + } + $scope.filterUsers(); + }); + + $scope.$watch('currentPage + itemsPerPage', function() { + $scope.filterUsers(); + }); + + $scope.$watch('usersOrderProp', function() { + $scope.filterUsers(); + }); + $scope.userFilterTickets = function() { var tickets = $scope.user.tickets || []; tickets = $filter('splittedFilter')(tickets, $scope.userQuery); @@ -1037,7 +1067,9 @@ eventManControllers.controller('UsersCtrl', ['$scope', '$rootScope', '$state', ' $scope.updateUsersList = function() { if ($state.is('users')) { - $scope.users = User.all(); + $scope.users = User.all(function() { + $scope.filterUsers(); + }); } }; diff --git a/angular_app/users-list.html b/angular_app/users-list.html index f5f0263..31720a1 100644 --- a/angular_app/users-list.html +++ b/angular_app/users-list.html @@ -28,15 +28,20 @@ + + + - + +
# {{'User' | translate}} {{'Actions' | translate}}
{{$index + 1 + ((currentPage-1)*itemsPerPage)}} @@ -50,6 +55,9 @@
+ +