Loheide-eu-mitarbeiterplatt.../public/build/assets/FormRenderer-BSsckrsz.js
Friederich Loheide 64d9e0bbed
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m50s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m4s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m13s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m43s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m44s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m55s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m1s
Plugin-Updates über update_url (0.24.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 08:06:22 +00:00

1 line
No EOL
9.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 ne,y as re}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{a as h,o as ie}from"./dist--2OKCVzt.js";import{t as ae}from"./circle-check-K9QH5jex.js";import{t as oe}from"./eye-off-CneL5LCR.js";import{t as se}from"./loader-circle-Wr6tQn-J.js";import{t as ce}from"./lock-yku43otw.js";import{t as g}from"./paperclip-BU1eARzf.js";import{t as _}from"./send-B_gp9Kto.js";import{t as v}from"./x-DU8daajy.js";import{n as y}from"./lib-Be7KNAML.js";import{b,d as x,f as S,m as C}from"./app-ljw5ZzEq.js";var 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`],R=[`onUpdate:modelValue`,`name`,`value`],z=[`checked`,`onChange`],B={key:3,class:`grid gap-2`},le={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`},ue=[`id`,`accept`,`multiple`,`onChange`],de=[`aria-describedby`],fe=[`id`],pe={key:1,class:`text-muted-foreground italic`},me={key:2,class:`text-[13px] text-destructive`},he={key:0,href:`/profil/bearbeiten`,class:`font-medium underline`},ge=[`id`],_e={key:4,class:`text-[13px] text-muted-foreground`},ve={class:`flex items-center gap-4 border-t pt-5 @xl:col-span-2`},G={__name:`FormRenderer`,props:{form:{type:Object,required:!0},compact:{type:Boolean,default:!1},preview:{type:Boolean,default:!1}},setup(G){let K=G,q=ie(),ye=[`text`,`textarea`,`email`,`phone`,`number`,`date`,`select`,`radio`,`checkboxes`,`checkbox`,`file`];function be(e){let t=K.form.prefill?.[e.key];return e.type===`checkboxes`||e.type===`file`?[]:e.type===`checkbox`?!1:t??``}let J=h({answers:Object.fromEntries(K.form.fields.filter(e=>ye.includes(e.type)).map(e=>[e.key,be(e)]))}),xe=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 Se(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 Ce(e,t){J.answers[e.key]=J.answers[e.key].filter((e,n)=>n!==t)}function we(){if(K.preview){y.info(`Vorschau – es wird nichts gesendet.`);return}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 Te=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,h)=>xe.value?(l(),o(`div`,w,[e(n(ae),{class:`mt-0.5 size-5 shrink-0 text-emerald-600`}),a(`div`,null,[a(`p`,T,f(G.form.confirmation),1),G.form.send_copy?(l(),o(`p`,E,`Eine Kopie Ihrer Angaben ist per E-Mail unterwegs.`)):m(``,!0)])])):G.form.already_submitted?(l(),o(`p`,D,`Sie haben dieses Formular bereits ausgefüllt. Vielen Dank!`)):G.form.open?(l(),o(`form`,{key:3,class:`grid gap-5 @xl:grid-cols-2`,novalidate:``,onSubmit:ne(we,[`prevent`])},[G.form.anonymous?(l(),o(`p`,k,[e(n(oe),{class:`mt-0.5 size-4 shrink-0`}),h[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(x),{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(b,{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,R)),[[re,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,z)),t(` `+f(e),1)]))),128))],8,L)):c.type===`file`?(l(),o(`div`,B,[n(J).answers[c.key].length?(l(),o(`ul`,le,[(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(g),{class:`size-4 shrink-0 text-muted-foreground`}),a(`span`,V,f(t.name),1),a(`span`,H,f(Te(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=>Ce(c,r)},[e(n(v),{class:`size-3.5`})],8,U)]))),128))])):m(``,!0),c.multiple||!n(J).answers[c.key].length?(l(),o(`label`,W,[e(n(g),{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=>Se(c,e)},null,40,ue)])):m(``,!0)])):c.locked?(l(),o(`div`,{key:4,class:`flex h-9 items-center gap-2 rounded-md border border-input bg-muted/60 px-3 text-sm`,"aria-describedby":`${$(c)}-locked`},[e(n(ce),{class:`size-3.5 shrink-0 text-muted-foreground`}),n(J).answers[c.key]?(l(),o(`span`,{key:0,id:$(c),class:`truncate`},f(n(J).answers[c.key]),9,fe)):(l(),o(`span`,pe,f(G.preview?`wird aus dem Profil übernommen`:`nicht im Profil hinterlegt`),1))],8,de)):(l(),p(n(S),{key:5,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`,me,[t(f(Z(c))+` `,1),c.locked?(l(),o(`a`,he,`Profil öffnen`)):m(``,!0)])):c.locked?(l(),o(`p`,{key:3,id:`${$(c)}-locked`,class:`text-[13px] text-muted-foreground`},`Aus Ihrem Profil – nicht änderbar.`,8,ge)):c.help?(l(),o(`p`,_e,[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`,ve,[e(n(C),{type:`submit`,disabled:n(J).processing},{default:d(()=>[n(J).processing?(l(),p(n(se),{key:0,class:`animate-spin`})):(l(),p(n(_),{key:1})),t(` `+f(G.form.submit_label),1)]),_:1},8,[`disabled`]),h[1]||=a(`span`,{class:`text-xs text-muted-foreground`},`* Pflichtfeld`,-1)])],32)):(l(),o(`p`,O,`Dieses Formular nimmt keine Einsendungen mehr an.`))}};export{G as t};