From 7475d4fd37a10a620d58ed9d2b0c6afadc1244a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20X=2E=20F=C3=BCrst?= Date: Sun, 14 Jun 2026 16:14:52 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Objekte-Kategorien=20(stern/sonne/beide?= =?UTF-8?q?)=20=E2=80=94=20Version=201.10.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Neue Spalte Kategorie (SET stern/sonne) in objekte-Tabelle - ObjektSelector zeigt je nach ArtFuehrung nur passende Objekte - SonnenFührung: Sonne fest vorausgewählt, zusätzliche Sonne-Objekte wählbar - Bestehende Objekte erhalten Kategorie automatisch beim Speichern - Admin: Kategorie editierbar (stern / sonne / stern,sonne) Co-Authored-By: Claude Sonnet 4.6 --- app/admin/ObjekteManager.tsx | 41 +++++++++++++++++++++++++++++++---- app/admin/actions.ts | 1 + app/api/objekte/[id]/route.ts | 6 +++-- app/api/objekte/route.ts | 12 ++++++---- components/LogbuchForm.tsx | 33 +++++++++++++--------------- components/ObjektSelector.tsx | 25 ++++++++++++++++----- lib/phpdb.ts | 14 ++++++------ package.json | 2 +- 8 files changed, 92 insertions(+), 42 deletions(-) diff --git a/app/admin/ObjekteManager.tsx b/app/admin/ObjekteManager.tsx index b474be4..8c99538 100644 --- a/app/admin/ObjekteManager.tsx +++ b/app/admin/ObjekteManager.tsx @@ -12,7 +12,9 @@ export default function ObjekteManager({ initialObjekte }: Props) { const router = useRouter(); const [editingId, setEditingId] = useState(null); const [editName, setEditName] = useState(''); + const [editKategorie, setEditKategorie] = useState('stern'); const [newName, setNewName] = useState(''); + const [newKategorie, setNewKategorie] = useState('stern'); const [error, setError] = useState(''); const [busy, setBusy] = useState(false); @@ -24,7 +26,7 @@ export default function ObjekteManager({ initialObjekte }: Props) { const res = await fetch('/api/objekte/' + id, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ name: trimmed }), + body: JSON.stringify({ name: trimmed, kategorie: editKategorie }), }); setBusy(false); if (!res.ok) { @@ -59,7 +61,7 @@ export default function ObjekteManager({ initialObjekte }: Props) { const res = await fetch('/api/objekte', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ name: trimmed }), + body: JSON.stringify({ name: trimmed, kategorie: newKategorie }), }); setBusy(false); if (!res.ok) { @@ -85,6 +87,15 @@ export default function ObjekteManager({ initialObjekte }: Props) { placeholder="Neues Objekt…" className="flex-1 px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:border-blue-500" /> +