diff --git a/src/lib/components/blocks/StellingnahmeGeneratorBlock.svelte b/src/lib/components/blocks/StellingnahmeGeneratorBlock.svelte index 1b25462..be90139 100644 --- a/src/lib/components/blocks/StellingnahmeGeneratorBlock.svelte +++ b/src/lib/components/blocks/StellingnahmeGeneratorBlock.svelte @@ -87,6 +87,25 @@ return Array.from(map.values()); }); + // Quick-filter for allgemeine arguments (matches title / text / bulletPoints) + let argFilter = $state(""); + const filteredGruppen = $derived.by((): Group[] => { + const q = argFilter.trim().toLowerCase(); + if (!q) return allgemeineGruppen; + return allgemeineGruppen + .map((g) => ({ + ...g, + items: g.items.filter((f) => { + const hay = [f.title, f.text, ...(f.bulletPoints ?? [])] + .filter(Boolean) + .join(" ") + .toLowerCase(); + return hay.includes(q); + }), + })) + .filter((g) => g.items.length > 0); + }); + // ── localStorage ──────────────────────────────────────────────────────────── const storageKey = `stellungnahme:${block._slug ?? block.id ?? "default"}`; const historyKey = `${storageKey}:history`; @@ -146,6 +165,12 @@ argNotes = { ...argNotes, [slug]: value }; } + const gebietsBez = $derived( + windArea + ? `${windArea.gebiets_nr}${windArea.bezeichnung ? " – " + windArea.bezeichnung : ""}` + : "", + ); + // Editable opening/closing — null = use reactive default const defaultOpening = $derived( block.defaultOpeningText @@ -218,18 +243,14 @@ Regionale Planungsstelle Karl-Liebknecht-Straße 4 98527 Suhl`; - const gebietsBez = $derived( - windArea - ? `${windArea.gebiets_nr}${windArea.bezeichnung ? " – " + windArea.bezeichnung : ""}` - : "", - ); - const mailtoLink = $derived.by(() => { if (!outputText) return ""; const subject = `Einwendung Regionalplan Südwestthüringen – Vorranggebiet ${gebietsBez}`; const to = block.recipientEmail ?? ""; return `mailto:${to}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(outputText)}`; }); + // mailto-URLs >~2000 Zeichen werden von manchen Clients (Outlook/Windows) abgeschnitten + const mailTooLong = $derived(mailtoLink.length > 1900); function buildText(): string { const heute = new Date().toLocaleDateString("de-DE", { day: "2-digit", month: "2-digit", year: "numeric" }); @@ -299,6 +320,9 @@ ${"=".repeat(64)}`; } function resetAll() { + if (typeof window !== "undefined" && !window.confirm("Alle Eingaben und ausgewählten Argumente löschen und neu beginnen?")) { + return; + } selectedSlugs = new Set(); expandedItems = new Set(); expandedGroups = new Set(); @@ -470,6 +494,11 @@ ${"=".repeat(64)}`; {/if} + {:else if deadlineDays !== null && deadlineDays < 0} +