mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
fix: Application du formattage sur les fichiers modifiés
This commit is contained in:
@ -2,9 +2,7 @@ import React, { useState, useEffect } from 'react';
|
||||
import InputText from '@/components/InputText';
|
||||
import SelectChoice from '@/components/SelectChoice';
|
||||
import Loader from '@/components/Loader';
|
||||
import {
|
||||
fetchRegisterForm
|
||||
} from '@/app/actions/subscriptionAction';
|
||||
import { fetchRegisterForm } from '@/app/actions/subscriptionAction';
|
||||
import logger from '@/utils/logger';
|
||||
import SectionHeader from '@/components/SectionHeader';
|
||||
import { User } from 'lucide-react';
|
||||
@ -29,9 +27,8 @@ export default function StudentInfoForm({
|
||||
errors,
|
||||
setIsPageValid,
|
||||
hasInteracted,
|
||||
setHasInteracted
|
||||
setHasInteracted,
|
||||
}) {
|
||||
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@ -59,14 +56,15 @@ export default function StudentInfoForm({
|
||||
});
|
||||
|
||||
setIsLoading(false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}, [studentId, hasInteracted]);
|
||||
|
||||
useEffect(() => {
|
||||
const isValid = !Object.keys(formData).some((field) => getLocalError(field) !== '');
|
||||
const isValid = !Object.keys(formData).some(
|
||||
(field) => getLocalError(field) !== ''
|
||||
);
|
||||
setIsPageValid(isValid);
|
||||
}, [formData, hasInteracted, setIsPageValid]);
|
||||
|
||||
@ -77,15 +75,26 @@ export default function StudentInfoForm({
|
||||
const getLocalError = (field) => {
|
||||
if (
|
||||
// Student Form
|
||||
( field === 'last_name' && (!formData.last_name || formData.last_name.trim() === '') ) ||
|
||||
( field === 'first_name' && (!formData.first_name || formData.first_name.trim() === '') ) ||
|
||||
( field === 'nationality' && (!formData.nationality || formData.nationality.trim() === '') ) ||
|
||||
( field === 'birth_date' && (!formData.birth_date || formData.birth_date.trim() === '') ) ||
|
||||
( field === 'birth_place' && (!formData.birth_place || formData.birth_place.trim() === '') ) ||
|
||||
( field === 'birth_postal_code' && (!formData.birth_postal_code || String(formData.birth_postal_code).trim() === '') ) ||
|
||||
( field === 'address' && (!formData.address || formData.address.trim() === '') ) ||
|
||||
( field === 'attending_physician' && (!formData.attending_physician || formData.attending_physician.trim() === '') ) ||
|
||||
( field === 'level' && (!formData.level || String(formData.level).trim() === '') )
|
||||
(field === 'last_name' &&
|
||||
(!formData.last_name || formData.last_name.trim() === '')) ||
|
||||
(field === 'first_name' &&
|
||||
(!formData.first_name || formData.first_name.trim() === '')) ||
|
||||
(field === 'nationality' &&
|
||||
(!formData.nationality || formData.nationality.trim() === '')) ||
|
||||
(field === 'birth_date' &&
|
||||
(!formData.birth_date || formData.birth_date.trim() === '')) ||
|
||||
(field === 'birth_place' &&
|
||||
(!formData.birth_place || formData.birth_place.trim() === '')) ||
|
||||
(field === 'birth_postal_code' &&
|
||||
(!formData.birth_postal_code ||
|
||||
String(formData.birth_postal_code).trim() === '')) ||
|
||||
(field === 'address' &&
|
||||
(!formData.address || formData.address.trim() === '')) ||
|
||||
(field === 'attending_physician' &&
|
||||
(!formData.attending_physician ||
|
||||
formData.attending_physician.trim() === '')) ||
|
||||
(field === 'level' &&
|
||||
(!formData.level || String(formData.level).trim() === ''))
|
||||
) {
|
||||
return 'Champs requis';
|
||||
}
|
||||
@ -158,11 +167,12 @@ export default function StudentInfoForm({
|
||||
name="birth_postal_code"
|
||||
label="Code Postal de Naissance"
|
||||
value={formData.birth_postal_code}
|
||||
onChange={(e) =>
|
||||
onChange('birth_postal_code', e.target.value)
|
||||
}
|
||||
onChange={(e) => onChange('birth_postal_code', e.target.value)}
|
||||
required
|
||||
errorMsg={getError('birth_postal_code') || getLocalError('birth_postal_code')}
|
||||
errorMsg={
|
||||
getError('birth_postal_code') ||
|
||||
getLocalError('birth_postal_code')
|
||||
}
|
||||
/>
|
||||
<div className="md:col-span-2">
|
||||
<InputText
|
||||
@ -178,11 +188,12 @@ export default function StudentInfoForm({
|
||||
name="attending_physician"
|
||||
label="Médecin Traitant"
|
||||
value={formData.attending_physician}
|
||||
onChange={(e) =>
|
||||
onChange('attending_physician', e.target.value)
|
||||
}
|
||||
onChange={(e) => onChange('attending_physician', e.target.value)}
|
||||
required
|
||||
errorMsg={getError('attending_physician') || getLocalError('attending_physician')}
|
||||
errorMsg={
|
||||
getError('attending_physician') ||
|
||||
getLocalError('attending_physician')
|
||||
}
|
||||
/>
|
||||
<SelectChoice
|
||||
name="level"
|
||||
|
||||
Reference in New Issue
Block a user