diff --git a/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx b/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx index 4df9a9f7..c92b8e3a 100644 --- a/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx +++ b/admin-compliance/app/sdk/agent/_components/DocCheckTab.tsx @@ -10,6 +10,8 @@ interface DocEntry { type: string label: string url: string + text: string // P-Paste: User kopiert Doc-Text direkt rein + mode: 'url' | 'text' // welcher Input wird aktiv genutzt } const DOC_TYPES = [ @@ -28,7 +30,8 @@ const DOC_TYPES = [ ] function newEntry(): DocEntry { - return { id: crypto.randomUUID().slice(0, 8), type: 'dse', label: '', url: '' } + return { id: crypto.randomUUID().slice(0, 8), type: 'dse', label: '', + url: '', text: '', mode: 'url' } } export function DocCheckTab() { @@ -81,7 +84,7 @@ export function DocCheckTab() { } const handleSubmit = async () => { - const validEntries = entries.filter(e => e.url.trim()) + const validEntries = entries.filter(e => e.url.trim() || e.text.trim()) if (validEntries.length === 0) return setLoading(true) @@ -96,8 +99,13 @@ export function DocCheckTab() { body: JSON.stringify({ entries: validEntries.map(e => ({ doc_type: e.type, - label: e.label || e.url.split('/').pop() || 'Dokument', - url: e.url.trim(), + label: e.label + || (e.url ? e.url.split('/').pop() : '') + || `${e.type}-paste`, + url: e.mode === 'text' ? '' : e.url.trim(), + // Backend nimmt text > url. Wenn beide gefuellt sind und + // mode='url', schicken wir den text NICHT mit. + text: e.mode === 'text' ? e.text.trim() : '', })), check_cookie_banner: checkCookieBanner, use_agent: useAgent, @@ -148,41 +156,83 @@ export function DocCheckTab() { {/* P79 Pre-Scan-Wizard — 8 Pflichtfelder */} - {/* URL Entries */} -
+ {/* URL / Text Entries */} +
{entries.map((entry, i) => ( -
- - updateEntry(entry.id, 'label', e.target.value)} - placeholder={entry.type === 'other' ? 'Dokumentname' : 'Version / Stand (optional)'} - className="w-40 px-3 py-2.5 border border-gray-300 rounded-lg text-sm shrink-0" - /> - updateEntry(entry.id, 'url', e.target.value)} - onBlur={() => autoLabel(entry)} - placeholder="https://example.com/datenschutz" - className="flex-1 px-3 py-2.5 border border-gray-300 rounded-lg text-sm" - /> - {entries.length > 1 && ( - +
+
+ + updateEntry(entry.id, 'label', e.target.value)} + placeholder={entry.type === 'other' ? 'Dokumentname' : 'Version / Stand (optional)'} + className="w-40 px-3 py-2.5 border border-gray-300 rounded-lg text-sm shrink-0" + /> + + {/* Mode-Toggle URL / Text */} +
+ + +
+ + {entry.mode === 'url' && ( + updateEntry(entry.id, 'url', e.target.value)} + onBlur={() => autoLabel(entry)} + placeholder="https://example.com/datenschutz" + className="flex-1 px-3 py-2.5 border border-gray-300 rounded-lg text-sm" + /> + )} + + {entries.length > 1 && ( + + )} +
+ + {entry.mode === 'text' && ( +
+