'use client'; import { useState } from 'react'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Textarea } from '@/components/ui/textarea'; import type { Intervention, SmartGoal } from '@/lib/types/behandelplan'; import { Checkbox } from '@/components/ui/checkbox'; interface InterventionFormProps { initialData?: Intervention | null; goals?: SmartGoal[]; onChange: (data: Intervention) => void; } const COMMON_INTERVENTIONS = [ 'CGT (Cognitieve Gedragstherapie)', 'EMDR', 'ACT (Acceptance and Commitment Therapy)', 'Schematherapie', 'Psycho-educatie', 'Mindfulness', 'Exposure therapie', 'Systeemtherapie', ]; export function InterventionForm({ initialData, goals = [], onChange }: InterventionFormProps) { const [data, setData] = useState( initialData || { id: crypto.randomUUID(), name: '', description: '', rationale: '', linkedGoalIds: [], } ); const handleChange = (field: K, value: Intervention[K]) => { const updated = { ...data, [field]: value }; setData(updated); onChange(updated); }; const toggleGoalLink = (goalId: string) => { const linkedGoalIds = data.linkedGoalIds.includes(goalId) ? data.linkedGoalIds.filter((id) => id !== goalId) : [...data.linkedGoalIds, goalId]; handleChange('linkedGoalIds', linkedGoalIds); }; return (
handleChange('name', e.target.value)} placeholder="bijv. CGT, EMDR, ACT" list="interventions" /> {COMMON_INTERVENTIONS.map((name) => (