This commit is contained in:
anto
2024-10-24 16:35:26 +02:00
parent 300aa67a7b
commit bc49332321
4 changed files with 57 additions and 32 deletions

View File

@@ -9,13 +9,13 @@ function display_projects() {
<th>Status</th>
<th>Actions</th>
</tr> `;
for (let i = 0; i < global_project_list.rows.length; i++) {
for (let i = 0; i < global_project_list.length; i++) {
datas += `<tr>
<th>${global_project_list.rows[i].id}</th>
<th>${global_project_list.rows[i].titre}</th>
<th>${formatDate(global_project_list.rows[i].creation)}</th>
<th>${global_project_list.rows[i].status}</th>
<th><button class="project_detail btn btn-primary">détails de ${global_project_list.rows[i].titre}</button></th>
<th>${global_project_list[i].id}</th>
<th>${global_project_list[i].titre}</th>
<th>${formatDate(global_project_list[i].creation)}</th>
<th>${global_project_list[i].status}</th>
<th><button class="project_detail btn btn-primary">détails de ${global_project_list[i].titre}</button></th>
</tr>`;
}
table.innerHTML = datas;
@@ -26,7 +26,7 @@ function display_projects() {
for (let i = 0; i < buttons.length; i++) {
buttons[i].addEventListener("click", (event) => {
// Send data to API and then navigate to projet_detail.html page
window.location.href = `html/projet_detail.html?id=${global_project_list.rows[i].id}`;
window.location.href = `html/projet_detail.html?id=${global_project_list[i].id}`;
});
buttons[i].addEventListener("onclick", (event) => {
// Send data to API and then navigate to projet_detail.html page
@@ -34,7 +34,7 @@ function display_projects() {
});
}
}
getDataFromApi()
getDataProjectFromApi()
.then(project_list => {
global_project_list = project_list;
// Call the next function here