add selected input wip

This commit is contained in:
Valentin CZERYBA 2023-10-31 00:25:59 +01:00
parent e590b3f823
commit 64762778d0
2 changed files with 12 additions and 8 deletions

View File

@ -159,20 +159,24 @@
<table id=users class="table table-striped table-sm"> <table id=users class="table table-striped table-sm">
<thead> <thead>
<tr> <tr>
<th><input type="checkbox" id="checkboxPrincipal" aria-label="Checkbox for following text input"></th>
<th scope="col">ID</th> <th scope="col">ID</th>
<th scope="col">Pseudo</th> <th scope="col">Username</th>
<th scope="col">Mail</th> <th scope="col">Mail</th>
<th scope="col">Rôle</th> <th scope="col">Rôle</th>
<th scope="col">Statut</th> <th scope="col">Statut</th>
<th scope="col"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td><input type="checkbox" class="checkboxList" aria-label="Checkbox for following text input"></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td><span class="activeStatus hidden">Activé</span><span class="disableStatus hidden">Désactivé</span><span class="confirmStatus hidden">En attente de confirmation</span><span class="removeStatus hidden">En attente de suppression</span><span class="unknownStatus hidden">Statut inconnu</span></td> <td><span class="activeStatus hidden">Activé</span><span class="disableStatus hidden">Désactivé</span><span class="confirmStatus hidden">En attente de confirmation</span><span class="removeStatus hidden">En attente de suppression</span><span class="unknownStatus hidden">Statut inconnu</span></td>
<td><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updateUserModal">Modifier</button></td>
</tr> </tr>
</tbody> </tbody>

View File

@ -96,10 +96,10 @@ instance.get("users", {withCredentials: true, params:param}).then(function(respo
} }
var trAll = document.querySelectorAll("#users tbody tr") var trAll = document.querySelectorAll("#users tbody tr")
td = trAll[i].querySelectorAll("td"); td = trAll[i].querySelectorAll("td");
td[0].textContent = listData[i].id; td[1].textContent = listData[i].id;
td[1].textContent = listData[i].username; td[2].textContent = listData[i].username;
td[2].textContent = listData[i].email; td[3].textContent = listData[i].email;
td[3].textContent = listData[i].roles; td[4].textContent = listData[i].roles;
var classTd = ""; var classTd = "";
switch(listData[i].status){ switch(listData[i].status){
case 1: case 1:
@ -118,11 +118,11 @@ instance.get("users", {withCredentials: true, params:param}).then(function(respo
classTd = ".unknownStatus" classTd = ".unknownStatus"
break; break;
} }
td[4].querySelector(".activeStatus").classList.add("hidden"); td[5].querySelector(".activeStatus").classList.add("hidden");
td[4].querySelector(classTd).classList.remove("hidden"); td[5].querySelector(classTd).classList.remove("hidden");
trAll[i].addEventListener("click", function(e){ trAll[i].addEventListener("click", function(e){
var id = e.currentTarget.querySelector("td").textContent; var id = e.currentTarget.querySelectorAll("td")[1].textContent;
location.href="/html/user.html?id="+id; location.href="/html/user.html?id="+id;
}); });