'use client'; import { useState, useEffect } from 'react'; import { Modal } from '@/components/ui'; import FormField from '@/components/ui/FormField'; interface Props { isOpen: boolean; onClose: () => void; organization: any; onSave: (data: any) => void; } export default function OrganizationEditModal({ isOpen, onClose, organization, onSave }: Props) { const [form, setForm] = useState({ name: '', kind: 'operator', inn: '', address: '', contact_email: '', contact_phone: '' }); const set = (k: string, v: string) => setForm(f => ({ ...f, [k]: v })); useEffect(() => { if (organization) setForm({ name: organization.name || '', kind: organization.kind || 'operator', inn: organization.inn || '', address: organization.address || '', contact_email: organization.contact_email || '', contact_phone: organization.contact_phone || '' }); }, [organization]); return ( }> set('name', e.target.value)} className="input-field" /> set('inn', e.target.value)} className="input-field" /> set('address', e.target.value)} className="input-field" /> set('contact_email', e.target.value)} className="input-field" /> set('contact_phone', e.target.value)} className="input-field" /> ); }