feat: Ajout de la sélection des modes de paiements / refactoring de

l'automate
This commit is contained in:
N3WT DE COMPET
2025-04-06 20:45:41 +02:00
parent 9559db59eb
commit 5a7661db93
19 changed files with 286 additions and 190 deletions

View File

@ -2,6 +2,7 @@ import React from 'react';
import InputText from '@/components/InputText';
import SelectChoice from '@/components/SelectChoice';
import ResponsableInputFields from '@/components/Inscription/ResponsableInputFields';
import PaymentMethodSelector from '@/components/Inscription/PaymentMethodSelector';
const levels = [
{ value:'1', label: 'TPS - Très Petite Section'},
@ -10,6 +11,13 @@ const levels = [
{ value:'4', label: 'GS - Grande Section'},
];
const paymentModesOptions = [
{ id: 1, name: 'Prélèvement SEPA' },
{ id: 2, name: 'Virement' },
{ id: 3, name: 'Chèque' },
{ id: 4, name: 'Espèce' },
];
// Fonction de validation pour vérifier les champs requis
export function validateStudentInfo(formData) {
const requiredFields = [
@ -32,7 +40,7 @@ export function validateStudentInfo(formData) {
return isValid;
}
export default function StudentInfoForm({ formData, updateFormField, guardians, setGuardians, errors }) {
export default function StudentInfoForm({ formData, updateFormField, guardians, setGuardians, registrationPaymentModes, tuitionPaymentModes, errors }) {
const getError = (field) => {
return errors?.student?.[field]?.[0];
};
@ -143,6 +151,30 @@ export default function StudentInfoForm({ formData, updateFormField, guardians,
errors={errors?.student?.guardians || []}
/>
</div>
<PaymentMethodSelector
formData={formData}
title="Frais d'inscription"
name="registration_payment"
updateFormField={updateFormField}
selected={formData.registration_payment}
paymentModes={registrationPaymentModes}
paymentModesOptions={paymentModesOptions}
amount={formData.totalRegistrationFees}
getError={getError}
/>
<PaymentMethodSelector
formData={formData}
title="Frais de scolarité"
name="tuition_payment"
updateFormField={updateFormField}
selected={formData.tuition_payment}
paymentModes={tuitionPaymentModes}
paymentModesOptions={paymentModesOptions}
amount={formData.totalTuitionFees}
getError={getError}
/>
</>
);
}