From 9a4f17f469dc5623a62f351bb666fc14dc353131 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 2 Nov 2023 17:29:12 +0100 Subject: [PATCH] group button --- web/html/users.html | 6 ++--- web/js/user.js | 2 +- web/js/users.js | 53 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/web/html/users.html b/web/html/users.html index 800474d..1704286 100644 --- a/web/html/users.html +++ b/web/html/users.html @@ -157,10 +157,10 @@
- + - - + +


diff --git a/web/js/user.js b/web/js/user.js index 6a86aa9..d7a743f 100644 --- a/web/js/user.js +++ b/web/js/user.js @@ -72,7 +72,7 @@ if(id.length > 0){ break; default: httpMethod = "patch"; - httpUrl = "users/enable/"+idInput; + httpUrl = "users/"+idInput; break; } instance({ diff --git a/web/js/users.js b/web/js/users.js index b327a19..483ea2c 100644 --- a/web/js/users.js +++ b/web/js/users.js @@ -89,6 +89,59 @@ instance.get("users", {withCredentials: true, params:param}).then(function(respo var listData = [] listData.push(response.data); } + if(listData.length > 0 ){ + var listModalButton = ["disable", "enable", "remove"]; + + for (var i=0; i 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