Einstellungen: Vereinsprofil + SEPA-Bankdaten editierbar, Abmelden auf Einstellungsseite
This commit is contained in:
parent
472979a91c
commit
7e2e5a643d
6 changed files with 314 additions and 20 deletions
|
|
@ -3,6 +3,7 @@ import users from './icons/users.svg?raw';
|
||||||
import calendar from './icons/calendar.svg?raw';
|
import calendar from './icons/calendar.svg?raw';
|
||||||
import currencyEur from './icons/currency-eur.svg?raw';
|
import currencyEur from './icons/currency-eur.svg?raw';
|
||||||
import envelope from './icons/envelope.svg?raw';
|
import envelope from './icons/envelope.svg?raw';
|
||||||
|
import gear from './icons/gear.svg?raw';
|
||||||
|
|
||||||
export const icons = {
|
export const icons = {
|
||||||
house,
|
house,
|
||||||
|
|
@ -10,6 +11,7 @@ export const icons = {
|
||||||
calendar,
|
calendar,
|
||||||
'currency-eur': currencyEur,
|
'currency-eur': currencyEur,
|
||||||
envelope,
|
envelope,
|
||||||
|
gear,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type IconName = keyof typeof icons;
|
export type IconName = keyof typeof icons;
|
||||||
|
|
|
||||||
1
app/src/lib/icons/gear.svg
Normal file
1
app/src/lib/icons/gear.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><circle cx="128" cy="128" r="40" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><path d="M41.43,178.09A99.14,99.14,0,0,1,31.36,153.8l16.78-21a81.59,81.59,0,0,1,0-9.64l-16.77-21a99.43,99.43,0,0,1,10.05-24.3l26.71-3a81,81,0,0,1,6.81-6.81l3-26.7A99.14,99.14,0,0,1,102.2,31.36l21,16.78a81.59,81.59,0,0,1,9.64,0l21-16.77a99.43,99.43,0,0,1,24.3,10.05l3,26.71a81,81,0,0,1,6.81,6.81l26.7,3a99.14,99.14,0,0,1,10.07,24.29l-16.78,21a81.59,81.59,0,0,1,0,9.64l16.77,21a99.43,99.43,0,0,1-10,24.3l-26.71,3a81,81,0,0,1-6.81,6.81l-3,26.7a99.14,99.14,0,0,1-24.29,10.07l-21-16.78a81.59,81.59,0,0,1-9.64,0l-21,16.77a99.43,99.43,0,0,1-24.3-10l-3-26.71a81,81,0,0,1-6.81-6.81Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>
|
||||||
|
After Width: | Height: | Size: 920 B |
|
|
@ -12,6 +12,9 @@ export interface Verein {
|
||||||
bundesland?: string;
|
bundesland?: string;
|
||||||
plan: Plan;
|
plan: Plan;
|
||||||
dosb_mitglied: boolean;
|
dosb_mitglied: boolean;
|
||||||
|
email?: string;
|
||||||
|
telefon?: string;
|
||||||
|
website?: string;
|
||||||
glaeubigerid?: string;
|
glaeubigerid?: string;
|
||||||
iban?: string;
|
iban?: string;
|
||||||
bic?: string;
|
bic?: string;
|
||||||
|
|
|
||||||
|
|
@ -67,17 +67,13 @@
|
||||||
return Uint8Array.from([...raw].map((c) => c.charCodeAt(0)));
|
return Uint8Array.from([...raw].map((c) => c.charCodeAt(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
|
||||||
pb.authStore.clear();
|
|
||||||
goto('/login');
|
|
||||||
}
|
|
||||||
|
|
||||||
const navItems: { href: string; label: string; icon: IconName }[] = [
|
const navItems: { href: string; label: string; icon: IconName }[] = [
|
||||||
{ href: '/', label: 'Übersicht', icon: 'house' },
|
{ href: '/', label: 'Übersicht', icon: 'house' },
|
||||||
{ href: '/mitglieder', label: 'Mitglieder', icon: 'users' },
|
{ href: '/mitglieder', label: 'Mitglieder', icon: 'users' },
|
||||||
{ href: '/termine', label: 'Termine', icon: 'calendar' },
|
{ href: '/termine', label: 'Termine', icon: 'calendar' },
|
||||||
{ href: '/beitraege', label: 'Beiträge', icon: 'currency-eur' },
|
{ href: '/beitraege', label: 'Beiträge', icon: 'currency-eur' },
|
||||||
{ href: '/nachrichten', label: 'Nachrichten', icon: 'envelope' },
|
{ href: '/nachrichten', label: 'Nachrichten', icon: 'envelope' },
|
||||||
|
{ href: '/einstellungen', label: 'Einstellungen', icon: 'gear' },
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -87,7 +83,9 @@
|
||||||
<img src="/favicon.svg" alt="" width="28" height="28" />
|
<img src="/favicon.svg" alt="" width="28" height="28" />
|
||||||
vereins.haus
|
vereins.haus
|
||||||
</a>
|
</a>
|
||||||
<button class="logout-btn" onclick={logout}>Abmelden</button>
|
<a href="/einstellungen" class="header-icon" aria-label="Einstellungen">
|
||||||
|
<Icon name="gear" size={22} />
|
||||||
|
</a>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
@ -137,17 +135,14 @@
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logout-btn {
|
.header-icon {
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
padding: 0.25rem 0.5rem;
|
display: flex;
|
||||||
}
|
align-items: center;
|
||||||
|
padding: 0.25rem;
|
||||||
.logout-btn:hover {
|
transition: color 0.15s;
|
||||||
color: #1e293b;
|
|
||||||
}
|
}
|
||||||
|
.header-icon:hover { color: #1e293b; }
|
||||||
|
|
||||||
main {
|
main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
|
||||||
267
app/src/routes/(app)/einstellungen/+page.svelte
Normal file
267
app/src/routes/(app)/einstellungen/+page.svelte
Normal file
|
|
@ -0,0 +1,267 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { pb } from '$lib/pb';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import type { Verein } from '$lib/types';
|
||||||
|
|
||||||
|
let loading = $state(true);
|
||||||
|
let saving = $state(false);
|
||||||
|
let error = $state('');
|
||||||
|
let success = $state('');
|
||||||
|
|
||||||
|
// Vereinsprofil
|
||||||
|
let name = $state('');
|
||||||
|
let adresse = $state('');
|
||||||
|
let plz = $state('');
|
||||||
|
let ort = $state('');
|
||||||
|
let bundesland = $state('');
|
||||||
|
let email = $state('');
|
||||||
|
let telefon = $state('');
|
||||||
|
let website = $state('');
|
||||||
|
|
||||||
|
// SEPA
|
||||||
|
let glaeubigerid = $state('');
|
||||||
|
let iban = $state('');
|
||||||
|
let bic = $state('');
|
||||||
|
|
||||||
|
let vereinId = '';
|
||||||
|
|
||||||
|
const bundeslaender = [
|
||||||
|
['', '—'],
|
||||||
|
['BW', 'Baden-Württemberg'], ['BY', 'Bayern'], ['BE', 'Berlin'],
|
||||||
|
['BB', 'Brandenburg'], ['HB', 'Bremen'], ['HH', 'Hamburg'],
|
||||||
|
['HE', 'Hessen'], ['MV', 'Mecklenburg-Vorpommern'], ['NI', 'Niedersachsen'],
|
||||||
|
['NW', 'Nordrhein-Westfalen'], ['RP', 'Rheinland-Pfalz'], ['SL', 'Saarland'],
|
||||||
|
['SN', 'Sachsen'], ['ST', 'Sachsen-Anhalt'], ['SH', 'Schleswig-Holstein'],
|
||||||
|
['TH', 'Thüringen'],
|
||||||
|
];
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
vereinId = pb.authStore.record?.verein_id as string;
|
||||||
|
const v = await pb.collection('vereine').getOne<Verein>(vereinId);
|
||||||
|
name = v.name ?? '';
|
||||||
|
adresse = v.adresse ?? '';
|
||||||
|
plz = v.plz ?? '';
|
||||||
|
ort = v.ort ?? '';
|
||||||
|
bundesland = v.bundesland ?? '';
|
||||||
|
email = v.email ?? '';
|
||||||
|
telefon = v.telefon ?? '';
|
||||||
|
website = v.website ?? '';
|
||||||
|
glaeubigerid = v.glaeubigerid ?? '';
|
||||||
|
iban = v.iban ?? '';
|
||||||
|
bic = v.bic ?? '';
|
||||||
|
loading = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
async function speichern() {
|
||||||
|
if (!name.trim()) { error = 'Vereinsname ist Pflichtfeld.'; return; }
|
||||||
|
error = ''; success = ''; saving = true;
|
||||||
|
try {
|
||||||
|
await pb.collection('vereine').update(vereinId, {
|
||||||
|
name: name.trim(),
|
||||||
|
adresse: adresse.trim() || null,
|
||||||
|
plz: plz.trim() || null,
|
||||||
|
ort: ort.trim() || null,
|
||||||
|
bundesland: bundesland || null,
|
||||||
|
email: email.trim() || null,
|
||||||
|
telefon: telefon.trim() || null,
|
||||||
|
website: website.trim() || null,
|
||||||
|
glaeubigerid: glaeubigerid.trim() || null,
|
||||||
|
iban: iban.trim() || null,
|
||||||
|
bic: bic.trim() || null,
|
||||||
|
});
|
||||||
|
success = 'Gespeichert.';
|
||||||
|
} catch (e: unknown) {
|
||||||
|
error = e instanceof Error ? e.message : 'Fehler beim Speichern.';
|
||||||
|
} finally {
|
||||||
|
saving = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function abmelden() {
|
||||||
|
pb.authStore.clear();
|
||||||
|
goto('/login');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head><title>Einstellungen — vereins.haus</title></svelte:head>
|
||||||
|
|
||||||
|
<h1>Einstellungen</h1>
|
||||||
|
|
||||||
|
{#if loading}
|
||||||
|
<p class="hint">Laden…</p>
|
||||||
|
{:else}
|
||||||
|
<form onsubmit={(e) => { e.preventDefault(); speichern(); }}>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Vereinsprofil</h2>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="name">Vereinsname *</label>
|
||||||
|
<input id="name" type="text" bind:value={name} required />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="email">E-Mail</label>
|
||||||
|
<input id="email" type="email" bind:value={email} placeholder="info@meinverein.de" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="telefon">Telefon</label>
|
||||||
|
<input id="telefon" type="tel" bind:value={telefon} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="website">Website</label>
|
||||||
|
<input id="website" type="url" bind:value={website} placeholder="https://meinverein.de" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Anschrift</h2>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="adresse">Straße & Hausnummer</label>
|
||||||
|
<input id="adresse" type="text" bind:value={adresse} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="field" style="flex: 0 0 5.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>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="bundesland">Bundesland</label>
|
||||||
|
<select id="bundesland" bind:value={bundesland}>
|
||||||
|
{#each bundeslaender as [val, label]}
|
||||||
|
<option value={val}>{label}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>SEPA-Lastschrift</h2>
|
||||||
|
<p class="sepa-hint">
|
||||||
|
Für den SEPA-XML-Export. Gläubiger-ID beim Finanzamt oder der Bundesbank beantragen.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="glaeubigerid">Gläubiger-ID</label>
|
||||||
|
<input id="glaeubigerid" type="text" bind:value={glaeubigerid} placeholder="DE98ZZZ09999999999" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="iban">IBAN des Vereinskontos</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>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{#if error}
|
||||||
|
<p class="error">{error}</p>
|
||||||
|
{/if}
|
||||||
|
{#if success}
|
||||||
|
<p class="success">{success}</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<button type="submit" class="btn-primary" disabled={saving}>
|
||||||
|
{saving ? 'Speichern…' : 'Speichern'}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<button class="btn-logout" onclick={abmelden}>Abmelden</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h1 { font-size: 1.4rem; font-weight: 700; color: #1e293b; margin-bottom: 1.5rem; }
|
||||||
|
|
||||||
|
section {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
padding-bottom: 1.5rem;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #94a3b8;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
margin-bottom: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sepa-hint {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
margin-bottom: 0.85rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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 {
|
||||||
|
padding: 0.65rem 0.85rem;
|
||||||
|
border: 1.5px solid #e2e8f0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
background: #fff;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
}
|
||||||
|
input:focus, select:focus { outline: none; border-color: #1e40af; }
|
||||||
|
|
||||||
|
.error { color: #dc2626; font-size: 0.875rem; margin-bottom: 0.75rem; }
|
||||||
|
.success { color: #16a34a; font-size: 0.875rem; margin-bottom: 0.75rem; }
|
||||||
|
.hint { color: #94a3b8; font-size: 0.95rem; }
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.75rem;
|
||||||
|
background: #1e40af;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
.btn-primary:hover:not(:disabled) { background: #1d3a9e; }
|
||||||
|
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
height: 1px;
|
||||||
|
background: #f1f5f9;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-logout {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.75rem;
|
||||||
|
background: none;
|
||||||
|
border: 1.5px solid #e2e8f0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: #64748b;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 5rem;
|
||||||
|
}
|
||||||
|
.btn-logout:hover { border-color: #94a3b8; color: #1e293b; }
|
||||||
|
</style>
|
||||||
26
pocketbase/pb_migrations/1779230400_verein_kontakt.js
Normal file
26
pocketbase/pb_migrations/1779230400_verein_kontakt.js
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((app) => {
|
||||||
|
const c = app.findCollectionByNameOrId("pbc_3589557411") // vereine
|
||||||
|
c.fields.addAt(99, new Field({
|
||||||
|
"type": "email", "id": "email2001000060", "name": "email",
|
||||||
|
"help": "", "hidden": false, "presentable": false, "required": false, "system": false,
|
||||||
|
"exceptDomains": null, "onlyDomains": null
|
||||||
|
}))
|
||||||
|
c.fields.addAt(99, new Field({
|
||||||
|
"type": "text", "id": "text2001000061", "name": "telefon",
|
||||||
|
"help": "", "hidden": false, "presentable": false, "required": false, "system": false,
|
||||||
|
"autogeneratePattern": "", "min": 0, "max": 0, "pattern": ""
|
||||||
|
}))
|
||||||
|
c.fields.addAt(99, new Field({
|
||||||
|
"type": "url", "id": "url2001000062", "name": "website",
|
||||||
|
"help": "", "hidden": false, "presentable": false, "required": false, "system": false,
|
||||||
|
"exceptDomains": null, "onlyDomains": null
|
||||||
|
}))
|
||||||
|
app.save(c)
|
||||||
|
}, (app) => {
|
||||||
|
const c = app.findCollectionByNameOrId("pbc_3589557411")
|
||||||
|
c.fields.removeById("email2001000060")
|
||||||
|
c.fields.removeById("text2001000061")
|
||||||
|
c.fields.removeById("url2001000062")
|
||||||
|
app.save(c)
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue