mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Ajout de la fratrie [#27]
This commit is contained in:
@ -23,6 +23,7 @@ import FilesToUpload from '@/components/Inscription/FilesToUpload';
|
||||
import { DocusealForm } from '@docuseal/react';
|
||||
import StudentInfoForm from '@/components/Inscription/StudentInfoForm';
|
||||
import ResponsableInputFields from '@/components/Inscription/ResponsableInputFields';
|
||||
import SiblingInputFields from '@/components/Inscription/SiblingInputFields';
|
||||
import PaymentMethodSelector from '@/components/Inscription/PaymentMethodSelector';
|
||||
import ProgressStep from '@/components/ProgressStep';
|
||||
import { CheckCircle, Hourglass } from 'lucide-react';
|
||||
@ -58,6 +59,7 @@ export default function InscriptionFormShared({
|
||||
photo: '',
|
||||
});
|
||||
const [guardians, setGuardians] = useState([]);
|
||||
const [siblings, setSiblings] = useState([]);
|
||||
|
||||
const [registrationPaymentModes, setRegistrationPaymentModes] = useState([]);
|
||||
const [tuitionPaymentModes, setTuitionPaymentModes] = useState([]);
|
||||
@ -75,6 +77,7 @@ export default function InscriptionFormShared({
|
||||
const [isPage3Valid, setIsPage3Valid] = useState(false);
|
||||
const [isPage4Valid, setIsPage4Valid] = useState(false);
|
||||
const [isPage5Valid, setIsPage5Valid] = useState(false);
|
||||
const [isPage6Valid, setIsPage6Valid] = useState(false);
|
||||
|
||||
const [hasInteracted, setHasInteracted] = useState(false);
|
||||
|
||||
@ -103,7 +106,7 @@ export default function InscriptionFormShared({
|
||||
);
|
||||
|
||||
// Mettre à jour isPage4Valid en fonction de cette condition
|
||||
setIsPage4Valid(allSigned);
|
||||
setIsPage5Valid(allSigned);
|
||||
|
||||
if (allSigned) {
|
||||
setCurrentTemplateIndex(0);
|
||||
@ -116,8 +119,8 @@ export default function InscriptionFormShared({
|
||||
(template) => template.file !== null
|
||||
);
|
||||
|
||||
// Mettre à jour isPage5Valid en fonction de cette condition
|
||||
setIsPage5Valid(allUploaded);
|
||||
// Mettre à jour isPage6Valid en fonction de cette condition
|
||||
setIsPage6Valid(allUploaded);
|
||||
}, [parentFileTemplates]);
|
||||
|
||||
const handleTemplateSigned = (index) => {
|
||||
@ -333,7 +336,7 @@ export default function InscriptionFormShared({
|
||||
.then((response) => {
|
||||
logger.debug('Fichier supprimé avec succès dans la base :', response);
|
||||
|
||||
setIsPage5Valid(false);
|
||||
setIsPage6Valid(false);
|
||||
|
||||
// Mettre à jour l'état local pour refléter la suppression
|
||||
setUploadedFiles((prev) =>
|
||||
@ -374,6 +377,7 @@ export default function InscriptionFormShared({
|
||||
student: {
|
||||
...formData,
|
||||
guardians: guardians,
|
||||
siblings: siblings,
|
||||
},
|
||||
establishment: selectedEstablishmentId,
|
||||
status: isSepaPayment ? 8 : 3,
|
||||
@ -383,8 +387,6 @@ export default function InscriptionFormShared({
|
||||
registration_payment_plan: formData.registration_payment_plan,
|
||||
};
|
||||
|
||||
console.log('jsonData : ', jsonData);
|
||||
|
||||
// Créer un objet FormData
|
||||
const formDataToSend = new FormData();
|
||||
|
||||
@ -411,14 +413,16 @@ export default function InscriptionFormShared({
|
||||
const stepTitles = {
|
||||
1: 'Elève',
|
||||
2: 'Responsables légaux',
|
||||
3: 'Modalités de paiement',
|
||||
4: 'Formulaires à signer',
|
||||
5: 'Pièces à fournir',
|
||||
3: 'Frères et soeurs',
|
||||
4: 'Modalités de paiement',
|
||||
5: 'Formulaires à signer',
|
||||
6: 'Pièces à fournir',
|
||||
};
|
||||
|
||||
const steps = [
|
||||
'Élève',
|
||||
'Responsable',
|
||||
'Fratrie',
|
||||
'Paiement',
|
||||
'Formulaires',
|
||||
'Documents parent',
|
||||
@ -436,6 +440,8 @@ export default function InscriptionFormShared({
|
||||
return isPage4Valid;
|
||||
case 5:
|
||||
return isPage5Valid;
|
||||
case 6:
|
||||
return isPage6Valid;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -464,6 +470,7 @@ export default function InscriptionFormShared({
|
||||
setFormData={setFormData}
|
||||
guardians={guardians}
|
||||
setGuardians={setGuardians}
|
||||
setSiblings={setSiblings}
|
||||
errors={errors}
|
||||
setIsPageValid={setIsPage1Valid}
|
||||
hasInteracted={hasInteracted}
|
||||
@ -481,8 +488,19 @@ export default function InscriptionFormShared({
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Page 3 : Informations sur les modalités de paiement */}
|
||||
{/* Étape 3 : Frères et Sœurs */}
|
||||
{currentPage === 3 && (
|
||||
<SiblingInputFields
|
||||
siblings={siblings}
|
||||
setSiblings={setSiblings}
|
||||
setFormData={setFormData}
|
||||
errors={errors.siblings || []}
|
||||
setIsPageValid={setIsPage3Valid}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Page 4 : Informations sur les modalités de paiement */}
|
||||
{currentPage === 4 && (
|
||||
<>
|
||||
<PaymentMethodSelector
|
||||
formData={formData}
|
||||
@ -492,13 +510,13 @@ export default function InscriptionFormShared({
|
||||
registrationPaymentPlans={registrationPaymentPlans}
|
||||
tuitionPaymentPlans={tuitionPaymentPlans}
|
||||
errors={errors}
|
||||
setIsPageValid={setIsPage3Valid}
|
||||
setIsPageValid={setIsPage4Valid}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Pages suivantes : Section Fichiers d'inscription */}
|
||||
{currentPage === 4 && (
|
||||
{/* Page 5 : Section Fichiers d'inscription */}
|
||||
{currentPage === 5 && (
|
||||
<div className="mt-8 mb-4 w-full mx-auto flex gap-8">
|
||||
{/* Liste des états de signature */}
|
||||
<div className="w-1/4 bg-gray-50 p-4 rounded-lg shadow-sm border border-gray-200">
|
||||
@ -613,7 +631,8 @@ export default function InscriptionFormShared({
|
||||
(currentPage === 1 && !isPage1Valid) ||
|
||||
(currentPage === 2 && !isPage2Valid) ||
|
||||
(currentPage === 3 && !isPage3Valid) ||
|
||||
(currentPage === 4 && !isPage4Valid)
|
||||
(currentPage === 4 && !isPage4Valid) ||
|
||||
(currentPage === 5 && !isPage5Valid)
|
||||
? 'bg-gray-300 text-gray-700 cursor-not-allowed'
|
||||
: 'bg-emerald-500 text-white hover:bg-emerald-600'
|
||||
}`}
|
||||
@ -621,7 +640,8 @@ export default function InscriptionFormShared({
|
||||
(currentPage === 1 && !isPage1Valid) ||
|
||||
(currentPage === 2 && !isPage2Valid) ||
|
||||
(currentPage === 3 && !isPage3Valid) ||
|
||||
(currentPage === 4 && !isPage4Valid)
|
||||
(currentPage === 4 && !isPage4Valid) ||
|
||||
(currentPage === 5 && !isPage5Valid)
|
||||
}
|
||||
primary
|
||||
name="Next"
|
||||
@ -633,11 +653,11 @@ export default function InscriptionFormShared({
|
||||
text="Valider"
|
||||
primary
|
||||
className={`px-4 py-2 rounded-md shadow-sm focus:outline-none ${
|
||||
currentPage === 5 && !isPage5Valid
|
||||
currentPage === 6 && !isPage6Valid
|
||||
? 'bg-gray-300 text-gray-700 cursor-not-allowed'
|
||||
: 'bg-emerald-500 text-white hover:bg-emerald-600'
|
||||
}`}
|
||||
disabled={currentPage === 5 && !isPage5Valid}
|
||||
disabled={currentPage === 6 && !isPage6Valid}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user