add last id

This commit is contained in:
Valentin CZERYBA 2023-11-09 21:17:45 +01:00
parent 48c7e38c87
commit 162edf5857

View File

@ -152,9 +152,19 @@ instance.get(pathURL, {withCredentials: true, params:param}).then(function(respo
td = trAll[i].querySelectorAll("td");
td[0].querySelector("input").setAttribute("userid", listData[i].id)
td[1].textContent = listData[i].id;
td[2].textContent = listData[i].username;
td[3].textContent = listData[i].email;
td[4].textContent = listData[i].roles;
if(pathURL == "users"){
td[2].textContent = listData[i].username;
td[3].textContent = listData[i].email;
td[4].textContent = listData[i].roles;
last_id = 5;
}
if(pathURL == "events"){
td[2].textContent = listData[i].name;
td[3].textContent = listData[i].place;
td[4].textContent = listData[i].start_date;
td[5].textContent = listData[i].start_date;
last_id = 6;
}
var classTd = "";
switch(listData[i].status){
case 1:
@ -173,12 +183,12 @@ instance.get(pathURL, {withCredentials: true, params:param}).then(function(respo
classTd = ".unknownStatus"
break;
}
td[5].querySelector(".activeStatus").classList.add("hidden");
td[5].querySelector(classTd).classList.remove("hidden");
td[last_id].querySelector(".activeStatus").classList.add("hidden");
td[last_id].querySelector(classTd).classList.remove("hidden");
td[6].querySelector("button").setAttribute("userid", listData[i].id)
td[last_id + 1].querySelector("button").setAttribute("userid", listData[i].id)
td[6].querySelector("button").addEventListener("click", function(e){
td[last_id + 1].querySelector("button").addEventListener("click", function(e){
var id = e.currentTarget.getAttribute("userid");
location.href="/html/"+pathURL.slice(0, -1)+".html?id="+id;
});