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({ ) : (