mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-04-04 04:01:27 +00:00
feat: Sauvegarde des formulaires d'école dans les bons dossiers /
utilisation des bons composants dans les modales [N3WTS-17]
This commit is contained in:
@ -37,6 +37,7 @@ import {
|
||||
FileUp,
|
||||
PenTool,
|
||||
} from 'lucide-react';
|
||||
import CheckBox from '@/components/Form/CheckBox';
|
||||
|
||||
const FIELD_TYPES_ICON = {
|
||||
text: { icon: TextCursorInput },
|
||||
@ -520,29 +521,27 @@ export default function FormTemplateBuilder({
|
||||
Groupes d'inscription{' '}
|
||||
<span className="text-red-500">*</span>
|
||||
</label>
|
||||
<div className="space-y-2 max-h-32 overflow-y-auto border rounded-md p-2">
|
||||
<div className="flex flex-wrap gap-4 max-h-32 overflow-y-auto border rounded-md p-2">
|
||||
{groups && groups.length > 0 ? (
|
||||
groups.map((group) => (
|
||||
<label key={group.id} className="flex items-center">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedGroups.includes(group.id)}
|
||||
onChange={(e) => {
|
||||
if (e.target.checked) {
|
||||
setSelectedGroups([
|
||||
...selectedGroups,
|
||||
group.id,
|
||||
]);
|
||||
} else {
|
||||
setSelectedGroups(
|
||||
selectedGroups.filter((id) => id !== group.id)
|
||||
);
|
||||
}
|
||||
}}
|
||||
className="mr-2 text-blue-600"
|
||||
/>
|
||||
<span className="text-sm">{group.name}</span>
|
||||
</label>
|
||||
<CheckBox
|
||||
key={group.id}
|
||||
item={{ id: group.id }}
|
||||
formData={{
|
||||
groups: selectedGroups
|
||||
}}
|
||||
handleChange={() => {
|
||||
let group_ids = selectedGroups;
|
||||
if (group_ids.includes(group.id)) {
|
||||
group_ids = group_ids.filter((id) => id !== group.id);
|
||||
} else {
|
||||
group_ids = [...group_ids, group.id];
|
||||
}
|
||||
setSelectedGroups(group_ids);
|
||||
}}
|
||||
fieldName="groups"
|
||||
itemLabelFunc={() => group.name}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<p className="text-gray-500 text-sm">
|
||||
|
||||
Reference in New Issue
Block a user