From 77f43fff95d49028294f8727e2b5e583bec5aa56 Mon Sep 17 00:00:00 2001 From: pestak Date: Fri, 12 Dec 2025 08:33:41 +0100 Subject: [PATCH 01/18] citations --- citations/html/accueil.html | 184 ++++++++++++++++++++++++++++++++++ citations/js/contentReduct.js | 43 ++++++++ css/citations.css | 0 css/style.css | 7 +- header.html | 36 ++----- 5 files changed, 239 insertions(+), 31 deletions(-) create mode 100644 citations/html/accueil.html create mode 100644 citations/js/contentReduct.js create mode 100644 css/citations.css diff --git a/citations/html/accueil.html b/citations/html/accueil.html new file mode 100644 index 0000000..4f83023 --- /dev/null +++ b/citations/html/accueil.html @@ -0,0 +1,184 @@ + + + + + + + Citations - L'Il'eau chiens - Admin + + + + + + + + + + + + +
+ + +
+
+
+
+

Liste des citations

+
+
+ +
+

Citations chiens

+ + + + + + + + + + + + + + + + +
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
+
+ +
+

Citations chats

+ + + + + + + + + + + + + + + + +
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
+
+ +
+

Citations divers

+ + + + + + + + + + + + + + + + +
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/citations/js/contentReduct.js b/citations/js/contentReduct.js new file mode 100644 index 0000000..f42dd66 --- /dev/null +++ b/citations/js/contentReduct.js @@ -0,0 +1,43 @@ +/** + * Réduit le contenu des cellules td des tableaux + */ + + + +const BREAKPOINT_SM = 1000; +(() => { + // Récupère les cellules td (premier d'un tr) à traiter + const getTargetCells = () => { + const tbodyRows = Array.from(document.querySelectorAll("tbody tr")); + let cells = tbodyRows.map((row) => row.querySelector("td")).filter(Boolean); + if (cells.length === 0) { + const allRows = Array.from(document.querySelectorAll("tr")); + cells = allRows.map((row) => row.querySelector("td")).filter(Boolean); + } + return cells; + }; + + const tdElts = getTargetCells(); + + tdElts.forEach((td) => { + if (!td.dataset.fullText) { + td.dataset.fullText = td.textContent.trim(); + } + }); + + const applyTruncation = () => { + const narrow = window.innerWidth < BREAKPOINT_SM; + tdElts.forEach((td) => { + const full = td.dataset.fullText ?? td.textContent; + const text = (full || "").trim(); + if (narrow) { + td.textContent = text.length > 40 ? text.slice(0, 40) + '...': text; + } else { + td.textContent = full; + } + }); + }; + + applyTruncation(); + window.addEventListener("resize", applyTruncation); +})(); \ No newline at end of file diff --git a/css/citations.css b/css/citations.css new file mode 100644 index 0000000..e69de29 diff --git a/css/style.css b/css/style.css index d591513..1f260a9 100644 --- a/css/style.css +++ b/css/style.css @@ -1,16 +1,19 @@ /*============================================================================= Header Navbar Styles =============================================================================*/ +a.nav-link{ + font-size: .95rem; +} .navbar-brand { - font-size: 1.2rem; + font-size: 1.1rem; line-height: 1; padding-top: 0.25rem; padding-bottom: 0.25rem; } .brand-sep { - height: 1.2rem; + height: .8rem; } diff --git a/header.html b/header.html index cc4095e..6d468be 100644 --- a/header.html +++ b/header.html @@ -8,34 +8,9 @@ + - + @@ -67,11 +42,14 @@ FAQ + @@ -105,7 +83,7 @@
-

Titre de la page

+

Titre de la page

Contenu de la page From c7aaa923af4826c768f472012d626dd8c3103a95 Mon Sep 17 00:00:00 2001 From: RoxanaElena09 Date: Thu, 11 Dec 2025 16:14:47 +0100 Subject: [PATCH 02/18] feat: creation header composant html et js --- header-composant.html | 100 ++++++++++++++++++ header-composant.js | 5 + prestations/html/ajouter_avant_apres.html | 67 +----------- prestations/html/ajouter_slider.html | 4 + prestations/html/liste_avant_apres.html | 66 +----------- prestations/html/modifier_avant_apres.html | 63 +---------- prestations/html/modifier_slider.html | 7 ++ prestations/html/prestation_accueil.html | 117 +++++++++------------ prestations/html/voir_avant_apres.html | 1 + 9 files changed, 173 insertions(+), 257 deletions(-) create mode 100644 header-composant.html create mode 100644 header-composant.js 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 @@ - - - -
-

Liste des prestations

- - -
Prestation supprimée avec succès !
- - - - - - - - - - - - - - - - - - -
TitreTypeDescriptionTarifActions
-
- - - - - - - \ No newline at end of file diff --git a/prestations/html/liste_slider.html b/prestations/html/liste_slider.html deleted file mode 100644 index 9003512..0000000 --- a/prestations/html/liste_slider.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - Liste des slides - - - - - - - -
- - -
- - - -
- -

Slider – Liste des images

- - -
- - - - - - - - - - - - - - - - - - -
ImageTexte ALTTitreOrdreActions
-
- - - - - - - \ No newline at end of file diff --git a/prestations/html/voir_avant_apres.html b/prestations/html/voir_avant_apres.html deleted file mode 100644 index db31fe3..0000000 --- a/prestations/html/voir_avant_apres.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - Voir le résultat avant/après - - - - - - - - - - -
- -

Détails du résultat en images (Avant / Après)

- - -
- Impossible d'afficher ce résultat. -
- -
- -

Chargement...

- - - -
- -
-

AVANT

- Photo avant -
- -
-

APRÈS

- Photo après -
- -
- - - - -
- -
- - - - - - - - \ No newline at end of file diff --git a/prestations/js/liste_avant_apres.js b/prestations/js/liste_avant_apres.js deleted file mode 100644 index 12d6c71..0000000 --- a/prestations/js/liste_avant_apres.js +++ /dev/null @@ -1,103 +0,0 @@ -// =============================== -// Données simulées (à remplacer plus tard par une BDD) -// =============================== -let galleryPairs = [ - { - id: 1, - titre: "Petit chien poils longs", - - - }, - { - id: 2, - titre: "Coupe ciseaux", - - - } -]; - -// Sélecteurs -const tableBody = document.getElementById("prestationTableBody"); -const succesDeleteMsg = document.getElementById("succesDeleteMsg"); - -// Modal & bouton de confirmation -const deleteModalEl = document.getElementById("deleteModal"); -const confirmDeleteBtn = document.getElementById("confirmDeleteBtn"); -const deleteModal = new bootstrap.Modal(deleteModalEl); - -// ID de la paire en attente de suppression -let pairIdToDelete = null; - -// =============================== -// Fonction d'affichage -// =============================== -function displayPairs() { - tableBody.innerHTML = ""; // reset tableau - - galleryPairs.forEach(pair => { - const row = document.createElement("tr"); - - row.innerHTML = ` - ${pair.titre} - - - -
- - - - - - Modifier - - - - -
- - `; - - tableBody.appendChild(row); - }); -} - -// =============================== -// Ouvrir le modal de suppression -// =============================== -function openDeleteModal(id) { - pairIdToDelete = id; // on mémorise l'id - deleteModal.show(); // on ouvre le modal -} - -// =============================== -// Fonction de suppression réelle -// =============================== -function deletePair(id) { - galleryPairs = galleryPairs.filter(pair => pair.id !== id); - displayPairs(); - - succesDeleteMsg.classList.remove("d-none"); - - setTimeout(() => { - succesDeleteMsg.classList.add("d-none"); - }, 2000); -} - -// =============================== -// Clic sur "Supprimer" dans le modal -// =============================== -confirmDeleteBtn.addEventListener("click", () => { - if (pairIdToDelete !== null) { - deletePair(pairIdToDelete); - pairIdToDelete = null; - } - deleteModal.hide(); -}); - -// =============================== -// Chargement initial -// =============================== -displayPairs(); diff --git a/prestations/js/liste_prestation.js b/prestations/js/liste_prestation.js deleted file mode 100644 index 511c1ac..0000000 --- a/prestations/js/liste_prestation.js +++ /dev/null @@ -1,61 +0,0 @@ -// Exemple BDD -const prestations = [ - { - id: 1, - titre: "Toilettage complet", - type: "Chien", - description: "• Bain complet \n• Séchage \n• Coupe aux ciseaux\n• Nettoyage des oreilles", - prixMin: 35, - prixMax: 60 - }, - { - id: 2, - titre: "Toilettage express", - type: "Chat", - description: "• Bain rapide\n• Séchage\n• Brossage", - prixMin: 20, - prixMax: 35 - } -]; - -// Sélection des éléments -const tableBody = document.getElementById('prestationTableBody'); -const successDeleteMsg = document.getElementById('successDeleteMsg'); - -// Fonction pour extrait description -function extrait(desc, limite = 60) { - return desc.length > limite ? desc.substring(0, limite) + '...' : desc; -} - -// Affichage du tableau -function afficherPrestations() { - tableBody.innerHTML = ''; - - prestations.forEach((p, index) => { - const row = ` - - ${p.titre} - ${p.type} - ${extrait(p.description.replace(/\n/g, " "))} - ${p.prixMin}€ - ${p.prixMax}€ - - - Voir - Modifier - - - - `; - tableBody.innerHTML += row; - }); -} - -afficherPrestations(); - -// Suppression -function supprimerPrestation(index) { - prestations.splice(index, 1); - afficherPrestations(); - - successDeleteMsg.classList.remove("d-none"); -} diff --git a/prestations/js/liste_slider.js b/prestations/js/liste_slider.js deleted file mode 100644 index 7d25a9c..0000000 --- a/prestations/js/liste_slider.js +++ /dev/null @@ -1,87 +0,0 @@ -// Simulation BDD slider -let slides = [ - { id: 1, image: "slide1.webp", alt: "Chien toiletté", title: "Promo du mois", order: 1 }, - { id: 2, image: "slide2.webp", alt: "Avant / Après", title: "", order: 2 }, - { id: 3, image: "slide3.webp", alt: "Coupe ciseaux", title: "Nouveauté", order: 3 } -]; - -const tableBody = document.getElementById("sliderTableBody"); -const successMsg = document.getElementById("successMsg"); - -function afficherSlides() { - - // trier par ordre - slides.sort((a, b) => a.order - b.order); - - tableBody.innerHTML = ""; - - slides.forEach((slide, index) => { - const row = ` - - ${slide.alt} - - ${slide.alt} - ${slide.title || "-"} - ${slide.order} - - - - - - Modifier - - - - - - `; - tableBody.innerHTML += row; - }); -} - -afficherSlides(); - -// Suppression -function supprimerSlide(index) { - if (confirm("Voulez-vous vraiment supprimer cette image du slider ?")) { - slides.splice(index, 1); - - // Réordonner après suppression - slides.forEach((s, i) => s.order = i + 1); - - afficherSlides(); - - successMsg.textContent = "Image du slider supprimée avec succès."; - successMsg.classList.remove("d-none"); - } -} - -// Monter -function monter(index) { - if (index === 0) return; // déjà en haut - - [slides[index - 1], slides[index]] = [slides[index], slides[index - 1]]; - - // recalcul ordre - slides.forEach((s, i) => s.order = i + 1); - - afficherSlides(); - - successMsg.textContent = "Ordre mis à jour."; - successMsg.classList.remove("d-none"); -} - -// Descendre -function descendre(index) { - if (index === slides.length - 1) return; // déjà en bas - - [slides[index], slides[index + 1]] = [slides[index + 1], slides[index]]; - - slides.forEach((s, i) => s.order = i + 1); - - afficherSlides(); - - successMsg.textContent = "Ordre mis à jour."; - successMsg.classList.remove("d-none"); -} diff --git a/prestations/js/voir_avant_apres.js b/prestations/js/voir_avant_apres.js deleted file mode 100644 index c39d31d..0000000 --- a/prestations/js/voir_avant_apres.js +++ /dev/null @@ -1,58 +0,0 @@ -// =============================== -// Données simulées (à remplacer plus tard par BDD / API) -// =============================== -let galleryPairs = [ - { - id: 1, - titre: "Petit chien poils longs", - type: "Chien", - avant: "../../img/avant1.jpg", - apres: "../../img/apres1.jpg" - }, - { - id: 2, - titre: "Coupe ciseaux", - type: "Chat", - avant: "../../img/avant2.jpg", - apres: "../../img/apres2.jpg" - } -]; - -// Sélecteurs -const titleEl = document.getElementById("pairTitle"); -const beforePreview = document.getElementById("beforePreview"); -const afterPreview = document.getElementById("afterPreview"); -const errorMsg = document.getElementById("errorMsg"); -const detailsSection = document.getElementById("detailsSection"); - -// =============================== -// Récup ID dans l'URL -// =============================== -function getIdFromUrl() { - const params = new URLSearchParams(window.location.search); - return parseInt(params.get("id")); -} - -// =============================== -// Charger les infos de la paire -// =============================== -function loadPairDetails() { - const id = getIdFromUrl(); - const pair = galleryPairs.find(p => p.id === id); - - if (!pair) { - errorMsg.classList.remove("d-none"); - detailsSection.classList.add("d-none"); - return; - } - - // Affichage du titre - titleEl.textContent = pair.titre; - - // Affichage des images - beforePreview.src = pair.avant; - afterPreview.src = pair.apres; -} - -// Initialisation -loadPairDetails(); From 374334de44aeaaeb84e8e7b40ff1a1131f09cbf3 Mon Sep 17 00:00:00 2001 From: RoxanaElena09 Date: Fri, 12 Dec 2025 09:43:06 +0100 Subject: [PATCH 07/18] feat:modification page prestation --- prestations/html/prestation_accueil.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prestations/html/prestation_accueil.html b/prestations/html/prestation_accueil.html index 76f4331..5b1d1df 100644 --- a/prestations/html/prestation_accueil.html +++ b/prestations/html/prestation_accueil.html @@ -40,7 +40,7 @@ data-bs-parent="#accordionExample">
-
+
Ajouter une prestation @@ -78,7 +78,7 @@ -
+
Ajouter une catégorie @@ -132,7 +132,7 @@ data-bs-parent="#accordionExample">
-
+
Ajouter un slider @@ -198,7 +198,7 @@ data-bs-parent="#accordionExample">
-
+
Ajouter un résultat From 47a124346423524cdbd0d5c7cd7bb61fd40c465c Mon Sep 17 00:00:00 2001 From: RoxanaElena09 Date: Fri, 12 Dec 2025 09:46:01 +0100 Subject: [PATCH 08/18] feat: ajouter une categorie mb-4 mt-3 --- prestations/html/prestation_accueil.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prestations/html/prestation_accueil.html b/prestations/html/prestation_accueil.html index 5b1d1df..92cf910 100644 --- a/prestations/html/prestation_accueil.html +++ b/prestations/html/prestation_accueil.html @@ -78,7 +78,7 @@ -
+
Ajouter une catégorie @@ -141,7 +141,7 @@ - + From a0ef8c98c97297f52ac5e9414a867deb28209a57 Mon Sep 17 00:00:00 2001 From: RoxanaElena09 Date: Fri, 12 Dec 2025 09:46:52 +0100 Subject: [PATCH 09/18] feat: ajouter une carte --- prestations/html/prestation_accueil.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prestations/html/prestation_accueil.html b/prestations/html/prestation_accueil.html index 92cf910..d6399f1 100644 --- a/prestations/html/prestation_accueil.html +++ b/prestations/html/prestation_accueil.html @@ -80,7 +80,7 @@ From b77f82f2167bfc6b5b5b7eccf739a8f83b30d6b7 Mon Sep 17 00:00:00 2001 From: pestak Date: Fri, 12 Dec 2025 10:00:08 +0100 Subject: [PATCH 10/18] ups modif prestations accueil --- prestations/html/prestation_accueil.html | 199 ++++++++++++----------- 1 file changed, 101 insertions(+), 98 deletions(-) diff --git a/prestations/html/prestation_accueil.html b/prestations/html/prestation_accueil.html index d6399f1..9831caf 100644 --- a/prestations/html/prestation_accueil.html +++ b/prestations/html/prestation_accueil.html @@ -28,90 +28,96 @@

-

+ data-bs-parent="#accordionExample">
ImageTitre Actions
+ + + -
Titre
- - - - - - - - - - - - - + + + + + + - - - - - - - - - -
TitreActions
Toilettage complet - Modifier - + Actions
Toilettage complet
Toilettage express - Modifier - + + Modifier + -
+ + + + + Toilettage express - + + Modifier + - - - - - - - - - - - - - + + +
TitreActions
Coupe ciseaux - Modifier - +
+ + +
+

Cartes

+ - - - Coupe griffes - - - Modifier - + + + + - - - -
Titre
+ Actions + + + + + Coupe ciseaux + + + Modifier + + + + + Coupe griffes + + + Modifier + + + + + + +
@@ -120,16 +126,12 @@

-

-
+
@@ -151,28 +153,31 @@ Modifier - + - + Avant / Après - - + + Modifier - + - + Nouveauté - + Modifier - + @@ -186,16 +191,12 @@

-

-
+
@@ -216,8 +217,9 @@ Toilettage complet Modifier - + class="btn btn-sm btn-outline-primary me-1">Modifier + @@ -225,8 +227,9 @@ Toilettage complet Modifier - + class="btn btn-sm btn-outline-primary me-1">Modifier + @@ -250,5 +253,5 @@ - + \ No newline at end of file From f02c69449abb3042ddfb3a3abe7ea568c0c74108 Mon Sep 17 00:00:00 2001 From: RoxanaElena09 Date: Fri, 12 Dec 2025 11:27:58 +0100 Subject: [PATCH 11/18] feat:creation dossier components --- package-lock.json | 3 ++- .../components/html/delete-composant.html | 0 .../components/html/header-composant.html | 0 .../components/js/delete-composant.js | 2 +- .../components/js/header-composant.js | 2 +- prestations/html/prestation_accueil.html | 4 ++-- 6 files changed, 6 insertions(+), 5 deletions(-) rename delete-composant.html => prestations/components/html/delete-composant.html (100%) rename header-composant.html => prestations/components/html/header-composant.html (100%) rename delete-composant.js => prestations/components/js/delete-composant.js (95%) rename header-composant.js => prestations/components/js/header-composant.js (74%) diff --git a/package-lock.json b/package-lock.json index 890a3bd..1bfd43d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,7 +76,8 @@ "node_modules/scheduler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==" + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "peer": true }, "node_modules/tinymce": { "version": "8.2.2", diff --git a/delete-composant.html b/prestations/components/html/delete-composant.html similarity index 100% rename from delete-composant.html rename to prestations/components/html/delete-composant.html diff --git a/header-composant.html b/prestations/components/html/header-composant.html similarity index 100% rename from header-composant.html rename to prestations/components/html/header-composant.html diff --git a/delete-composant.js b/prestations/components/js/delete-composant.js similarity index 95% rename from delete-composant.js rename to prestations/components/js/delete-composant.js index c55b3f1..87907ff 100644 --- a/delete-composant.js +++ b/prestations/components/js/delete-composant.js @@ -1,5 +1,5 @@ // Injection du modal -fetch("../../delete-composant.html") +fetch("../components/html/delete-composant.html") .then(res => { if (!res.ok) throw new Error("Modal HTML introuvable"); return res.text(); diff --git a/header-composant.js b/prestations/components/js/header-composant.js similarity index 74% rename from header-composant.js rename to prestations/components/js/header-composant.js index dd43767..3ee6180 100644 --- a/header-composant.js +++ b/prestations/components/js/header-composant.js @@ -1,4 +1,4 @@ -fetch("../../header-composant.html") +fetch("../components/html/header-composant.html") .then(response => response.text()) .then(data => { document.getElementById("header-placeholder").innerHTML = data; diff --git a/prestations/html/prestation_accueil.html b/prestations/html/prestation_accueil.html index 9831caf..c9ace19 100644 --- a/prestations/html/prestation_accueil.html +++ b/prestations/html/prestation_accueil.html @@ -250,8 +250,8 @@
- - + + \ No newline at end of file From 4fe4facd321d1a2983ac7c5b4e65e8e1abce430b Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 12 Dec 2025 14:38:43 +0100 Subject: [PATCH 12/18] mise a jour du Dom de ajouter article et modifier article --- blog/html/ajouter_article.html | 109 +++++++------------ blog/html/modifier_article.html | 172 +++++++++++------------------- blog/html/modifier_categorie.html | 2 +- blog/js/ajouter_article.js | 132 ++++++++++++----------- blog/js/modifier_article.js | 72 ++++++++----- 5 files changed, 217 insertions(+), 270 deletions(-) diff --git a/blog/html/ajouter_article.html b/blog/html/ajouter_article.html index eb8cd59..7db0417 100644 --- a/blog/html/ajouter_article.html +++ b/blog/html/ajouter_article.html @@ -4,22 +4,14 @@ Ajouter un article + - - - - - - - + -
-
+

Ajouter un article

+
- - -
Le titre de l'article est obligatoire
- - -
- Format d'image invalide. Formats acceptés : JPG, PNG -
- - -
Ce titre existe déjà. Choisissez un autre titre.
- - -
Article ajouté avec succès !
+ +
-
- - -
+
+ + +
+ +
+ + +
+ +
+ + +
- -
- - -
+ +
+ + +
- -
- - -
- - -
- - -
- - - - - - +
- - + +
- - +
- Annuler - + Annuler +
-
- - - - - - - diff --git a/blog/html/modifier_article.html b/blog/html/modifier_article.html index caa594d..d15f6ad 100644 --- a/blog/html/modifier_article.html +++ b/blog/html/modifier_article.html @@ -4,32 +4,16 @@ Modifier un article - - - + + + - + -
-
-

Modifier un article

+

Modifier un article

- -
- g Le titre de l'article est obligatoire. -
+ +
- -
- Format d'image invalide. Formats acceptés : JPG, PNG, GIF. -
+
- -
- Ce titre existe déjà. Veuillez en choisir un autre. -
+ +
+ + +
- -
- L'article a été modifié avec succès ! -
+ +
+ + +
- - + +
+ + + + +
- + +
+ +
+ apercu image + +
+
- -
- - -
+ +
+ + +
- -
- - -
- - -
- - - - - - -
- - - -
- Image actuelle - -
- - -
- - -
- - -
- Annuler - -
- -
+ +
+ Annuler + +
+
- - - + + + - - - diff --git a/blog/html/modifier_categorie.html b/blog/html/modifier_categorie.html index b1ced3a..368db98 100644 --- a/blog/html/modifier_categorie.html +++ b/blog/html/modifier_categorie.html @@ -4,7 +4,7 @@ Modifier une catégorie - + diff --git a/blog/js/ajouter_article.js b/blog/js/ajouter_article.js index 298d7d1..db85da1 100644 --- a/blog/js/ajouter_article.js +++ b/blog/js/ajouter_article.js @@ -1,94 +1,102 @@ -const form = document.getElementById('ajouterArticleForm'); -const imgField = document.getElementById('articleImage'); -const titleField = document.getElementById('articleTitle'); -const categoryField = document.getElementById('articleCategory'); -const publishedField = document.getElementById('articlePublished'); +const form = document.getElementById("ajouterArticleForm"); +const messages = document.getElementById("messages"); -const errorEmpty = document.getElementById('errorEmpty'); -const errorImage = document.getElementById('errorImage'); -const errorExists = document.getElementById('errorExists'); -const successMsg = document.getElementById('successMsg'); +const imgField = document.getElementById("articleImage"); +const titleField = document.getElementById("articleTitle"); +const categoryField = document.getElementById("articleCategory"); +const publishedField = document.getElementById("articlePublished"); // Simulation BDD -const titreExistants = ['décoration noel', 'coupe de chien']; +const titresExistants = ["décoration noel", "coupe de chien"]; -form.addEventListener('submit', function(e) { +/* ========================= + DOM : messages +========================= */ +function showMessage(type, text) { + messages.innerHTML = ""; + + const div = document.createElement("div"); + div.className = `alert alert-${type}`; + div.textContent = text; + + messages.appendChild(div); +} + +/* ========================= + Validation image +========================= */ +function imageValide(file) { + if (!file) return true; + return ["image/jpeg", "image/png"].includes(file.type); +} + +/* ========================= + Submit formulaire +========================= */ +form.addEventListener("submit", function (e) { e.preventDefault(); + messages.innerHTML = ""; - const titre = titleField.value.trim().toLowerCase(); - const fichierImage = imgField.files[0]; - const contenu = tinymce.get("articleContent").getContent(); + const titre = titleField.value.trim(); + const titreLower = titre.toLowerCase(); + const contenu = tinymce.get("articleContent").getContent().trim(); const categorie = categoryField.value; - const published = publishedField.checked; // récupère la case cochée - - // Reset messages - errorEmpty.classList.add('d-none'); - errorImage.classList.add('d-none'); - errorExists.classList.add('d-none'); - successMsg.classList.add('d-none'); + const image = imgField.files[0]; + const published = publishedField.checked; // Catégorie obligatoire - if (categorie === "") { - errorEmpty.textContent = "Veuillez choisir une catégorie."; - errorEmpty.classList.remove('d-none'); + if (!categorie) { + showMessage("danger", "Veuillez choisir une catégorie."); return; } // Titre obligatoire - if (titre === "") { - errorEmpty.textContent = "Le titre de l'article est obligatoire."; - errorEmpty.classList.remove('d-none'); + if (!titre) { + showMessage("danger", "Le titre de l'article est obligatoire."); return; } - // Titre déjà existant - if (titreExistants.includes(titre)) { - errorExists.classList.remove('d-none'); + // Titre existant + if (titresExistants.includes(titreLower)) { + showMessage("danger", "Ce titre existe déjà. Choisissez-en un autre."); return; } // Contenu obligatoire - if (contenu.trim() === "") { - errorEmpty.textContent = "Le contenu de l'article ne peut pas être vide."; - errorEmpty.classList.remove('d-none'); + if (!contenu) { + showMessage("danger", "Le contenu de l'article ne peut pas être vide."); return; } - // Image invalide - if (fichierImage) { - const validFormats = ['image/jpeg', 'image/png']; - if (!validFormats.includes(fichierImage.type)) { - errorImage.classList.remove('d-none'); - return; - } + // Image valide + if (!imageValide(image)) { + showMessage("danger", "Format d'image invalide. JPG ou PNG uniquement."); + return; } - // Simuler enregistrement - titreExistants.push(titre); + // Enregistrement titre simulé + titresExistants.push(titreLower); - - // CRÉATION DE L'ARTICLE - + // Création article const nouvelArticle = { id: Date.now(), - titre: titleField.value.trim(), - contenu: contenu, - categorie: categorie, - published: published, // valeur TRUE/FALSE pour afficher le badge Facebook + titre, + contenu, + categorie, + published, date: new Date().toISOString() }; - - // SAUVEGARDE DANS LOCALSTORAGE - - let articles = JSON.parse(localStorage.getItem("articles")) || []; + // LocalStorage + const articles = JSON.parse(localStorage.getItem("articles")) || []; articles.push(nouvelArticle); localStorage.setItem("articles", JSON.stringify(articles)); - console.log("Article enregistré :", nouvelArticle); + showMessage("success", "Article ajouté avec succès !"); - // Succès - successMsg.classList.remove('d-none'); + // Reset + form.reset(); + tinymce.get("articleContent").setContent(""); // Redirection setTimeout(() => { @@ -96,11 +104,13 @@ form.addEventListener('submit', function(e) { }, 1000); }); -// TinyMCE INIT +/* ========================= + TinyMCE +========================= */ tinymce.init({ - selector: '#articleContent', + selector: "#articleContent", height: 400, - language: 'fr', - plugins: 'lists fullscreen', - toolbar: 'undo redo | bold italic underline | bullist numlist | fullscreen' + language: "fr", + plugins: "lists fullscreen", + toolbar: "undo redo | bold italic underline | bullist numlist | fullscreen" }); diff --git a/blog/js/modifier_article.js b/blog/js/modifier_article.js index fc53268..57d54c7 100644 --- a/blog/js/modifier_article.js +++ b/blog/js/modifier_article.js @@ -1,60 +1,74 @@ const form = document.getElementById("editArticleForm"); +const messages = document.getElementById("messages"); + const imgField = document.getElementById("articleImage"); const titleField = document.getElementById("articleTitle"); const contentField = document.getElementById("articleContent"); const categoryField = document.getElementById("articleCategory"); const publishedField = document.getElementById("articlePublished"); -const errorEmpty = document.getElementById("errorEmpty"); -const errorImage = document.getElementById("errorImage"); -const errorExists = document.getElementById("errorExists"); -const successMsg = document.getElementById("successMsg"); - -// Simulation BDD pour vérifier doublons +// Simulation BDD pour doublons const titresExistants = [ "article de test", "nouveautés chiens", - "actualité du mois", + "actualité du mois" ]; + +function showMessage(type, text) { + messages.innerHTML = ""; + + const div = document.createElement("div"); + div.className = `alert alert-${type}`; + div.textContent = text; + + messages.appendChild(div); +} + + +function imageValide(file) { + if (!file) return true; + return ["image/jpeg", "image/png", "image/gif"].includes(file.type); +} + + form.addEventListener("submit", function (e) { e.preventDefault(); + messages.innerHTML = ""; const titre = titleField.value.trim().toLowerCase(); - const fichierImage = imgField.files[0]; + const contenu = tinymce.get("articleContent").getContent().trim(); + const image = imgField.files[0]; - // Reset messages - errorEmpty.classList.add("d-none"); - errorImage.classList.add("d-none"); - errorExists.classList.add("d-none"); - successMsg.classList.add("d-none"); - - //Titre obligatoire - if (titre === "") { - errorEmpty.classList.remove("d-none"); + // Titre obligatoire + if (!titre) { + showMessage("danger", "Le titre de l'article est obligatoire."); return; } - // Titre déjà existant ? + // Titre existant if (titresExistants.includes(titre)) { - errorExists.classList.remove("d-none"); + showMessage("danger", "Ce titre existe déjà. Veuillez en choisir un autre."); return; } - //Vérification image - if (fichierImage) { - const validFormats = ["image/jpeg", "image/png", "image/gif"]; - if (!validFormats.includes(fichierImage.type)) { - errorImage.classList.remove("d-none"); - return; - } + // Contenu obligatoire + if (!contenu) { + showMessage("danger", "Le contenu de l'article ne peut pas être vide."); + return; + } + + // Image valide + if (!imageValide(image)) { + showMessage("danger", "Format d'image invalide. JPG, PNG ou GIF uniquement."); + return; } // Succès - successMsg.classList.remove("d-none"); + showMessage("success", "L'article a été modifié avec succès !"); - // Redirection après succès + // Redirection setTimeout(() => { - window.location.href = "../../blog/html/accueil_blog.html"; + window.location.href = "../../blog/html/accueil_blog.html"; }, 1500); }); From dbd1ccee680abfaa015d34185bd56ed23c795e7f Mon Sep 17 00:00:00 2001 From: pestak Date: Fri, 12 Dec 2025 15:02:57 +0100 Subject: [PATCH 13/18] script delete --- citations/html/accueil.html | 338 ++++++++++----------- citations/html/ajouter.html | 93 ++++++ citations/html/modifier.html | 93 ++++++ header.html | 4 +- js/confirmDelete.js | 60 ++++ {citations/js => js}/contentReduct.js | 3 +- prestations/html/modifier_avant_apres.html | 8 +- prestations/html/verif.html | 111 +++++++ 8 files changed, 530 insertions(+), 180 deletions(-) create mode 100644 citations/html/ajouter.html create mode 100644 citations/html/modifier.html create mode 100644 js/confirmDelete.js rename {citations/js => js}/contentReduct.js (90%) create mode 100644 prestations/html/verif.html diff --git a/citations/html/accueil.html b/citations/html/accueil.html index 432e883..b139a5e 100644 --- a/citations/html/accueil.html +++ b/citations/html/accueil.html @@ -1,182 +1,174 @@ - - - - Citations - L'Il'eau chiens - Admin - - - - - - - + + + Citations - L'Il'eau chiens - Admin + + + + + + - -
- - -
-
-
-
-

Liste des citations

-
-
- -
-

Citations chiens

- - - - - - - - - - - - - - - - -
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) - Modifier - Supprimer -
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) - Modifier - Supprimer -
-
- -
-

Citations chats

- - - - - - - - - - - - - - - - -
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) - Modifier - Supprimer -
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) - Modifier - Supprimer -
-
- -
-

Citations divers

- - - - - - - - - - - - - - - - -
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) - Modifier - Supprimer -
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) - Modifier - Supprimer -
-
-
+
+
+
+ + + +
+
+
+

Liste des citations

+
+
+ + +
+

Citations chiens

+ + + + + + + + + + + + + + + + + +
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
+
+ +
+

Citations chats

+ + + + + + + + + + + + + + + + + +
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
+
+ +
+

Citations divers

+ + + + + + + + + + + + + + + + + +
CitationsActions
Le chien est le seul être sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
Un chien est la seule chose sur terre qui vous aime plus qu'il ne s'aime lui-même. (Josh Billings) + Modifier + Supprimer +
+
+
+
+
+ + + + + + - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/citations/html/ajouter.html b/citations/html/ajouter.html new file mode 100644 index 0000000..0f457bb --- /dev/null +++ b/citations/html/ajouter.html @@ -0,0 +1,93 @@ + + + + + + + Ajouter une citation - L'Il'eau chiens - Admin + + + + + + + + +
+ +
+
+
+
+

Ajouter une citation

+
+
+
+
+ + +
+
+ + +
+
+ Annuler + +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/citations/html/modifier.html b/citations/html/modifier.html new file mode 100644 index 0000000..09f41d4 --- /dev/null +++ b/citations/html/modifier.html @@ -0,0 +1,93 @@ + + + + + + + Modifier une citation - L'Il'eau chiens - Admin + + + + + + + + +
+ +
+
+
+
+

Modifier une citation

+
+
+
+
+ + +
+
+ + +
+
+ Annuler + +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/header.html b/header.html index 6d468be..997d403 100644 --- a/header.html +++ b/header.html @@ -85,9 +85,9 @@

Titre de la page

-
+
Contenu de la page -
+
diff --git a/js/confirmDelete.js b/js/confirmDelete.js new file mode 100644 index 0000000..97d5a16 --- /dev/null +++ b/js/confirmDelete.js @@ -0,0 +1,60 @@ + +/** + * confirmDelete.js + * + * Modal de confirmation générique pour les actions de suppression. + * + * Usage: + * 1. Ajouter data-bs-toggle="modal" et data-bs-target="#confirmDeleteModal" au lien de suppression. + * 2. Lors de la confirmation, l'attribut href du lien est utilisé pour la navigation (GET). + */ + + +(function(){ + + + let pendingHref = null; + let pendingModalId = '#confirmDeleteModal'; + + function getBootstrapModal(modalEl){ + //retourne l'instance Bootstrap Modal associée à modalEl, ou en crée une nouvelle si nécessaire + if (!modalEl || !window.bootstrap) return null; + return bootstrap.Modal.getInstance(modalEl) || new bootstrap.Modal(modalEl); + } + + document.addEventListener('click', function(e){ + const btn = e.target.closest('a[data-bs-toggle="modal"][data-bs-target]'); + if (!btn) return; + const target = btn.getAttribute('data-bs-target'); + + // Gérer les boutons de type suppression ; restreindre éventuellement en utilisant une classe CSS spécifique + // Pour un appariement plus strict, ajouter une classe dédiée et la vérifier ici. + e.preventDefault(); + pendingHref = btn.getAttribute('href'); + pendingModalId = btn.getAttribute('data-confirm-modal') || target || '#confirmDeleteModal'; + const modalEl = document.querySelector(pendingModalId); + const modal = getBootstrapModal(modalEl); + if (modal) modal.show(); + }); + + document.addEventListener('click', function(e){ + const confirmBtn = e.target.closest('#confirmDeleteBtn'); + if (!confirmBtn) return; + if (pendingHref && pendingHref !== '#' && pendingHref.trim() !== ''){ + window.location.assign(pendingHref); + return; // la navigation va se produire, arrêter le traitement ici + } + // Si aucun href n'est présent, fermer simplement le modal + const modalEl = document.querySelector(pendingModalId); + const modal = getBootstrapModal(modalEl); + if (modal) modal.hide(); + pendingHref = null; + pendingModalId = '#confirmDeleteModal'; + }); + + // Réinitialiser l'état stocké lorsque n'importe quel modal Bootstrap est caché + document.addEventListener('hidden.bs.modal', function(){ + pendingHref = null; + pendingModalId = '#confirmDeleteModal'; + }); +})(); diff --git a/citations/js/contentReduct.js b/js/contentReduct.js similarity index 90% rename from citations/js/contentReduct.js rename to js/contentReduct.js index f42dd66..b2671ce 100644 --- a/citations/js/contentReduct.js +++ b/js/contentReduct.js @@ -5,6 +5,7 @@ const BREAKPOINT_SM = 1000; +const NB_CARACTERES = 40; (() => { // Récupère les cellules td (premier d'un tr) à traiter const getTargetCells = () => { @@ -31,7 +32,7 @@ const BREAKPOINT_SM = 1000; const full = td.dataset.fullText ?? td.textContent; const text = (full || "").trim(); if (narrow) { - td.textContent = text.length > 40 ? text.slice(0, 40) + '...': text; + td.textContent = text.length > 40 ? text.slice(0, NB_CARACTERES) + '...': text; } else { td.textContent = full; } diff --git a/prestations/html/modifier_avant_apres.html b/prestations/html/modifier_avant_apres.html index d1b508d..39a9aa3 100644 --- a/prestations/html/modifier_avant_apres.html +++ b/prestations/html/modifier_avant_apres.html @@ -5,10 +5,10 @@ Modifier un résultat avant/après - - - - + + + + diff --git a/prestations/html/verif.html b/prestations/html/verif.html new file mode 100644 index 0000000..4e67b98 --- /dev/null +++ b/prestations/html/verif.html @@ -0,0 +1,111 @@ + + + + + + + Modifier un résultat avant/après + + + + + + + + +
+ + +
+
+
+

Modifier un résultat en images (Avant / Après)

+ + +
+ Le résultat a été modifié avec succès. +
+
+ Une erreur est survenue. Merci de vérifier le formulaire. +
+ + +
+ Format d'image invalide. Formats acceptés : JPG, PNG, WEBP. +
+
+ + +
+ + +
+ + + + + +
+ + +
+ + +
+ + +
+ + +
+ +
+ + + Aperçu avant +
+ + +
+ + + Aperçu après +
+
+ + +
+ +
+ +
+
+ +
+ +
+
+
+ + + + + + + + From f72b6e9337ed6e7acc66e340735c872157acfb4e Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 12 Dec 2025 15:32:17 +0100 Subject: [PATCH 14/18] =?UTF-8?q?mise=20a=20jour=20du=20dom=20ajouter=20ca?= =?UTF-8?q?t=C3=A9gorie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog/html/ajouter_categorie.html | 120 ++++++++++--------------------- blog/js/ajouter_categorie.js | 57 ++++++++------- package-lock.json | 3 +- 3 files changed, 68 insertions(+), 112 deletions(-) diff --git a/blog/html/ajouter_categorie.html b/blog/html/ajouter_categorie.html index ae80d6a..4e6e0c9 100644 --- a/blog/html/ajouter_categorie.html +++ b/blog/html/ajouter_categorie.html @@ -4,107 +4,59 @@ Ajouter une catégorie - - + + + + + -
-
-

Ajouter une catégorie

+
+

Ajouter une catégorie

- -
Le nom de catégorie est obligatoire.
+ +
- -
Cette catégorie existe déjà. Veuillez en choisir une autre.
+
- -
Catégorie ajoutée avec succès !
+
+ + +
- +
+ + +
+
+ Annuler + +
+
+
-
- -
+ + -
- - -
- -
- Annuler - -
- -
- - - - - \ No newline at end of file + diff --git a/blog/js/ajouter_categorie.js b/blog/js/ajouter_categorie.js index dd7e34c..b8e1038 100644 --- a/blog/js/ajouter_categorie.js +++ b/blog/js/ajouter_categorie.js @@ -1,47 +1,52 @@ - const form = document.getElementById("addCategoryForm"); +const messages = document.getElementById("messages"); + const nameField = document.getElementById("categoryName"); const descField = document.getElementById("categoryDescription"); -const errorEmpty = document.getElementById("errorEmpty"); -const errorExists = document.getElementById("errorExists"); -const successMessage = document.getElementById("successMessage"); - -// Catégories existantes ( à remplacer en BD si besoin) +// Catégories existantes (simulation BDD) const existingCategories = ["Actualités", "Chien", "Chat", "Boutique"]; + +function showMessage(type, text) { + messages.innerHTML = ""; + + const div = document.createElement("div"); + div.className = `alert alert-${type}`; + div.textContent = text; + + messages.appendChild(div); +} + + form.addEventListener("submit", function (e) { e.preventDefault(); + messages.innerHTML = ""; const nom = nameField.value.trim(); - //Remettre tout a zero - errorEmpty.classList.add("d-none"); - errorExists.classList.add("d-none"); - successMessage.classList.add("d-none"); - - //Erreur champs vide - if (nom === "") { - errorEmpty.classList.remove("d-none"); + // Champ obligatoire + if (!nom) { + showMessage("danger", "Le nom de la catégorie est obligatoire."); return; } - //Erreur catégorie existante + // Catégorie existante if (existingCategories.includes(nom)) { - errorExists.classList.remove("d-none"); + showMessage("danger", "Cette catégorie existe déjà. Veuillez en choisir une autre."); return; } - // Succès -successMessage.classList.remove("d-none"); + // Ajout catégorie (simulation) + existingCategories.push(nom); -// Ajout d'une nouvelle catégorie -existingCategories.push(nom); + showMessage("success", "Catégorie ajoutée avec succès !"); -// Redirection après 1 seconde -setTimeout(() => { - window.location.href = "../html/accueil_blog.html"; -}, 1000); + // Reset formulaire + form.reset(); - -}); \ No newline at end of file + // Redirection + setTimeout(() => { + window.location.href = "../html/accueil_blog.html"; + }, 1000); +}); diff --git a/package-lock.json b/package-lock.json index 1bfd43d..890a3bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,8 +76,7 @@ "node_modules/scheduler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", - "peer": true + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==" }, "node_modules/tinymce": { "version": "8.2.2", From 248bc80da5176fa6de8dcbe979ae411740cf501b Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 12 Dec 2025 16:34:45 +0100 Subject: [PATCH 15/18] Ajouter prestation : DOM message + mise ne place du header+fichier style css prestation --- blog/html/ajouter_categorie.html | 50 +++++++- blog/html/modifier_article.html | 2 +- css/prestation.css | 2 + prestations/html/ajouter_prestation.html | 149 ++++++++++++++--------- prestations/js/ajouter_prestation.js | 52 ++++---- 5 files changed, 164 insertions(+), 91 deletions(-) create mode 100644 css/prestation.css diff --git a/blog/html/ajouter_categorie.html b/blog/html/ajouter_categorie.html index 4e6e0c9..6e0a7a1 100644 --- a/blog/html/ajouter_categorie.html +++ b/blog/html/ajouter_categorie.html @@ -4,11 +4,7 @@ Ajouter une catégorie - - - - @@ -17,6 +13,50 @@ @@ -24,7 +64,7 @@

Ajouter une catégorie

- +
diff --git a/blog/html/modifier_article.html b/blog/html/modifier_article.html index d15f6ad..23a8b96 100644 --- a/blog/html/modifier_article.html +++ b/blog/html/modifier_article.html @@ -69,7 +69,7 @@

Modifier un article

- +
diff --git a/css/prestation.css b/css/prestation.css new file mode 100644 index 0000000..eba3746 --- /dev/null +++ b/css/prestation.css @@ -0,0 +1,2 @@ +body { background: #f4f6f981; } + .container { margin-top: 50px; } \ No newline at end of file diff --git a/prestations/html/ajouter_prestation.html b/prestations/html/ajouter_prestation.html index e1dbf2a..9dde8b7 100644 --- a/prestations/html/ajouter_prestation.html +++ b/prestations/html/ajouter_prestation.html @@ -1,88 +1,117 @@ - - Ajouter une catégorie - + Ajouter une prestation + + - + -
-

Ajouter une prestation

+
+ +
+
+

Ajouter une prestation

- -
+ +
+ + + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
-
+
-
- Annuler - -
- -
+
+ Annuler + +
+ +
- - + + - - \ No newline at end of file + diff --git a/prestations/js/ajouter_prestation.js b/prestations/js/ajouter_prestation.js index 70e021e..b3aec96 100644 --- a/prestations/js/ajouter_prestation.js +++ b/prestations/js/ajouter_prestation.js @@ -1,16 +1,14 @@ -// Récupération des éléments +// Éléments const form = document.getElementById("addCategoryForm"); +const messages = document.getElementById("messages"); + const titleField = document.getElementById("categoryName"); const typeField = document.getElementById("prestationType"); const descField = document.getElementById("prestationDescription"); const priceMinField = document.getElementById("priceMin"); const priceMaxField = document.getElementById("priceMax"); -const errorEmpty = document.getElementById("errorEmpty"); -const errorExists = document.getElementById("errorExists"); -const successMessage = document.getElementById("successMessage"); - -// Prestations existantes (simulation) +// Prestations existantes (simulation BDD) const existingPrestations = [ "Toilettage complet", "Coupe ciseaux", @@ -18,38 +16,42 @@ const existingPrestations = [ "Démêlage poil long" ]; + +function showMessage(type, text) { + messages.innerHTML = ""; + + const div = document.createElement("div"); + div.className = `alert alert-${type}`; + div.textContent = text; + + messages.appendChild(div); +} + + form.addEventListener("submit", function (e) { e.preventDefault(); + messages.innerHTML = ""; - // Récupérer le titre const titre = titleField.value.trim(); - // Réinitialiser les alertes - errorEmpty.classList.add("d-none"); - errorExists.classList.add("d-none"); - successMessage.classList.add("d-none"); - - // 1. Vérif : titre obligatoire - if (titre === "") { - errorEmpty.classList.remove("d-none"); + // Titre obligatoire + if (!titre) { + showMessage("danger", "Le titre de la prestation est obligatoire."); return; } - // 2. Vérif : prestation déjà existante (exemple simple) + // Doublon if (existingPrestations.includes(titre)) { - errorExists.classList.remove("d-none"); + showMessage("danger", "Cette prestation existe déjà. Veuillez en choisir une autre."); return; } - // 3. Tout est ok → succès - successMessage.classList.remove("d-none"); - - // Simuler ajout en base + // Succès existingPrestations.push(titre); + showMessage("success", "Prestation ajoutée avec succès !"); - + // Redirection setTimeout(() => { - window.location.href = "../liste_prestation/liste_prestation.html"; -}, 1500); + window.location.href = "../liste_prestation/liste_prestation.html"; + }, 1500); }); - From 946bda115a99dcaecd75066228eb0a634b4b0858 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 12 Dec 2025 16:49:50 +0100 Subject: [PATCH 16/18] ajouter slider : DOM message + header + chemins --- prestations/html/ajouter_slider.html | 105 +++++++++++++++++++-------- prestations/js/ajouter_slider.js | 56 ++++++++------ 2 files changed, 105 insertions(+), 56 deletions(-) diff --git a/prestations/html/ajouter_slider.html b/prestations/html/ajouter_slider.html index 2c42a50..c11afc3 100644 --- a/prestations/html/ajouter_slider.html +++ b/prestations/html/ajouter_slider.html @@ -5,53 +5,90 @@ Ajouter un slide - + + - + + +
+ +

Ajouter une image au slider

- -
- Merci de sélectionner une image. -
- - -
- Format d'image invalide. Formats acceptés : JPG, PNG, WEBP. -
- - -
- Slide ajouté avec succès ! -
+ +
- +
- - + +
@@ -62,17 +99,21 @@
- Annuler + Annuler
- - - - + + + + + + + diff --git a/prestations/js/ajouter_slider.js b/prestations/js/ajouter_slider.js index ccf12c2..cdda2aa 100644 --- a/prestations/js/ajouter_slider.js +++ b/prestations/js/ajouter_slider.js @@ -1,44 +1,52 @@ -const form = document.getElementById('addSlideForm'); -const imgField = document.getElementById('slideImage'); -const altField = document.getElementById('slideAlt'); -const titleField = document.getElementById('slideTitle'); +const form = document.getElementById("addSlideForm"); +const messages = document.getElementById("messages"); -const errorEmpty = document.getElementById('errorEmpty'); -const errorFormat = document.getElementById('errorFormat'); -const successMsg = document.getElementById('successMsg'); +const imgField = document.getElementById("slideImage"); +const altField = document.getElementById("slideAlt"); +const titleField = document.getElementById("slideTitle"); -// Création du tableau simulant la BDD +// Simulation BDD let slides = []; -form.addEventListener('submit', function (e) { - e.preventDefault(); - // Reset messages - errorEmpty.classList.add('d-none'); - errorFormat.classList.add('d-none'); - successMsg.classList.add('d-none'); +function showMessage(type, text) { + messages.innerHTML = ""; + + const div = document.createElement("div"); + div.className = `alert alert-${type}`; + div.textContent = text; + + messages.appendChild(div); +} + + +form.addEventListener("submit", function (e) { + e.preventDefault(); + messages.innerHTML = ""; const image = imgField.files[0]; const alt = altField.value.trim(); + const title = titleField.value.trim(); // Image obligatoire if (!image) { - errorEmpty.textContent = "Merci de sélectionner une image."; - errorEmpty.classList.remove('d-none'); + showMessage("danger", "Merci de sélectionner une image."); return; } // ALT obligatoire - if (alt === "") { - errorEmpty.textContent = "Le texte ALT est obligatoire."; - errorEmpty.classList.remove('d-none'); + if (!alt) { + showMessage("danger", "Le texte ALT est obligatoire."); return; } // Vérification format const validFormats = ["image/jpeg", "image/png", "image/webp"]; if (!validFormats.includes(image.type)) { - errorFormat.classList.remove('d-none'); + showMessage( + "danger", + "Format d'image invalide. Formats acceptés : JPG, PNG, WEBP." + ); return; } @@ -46,18 +54,18 @@ form.addEventListener('submit', function (e) { slides.push({ id: Date.now(), image: image.name, - alt: alt, - title: titleField.value.trim(), + alt, + title, order: slides.length + 1 }); console.log("Nouveau slide ajouté :", slides); // Succès - successMsg.classList.remove('d-none'); + showMessage("success", "Slide ajouté avec succès !"); // Redirection setTimeout(() => { - window.location.href = "../../../slider/liste_slider/liste_slider.html"; + window.location.href = "/prestations/html/prestation_accueil.html"; }, 1500); }); From e37b8c4c7d379e28a032f9ab1a897a313017c20d Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 12 Dec 2025 17:03:35 +0100 Subject: [PATCH 17/18] =?UTF-8?q?modifier=20presta:=20DOM=20message=20+=20?= =?UTF-8?q?header=20+=20chemins.=20W3C=20=C3=A9ffectu=C3=A9=20sur=20les=20?= =?UTF-8?q?3pages=20commit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prestations/html/ajouter_slider.html | 198 ++++++++++++---------- prestations/html/modifier_prestation.html | 156 +++++++++-------- prestations/js/modifier_prestation.js | 58 ++++--- 3 files changed, 229 insertions(+), 183 deletions(-) diff --git a/prestations/html/ajouter_slider.html b/prestations/html/ajouter_slider.html index c11afc3..1d60d9a 100644 --- a/prestations/html/ajouter_slider.html +++ b/prestations/html/ajouter_slider.html @@ -1,119 +1,147 @@ - - - + + + Ajouter un slide + + + - - - - - - - - +
-
+ + -
+
-
-

Ajouter une image au slider

+
+

Ajouter une image au slider

- -
- -
+ +
+
- - + +
- - + +
- - + +
- Annuler - + Annuler +
+
+
- -
- - - - - + + + - - - diff --git a/prestations/html/modifier_prestation.html b/prestations/html/modifier_prestation.html index 19dc713..e825623 100644 --- a/prestations/html/modifier_prestation.html +++ b/prestations/html/modifier_prestation.html @@ -1,84 +1,98 @@ - - - + + + Modifier une prestation - + - - - + + + +
+ +
-

Modifier une prestation

+

Modifier une prestation

+ +
- -
Le titre est obligatoire.
-
Une erreur est survenue. Veuillez réessayer plus tard.
- - -
Prestation modifiée avec succès !
- -
- - -
- - -
- - -
- - -
- - - -
- - -
- - -
- -
- - -
-
- - -
- Annuler - + + +
+ +
- + +
+ + +
+ +
+ + +
+ + +
+ +
+ + +
+
+ + +
+ Annuler + +
+
- - - - - \ No newline at end of file + + + + diff --git a/prestations/js/modifier_prestation.js b/prestations/js/modifier_prestation.js index 8ae8b65..2876545 100644 --- a/prestations/js/modifier_prestation.js +++ b/prestations/js/modifier_prestation.js @@ -1,41 +1,45 @@ +const form = document.getElementById("editPrestationForm"); +const messages = document.getElementById("messages"); -const form = document.getElementById('editPrestationForm'); -const titleField = document.getElementById('prestationTitle'); -const descriptionField = document.getElementById('prestationDescription'); -const typeField = document.getElementById('prestationType'); -const priceMinField = document.getElementById('priceMin'); -const priceMaxField = document.getElementById('priceMax'); - -const errorEmpty = document.getElementById('errorEmpty'); -const errorTechnical = document.getElementById('errorTechnical'); -const successMsg = document.getElementById('successMsg'); +const titleField = document.getElementById("prestationTitle"); +const descriptionField = document.getElementById("prestationDescription"); +const typeField = document.getElementById("prestationType"); +const priceMinField = document.getElementById("priceMin"); +const priceMaxField = document.getElementById("priceMax"); -form.addEventListener('submit', function (e) { +function showMessage(type, text) { + messages.innerHTML = ""; + + const div = document.createElement("div"); + div.className = `alert alert-${type}`; + div.textContent = text; + + messages.appendChild(div); +} + + +form.addEventListener("submit", function (e) { e.preventDefault(); - - errorEmpty.classList.add('d-none'); - errorTechnical.classList.add('d-none'); - successMsg.classList.add('d-none'); + messages.innerHTML = ""; const title = titleField.value.trim(); - - // champ obligatoire manquant - if (title === '') { - errorEmpty.classList.remove('d-none'); + // Champ obligatoire + if (!title) { + showMessage("danger", "Le titre de la prestation est obligatoire."); return; } - // 2️ Simulation d’erreur technique - const erreurTechnique = false; // mettre true pour tester + // Simulation erreur technique + const erreurTechnique = false; // mettre true pour tester if (erreurTechnique) { - errorTechnical.classList.remove('d-none'); + showMessage("danger", "Une erreur est survenue. Veuillez réessayer plus tard."); return; } - //Succès - successMsg.classList.remove('d-none'); + // Succès + showMessage("success", "Prestation modifiée avec succès !"); console.log("Nouvelles données :", { titre: title, @@ -45,8 +49,8 @@ form.addEventListener('submit', function (e) { prixMax: priceMaxField.value }); - // Redirection après un court délai + // Redirection setTimeout(() => { - window.location.href = "../liste_prestation/liste_prestation.html"; -}, 1500); + window.location.href = "/prestations/html/prestation_accueil.html"; + }, 1500); }); From da0dfdc8c7dc8896dea1dbdc472f8ca773dc3e12 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 12 Dec 2025 17:09:55 +0100 Subject: [PATCH 18/18] nettoyage de doucmentation --- blog/html/ajouter_article.html | 2 +- blog/js/ajouter_article.js | 14 ++++---------- blog/js/ajouter_categorie.js | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/blog/html/ajouter_article.html b/blog/html/ajouter_article.html index 7db0417..1fc257d 100644 --- a/blog/html/ajouter_article.html +++ b/blog/html/ajouter_article.html @@ -69,7 +69,7 @@
- +
diff --git a/blog/js/ajouter_article.js b/blog/js/ajouter_article.js index db85da1..5da8a12 100644 --- a/blog/js/ajouter_article.js +++ b/blog/js/ajouter_article.js @@ -9,9 +9,7 @@ const publishedField = document.getElementById("articlePublished"); // Simulation BDD const titresExistants = ["décoration noel", "coupe de chien"]; -/* ========================= - DOM : messages -========================= */ + function showMessage(type, text) { messages.innerHTML = ""; @@ -22,17 +20,13 @@ function showMessage(type, text) { messages.appendChild(div); } -/* ========================= - Validation image -========================= */ + function imageValide(file) { if (!file) return true; return ["image/jpeg", "image/png"].includes(file.type); } -/* ========================= - Submit formulaire -========================= */ + form.addEventListener("submit", function (e) { e.preventDefault(); messages.innerHTML = ""; @@ -101,7 +95,7 @@ form.addEventListener("submit", function (e) { // Redirection setTimeout(() => { window.location.href = "../html/accueil_blog.html"; - }, 1000); + }, 1500); }); /* ========================= diff --git a/blog/js/ajouter_categorie.js b/blog/js/ajouter_categorie.js index b8e1038..bc5a4aa 100644 --- a/blog/js/ajouter_categorie.js +++ b/blog/js/ajouter_categorie.js @@ -48,5 +48,5 @@ form.addEventListener("submit", function (e) { // Redirection setTimeout(() => { window.location.href = "../html/accueil_blog.html"; - }, 1000); + }, 1500); });