From 34150d8d45c0cfb8126c55dcd541bf48bd6d7c01 Mon Sep 17 00:00:00 2001 From: patrick Date: Fri, 4 Sep 2026 23:14:27 +0200 Subject: [PATCH] Objektliste: gleiches zweispaltiges Layout mit Suche wie Materialliste MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Anlegen-Formular links fix (20rem, nur Admin), Objektliste rechts mit Suchfeld oben (Name/Code) - gleiches Muster wie MaterialSection, wächst mit der Anzahl Objekte mit statt unsuchbare Liste zu werden. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV --- frontend/src/pages/admin/ObjektSection.tsx | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/admin/ObjektSection.tsx b/frontend/src/pages/admin/ObjektSection.tsx index fd69f57..14ec3fe 100644 --- a/frontend/src/pages/admin/ObjektSection.tsx +++ b/frontend/src/pages/admin/ObjektSection.tsx @@ -43,6 +43,7 @@ export function ObjektSection({ const [gezogenVonId, setGezogenVonId] = useState(""); const [kopplungBearbeitenId, setKopplungBearbeitenId] = useState(null); const [kopplungAuswahl, setKopplungAuswahl] = useState(""); + const [suche, setSuche] = useState(""); async function codeVorschlagen() { if (!praefix) { @@ -154,11 +155,20 @@ export function ObjektSection({ } } + const sucheNormalisiert = suche.trim().toLowerCase(); + const gefilterteObjekte = sucheNormalisiert + ? objekte.filter( + (o) => o.name.toLowerCase().includes(sucheNormalisiert) || o.code.toLowerCase().includes(sucheNormalisiert) + ) + : objekte; + return (
-

{nurPflegen ? "Objekte" : "Objekt aus Vorlage anlegen"}

+

Objekte

+
{!nurPflegen && ( -
+
+

Objekt aus Vorlage anlegen

{vorlagen.length === 0 ? (

Keine aktive Vorlage vorhanden – erst Excel-Import oder Vorlage per API anlegen. @@ -234,10 +244,18 @@ export function ObjektSection({

)} -
- {objekte.length > 0 && ( +
+ setSuche(e.target.value)} + /> + {gefilterteObjekte.length === 0 &&

Keine Treffer.

} + {gefilterteObjekte.length > 0 && (
    - {objekte.map((o) => ( + {gefilterteObjekte.map((o) => (
  • @@ -345,6 +363,7 @@ export function ObjektSection({
)}
+
); }