From 9a86fad4074b844d0fc19babe7082355bbe85b2d Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 4 Aug 2022 23:19:26 +0200 Subject: [PATCH] change status users --- web/html/home.html | 2 +- web/js/home.js | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/web/html/home.html b/web/html/home.html index 852635a..f61c705 100644 --- a/web/html/home.html +++ b/web/html/home.html @@ -165,7 +165,7 @@ - + diff --git a/web/js/home.js b/web/js/home.js index 3a5cf9b..ccab1d8 100644 --- a/web/js/home.js +++ b/web/js/home.js @@ -33,10 +33,24 @@ instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages td[1].textContent = listData[i].pseudo td[2].textContent = listData[i].email td[3].textContent = listData[i].roles - var classTd = ".disableStatus"; - if(listData[i].status){ - classTd = ".activeStatus"; - } + var classTd = ""; + switch(listData[i].status){ + case 1: + classTd = ".activeStatus"; + break; + case 0: + classTd = ".disableStatus"; + break; + case 2: + classTd = ".confirmStatus"; + break; + case -1: + classTd = ".removeStatus"; + break; + default: + classTd = ".unknownStatus" + break; + } td[4].querySelector(classTd).classList.remove("hidden"); trAll[i].addEventListener("click", function(e){