Loheide-eu-mitarbeiterplatt.../public/build/assets/FormRenderer-BrPUPdr2.js
Friederich Loheide 11123fecc0
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m0s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m11s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m7s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m52s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m2s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m31s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m27s
CI / Build-Artefakte aktuell (pull_request) Successful in 53s
Formulare, WordPress-Import und E-Mail-Versand
- Formular-Plugin: Baukasten mit 13 Feldtypen, Bedingungen, Vorbelegung
  aus dem Profil, Datei-Uploads (geschützt), anonyme Formulare, „nur einmal“,
  Einsendeschluss, Sichtbarkeit, Löschfrist; Einsendungen im Backend und per
  Mail (optional ohne Angaben, Kopie an die Person); Rechte je Formular und
  Rolle für Ansehen/Export und Löschen; CSV für Excel; Pagebuilder-Block
- WordPress-Import (Plugin): WXR-Datei einlesen, Kategorien/Personen zuordnen,
  Beiträge mit Status, Datum, Beitragsbild und Bildern im Text übernehmen,
  optional Seiten mit Hierarchie; in Portionen, wiederholbar ohne Doppelungen
- E-Mail-Versand im Admin (SMTP, verschlüsseltes Passwort, Test-Mail)
- Speichertest unabhängig vom Verbrauch der Test-Suite

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 09:20:54 +00:00

1 line
No EOL
8.5 KiB
JavaScript

import{D as e,E as t,On as n,Yt as r,Zn as i,_ as a,b as o,bt as s,g as c,mt as l,o as u,qt as d,tr as f,v as p,wt as ee,y as m}from"./runtime-core.esm-bundler-B8D2lM98.js";import{_ as te,w as h,y as ne}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{i as g,r as re}from"./app-qaQo9ARB.js";import{A as ie,j as _}from"./utils-DfNUDixG.js";import{F as ae,U as oe}from"./PersonAvatar-CD4S56En.js";import{t as se}from"./eye-off-D9ExUiqn.js";import{n as v,t as y}from"./NativeSelect-BmmO8Miz.js";import{t as b}from"./button-BVLATeqq.js";import{t as x}from"./Input-DE5SwW-e.js";import{t as S}from"./Textarea-_u9EqblO.js";var C=_({name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]}),w={key:0,class:`flex gap-3 rounded-lg border border-emerald-200 bg-emerald-50 p-5 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100`,role:`status`},T={class:`font-medium whitespace-pre-line`},E={key:0,class:`mt-1 text-sm opacity-80`},D={key:1,class:`rounded-lg border bg-muted px-5 py-4 text-sm`},O={key:2,class:`rounded-lg border bg-muted px-5 py-4 text-sm`},k={key:0,class:`flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-[13px] text-muted-foreground @xl:col-span-2`},A={key:1,class:`rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive @xl:col-span-2`},j={key:0,class:`pt-2 text-lg font-semibold @xl:col-span-2`},M={key:1,class:`text-sm leading-relaxed whitespace-pre-line text-muted-foreground @xl:col-span-2`},N=[`for`],P=[`id`,`onUpdate:modelValue`,`aria-invalid`],F={key:0,class:`text-destructive`},I={key:0,class:`text-destructive`},L=[`aria-labelledby`],ce=[`onUpdate:modelValue`,`name`,`value`],R=[`checked`,`onChange`],z={key:3,class:`grid gap-2`},B={key:0,class:`grid gap-1`},V={class:`min-w-0 flex-1 truncate`},H={class:`text-xs text-muted-foreground`},U=[`aria-label`,`onClick`],W={key:1,class:`flex h-10 cursor-pointer items-center justify-center gap-2 rounded-md border border-dashed text-sm text-muted-foreground hover:border-brand-300 hover:text-foreground`},G=[`id`,`accept`,`multiple`,`onChange`],le={key:2,class:`text-[13px] text-destructive`},ue={key:3,class:`text-[13px] text-muted-foreground`},de={class:`flex items-center gap-4 border-t pt-5 @xl:col-span-2`},K={__name:`FormRenderer`,props:{form:{type:Object,required:!0},compact:{type:Boolean,default:!1}},setup(_){let K=_,q=g(),fe=[`text`,`textarea`,`email`,`phone`,`number`,`date`,`select`,`radio`,`checkboxes`,`checkbox`,`file`];function pe(e){let t=K.form.prefill?.[e.key];return e.type===`checkboxes`||e.type===`file`?[]:e.type===`checkbox`?!1:t??``}let J=re({answers:Object.fromEntries(K.form.fields.filter(e=>fe.includes(e.type)).map(e=>[e.key,pe(e)]))}),me=c(()=>q.props.flash?.form_submitted===K.form.id);function Y(e,t=0){if(!e.condition||t>10)return!0;let n=K.form.fields.find(t=>t.key===e.condition.field);if(!n||!Y(n,t+1))return!1;let r=J.answers[e.condition.field],i=(Array.isArray(r)?r:r===!0?[`1`]:r===!1||r===``||r==null?[]:[String(r)]).map(String),a=e.condition.value??``;switch(e.condition.operator){case`not_equals`:return!i.includes(a);case`filled`:return i.length>0;case`empty`:return i.length===0;default:return i.includes(a)}}let X=c(()=>K.form.fields.filter(e=>Y(e)));function Z(e){return J.errors[`answers.${e.key}`]??Object.entries(J.errors).find(([t])=>t.startsWith(`answers.${e.key}.`))?.[1]}function Q(e,t){let n=new Set(J.answers[e.key]);n.has(t)?n.delete(t):n.add(t),J.answers[e.key]=[...n]}function he(e,t){let n=[...t.target.files??[]];J.answers[e.key]=e.multiple?[...J.answers[e.key],...n].slice(0,10):n.slice(0,1),t.target.value=``}function ge(e,t){J.answers[e.key]=J.answers[e.key].filter((e,n)=>n!==t)}function _e(){let e=new Set(X.value.map(e=>e.key));J.transform(t=>({answers:Object.fromEntries(Object.entries(t.answers).filter(([t])=>e.has(t)))})).post(K.form.url,{forceFormData:!0,preserveScroll:!0,onSuccess:()=>{q.props.flash?.form_submitted===K.form.id&&J.reset()}})}let ve=e=>e>1048576?`${(e/1024/1024).toFixed(1).replace(`.`,`,`)} MB`:`${Math.max(1,Math.round(e/1024))} KB`,$=e=>`f${K.form.id}-${e.key}`;return(c,g)=>me.value?(l(),o(`div`,w,[e(n(oe),{class:`mt-0.5 size-5 shrink-0 text-emerald-600`}),a(`div`,null,[a(`p`,T,f(_.form.confirmation),1),_.form.send_copy?(l(),o(`p`,E,`Eine Kopie Ihrer Angaben ist per E-Mail unterwegs.`)):m(``,!0)])])):_.form.already_submitted?(l(),o(`p`,D,`Sie haben dieses Formular bereits ausgefüllt. Vielen Dank!`)):_.form.open?(l(),o(`form`,{key:3,class:`grid gap-5 @xl:grid-cols-2`,novalidate:``,onSubmit:h(_e,[`prevent`])},[_.form.anonymous?(l(),o(`p`,k,[e(n(se),{class:`mt-0.5 size-4 shrink-0`}),g[0]||=t(` Anonym: Ihr Name und Ihre E-Mail-Adresse werden nicht gespeichert. `,-1)])):m(``,!0),n(J).errors.form?(l(),o(`p`,A,f(n(J).errors.form),1)):m(``,!0),(l(!0),o(u,null,s(X.value,c=>(l(),o(u,{key:c.key},[c.type===`heading`?(l(),o(`h3`,j,f(c.text),1)):c.type===`paragraph`?(l(),o(`p`,M,f(c.text),1)):(l(),o(`div`,{key:2,class:i([`grid content-start gap-1.5`,c.width===`half`?``:`@xl:col-span-2`])},[c.type===`checkbox`?(l(),o(`label`,{key:0,for:$(c),class:`flex items-start gap-2.5 text-sm`},[r(a(`input`,{id:$(c),"onUpdate:modelValue":e=>n(J).answers[c.key]=e,type:`checkbox`,class:`mt-0.5 size-4 shrink-0 accent-[var(--brand)]`,"aria-invalid":!!Z(c)},null,8,P),[[te,n(J).answers[c.key]]]),a(`span`,null,[t(f(c.label),1),c.required?(l(),o(`span`,F,` *`)):m(``,!0)])],8,N)):(l(),o(u,{key:1},[(l(),p(ee([`radio`,`checkboxes`].includes(c.type)?`span`:`label`),{for:$(c),class:`text-[13px] font-medium`,id:`${$(c)}-label`},{default:d(()=>[t(f(c.label),1),c.required?(l(),o(`span`,I,` *`)):m(``,!0)]),_:2},1032,[`for`,`id`])),c.type===`textarea`?(l(),p(n(S),{key:0,id:$(c),modelValue:n(J).answers[c.key],"onUpdate:modelValue":e=>n(J).answers[c.key]=e,rows:c.rows??4,maxlength:c.max,"aria-invalid":!!Z(c)},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`rows`,`maxlength`,`aria-invalid`])):c.type===`select`?(l(),p(y,{key:1,id:$(c),modelValue:n(J).answers[c.key],"onUpdate:modelValue":e=>n(J).answers[c.key]=e,options:c.options.map(e=>({value:e,label:e})),placeholder:`Bitte wählen …`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`options`])):c.type===`radio`||c.type===`checkboxes`?(l(),o(`div`,{key:2,class:`grid gap-1.5`,role:`group`,"aria-labelledby":`${$(c)}-label`},[(l(!0),o(u,null,s(c.options,e=>(l(),o(`label`,{key:e,class:`flex items-center gap-2.5 text-sm`},[c.type===`radio`?r((l(),o(`input`,{key:0,"onUpdate:modelValue":e=>n(J).answers[c.key]=e,type:`radio`,name:$(c),value:e,class:`size-4 accent-[var(--brand)]`},null,8,ce)),[[ne,n(J).answers[c.key]]]):(l(),o(`input`,{key:1,type:`checkbox`,checked:n(J).answers[c.key].includes(e),class:`size-4 accent-[var(--brand)]`,onChange:t=>Q(c,e)},null,40,R)),t(` `+f(e),1)]))),128))],8,L)):c.type===`file`?(l(),o(`div`,z,[n(J).answers[c.key].length?(l(),o(`ul`,B,[(l(!0),o(u,null,s(n(J).answers[c.key],(t,r)=>(l(),o(`li`,{key:r,class:`flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm`},[e(n(C),{class:`size-4 shrink-0 text-muted-foreground`}),a(`span`,V,f(t.name),1),a(`span`,H,f(ve(t.size)),1),a(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,"aria-label":`${t.name} entfernen`,onClick:e=>ge(c,r)},[e(n(ae),{class:`size-3.5`})],8,U)]))),128))])):m(``,!0),c.multiple||!n(J).answers[c.key].length?(l(),o(`label`,W,[e(n(C),{class:`size-4`}),t(` `+f(c.multiple?`Dateien auswählen`:`Datei auswählen`)+` `,1),a(`input`,{id:$(c),type:`file`,class:`sr-only`,accept:c.accept,multiple:c.multiple,onChange:e=>he(c,e)},null,40,G)])):m(``,!0)])):(l(),p(n(x),{key:4,id:$(c),modelValue:n(J).answers[c.key],"onUpdate:modelValue":e=>n(J).answers[c.key]=e,type:{email:`email`,phone:`tel`,number:`number`,date:`date`}[c.type]??`text`,placeholder:c.placeholder,maxlength:c.type===`text`?c.max:void 0,min:c.type===`number`?c.min:void 0,max:c.type===`number`?c.max:void 0,"aria-invalid":!!Z(c)},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`type`,`placeholder`,`maxlength`,`min`,`max`,`aria-invalid`]))],64)),Z(c)?(l(),o(`p`,le,f(Z(c)),1)):c.help?(l(),o(`p`,ue,[t(f(c.help),1),c.type===`file`&&c.max_size?(l(),o(u,{key:0},[t(` (höchstens `+f(c.max_size)+` MB)`,1)],64)):m(``,!0)])):m(``,!0)],2))],64))),128)),a(`div`,de,[e(n(b),{type:`submit`,disabled:n(J).processing},{default:d(()=>[n(J).processing?(l(),p(n(ie),{key:0,class:`animate-spin`})):(l(),p(n(v),{key:1})),t(` `+f(_.form.submit_label),1)]),_:1},8,[`disabled`]),g[1]||=a(`span`,{class:`text-xs text-muted-foreground`},`* Pflichtfeld`,-1)])],32)):(l(),o(`p`,O,`Dieses Formular nimmt keine Einsendungen mehr an.`))}};export{K as t};