This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit 3055de44bd3bf4373390f7b992ec56f20d2e0d74 Author: Yannick Martel <martel@©odelutin.com> Date: Wed Jan 14 18:32:13 2015 +0100 prepare advanced search on users --- .../src/main/webapp/js/coselmar-controllers.js | 21 ++++++++- .../src/main/webapp/js/coselmar-user-services.js | 25 +++-------- coselmar-ui/src/main/webapp/views/users/users.html | 51 ++++++++++++++++++---- 3 files changed, 70 insertions(+), 27 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 1d0e8af..ddd2f53 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -206,6 +206,8 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', //manage keywords if given $scope.search = { searchKeyword : ''}; + $scope.example = {}; + var keywords = $routeParams.keywords; if (Array.isArray(keywords)) { $scope.search.searchKeyword = keywords[0]; @@ -255,7 +257,24 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', $scope.searchUsers = function(){ $location.search('keywords', $scope.search.searchKeyword); $location.search('showDisable', $scope.search.showDisable); - } + }; + + $scope.advancedSearchUsers = function() { + if ($scope.example.role && $scope.example.role == "ALL") { + delete $scope.example.role; + }; + if ($scope.example.active) { + if($scope.example.active == "true") { + $scope.example.active = true; + } else { + $scope.example.active = false; + }; + }; + console.log($scope.example); + userService.getAdvancedUsers($scope.example, function(users){ + $scope.users = users; + }); + }; }]); diff --git a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js index b0b61fd..52a44e3 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-user-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-user-services.js @@ -72,7 +72,13 @@ function User(resource, config){ // Load all users var userResource = resource(baseURL, {'search' : {'fullTextSearch' : searchKeywords, 'activeAndInactive': showDisable}}); userResource.query(successFunction); - } + }; + + this.getAdvancedUsers = function(searchExample, successFunction){ + // Load all users + var userResource = resource(baseURL, {'search' : searchExample}); + userResource.query(successFunction); + }; this.login = function(mail, password, successFunction, failFunction){ @@ -91,21 +97,4 @@ function User(resource, config){ userResource.post(credentials, successFunction, failFunction); } -// this.saveUser = function(user, successFunction, failFunction){ -// -// var formData = new FormData(); -// formData.append("user", JSON.stringify(user)); -// -// // Save the User -// var userResource = resource(baseURL + "/" + user.id, null, { -// 'save': { -// method: 'POST', -// transformRequest: angular.identity, -// headers:{ -// 'Content-Type': undefined -// } -// } -// }); -// userResource.save(null, formData, successFunction, failFunction); -// } }; \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/views/users/users.html b/coselmar-ui/src/main/webapp/views/users/users.html index 75fbc0a..db11036 100644 --- a/coselmar-ui/src/main/webapp/views/users/users.html +++ b/coselmar-ui/src/main/webapp/views/users/users.html @@ -34,7 +34,7 @@ <div class="form-group"> <a href="#/users/new" class="form-inline navbar-left btn btn-primary">Add an user</a> </div> - <form class="form-inline pull-right" role="userOptions" ng-submit="searchUsers()"> + <form class="form-inline pull-right" name="userOptions" role="userOptions" ng-submit="searchUsers()"> <div class="form-group"> <input type="checkbox" class="form-control" ng-model="search.showDisable" /> <span>Show Disable</span> @@ -51,13 +51,48 @@ <br/> <table class="table"> <tr> - <th>Name</th> - <th>Mail</th> - <th>Qualification</th> - <th>Organization</th> - <th>Role</th> - <th>Status</th> - <th></th> + <form class="form-inline" name="userFullOption" role="userFullOptions" ng-submit="advancedSearchUsers()"> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Name" ng-model="example.name" /> + </td> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Mail" ng-model="example.mail" /> + </td> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Qualification" ng-model="example.qualification" /> + </td> + <td class="form-group"> + <input type="search" class="form-control" placeholder="Organization" ng-model="example.organization" /> + </td> + <td class="form-group"> + <select class="form-control" name="role" ng-model="example.role" title="role" > + <option value="ALL">All</option> + <option value="ADMIN">Admin</option> + <option value="SUPERVISOR">Supervisor</option> + <option value="EXPERT">Expert</option> + <option value="MEMBER">Member</option> + <option value="CLIENT">Client</option> + </select> + </td> + <td class="form-group"> + <select class="form-control" name="active" ng-model="example.active" title="active" > + <option value="true">Active</option> + <option value="false">Inactive</option> + </select> + </td> + <td class="form-group text-center"> + <button type="submit" class="btn btn-default fa fa-search"></button> + </td> + </form> + </tr> + <tr> + <th class="col-md-1">Name</th> + <th class="col-md-2">Mail</th> + <th class="col-md-2">Qualification</th> + <th class="col-md-2">Organization</th> + <th class="col-md-1">Role</th> + <th class="col-md-1">Status</th> + <th class="col-md-1"></th> </tr> <tr ng-repeat="user in users"> <td><a href="#/users/{{user.id}}">{{user.firstname}} {{user.name}}</a></td> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.