Commit d076d315 authored by Alexis Ragot's avatar Alexis Ragot

Toggle to see only activated users

parent 64ce7951
......@@ -78,17 +78,23 @@ class userAccount
/**
* List all users to display
* @param string $query
*
* @return array The array of stdClass
*/
public function userList()
public function userList($query = null)
{
$accountId = \laabs::getToken("AUTH")->accountId;
$queryAssert = [];
$queryAssert[] = "accountType='user'";
if ($query) {
$queryAssert[] = "$query";
}
$account = $this->sdoFactory->read("auth/account", array("accountId" => $accountId));
if (!empty($this->adminUsers) && !in_array($account->accountName, $this->adminUsers)) {
$queryAssert[] = "accountId!=['".\laabs\implode("','", $this->adminUsers)."']";
}
......
......@@ -36,10 +36,11 @@ interface userAccountInterface
/**
* List the user account
* @param string $query
*
* @action auth/userAccount/userList
*/
public function readUserlist();
public function readUserlist($query = null);
/**
* List the user account detail
......
......@@ -695,3 +695,6 @@ msgstr "Le champs est vide"
msgid "Passwords are not the same"
msgstr "Les mots de passe sont pas identiques"
msgid "Display only activated users"
msgstr "Afficher uniquement les utilisateurs activés"
......@@ -10,11 +10,18 @@
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label">Display only activated users</label>
<input type="checkbox" name="activatedUsers" id="activatedUsers" data-toggle="toggle" data-size="mini">
</div>
<div class="panel panel-primary">
<div class="panel-heading clearfix">
<div class="pull-left">
<h4>Users</h4>
</div>
<div class="pull-left">
</div>
<div class="pull-right">
<button type="button" class="btn btn-default btn-sm" id="user_newUser" title="Add"><i class="fa fa-plus">&nbsp;</i>Add</button>
</div>
......@@ -75,8 +82,34 @@
<?hinclude auth/userAccount/admin/modalsForDisabling.html ?>
</div>
</div>
<script src="/public/dependency/html/js/bootstrap-toggle/bootstrap-toggle.js"></script>
<script type="application/javascript">
$("#contain").ready(function() {
/*$('#activatedUsers').bootstrapToggle({
size: 'mini',
on: 'Yes',
off: 'All'
});*/
var url = new URL(document.URL);
var deactivatedUsers = url.searchParams.get("query");
if (deactivatedUsers === 'enabled=true') {
$("#activatedUsers").bootstrapToggle('on');
}
});
$("#contain").on('click', '#activatedUsers', function() {
let value = $(this).prop('checked');
if (value) {
let param = encodeURIComponent("enabled=true");
window.location.replace("/userAccounts?query="+param);
} else {
window.location.replace("/userAccounts");
}
});
//add
$("#user_newUser").on('click', function() {
......
......@@ -31,7 +31,7 @@ interface adminUseraccountInterface
* @return auth/user/indexHtml
* @uses auth/userAccount/readUserlist
*/
public function readUseraccounts();
public function readUseraccounts($query = null);
/**
* Prepare an empty user object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment