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({
)}
+
); }