add select

This commit is contained in:
Valentin CZERYBA 2022-08-25 01:41:06 +02:00
parent f740138cbc
commit 8405947254

View File

@ -6,8 +6,8 @@ param["nbPages"] = 20;
instance.get("users/count", { withCredentials: true }).then(function(response){
var count = response.data / nbPages;
var reste = response.data % nbPages;
var count = response.data / param["nbPages"];
var reste = response.data % param["nbPages"];
var total = 0;
if(reste != 0){
total = Number.parseInt(count) + 1;
@ -122,22 +122,57 @@ document.getElementById("inputStatus").addEventListener("change", function(e){
var search = document.getElementById("searchUser").value;
var select = document.getElementById("inputRoles");
var roles = select.options[select.selectedIndex].value;
if(search.length > 0){
location.href="/html/users.html?search="+search+"&status="+e.target.value+"&roles="+roles;
} else {
location.href="/html/users.html?status="+e.target.value+"&roles="+roles;
var param = "";
var page = getQuery("page");
if(page.length > 0){
param = param + "page="+page+"&";
}
var nbPages = getQuery("nbPages");
if(nbPages.length > 0 ){
param = param+ "nbPages="+nbPages+"&";
}
if(search.length > 0){
param = param + "search="+search+"&";
}
var status = e.target.value;
if(status != "-2"){
param = param + "status="+status+"&";
}
if(roles != "All"){
param = param + "roles="+roles;
}
location.href="/html/users.html?"+param;
});
document.getElementById("inputRoles").addEventListener("change", function(e){
var search = document.getElementById("searchUser").value;
var select = document.getElementById("inputStatus");
var status = select.options[select.selectedIndex].value;
if(search.length > 0){
location.href="/html/users.html?search="+search+"&roles="+e.target.value+"&status="+status;
} else {
location.href="/html/users.html?roles="+e.target.value+"&status="+status;
var param = "";
var page = getQuery("page");
if(page.length > 0){
param = param + "page="+page+"&";
}
var nbPages = getQuery("nbPages");
if(nbPages.length > 0 ){
param = param + "nbPages="+nbPages+"&";
}
if(search.length > 0){
param = param + "search="+search+"&";
}
if(status != "-2"){
param = param + "status="+status+"&";
}
var roles = e.target.value;
if(roles != "All"){
param = param + "roles="+roles;
}
console.log(param);
location.href="/html/users.html?"+param;
});