mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
fix: Limite du nombre de responsables légaux à 2 [#27]
This commit is contained in:
@ -69,7 +69,9 @@ export default function FileUpload({
|
|||||||
<CloudUpload className="w-6 h-6 text-emerald-500" />
|
<CloudUpload className="w-6 h-6 text-emerald-500" />
|
||||||
<p className="text-sm font-medium text-gray-800">
|
<p className="text-sm font-medium text-gray-800">
|
||||||
<span className="font-semibold">
|
<span className="font-semibold">
|
||||||
{existingFile.split('/').pop()}
|
{typeof existingFile === 'string'
|
||||||
|
? existingFile.split('/').pop()
|
||||||
|
: existingFile?.name || 'Fichier inconnu'}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export default function ResponsableInputFields({
|
|||||||
}) {
|
}) {
|
||||||
const t = useTranslations('ResponsableInputFields');
|
const t = useTranslations('ResponsableInputFields');
|
||||||
const { selectedEstablishmentId } = useEstablishment();
|
const { selectedEstablishmentId } = useEstablishment();
|
||||||
|
const MAX_GUARDIANS = 2;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isValid =
|
const isValid =
|
||||||
@ -241,8 +242,20 @@ export default function ResponsableInputFields({
|
|||||||
|
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
<Plus
|
<Plus
|
||||||
className="w-8 h-8 text-green-500 cursor-pointer hover:text-green-700 transition-colors border-2 border-green-500 hover:border-green-700 rounded-full p-1"
|
className={`w-8 h-8 ${
|
||||||
onClick={(e) => addGuardian(e)}
|
guardians.length >= MAX_GUARDIANS
|
||||||
|
? 'text-gray-400 cursor-not-allowed'
|
||||||
|
: 'text-green-500 cursor-pointer hover:text-green-700'
|
||||||
|
} transition-colors border-2 ${
|
||||||
|
guardians.length >= MAX_GUARDIANS
|
||||||
|
? 'border-gray-400'
|
||||||
|
: 'border-green-500 hover:border-green-700'
|
||||||
|
} rounded-full p-1`}
|
||||||
|
onClick={(e) => {
|
||||||
|
if (guardians.length < MAX_GUARDIANS) {
|
||||||
|
addGuardian(e);
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user