feat: Ajout de la fratrie / Gestion des index de fratrie / Gestion des

required
This commit is contained in:
N3WT DE COMPET
2025-05-03 14:45:10 +02:00
parent 9374b001c9
commit 2ab1684791
9 changed files with 141 additions and 106 deletions

View File

@ -2,6 +2,7 @@ import InputText from '@/components/InputText';
import React, { useEffect } from 'react';
import { Trash2, Plus, Users } from 'lucide-react';
import SectionHeader from '@/components/SectionHeader';
import { v4 as uuidv4 } from 'uuid';
export default function SiblingInputFields({
siblings,
@ -67,6 +68,7 @@ export default function SiblingInputFields({
setSiblings([
...siblings,
{
id: `temp-${uuidv4()}`,
last_name: '',
first_name: '',
birth_date: '',
@ -105,10 +107,8 @@ export default function SiblingInputFields({
onChange={(event) => {
onSiblingsChange(item.id, 'last_name', event.target.value);
}}
errorMsg={
getError(index, 'last_name') ||
getLocalError(index, 'last_name')
}
errorMsg={getError('last_name')}
errorLocalMsg={getLocalError(index, 'last_name')}
required
/>
<InputText
@ -119,10 +119,8 @@ export default function SiblingInputFields({
onChange={(event) => {
onSiblingsChange(item.id, 'first_name', event.target.value);
}}
errorMsg={
getError(index, 'first_name') ||
getLocalError(index, 'first_name')
}
errorMsg={getError('first_name')}
errorLocalMsg={getLocalError(index, 'first_name')}
required
/>
</div>
@ -136,10 +134,8 @@ export default function SiblingInputFields({
onChange={(event) => {
onSiblingsChange(item.id, 'birth_date', event.target.value);
}}
errorMsg={
getError(index, 'birth_date') ||
getLocalError(index, 'birth_date')
}
errorMsg={getError('birth_date')}
errorLocalMsg={getLocalError(index, 'birth_date')}
required
/>
</div>