group button
This commit is contained in:
parent
d623d86db0
commit
9a4f17f469
@ -157,10 +157,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<button type="button" class="btn btn-success" id="enableUser" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
|
<button type="button" class="btn btn-success" id="enableUserButton" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
|
||||||
|
|
||||||
<button type="button" class="btn btn-warning " id="disableUser" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'utilisateur</button>
|
<button type="button" class="btn btn-warning " id="disableUserButton" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'utilisateur</button>
|
||||||
<button type="button" class="btn btn-danger" id="removeUser" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'utilisateur</button>
|
<button type="button" class="btn btn-danger" id="removeUserButton" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'utilisateur</button>
|
||||||
<br /><br /><br />
|
<br /><br /><br />
|
||||||
<table id=users class="table table-striped table-sm">
|
<table id=users class="table table-striped table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -72,7 +72,7 @@ if(id.length > 0){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
httpMethod = "patch";
|
httpMethod = "patch";
|
||||||
httpUrl = "users/enable/"+idInput;
|
httpUrl = "users/"+idInput;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
instance({
|
instance({
|
||||||
|
@ -89,6 +89,59 @@ instance.get("users", {withCredentials: true, params:param}).then(function(respo
|
|||||||
var listData = []
|
var listData = []
|
||||||
listData.push(response.data);
|
listData.push(response.data);
|
||||||
}
|
}
|
||||||
|
if(listData.length > 0 ){
|
||||||
|
var listModalButton = ["disable", "enable", "remove"];
|
||||||
|
|
||||||
|
for (var i=0; i<listModalButton.length; i++){
|
||||||
|
document.getElementById(listModalButton[i]+"UserButton").addEventListener("click", function(e){
|
||||||
|
var httpMethod = ""
|
||||||
|
var httpUrl = "";
|
||||||
|
param = {};
|
||||||
|
userids= [];
|
||||||
|
checkboxList = document.getElementsByClassName("checkboxList");
|
||||||
|
for (var j=0; j<checkboxList.length; j++){
|
||||||
|
if(checkboxList[j].checked){
|
||||||
|
userid = checkboxList.getAttribute("userid");
|
||||||
|
if (userid.length > 0){
|
||||||
|
userids.push(userid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
param["userids"]=userids;
|
||||||
|
|
||||||
|
switch(e.currentTarget.id){
|
||||||
|
case "disableUserButton":
|
||||||
|
httpMethod = "delete";
|
||||||
|
httpUrl = "users/groups";
|
||||||
|
break;
|
||||||
|
case "removeUserButton":
|
||||||
|
httpMethod = "delete";
|
||||||
|
httpUrl = "users/groups?remove=true";
|
||||||
|
param["remove"]=true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
httpMethod = "patch";
|
||||||
|
httpUrl = "users/groups";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
instance({
|
||||||
|
method: httpMethod,
|
||||||
|
url: httpUrl,
|
||||||
|
params:param,
|
||||||
|
withCredentials: true
|
||||||
|
})
|
||||||
|
.then(function(response){
|
||||||
|
if(response.status == 200){
|
||||||
|
location.href="/html/users.html";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function(error){
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
for (var i=0; i<listData.length; i++){
|
for (var i=0; i<listData.length; i++){
|
||||||
var trTag = document.querySelector("#users tbody tr").cloneNode(true);
|
var trTag = document.querySelector("#users tbody tr").cloneNode(true);
|
||||||
if(i != 0){
|
if(i != 0){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user