Feature: SEPA-Export, Push-Notifications, Onboarding + vollständige UI

- Phosphor Icons (Icon.svelte, svg-Registry)
- Schema-Abgleich: alle Felder zwischen PB-Migrations und types.ts konsistent
- Stripe entfernt, SEPA pain.008 XML-Export implementiert (sepa.ts)
- Beiträge: vollständiges CRUD + SEPA-Einzug-Sheet mit Vorschau
- Termine: vollständiges CRUD (upcoming/vergangen, datetime-local)
- Mitglieder: Formulare um alle Felder erweitert (Adresse, SEPA-Mandat, Notizen)
- Nachrichten: Brevo E-Mail via PocketBase-Hook, UI mit Gruppen-Filter
- Push-Notifications: VAPID, Custom Service Worker (injectManifest),
  Subscribe/Send API-Routen, automatische Subscription nach Login
- Onboarding: 3-Schritt-Flow für neue Vereine, Guard im App-Layout
- Makefile: .env wird vollständig zur DS übertragen
This commit is contained in:
rene 2026-05-20 13:01:11 +02:00
parent c2c4dfd518
commit 77c6f513b5
32 changed files with 3012 additions and 399 deletions

View file

@ -3,35 +3,70 @@
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { onMount } from 'svelte';
import type { Mitglied, Gruppe } from '$lib/types';
const id = $derived($page.params.id);
const id = $derived($page.params.id as string);
let gruppen = $state<any[]>([]);
let vorname = $state('');
let nachname = $state('');
let email = $state('');
let iban = $state('');
let status = $state('aktiv');
let gruppe_ids = $state<string[]>([]);
let gruppen = $state<Gruppe[]>([]);
let loading = $state(true);
let saving = $state(false);
let error = $state('');
let editMode = $state(false);
let showDelete = $state(false);
// Felder
let vorname = $state('');
let nachname = $state('');
let email = $state('');
let telefon = $state('');
let geburtsdatum = $state('');
let status = $state('aktiv');
let eintrittsdatum = $state('');
let austrittsdatum = $state('');
let strasse = $state('');
let plz = $state('');
let ort = $state('');
let iban = $state('');
let bic = $state('');
let mandatsreferenz = $state('');
let mandatsdatum = $state('');
let notizen = $state('');
let gruppe_ids = $state<string[]>([]);
function pbDateToInput(val: string | undefined): string {
// PocketBase gibt "2026-05-20 00:00:00.000Z" zurück, input[type=date] braucht "2026-05-20"
if (!val) return '';
return val.slice(0, 10);
}
function loadRecord(m: Mitglied) {
vorname = m.vorname;
nachname = m.nachname;
email = m.email ?? '';
telefon = m.telefon ?? '';
geburtsdatum = pbDateToInput(m.geburtsdatum);
status = m.status;
eintrittsdatum = pbDateToInput(m.eintrittsdatum);
austrittsdatum = pbDateToInput(m.austrittsdatum);
strasse = m.strasse ?? '';
plz = m.plz ?? '';
ort = m.ort ?? '';
iban = m.iban ?? '';
bic = m.bic ?? '';
mandatsreferenz = m.mandatsreferenz ?? '';
mandatsdatum = pbDateToInput(m.mandatsdatum);
notizen = m.notizen ?? '';
gruppe_ids = m.gruppe_ids ?? [];
}
onMount(async () => {
const [m, g] = await Promise.all([
pb.collection('mitglieder').getOne(id),
pb.collection('gruppen').getFullList({ sort: 'name' })
pb.collection('mitglieder').getOne<Mitglied>(id),
pb.collection('gruppen').getFullList<Gruppe>({ sort: 'name' }),
]);
vorname = m.vorname;
nachname = m.nachname;
email = m.email ?? '';
iban = m.iban ?? '';
status = m.status;
gruppe_ids = m.gruppe_ids ?? [];
gruppen = g;
loading = false;
loadRecord(m);
gruppen = g;
loading = false;
});
function toggleGruppe(gid: string) {
@ -41,16 +76,26 @@
}
async function speichern() {
error = '';
saving = true;
error = ''; saving = true;
try {
await pb.collection('mitglieder').update(id, {
vorname: vorname.trim(),
nachname: nachname.trim(),
email: email.trim(),
iban: iban.trim(),
vorname: vorname.trim(),
nachname: nachname.trim(),
email: email.trim() || null,
telefon: telefon.trim() || null,
geburtsdatum: geburtsdatum || null,
status,
gruppe_ids
eintrittsdatum: eintrittsdatum || null,
austrittsdatum: austrittsdatum || null,
strasse: strasse.trim() || null,
plz: plz.trim() || null,
ort: ort.trim() || null,
iban: iban.trim() || null,
bic: bic.trim() || null,
mandatsreferenz: mandatsreferenz.trim() || null,
mandatsdatum: mandatsdatum || null,
notizen: notizen.trim() || null,
gruppe_ids,
});
editMode = false;
} catch (e: unknown) {
@ -70,15 +115,20 @@
}
}
function gruppenName(ids: string[]) {
function gruppenName(ids: string[]): string {
return (ids ?? [])
.map(gid => gruppen.find(g => g.id === gid)?.name)
.filter(Boolean)
.join(', ');
}
function formatDatum(iso: string): string {
if (!iso) return '—';
return new Date(iso).toLocaleDateString('de-DE');
}
const statusFarbe: Record<string, string> = {
aktiv: '#16a34a', passiv: '#f59e0b', ausgetreten: '#94a3b8'
aktiv: '#16a34a', passiv: '#f59e0b', ausgetreten: '#94a3b8',
};
</script>
@ -87,7 +137,7 @@
<div class="top">
<a class="back" href="/mitglieder">← Mitglieder</a>
{#if !loading}
<button class="edit-btn" onclick={() => editMode = !editMode}>
<button class="edit-btn" onclick={() => { editMode = !editMode; error = ''; }}>
{editMode ? 'Abbrechen' : 'Bearbeiten'}
</button>
{/if}
@ -98,99 +148,223 @@
{:else if !editMode}
<!-- Detailansicht -->
<div class="card">
<div class="hero">
<div class="avatar-lg">{vorname[0]}{nachname[0]}</div>
<h1>{vorname} {nachname}</h1>
<span class="status-badge" style="color:{statusFarbe[status] ?? '#94a3b8'}">
{status}
</span>
<span class="status-badge" style="color:{statusFarbe[status] ?? '#94a3b8'}">{status}</span>
</div>
<div class="detail-list">
<div class="detail-block">
<h2>Kontakt</h2>
{#if email}
<div class="detail-row">
<span class="detail-label">E-Mail</span>
<a href="mailto:{email}" class="detail-value link">{email}</a>
<div class="row-detail">
<span class="dl">E-Mail</span>
<a href="mailto:{email}" class="dv link">{email}</a>
</div>
{/if}
{#if iban}
<div class="detail-row">
<span class="detail-label">IBAN</span>
<span class="detail-value mono">{iban}</span>
{#if telefon}
<div class="row-detail">
<span class="dl">Telefon</span>
<a href="tel:{telefon}" class="dv link">{telefon}</a>
</div>
{/if}
{#if gruppe_ids?.length > 0}
<div class="detail-row">
<span class="detail-label">Gruppen</span>
<span class="detail-value">{gruppenName(gruppe_ids)}</span>
{#if strasse || plz || ort}
<div class="row-detail">
<span class="dl">Adresse</span>
<span class="dv">{[strasse, [plz, ort].filter(Boolean).join(' ')].filter(Boolean).join(', ')}</span>
</div>
{/if}
{#if !email && !telefon && !strasse}
<p class="leer">Keine Kontaktdaten hinterlegt.</p>
{/if}
</div>
<div class="detail-block">
<h2>Mitgliedschaft</h2>
{#if eintrittsdatum}
<div class="row-detail">
<span class="dl">Eintritt</span>
<span class="dv">{formatDatum(eintrittsdatum)}</span>
</div>
{/if}
{#if geburtsdatum}
<div class="row-detail">
<span class="dl">Geburtsdatum</span>
<span class="dv">{formatDatum(geburtsdatum)}</span>
</div>
{/if}
{#if austrittsdatum}
<div class="row-detail">
<span class="dl">Austritt</span>
<span class="dv">{formatDatum(austrittsdatum)}</span>
</div>
{/if}
{#if gruppe_ids?.length}
<div class="row-detail">
<span class="dl">Gruppen</span>
<span class="dv">{gruppenName(gruppe_ids)}</span>
</div>
{/if}
</div>
{#if iban || bic || mandatsreferenz}
<div class="detail-block">
<h2>SEPA-Lastschrift</h2>
{#if iban}
<div class="row-detail">
<span class="dl">IBAN</span>
<span class="dv mono">{iban}</span>
</div>
{/if}
{#if bic}
<div class="row-detail">
<span class="dl">BIC</span>
<span class="dv mono">{bic}</span>
</div>
{/if}
{#if mandatsreferenz}
<div class="row-detail">
<span class="dl">Mandat</span>
<span class="dv mono">{mandatsreferenz}{mandatsdatum ? ' · ' + formatDatum(mandatsdatum) : ''}</span>
</div>
{/if}
</div>
{/if}
{#if notizen}
<div class="detail-block">
<h2>Notizen</h2>
<p class="notiz-text">{notizen}</p>
</div>
{/if}
<button class="btn-delete" onclick={() => showDelete = true}>Mitglied löschen</button>
{:else}
<!-- Bearbeitungsformular -->
<form onsubmit={(e) => { e.preventDefault(); speichern(); }}>
<div class="row">
<section>
<h2>Stammdaten</h2>
<div class="row">
<div class="field">
<label for="vorname">Vorname *</label>
<input id="vorname" type="text" bind:value={vorname} required />
</div>
<div class="field">
<label for="nachname">Nachname *</label>
<input id="nachname" type="text" bind:value={nachname} required />
</div>
</div>
<div class="row">
<div class="field">
<label for="status">Status</label>
<select id="status" bind:value={status}>
<option value="aktiv">Aktiv</option>
<option value="passiv">Passiv</option>
<option value="ausgetreten">Ausgetreten</option>
</select>
</div>
<div class="field">
<label for="geburtsdatum">Geburtsdatum</label>
<input id="geburtsdatum" type="date" bind:value={geburtsdatum} />
</div>
</div>
<div class="row">
<div class="field">
<label for="eintrittsdatum">Eintrittsdatum</label>
<input id="eintrittsdatum" type="date" bind:value={eintrittsdatum} />
</div>
<div class="field">
<label for="austrittsdatum">Austrittsdatum</label>
<input id="austrittsdatum" type="date" bind:value={austrittsdatum} />
</div>
</div>
</section>
<section>
<h2>Kontakt</h2>
<div class="field">
<label for="vorname">Vorname *</label>
<input id="vorname" type="text" bind:value={vorname} required />
<label for="email">E-Mail</label>
<input id="email" type="email" bind:value={email} />
</div>
<div class="field">
<label for="nachname">Nachname *</label>
<input id="nachname" type="text" bind:value={nachname} required />
<label for="telefon">Telefon</label>
<input id="telefon" type="tel" bind:value={telefon} />
</div>
</div>
<div class="field">
<label for="strasse">Straße & Hausnummer</label>
<input id="strasse" type="text" bind:value={strasse} />
</div>
<div class="row">
<div class="field" style="flex: 0 0 5rem">
<label for="plz">PLZ</label>
<input id="plz" type="text" inputmode="numeric" bind:value={plz} />
</div>
<div class="field">
<label for="ort">Ort</label>
<input id="ort" type="text" bind:value={ort} />
</div>
</div>
</section>
<div class="field">
<label for="email">E-Mail</label>
<input id="email" type="email" bind:value={email} />
</div>
<div class="field">
<label for="iban">IBAN</label>
<input id="iban" type="text" bind:value={iban} />
</div>
<div class="field">
<label for="status">Status</label>
<select id="status" bind:value={status}>
<option value="aktiv">Aktiv</option>
<option value="passiv">Passiv</option>
<option value="ausgetreten">Ausgetreten</option>
</select>
</div>
<section>
<h2>SEPA-Lastschrift</h2>
<div class="field">
<label for="iban">IBAN</label>
<input id="iban" type="text" bind:value={iban} placeholder="DE12 3456 7890 …" />
</div>
<div class="field">
<label for="bic">BIC</label>
<input id="bic" type="text" bind:value={bic} placeholder="COBADEFFXXX" />
</div>
<div class="row">
<div class="field">
<label for="mandatsreferenz">Mandatsreferenz</label>
<input id="mandatsreferenz" type="text" bind:value={mandatsreferenz} placeholder="automatisch" />
</div>
<div class="field">
<label for="mandatsdatum">Mandatsdatum</label>
<input id="mandatsdatum" type="date" bind:value={mandatsdatum} />
</div>
</div>
</section>
{#if gruppen.length > 0}
<div class="field">
<label>Gruppen</label>
<section>
<h2>Gruppen</h2>
<div class="checkboxes">
{#each gruppen as g (g.id)}
<label class="check-label">
<input
type="checkbox"
checked={gruppe_ids.includes(g.id)}
onchange={() => toggleGruppe(g.id)}
/>
<label class="check-label" class:active={gruppe_ids.includes(g.id)}>
<input type="checkbox" checked={gruppe_ids.includes(g.id)} onchange={() => toggleGruppe(g.id)} />
{g.name}
</label>
{/each}
</div>
</div>
</section>
{/if}
<section>
<h2>Notizen</h2>
<div class="field">
<label for="notizen">Interne Notizen</label>
<textarea id="notizen" bind:value={notizen} rows="3"></textarea>
</div>
</section>
{#if error}
<p class="error">{error}</p>
{/if}
<button type="submit" class="btn-primary" disabled={saving || !vorname || !nachname}>
{saving ? 'Speichern…' : 'Änderungen speichern'}
</button>
<div class="actions" style="margin-bottom:5rem">
<button type="submit" class="btn-primary" disabled={saving || !vorname || !nachname}>
{saving ? 'Speichern…' : 'Änderungen speichern'}
</button>
</div>
</form>
{/if}
<!-- Lösch-Bestätigung -->
<!-- Lösch-Dialog -->
{#if showDelete}
<div class="overlay" role="dialog" aria-modal="true">
<div class="dialog">
@ -205,166 +379,125 @@
{/if}
<style>
.top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1.5rem;
}
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.back { font-size: 0.9rem; color: #1e40af; text-decoration: none; }
.edit-btn {
background: none;
border: 1.5px solid #e2e8f0;
border-radius: 8px;
padding: 0.4rem 0.85rem;
font-size: 0.875rem;
color: #475569;
cursor: pointer;
}
.card {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
padding: 1.5rem 1rem;
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 12px;
margin-bottom: 1rem;
}
.avatar-lg {
width: 4rem;
height: 4rem;
border-radius: 50%;
background: #e0e7ff;
color: #1e40af;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 1.3rem;
text-transform: uppercase;
background: none; border: 1.5px solid #e2e8f0; border-radius: 8px;
padding: 0.4rem 0.85rem; font-size: 0.875rem; color: #475569; cursor: pointer;
}
h1 { font-size: 1.3rem; font-weight: 700; color: #1e293b; }
.hint { color: #94a3b8; text-align: center; margin-top: 3rem; }
.hero {
display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
padding: 1.5rem 1rem; background: #fff;
border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 1rem;
}
.avatar-lg {
width: 4rem; height: 4rem; border-radius: 50%;
background: #e0e7ff; color: #1e40af;
display: flex; align-items: center; justify-content: center;
font-weight: 700; font-size: 1.3rem; text-transform: uppercase;
}
.status-badge { font-size: 0.8rem; font-weight: 600; text-transform: capitalize; }
.detail-list {
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 12px;
overflow: hidden;
margin-bottom: 1.5rem;
.detail-block {
background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
overflow: hidden; margin-bottom: 0.75rem; padding: 0.75rem 1rem;
}
.detail-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.85rem 1rem;
.detail-block h2 {
font-size: 0.72rem; font-weight: 700; color: #94a3b8;
text-transform: uppercase; letter-spacing: 0.06em;
margin-bottom: 0.6rem;
}
.row-detail {
display: flex; justify-content: space-between; align-items: baseline;
gap: 1rem; padding: 0.45rem 0;
border-bottom: 1px solid #f1f5f9;
gap: 1rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 0.85rem; color: #94a3b8; flex-shrink: 0; }
.detail-value { font-size: 0.9rem; color: #1e293b; text-align: right; }
.detail-value.link { color: #1e40af; text-decoration: none; }
.detail-value.mono { font-family: monospace; font-size: 0.85rem; }
.row-detail:last-child { border-bottom: none; }
.dl { font-size: 0.82rem; color: #94a3b8; flex-shrink: 0; }
.dv { font-size: 0.88rem; color: #1e293b; text-align: right; }
.dv.link { color: #1e40af; text-decoration: none; }
.dv.mono { font-family: monospace; font-size: 0.82rem; }
.leer { font-size: 0.85rem; color: #94a3b8; }
.notiz-text { font-size: 0.875rem; color: #475569; white-space: pre-wrap; }
.btn-delete {
width: 100%;
padding: 0.75rem;
background: none;
border: 1.5px solid #fca5a5;
border-radius: 8px;
color: #dc2626;
font-size: 0.9rem;
cursor: pointer;
transition: background 0.15s;
width: 100%; padding: 0.75rem; background: none;
border: 1.5px solid #fca5a5; border-radius: 8px;
color: #dc2626; font-size: 0.9rem; cursor: pointer;
transition: background 0.15s; margin-bottom: 5rem;
}
.btn-delete:hover { background: #fef2f2; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
label { font-size: 0.875rem; font-weight: 500; color: #475569; }
input, select {
padding: 0.65rem 0.85rem;
border: 1.5px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
background: #fff;
transition: border-color 0.15s;
width: 100%;
box-sizing: border-box;
/* Formular */
section {
margin-bottom: 1.5rem; padding-bottom: 1.5rem;
border-bottom: 1px solid #f1f5f9;
}
input:focus, select:focus { outline: none; border-color: #1e40af; }
section:last-of-type { border-bottom: none; }
section h2 {
font-size: 0.72rem; font-weight: 700; color: #94a3b8;
text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.85rem;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; }
label { font-size: 0.875rem; font-weight: 500; color: #475569; }
input, select, textarea {
padding: 0.65rem 0.85rem;
border: 1.5px solid #e2e8f0; border-radius: 8px;
font-size: 1rem; background: #fff; width: 100%;
box-sizing: border-box; font-family: inherit; resize: vertical;
transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #1e40af; }
.checkboxes { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.check-label {
display: flex;
align-items: center;
gap: 0.4rem;
display: flex; align-items: center; gap: 0.4rem;
padding: 0.4rem 0.75rem;
border: 1.5px solid #e2e8f0;
border-radius: 20px;
font-size: 0.875rem;
cursor: pointer;
border: 1.5px solid #e2e8f0; border-radius: 20px;
font-size: 0.875rem; cursor: pointer;
transition: border-color 0.15s, background 0.15s;
}
.check-label:has(input:checked) { border-color: #1e40af; background: #e0e7ff; color: #1e40af; }
.check-label.active { border-color: #1e40af; background: #e0e7ff; color: #1e40af; }
.check-label input { display: none; }
.error { color: #dc2626; font-size: 0.875rem; margin-bottom: 0.75rem; }
.actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.btn-primary {
width: 100%;
padding: 0.75rem;
background: #1e40af;
color: #fff;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
margin-top: 0.5rem;
transition: background 0.15s;
flex: 1; padding: 0.75rem; background: #1e40af; color: #fff;
border: none; border-radius: 8px; font-size: 1rem; font-weight: 600;
cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: #1d3a9e; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.hint { color: #94a3b8; text-align: center; margin-top: 3rem; }
.btn-ghost {
padding: 0.75rem 1rem; background: none;
border: 1.5px solid #e2e8f0; border-radius: 8px;
font-size: 1rem; color: #64748b; cursor: pointer;
}
.overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.4);
display: flex;
align-items: flex-end;
justify-content: center;
z-index: 100;
padding: 1rem;
position: fixed; inset: 0; background: rgba(0,0,0,0.4);
display: flex; align-items: flex-end; justify-content: center;
z-index: 100; padding: 1rem;
padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
.dialog {
background: #fff;
border-radius: 16px;
padding: 1.5rem;
width: 100%;
max-width: 400px;
background: #fff; border-radius: 16px; padding: 1.5rem;
width: 100%; max-width: 400px;
}
.dialog p { font-size: 1rem; color: #1e293b; margin-bottom: 0.5rem; }
.dialog-sub { font-size: 0.875rem; color: #94a3b8; }
.dialog-sub { font-size: 0.875rem !important; color: #94a3b8; }
.dialog-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.btn-ghost {
flex: 1;
padding: 0.75rem;
background: none;
border: 1.5px solid #e2e8f0;
border-radius: 8px;
font-size: 0.95rem;
color: #64748b;
cursor: pointer;
}
.btn-danger {
flex: 1;
padding: 0.75rem;
background: #dc2626;
color: #fff;
border: none;
border-radius: 8px;
font-size: 0.95rem;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
flex: 1; padding: 0.75rem; background: #dc2626; color: #fff;
border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600;
cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #b91c1c; }
</style>

View file

@ -4,14 +4,31 @@
import { onMount } from 'svelte';
let gruppen = $state<any[]>([]);
let vorname = $state('');
let nachname = $state('');
let email = $state('');
let iban = $state('');
let status = $state('aktiv');
let gruppe_ids = $state<string[]>([]);
let error = $state('');
let loading = $state(false);
// Stammdaten
let vorname = $state('');
let nachname = $state('');
let email = $state('');
let telefon = $state('');
let geburtsdatum = $state('');
let status = $state('aktiv');
let eintrittsdatum = $state('');
let gruppe_ids = $state<string[]>([]);
let notizen = $state('');
// Adresse
let strasse = $state('');
let plz = $state('');
let ort = $state('');
// SEPA
let iban = $state('');
let bic = $state('');
let mandatsreferenz = $state('');
let mandatsdatum = $state('');
let error = $state('');
let loading = $state(false);
onMount(async () => {
gruppen = await pb.collection('gruppen').getFullList({ sort: 'name' });
@ -24,18 +41,27 @@
}
async function speichern() {
error = '';
loading = true;
error = ''; loading = true;
try {
const verein_id = (pb.authStore.record ?? pb.authStore.model)?.verein_id;
const verein_id = pb.authStore.record?.verein_id as string;
await pb.collection('mitglieder').create({
verein_id,
vorname: vorname.trim(),
nachname: nachname.trim(),
email: email.trim(),
iban: iban.trim(),
vorname: vorname.trim(),
nachname: nachname.trim(),
email: email.trim() || null,
telefon: telefon.trim() || null,
geburtsdatum: geburtsdatum || null,
status,
gruppe_ids
eintrittsdatum: eintrittsdatum || null,
strasse: strasse.trim() || null,
plz: plz.trim() || null,
ort: ort.trim() || null,
iban: iban.trim() || null,
bic: bic.trim() || null,
mandatsreferenz: mandatsreferenz.trim() || null,
mandatsdatum: mandatsdatum || null,
notizen: notizen.trim() || null,
gruppe_ids,
});
goto('/mitglieder');
} catch (e: unknown) {
@ -54,54 +80,117 @@
</div>
<form onsubmit={(e) => { e.preventDefault(); speichern(); }}>
<div class="row">
<section>
<h2>Stammdaten</h2>
<div class="row">
<div class="field">
<label for="vorname">Vorname *</label>
<input id="vorname" type="text" bind:value={vorname} required autocomplete="given-name" />
</div>
<div class="field">
<label for="nachname">Nachname *</label>
<input id="nachname" type="text" bind:value={nachname} required autocomplete="family-name" />
</div>
</div>
<div class="row">
<div class="field">
<label for="status">Status</label>
<select id="status" bind:value={status}>
<option value="aktiv">Aktiv</option>
<option value="passiv">Passiv</option>
<option value="ausgetreten">Ausgetreten</option>
</select>
</div>
<div class="field">
<label for="geburtsdatum">Geburtsdatum</label>
<input id="geburtsdatum" type="date" bind:value={geburtsdatum} />
</div>
</div>
<div class="row">
<div class="field">
<label for="eintrittsdatum">Eintrittsdatum</label>
<input id="eintrittsdatum" type="date" bind:value={eintrittsdatum} />
</div>
</div>
</section>
<section>
<h2>Kontakt</h2>
<div class="field">
<label for="vorname">Vorname *</label>
<input id="vorname" type="text" bind:value={vorname} required autocomplete="given-name" />
<label for="email">E-Mail</label>
<input id="email" type="email" bind:value={email} autocomplete="email" />
</div>
<div class="field">
<label for="nachname">Nachname *</label>
<input id="nachname" type="text" bind:value={nachname} required autocomplete="family-name" />
<label for="telefon">Telefon</label>
<input id="telefon" type="tel" bind:value={telefon} autocomplete="tel" />
</div>
</div>
</section>
<div class="field">
<label for="email">E-Mail</label>
<input id="email" type="email" bind:value={email} autocomplete="email" />
</div>
<section>
<h2>Adresse</h2>
<div class="field">
<label for="strasse">Straße & Hausnummer</label>
<input id="strasse" type="text" bind:value={strasse} autocomplete="street-address" />
</div>
<div class="row">
<div class="field" style="flex: 0 0 5rem">
<label for="plz">PLZ</label>
<input id="plz" type="text" inputmode="numeric" bind:value={plz} autocomplete="postal-code" />
</div>
<div class="field">
<label for="ort">Ort</label>
<input id="ort" type="text" bind:value={ort} autocomplete="address-level2" />
</div>
</div>
</section>
<div class="field">
<label for="iban">IBAN</label>
<input id="iban" type="text" bind:value={iban} placeholder="DE12 3456 7890 …" />
</div>
<div class="field">
<label for="status">Status</label>
<select id="status" bind:value={status}>
<option value="aktiv">Aktiv</option>
<option value="passiv">Passiv</option>
<option value="ausgetreten">Ausgetreten</option>
</select>
</div>
<section>
<h2>SEPA-Lastschrift</h2>
<div class="field">
<label for="iban">IBAN</label>
<input id="iban" type="text" bind:value={iban} placeholder="DE12 3456 7890 …" autocomplete="off" />
</div>
<div class="field">
<label for="bic">BIC</label>
<input id="bic" type="text" bind:value={bic} placeholder="COBADEFFXXX" autocomplete="off" />
</div>
<div class="row">
<div class="field">
<label for="mandatsreferenz">Mandatsreferenz</label>
<input id="mandatsreferenz" type="text" bind:value={mandatsreferenz} placeholder="wird automatisch vergeben" />
</div>
<div class="field">
<label for="mandatsdatum">Mandatsdatum</label>
<input id="mandatsdatum" type="date" bind:value={mandatsdatum} />
</div>
</div>
</section>
{#if gruppen.length > 0}
<div class="field">
<label>Gruppen</label>
<section>
<h2>Gruppen</h2>
<div class="checkboxes">
{#each gruppen as g (g.id)}
<label class="check-label">
<input
type="checkbox"
checked={gruppe_ids.includes(g.id)}
onchange={() => toggleGruppe(g.id)}
/>
<label class="check-label" class:active={gruppe_ids.includes(g.id)}>
<input type="checkbox" checked={gruppe_ids.includes(g.id)} onchange={() => toggleGruppe(g.id)} />
{g.name}
</label>
{/each}
</div>
</div>
</section>
{/if}
<section>
<h2>Notizen</h2>
<div class="field">
<label for="notizen">Interne Notizen</label>
<textarea id="notizen" bind:value={notizen} rows="3" placeholder="Nur für Vorstand sichtbar"></textarea>
</div>
</section>
{#if error}
<p class="error">{error}</p>
{/if}
@ -112,63 +201,59 @@
{loading ? 'Speichern…' : 'Mitglied anlegen'}
</button>
</div>
</form>
<style>
.top { margin-bottom: 1.25rem; }
.back { font-size: 0.9rem; color: #1e40af; text-decoration: none; display: block; margin-bottom: 0.5rem; }
h1 { font-size: 1.4rem; font-weight: 700; color: #1e293b; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
label { font-size: 0.875rem; font-weight: 500; color: #475569; }
input, select {
padding: 0.65rem 0.85rem;
border: 1.5px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
background: #fff;
transition: border-color 0.15s;
width: 100%;
box-sizing: border-box;
section {
margin-bottom: 1.5rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid #f1f5f9;
}
input:focus, select:focus { outline: none; border-color: #1e40af; }
section:last-of-type { border-bottom: none; }
h2 { font-size: 0.8rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.85rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; }
label { font-size: 0.875rem; font-weight: 500; color: #475569; }
input, select, textarea {
padding: 0.65rem 0.85rem;
border: 1.5px solid #e2e8f0; border-radius: 8px;
font-size: 1rem; background: #fff; width: 100%;
box-sizing: border-box; font-family: inherit; resize: vertical;
transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #1e40af; }
.checkboxes { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.check-label {
display: flex;
align-items: center;
gap: 0.4rem;
display: flex; align-items: center; gap: 0.4rem;
padding: 0.4rem 0.75rem;
border: 1.5px solid #e2e8f0;
border-radius: 20px;
font-size: 0.875rem;
cursor: pointer;
border: 1.5px solid #e2e8f0; border-radius: 20px;
font-size: 0.875rem; cursor: pointer;
transition: border-color 0.15s, background 0.15s;
}
.check-label:has(input:checked) { border-color: #1e40af; background: #e0e7ff; color: #1e40af; }
.check-label.active { border-color: #1e40af; background: #e0e7ff; color: #1e40af; }
.check-label input { display: none; }
.error { color: #dc2626; font-size: 0.875rem; margin-bottom: 0.75rem; }
.actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; margin-bottom: 5rem; }
.btn-primary {
flex: 1;
padding: 0.75rem;
background: #1e40af;
color: #fff;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
transition: background 0.15s;
flex: 1; padding: 0.75rem; background: #1e40af; color: #fff;
border: none; border-radius: 8px; font-size: 1rem; font-weight: 600;
cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: #1d3a9e; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost {
padding: 0.75rem 1rem;
background: none;
border: 1.5px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
color: #64748b;
text-decoration: none;
text-align: center;
padding: 0.75rem 1rem; background: none;
border: 1.5px solid #e2e8f0; border-radius: 8px;
font-size: 1rem; color: #64748b; text-decoration: none; text-align: center;
}
</style>