fix: Application du formattage sur les fichiers modifiés

This commit is contained in:
N3WT DE COMPET
2025-04-27 09:48:28 +02:00
parent 905b95f3a3
commit 001a5bc83c
10 changed files with 486 additions and 306 deletions

View File

@ -7,12 +7,13 @@ export default function PaymentMethodSelector({
registrationPaymentModes,
tuitionPaymentModes,
errors,
setIsPageValid
setIsPageValid,
}) {
useEffect(() => {
const isValid = !Object.keys(formData).some((field) => getLocalError(field) !== '');
console.log(isValid)
const isValid = !Object.keys(formData).some(
(field) => getLocalError(field) !== ''
);
console.log(isValid);
setIsPageValid(isValid);
}, [formData, setIsPageValid]);
@ -30,8 +31,12 @@ export default function PaymentMethodSelector({
const getLocalError = (field) => {
if (
// Student Form
( field === 'registration_payment' && (!formData.registration_payment || String(formData.registration_payment).trim() === '') ) ||
( field === 'tuition_payment' && (!formData.tuition_payment || String(formData.tuition_payment).trim() === '') )
(field === 'registration_payment' &&
(!formData.registration_payment ||
String(formData.registration_payment).trim() === '')) ||
(field === 'tuition_payment' &&
(!formData.tuition_payment ||
String(formData.tuition_payment).trim() === ''))
) {
return 'Champs requis';
}
@ -47,13 +52,14 @@ export default function PaymentMethodSelector({
<div className="bg-white p-6 rounded-lg shadow-sm border border-gray-200">
{/* Titre */}
<h2 className="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">
Frais d'inscription
Frais d'inscription
</h2>
{/* Section d'information */}
<div className="mb-6 bg-gray-50 p-4 rounded-lg border border-gray-100">
<p className="text-gray-700 text-sm mb-2">
<strong className="text-gray-900">Montant :</strong> {formData.totalRegistrationFees}
<strong className="text-gray-900">Montant :</strong>{' '}
{formData.totalRegistrationFees}
</p>
</div>
@ -62,7 +68,7 @@ export default function PaymentMethodSelector({
label="Mode de Paiement"
placeHolder="Sélectionner un mode de paiement"
selected={formData.registration_payment}
callback={(e) => onChange("registration_payment", e.target.value)}
callback={(e) => onChange('registration_payment', e.target.value)}
choices={registrationPaymentModes.map((mode) => ({
value: mode.mode,
label:
@ -70,20 +76,24 @@ export default function PaymentMethodSelector({
?.name || 'Mode inconnu',
}))}
required
errorMsg={getError("registration_payment") || getLocalError("registration_payment")}
errorMsg={
getError('registration_payment') ||
getLocalError('registration_payment')
}
/>
</div>
<div className="bg-white p-6 rounded-lg shadow-sm border border-gray-200 mt-12">
{/* Titre */}
<h2 className="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">
Frais de scolarité
Frais de scolarité
</h2>
{/* Section d'information */}
<div className="mb-6 bg-gray-50 p-4 rounded-lg border border-gray-100">
<p className="text-gray-700 text-sm mb-2">
<strong className="text-gray-900">Montant :</strong> {formData.totalTuitionFees}
<strong className="text-gray-900">Montant :</strong>{' '}
{formData.totalTuitionFees}
</p>
</div>
@ -92,7 +102,7 @@ export default function PaymentMethodSelector({
label="Mode de Paiement"
placeHolder="Sélectionner un mode de paiement"
selected={formData.tuition_payment}
callback={(e) => onChange("tuition_payment", e.target.value)}
callback={(e) => onChange('tuition_payment', e.target.value)}
choices={tuitionPaymentModes.map((mode) => ({
value: mode.mode,
label:
@ -100,7 +110,9 @@ export default function PaymentMethodSelector({
?.name || 'Mode inconnu',
}))}
required
errorMsg={getError("tuition_payment") || getLocalError("tuition_payment")}
errorMsg={
getError('tuition_payment') || getLocalError('tuition_payment')
}
/>
</div>
</>