"use client"; import { Archive } from "lucide-react"; import { useActionState, useRef } from "react"; import { useFormularAktion } from "@/components/hosts/useFormularAktion"; import { Auswahlliste, Button, Feld, Formularfehler, Karte, Textbereich } from "@/components/ui"; import type { FormularZustand } from "@/server/actions/formular"; import { personAnlegenAktion, personArchivierenAktion, personBearbeitenAktion, } from "@/server/actions/personen"; export type PersonFormularVorgabe = { id?: string; name: string; email: string; organisation: string; notiz: string; benutzerId: string; }; export const LEERE_PERSON: PersonFormularVorgabe = { name: "", email: "", organisation: "", notiz: "", benutzerId: "", }; /** Formular fuer neue und bestehende Personen (#013). Regeln prueft der Server. */ export function PersonFormular({ vorgabe, konten, abbrechenZiel, }: { vorgabe: PersonFormularVorgabe; konten: { id: string; name: string; email: string | null }[]; abbrechenZiel: string; }) { const bearbeiten = Boolean(vorgabe.id); const { zustand, absenden, laeuft } = useFormularAktion( bearbeiten ? personBearbeitenAktion : personAnlegenAktion, ); const f = zustand.feldfehler ?? {}; return (
); } /** Archivieren mit Rueckfrage, nativer `