From 8cf22905e533a23ee679107cc0bcae1198badb4a Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Fri, 30 May 2025 14:16:00 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Possibilit=C3=A9=20d'ajouter=20un=202?= =?UTF-8?q?=C3=A8me=20guardian,=20m=C3=AAme=20si=20son=20mail=20est=20asso?= =?UTF-8?q?ci=C3=A9=20=C3=A0=20un=20profil=20existant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Inscription/InscriptionFormShared.js | 17 +++++++++++++++-- .../Inscription/ResponsableInputFields.js | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Front-End/src/components/Inscription/InscriptionFormShared.js b/Front-End/src/components/Inscription/InscriptionFormShared.js index d4b7e2e..c2a90f5 100644 --- a/Front-End/src/components/Inscription/InscriptionFormShared.js +++ b/Front-End/src/components/Inscription/InscriptionFormShared.js @@ -17,6 +17,7 @@ import { fetchRegistrationPaymentPlans, fetchTuitionPaymentPlans, } from '@/app/actions/schoolAction'; +import { fetchProfiles } from '@/app/actions/authAction'; import { BASE_URL, FE_PARENTS_HOME_URL } from '@/utils/Url'; import logger from '@/utils/logger'; import FilesToUpload from '@/components/Inscription/FilesToUpload'; @@ -41,6 +42,7 @@ export default function InscriptionFormShared({ studentId, csrfToken, selectedEstablishmentId, + apiDocuseal, onSubmit, errors = {}, // Nouvelle prop pour les erreurs enable = true, @@ -87,6 +89,8 @@ export default function InscriptionFormShared({ // État pour suivre l'index du fichier en cours const [currentTemplateIndex, setCurrentTemplateIndex] = useState(0); + const [profiles, setProfiles] = useState([]); + const router = useRouter(); // Mettre à jour les états en fonction de la valeur de `enable` @@ -150,7 +154,7 @@ export default function InscriptionFormShared({ } // Télécharger le template - downloadTemplate(template.slug) + downloadTemplate(template.slug, selectedEstablishmentId, apiDocuseal) .then((downloadUrl) => fetch(downloadUrl)) .then((response) => { if (!response.ok) { @@ -212,6 +216,14 @@ export default function InscriptionFormShared({ setUploadedFiles(filteredFiles); }); + fetchProfiles() + .then((data) => { + setProfiles(data); + }) + .catch((error) => + logger.error('Error fetching profiles : ', error) + ); + if (selectedEstablishmentId) { // Fetch data for registration payment modes handleRegistrationPaymentModes(); @@ -492,6 +504,7 @@ export default function InscriptionFormShared({ ) : (