From 211e3ef9ba1b870c71ed98217f5fd7deb859ad4d Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 8 Dec 2025 14:21:30 +0100 Subject: [PATCH] ajout de la page modifier prestation --- .../modifier_prestation.html | 85 ++++++++++++++++++- .../modifier_prestation.js | 47 ++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 prestations/modifier_prestation/modifier_prestation.js diff --git a/prestations/modifier_prestation/modifier_prestation.html b/prestations/modifier_prestation/modifier_prestation.html index 93da2a5..9066032 100644 --- a/prestations/modifier_prestation/modifier_prestation.html +++ b/prestations/modifier_prestation/modifier_prestation.html @@ -1 +1,84 @@ -git \ No newline at end of file + + + + + + 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 + +
+ +
+ +
+ + + + + + \ No newline at end of file diff --git a/prestations/modifier_prestation/modifier_prestation.js b/prestations/modifier_prestation/modifier_prestation.js new file mode 100644 index 0000000..865e9bc --- /dev/null +++ b/prestations/modifier_prestation/modifier_prestation.js @@ -0,0 +1,47 @@ + +const form = document.getElementById('editPrestationForm'); +const titleField = document.getElementById('prestationTtile'); +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'); + + +form.addEventListener('submit', function (e) { + e.preventDefault(); + + errorEmpty.classList.add('d-none'); + errorTechnical.classList.add('d-none'); + successMsg.classList.add('d-none'); + + const title = titleField.value.trim(); + + + // champ obligatoire manquant + if (title === '') { + errorEmpty.classList.remove('d-none'); + return; + } + + // 2️ Simulation d’erreur technique + const erreurTechnique = false; // mettre true pour tester + if (erreurTechnique) { + errorTechnical.classList.remove('d-none'); + return; + } + + //Succès + successMsg.classList.remove('d-none'); + + console.log("Nouvelles données :", { + titre: title, + type: typeField.value, + description: descField.value, + prixMin: priceMinField.value, + prixMax: priceMaxField.value + }); +});