diff --git a/components/LogbuchForm.tsx b/components/LogbuchForm.tsx index 8923fb7..0b05494 100644 --- a/components/LogbuchForm.tsx +++ b/components/LogbuchForm.tsx @@ -137,10 +137,20 @@ export default function LogbuchForm({ kuppel, currentUserBeo, editEntry, onSaved async function handleSubmit(e: React.FormEvent) { e.preventDefault(); - setSaving(true); setError(''); setSuccess(false); + if (showBesucher && besucher === '') { + setError('Bitte Besucherzahl eingeben.'); + return; + } + if (beginn === ende) { + setError('Die Zeite wurden nicht eingegeben'); + return; + } + + setSaving(true); + const body = { Kuppel: kuppel, ArtFuehrung: artFuehrung, diff --git a/components/ObjektSelector.tsx b/components/ObjektSelector.tsx index af2fe2e..aa98104 100644 --- a/components/ObjektSelector.tsx +++ b/components/ObjektSelector.tsx @@ -48,7 +48,12 @@ export default function ObjektSelector({ selected, onChange }: Props) { function addNew() { const name = newName.trim(); if (!name || selectedNames.has(name.toLowerCase())) return; - onChange([...selected, { ID: null, Name: name }]); + const existing = all.find((o) => o.Name.toLowerCase() === name.toLowerCase()); + if (existing) { + onChange([...selected, { ID: existing.ID, Name: existing.Name }]); + } else { + onChange([...selected, { ID: null, Name: name }]); + } setNewName(''); setShowNewInput(false); } diff --git a/types/logbuch.ts b/types/logbuch.ts index dbef6a8..2bdec78 100644 --- a/types/logbuch.ts +++ b/types/logbuch.ts @@ -6,9 +6,9 @@ export const KUPPELN: Kuppel[] = ['West', 'Ost', 'Süd', 'Pluto']; export const ARTEN_MAP: Record = { RF: 'regulär', SF: 'sonder', + SonF: 'sonnen', PrF: 'privat', BEOS: '', - SonF: 'sonnen', TD: '', Beob: 'Beobachtung', ToT: '',