mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Génération d'une page de suivi pédagogique + fix utilisation
certains des composants
This commit is contained in:
@ -12,6 +12,8 @@ import logger from '@/utils/logger';
|
||||
import Popup from '@/components/Popup';
|
||||
import InputPhone from '../InputPhone';
|
||||
import { PhoneLabel } from '../PhoneLabel';
|
||||
import CheckBox from '@/components/CheckBox';
|
||||
import RadioList from '@/components/RadioList';
|
||||
|
||||
const InscriptionForm = ({
|
||||
students,
|
||||
@ -547,27 +549,35 @@ const InscriptionForm = ({
|
||||
{selectedStudent.first_name} :
|
||||
</h3>
|
||||
{existingGuardians.map((guardian) => (
|
||||
<div key={guardian.id}>
|
||||
<label className="flex items-center space-x-3 mt-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={formData.selectedGuardians.includes(
|
||||
guardian.id
|
||||
)}
|
||||
className="form-checkbox h-5 w-5 text-emerald-600"
|
||||
onChange={() =>
|
||||
handleResponsableSelection(
|
||||
guardian.id,
|
||||
guardian.associated_profile_email
|
||||
)
|
||||
}
|
||||
/>
|
||||
<span className="text-gray-900">
|
||||
{guardian.last_name && guardian.first_name
|
||||
<div key={guardian.id} className="mt-2">
|
||||
<CheckBox
|
||||
item={{ id: guardian.id }}
|
||||
formData={{
|
||||
selectedGuardians: formData.selectedGuardians,
|
||||
}}
|
||||
handleChange={() =>
|
||||
setFormData((prevData) => {
|
||||
const isSelected =
|
||||
prevData.selectedGuardians.includes(guardian.id);
|
||||
const updatedSelectedGuardians = isSelected
|
||||
? prevData.selectedGuardians.filter(
|
||||
(id) => id !== guardian.id
|
||||
) // Retirer le guardian si décoché
|
||||
: [...prevData.selectedGuardians, guardian.id]; // Ajouter le guardian si coché
|
||||
|
||||
return {
|
||||
...prevData,
|
||||
selectedGuardians: updatedSelectedGuardians,
|
||||
};
|
||||
})
|
||||
}
|
||||
fieldName="selectedGuardians"
|
||||
itemLabelFunc={() =>
|
||||
guardian.last_name && guardian.first_name
|
||||
? `${guardian.last_name} ${guardian.first_name} - ${guardian.associated_profile_email}`
|
||||
: `${guardian.associated_profile_email}`}
|
||||
</span>
|
||||
</label>
|
||||
: `${guardian.associated_profile_email}`
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@ -719,31 +729,28 @@ const InscriptionForm = ({
|
||||
{groups.length > 0 ? (
|
||||
<div className="space-y-4">
|
||||
<h3 className="font-bold">Sélectionnez un groupe de documents</h3>
|
||||
{groups.map((group) => (
|
||||
<div key={group.id} className="flex items-center space-x-3">
|
||||
<input
|
||||
type="radio"
|
||||
name="fileGroup"
|
||||
value={group.id}
|
||||
checked={formData.selectedFileGroup === group.id}
|
||||
onChange={(e) =>
|
||||
setFormData({
|
||||
...formData,
|
||||
selectedFileGroup: parseInt(e.target.value),
|
||||
})
|
||||
}
|
||||
className="form-radio h-4 w-4 text-emerald-600"
|
||||
/>
|
||||
<label className="text-gray-900">
|
||||
{group.name}
|
||||
{group.description && (
|
||||
<span className="text-sm text-gray-500 ml-2">
|
||||
({group.description})
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
<RadioList
|
||||
sectionLabel=""
|
||||
items={groups.map((group) => ({
|
||||
id: group.id,
|
||||
label: `${group.name}${
|
||||
group.description ? ` (${group.description})` : ''
|
||||
}`,
|
||||
}))}
|
||||
formData={{
|
||||
...formData,
|
||||
selectedFileGroup: parseInt(formData.selectedFileGroup, 10),
|
||||
}}
|
||||
handleChange={(e) => {
|
||||
const value = parseInt(e.target.value, 10);
|
||||
setFormData((prevData) => ({
|
||||
...prevData,
|
||||
selectedFileGroup: value,
|
||||
}));
|
||||
}}
|
||||
fieldName="selectedFileGroup"
|
||||
className="mt-4"
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<p
|
||||
@ -752,7 +759,6 @@ const InscriptionForm = ({
|
||||
>
|
||||
<strong className="font-bold">Attention!</strong>
|
||||
<span className="block sm:inline">
|
||||
{' '}
|
||||
Aucun groupe de documents n'a été créé.
|
||||
</span>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user