diff --git a/pages/cms/satzung.vue b/pages/cms/satzung.vue index 4fc403b..1caf010 100644 --- a/pages/cms/satzung.vue +++ b/pages/cms/satzung.vue @@ -7,6 +7,7 @@ +

PDF-Upload @@ -68,14 +69,15 @@

+

- Aktuelle Satzung + Aktuelle Satzung (PDF)

-
+

PDF-Datei verfügbar @@ -94,6 +96,52 @@

+ +
+
+

+ Textfassung für die Website +

+ +
+

+ Diese HTML-Fassung wird auf der Seite „Verein → Satzung“ angezeigt. Die PDF-Version bleibt die rechtlich verbindliche Fassung. +

+ + +
+
import { ref, onMounted } from 'vue' +import RichTextEditor from '~/components/RichTextEditor.vue' definePageMeta({ middleware: 'auth', @@ -121,6 +170,8 @@ const currentPdfUrl = ref('') const lastUpdated = ref('') const message = ref('') const messageType = ref('') +const satzungContent = ref('') +const savingText = ref(false) async function loadCurrentSatzung() { try { @@ -131,6 +182,11 @@ async function loadCurrentSatzung() { // Einfache Zeitstempel-Simulation lastUpdated.value = new Date().toLocaleDateString('de-DE') } + if (satzung?.content) { + satzungContent.value = satzung.content + } else { + satzungContent.value = '' + } } catch (e) { console.error('Fehler beim Laden der aktuellen Satzung:', e) } @@ -187,5 +243,51 @@ async function uploadPdf() { } } +async function saveText() { + savingText.value = true + message.value = '' + try { + const current = await $fetch('/api/config') + const currentSeiten = current.seiten || {} + const currentSatzung = currentSeiten.satzung || {} + + const updated = { + ...current, + seiten: { + ...currentSeiten, + satzung: { + ...currentSatzung, + content: satzungContent.value || '' + } + } + } + + await $fetch('/api/config', { + method: 'PUT', + body: updated + }) + + message.value = 'Satzungstext erfolgreich gespeichert' + messageType.value = 'success' + + try { + window.showSuccessModal && window.showSuccessModal('Erfolg', 'Satzungstext erfolgreich gespeichert.') + } catch { + // Modal optional + } + } catch (error) { + const errMsg = error?.data?.message || 'Fehler beim Speichern des Satzungstextes' + message.value = errMsg + messageType.value = 'error' + try { + window.showErrorModal && window.showErrorModal('Fehler', errMsg) + } catch { + // optional + } + } finally { + savingText.value = false + } +} + onMounted(loadCurrentSatzung)