'use client' /** * Consent Management Page (SDK Version) * * Admin interface for managing: * - Documents (AGB, Privacy, etc.) * - Document Versions * - Email Templates * - GDPR Processes (Art. 15-21) * - Statistics */ import { useState, useEffect } from 'react' import { useRouter } from 'next/navigation' import Link from 'next/link' import { useSDK } from '@/lib/sdk' import StepHeader from '@/components/sdk/StepHeader/StepHeader' // API Proxy URL (avoids CORS issues) const API_BASE = '/api/admin/consent' type Tab = 'documents' | 'versions' | 'emails' | 'gdpr' | 'stats' interface Document { id: string type: string name: string description: string mandatory: boolean created_at: string updated_at: string } interface Version { id: string document_id: string version: string language: string title: string content: string status: string created_at: string } // Email template editor types interface EmailTemplateData { key: string subject: string body: string } // ============================================================================ // Helper sub-components for API-backed inline editors // ============================================================================ function ApiTemplateEditor({ template, saving, onSave, onPreview, }: { template: { id: string; template_key: string; subject: string; body: string; language: string; is_active: boolean } saving: boolean onSave: (subject: string, body: string) => void onPreview: (subject: string, body: string) => void }) { const [subject, setSubject] = useState(template.subject) const [body, setBody] = useState(template.body) const [expanded, setExpanded] = useState(false) return (
{subject}
{description || 'Keine Beschreibung'}
{process.retention_days && ( Aufbewahrung: {process.retention_days} Tage )}| Typ | Name | Beschreibung | Pflicht | Erstellt | Aktionen |
|---|---|---|---|---|---|
| {doc.type} | {doc.name} | {doc.description} | {doc.mandatory ? ( Ja ) : ( Nein )} | {new Date(doc.created_at).toLocaleDateString('de-DE')} |
Erstellt: {new Date(version.created_at).toLocaleDateString('de-DE')}
{apiEmailTemplates.length > 0 ? `${apiEmailTemplates.length} DSGVO-Vorlagen aus der Datenbank` : '16 Lifecycle-Vorlagen fuer automatisierte Kommunikation'}
{template.description}
Artikel 15-21 Prozesse und Vorlagen
Hier verwalten Sie alle DSGVO-Anfragen. Jeder Artikel hat definierte Prozesse, SLAs und automatisierte Workflows.
{process.description}
{/* Actions */}