diff --git a/delete-composant.html b/delete-composant.html new file mode 100644 index 0000000..e71f7b8 --- /dev/null +++ b/delete-composant.html @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/delete-composant.js b/delete-composant.js new file mode 100644 index 0000000..c55b3f1 --- /dev/null +++ b/delete-composant.js @@ -0,0 +1,42 @@ +// Injection du modal +fetch("../../delete-composant.html") + .then(res => { + if (!res.ok) throw new Error("Modal HTML introuvable"); + return res.text(); + }) + .then(html => { + document.getElementById("modal-placeholder").innerHTML = html; + initDeleteModalLogic(); + }) + .catch(err => console.error(err)); + +// Logique du modal +function initDeleteModalLogic() { + let rowToDelete = null; + + const modalElement = document.getElementById("deleteModal"); + const itemNameSpan = document.getElementById("itemName"); + const confirmBtn = document.getElementById("confirmDeleteBtn"); + + const deleteModal = new bootstrap.Modal(modalElement); + + document.body.addEventListener("click", (event) => { + const button = event.target.closest(".delete-btn"); + if (!button) return; + + rowToDelete = button.closest("tr"); + + const firstCell = rowToDelete.querySelector("td"); + const itemName = firstCell ? firstCell.textContent.trim() : "cet élément"; + + itemNameSpan.textContent = itemName; + deleteModal.show(); + }); + + confirmBtn.addEventListener("click", () => { + if (rowToDelete) rowToDelete.remove(); + rowToDelete = null; + deleteModal.hide(); + }); +} + diff --git a/header-composant.html b/header-composant.html new file mode 100644 index 0000000..c7f2f1a --- /dev/null +++ b/header-composant.html @@ -0,0 +1,100 @@ + + + + + + Header- composant + + + + + + +
+ + +
+ + + \ No newline at end of file diff --git a/header-composant.js b/header-composant.js new file mode 100644 index 0000000..dd43767 --- /dev/null +++ b/header-composant.js @@ -0,0 +1,5 @@ +fetch("../../header-composant.html") + .then(response => response.text()) + .then(data => { + document.getElementById("header-placeholder").innerHTML = data; + }); diff --git a/prestations/html/ajouter_avant_apres.html b/prestations/html/ajouter_avant_apres.html index be53e9e..72d119b 100644 --- a/prestations/html/ajouter_avant_apres.html +++ b/prestations/html/ajouter_avant_apres.html @@ -15,71 +15,7 @@ -
- - -
+
@@ -164,6 +100,7 @@ + diff --git a/prestations/html/ajouter_slider.html b/prestations/html/ajouter_slider.html index 10d870e..2c42a50 100644 --- a/prestations/html/ajouter_slider.html +++ b/prestations/html/ajouter_slider.html @@ -20,6 +20,8 @@ +
+

Ajouter une image au slider

@@ -69,6 +71,8 @@ + + diff --git a/prestations/html/liste_avant_apres.html b/prestations/html/liste_avant_apres.html index 58fe8bc..3be6d68 100644 --- a/prestations/html/liste_avant_apres.html +++ b/prestations/html/liste_avant_apres.html @@ -9,71 +9,13 @@ + -
- -
+
+
@@ -138,6 +80,8 @@ + + diff --git a/prestations/html/modifier_avant_apres.html b/prestations/html/modifier_avant_apres.html index 3e77746..d1b508d 100644 --- a/prestations/html/modifier_avant_apres.html +++ b/prestations/html/modifier_avant_apres.html @@ -13,68 +13,8 @@ -
- -
@@ -164,6 +104,7 @@ + diff --git a/prestations/html/modifier_slider.html b/prestations/html/modifier_slider.html index 9da99f9..d025876 100644 --- a/prestations/html/modifier_slider.html +++ b/prestations/html/modifier_slider.html @@ -8,6 +8,9 @@