forked from v4l3n71n/covas-bo
add pages select
This commit is contained in:
parent
5a7283b92f
commit
4ed38c4940
@ -141,7 +141,7 @@
|
|||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<label for="inputRoles" class="form-label">Roles</label>
|
<label for="inputRoles" class="form-label">Rôle :</label>
|
||||||
<select class="form-select" id="inputRoles" aria-label="Default select example">
|
<select class="form-select" id="inputRoles" aria-label="Default select example">
|
||||||
<option value="All" selected>Tout</option>
|
<option value="All" selected>Tout</option>
|
||||||
<option value="Admin">Administrateurs</option>
|
<option value="Admin">Administrateurs</option>
|
||||||
@ -149,7 +149,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<label for="inputStatus" class="form-label">Statut</label>
|
<label for="inputStatus" class="form-label">Statut :</label>
|
||||||
<select class="form-select" id="inputStatus" aria-label="Default select example">
|
<select class="form-select" id="inputStatus" aria-label="Default select example">
|
||||||
<option value="-2" selected>Tout</option>
|
<option value="-2" selected>Tout</option>
|
||||||
<option value="-1">En cours de suppression</option>
|
<option value="-1">En cours de suppression</option>
|
||||||
@ -158,13 +158,30 @@
|
|||||||
<option value="2">En cours de validation</option>
|
<option value="2">En cours de validation</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-auto">
|
||||||
<br />
|
<label for="inputPages" class="form-label">Page :</label>
|
||||||
<button type="button" class="btn btn-success" id="enableUserButton" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
|
<select class="form-select" id="inputPages" aria-label="Page">
|
||||||
|
<option value="20" selected>20</option>
|
||||||
<button type="button" class="btn btn-warning " id="disableUserButton" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'utilisateur</button>
|
<option value="40">40</option>
|
||||||
<button type="button" class="btn btn-danger" id="removeUserButton" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'utilisateur</button>
|
<option value="60">60</option>
|
||||||
<br /><br /><br />
|
<option value="80">80</option>
|
||||||
|
<option value="100">100</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br /><br />
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="button" class="btn btn-success" id="enableUserButton" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="button" class="btn btn-warning " id="disableUserButton" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'utilisateur</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="button" class="btn btn-danger" id="removeUserButton" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'utilisateur</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br /><br /><br />
|
||||||
<table id=users class="table table-striped table-sm">
|
<table id=users class="table table-striped table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -21,34 +21,39 @@ function checkToken(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function buildParam(e, id){
|
function buildParam(typeInput){
|
||||||
var search = document.getElementById("searchUser").value;
|
var search = document.getElementById("searchUser").value;
|
||||||
var param = "";
|
var param = "";
|
||||||
var listParam = ["page", "nbPages"];
|
var listParam = ["skip"];
|
||||||
if(id.length > 0){
|
if(typeInput.length > 0){
|
||||||
var select = document.getElementById(id);
|
listId =["inputRoles", "inputStatus", "inputPages"]
|
||||||
var getId = select.options[select.selectedIndex].value;
|
for (var i=0; i<listId.length; i++) {
|
||||||
if(id == "inputRoles"){
|
var select = document.getElementById(listId[i]);
|
||||||
var status = e.target.value;
|
var getId = select.options[select.selectedIndex].value;
|
||||||
if(status != "-2"){
|
switch (listId[i])
|
||||||
param = param + "status="+status+"&";
|
{
|
||||||
}
|
case "inputRoles":
|
||||||
if(getId != "All"){
|
if (getId != "All"){
|
||||||
param = param + "roles="+getId;
|
param = param + "roles=" + getId + "&";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "inputStatus":
|
||||||
|
if (getId != "-2"){
|
||||||
|
param = param + "status=" + getId + "&";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "inputPages":
|
||||||
|
param = param + "limit=" + getId + "&";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(id == "inputStatus"){
|
|
||||||
var roles = e.target.value;
|
|
||||||
if(getId != "-2"){
|
|
||||||
param = param + "status="+getId+"&";
|
|
||||||
}
|
|
||||||
if(roles != "All"){
|
|
||||||
param = param + "roles="+roles+"&";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
listParam.push("roles");
|
listParam.push("roles");
|
||||||
listParam.push("status");
|
listParam.push("status");
|
||||||
|
listParam.push("limit");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(search.length > 0){
|
if(search.length > 0){
|
||||||
|
@ -12,7 +12,7 @@ for(var i=0; i<listSearch.length; i++){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var listQuery = [{"query": "roles", "id":"inputRoles"}, {"query":"status", "id":"inputStatus"}]
|
var listQuery = [{"query": "roles", "id":"inputRoles"}, {"query":"status", "id":"inputStatus"}, {"query":"limit", "id":"inputPages"}]
|
||||||
|
|
||||||
for (var i=0; i<listQuery.length; i++){
|
for (var i=0; i<listQuery.length; i++){
|
||||||
var query = getQuery(listQuery[i]["query"]);
|
var query = getQuery(listQuery[i]["query"]);
|
||||||
@ -199,20 +199,20 @@ document.getElementById("addUser").addEventListener("click", function(){
|
|||||||
|
|
||||||
document.getElementById("searchUser").addEventListener("keydown", function(ev){
|
document.getElementById("searchUser").addEventListener("keydown", function(ev){
|
||||||
if(ev.key === "Enter"){
|
if(ev.key === "Enter"){
|
||||||
var param = buildParam("", "");
|
var param = buildParam("");
|
||||||
location.href="/html/users.html?"+param;
|
location.href="/html/users.html?"+param;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("inputStatus").addEventListener("change", function(e){
|
|
||||||
var param = buildParam(e, "inputRoles");
|
|
||||||
location.href="/html/users.html?"+param;
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById("inputRoles").addEventListener("change", function(e){
|
listInput = ["Status", "Roles", "Pages" ]
|
||||||
var param = buildParam(e, "inputStatus");
|
for (var i=0; i<listInput.length; i++){
|
||||||
location.href="/html/users.html?"+param;
|
document.getElementById("input"+listInput[i]).addEventListener("change", function(e){
|
||||||
});
|
var param = buildParam("inputSelect");
|
||||||
|
location.href="/html/users.html?"+param;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user