Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 5m33s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 5m25s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 6m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m54s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 9m9s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m55s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 10m12s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 1m26s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m48s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m52s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 line
No EOL
12 KiB
JavaScript
1 line
No EOL
12 KiB
JavaScript
import{D as e,E as t,Ht as n,On as r,Yt 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 m,y as h}from"./runtime-core.esm-bundler-B8D2lM98.js";import{b as g,w as _}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{a as v,i as ee,o as te,s as ne}from"./dist--2OKCVzt.js";import{t as y}from"./createLucideIcon-VlaMqNX_.js";import{n as b,t as x}from"./arrow-up-DXJcYM_I.js";import{t as re}from"./circle-dot-Bkd78WI0.js";import{t as ie}from"./loader-circle-Wr6tQn-J.js";import{i as S}from"./PopoverTrigger-Cah311ye.js";import{t as ae}from"./plus-CQwC4vy-.js";import{t as oe}from"./save-Bjo-pGWz.js";import{t as C}from"./trash-CONUPzoz.js";import{t as se}from"./triangle-alert-DyO_Fk2w.js";import{t as ce}from"./x-DU8daajy.js";import{n as le}from"./lib-Be7KNAML.js";import{C as w,Mt as T,T as E,b as D,d as O,dt as k,m as A,p as j,u as M,w as N}from"./app-BmJeQFgp.js";var P=y({name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]}),F=y({name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]}),I={class:`grid min-w-0 gap-6`},L={class:`grid gap-5`},R={key:0,class:`flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-3 text-[13px]`},z={key:1,class:`text-[13px] text-destructive`},B={class:`grid gap-4`},V={class:`flex items-center gap-2`},H={class:`inline-flex items-center gap-1.5 rounded bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`},U={key:0,class:`grid gap-2`},W={class:`w-5 text-right text-xs text-muted-foreground tabular-nums`},ue={key:1,class:`grid gap-3 sm:grid-cols-3`},de=[`id`,`onUpdate:modelValue`],fe={class:`flex flex-wrap items-center gap-x-6 gap-y-3 border-t pt-3 text-sm`},pe={class:`flex items-center gap-2`},me={key:0,class:`flex items-center gap-2`},he={class:`flex flex-wrap gap-2`},ge={class:`grid gap-6`},_e={class:`grid gap-4`},ve={class:`flex items-center justify-between gap-3 text-sm`},ye={class:`flex items-center justify-between gap-3 text-sm`},be={class:`block text-xs text-muted-foreground`},xe={class:`grid gap-4`},Se=[`value`],Ce={class:`flex items-center justify-between gap-3 text-sm`},we={key:0,class:`text-[13px] text-destructive`},Te={class:`-mt-1 mb-3 flex items-start gap-2 text-[13px] text-muted-foreground`},G={__name:`Editor`,props:{poll:{type:Object,default:null},visibilityOptions:{type:Object,required:!0},audienceOptions:{type:Object,required:!0}},setup(y){let G=y,Ee=te();n(()=>Ee.props.flash.status,e=>e&&le.success(e),{immediate:!0});let K=()=>Math.random().toString(36).slice(2,10),q={single:{label:`Eine Antwort`,icon:re},multiple:{label:`Mehrere Antworten`,icon:T},scale:{label:`Skala`,icon:P},text:{label:`Freitext`,icon:F}},J=G.poll,Y=v({title:J?.title??``,description:J?.description??``,questions:J?.questions?.map(e=>({...e,options:e.options?.map(e=>({...e}))}))??[{id:K(),type:`single`,label:``,required:!0,options:[{id:K(),label:``},{id:K(),label:``}]}],anonymous:J?.anonymous??!1,results_visibility:J?.results_visibility??`after_vote`,published:J?.published??!1,published_at:J?.published_at??``,closes_at:J?.closes_at??``,announce:J?.announce??!1,audience:J?.audience??{}});function X(e){let t={id:K(),type:e,label:``,required:!0};(e===`single`||e===`multiple`)&&(t.options=[{id:K(),label:``},{id:K(),label:``}]),e===`multiple`&&(t.max=null),e===`scale`&&Object.assign(t,{scale:5,min_label:`gar nicht`,max_label:`sehr`}),e===`text`&&(t.required=!1),Y.questions.push(t)}function Z(e,t){let n=Y.questions,[r]=n.splice(e,1);n.splice(e+t,0,r)}let De=c(()=>Object.values(Y.audience??{}).some(e=>e?.length)),Q=c(()=>(J?.responses??0)>0);function $(){let e={preserveScroll:!0};J?Y.put(`/redaktion/umfragen/${J.id}`,e):Y.post(`/redaktion/umfragen`,e)}function Oe(){window.confirm(`Umfrage „${J.title}“ samt ${J.responses} Teilnahmen löschen?`)&&ne.delete(`/redaktion/umfragen/${J.id}`)}return(n,c)=>(l(),p(E,{title:r(J)?`Bearbeiten: ${r(J).title}`:`Neue Umfrage`},{default:d(()=>[e(N,{title:r(J)?`Umfrage bearbeiten`:`Neue Umfrage`,breadcrumbs:[{label:`Umfragen`,href:`/umfragen`}]},{actions:d(()=>[r(J)?(l(),p(r(j),{key:0,variant:`ghost`,class:`text-destructive hover:text-destructive`,onClick:Oe},{default:d(()=>[e(r(C)),c[9]||=t(` Löschen`,-1)]),_:1})):h(``,!0),r(J)?(l(),p(r(j),{key:1,variant:`outline`,"as-child":``},{default:d(()=>[e(r(ee),{href:r(J).url},{default:d(()=>[t(f(r(J).published?`Ansehen & Ergebnisse`:`Vorschau`),1)]),_:1},8,[`href`])]),_:1})):h(``,!0),e(r(j),{disabled:r(Y).processing,onClick:$},{default:d(()=>[r(Y).processing?(l(),p(r(ie),{key:0,class:`animate-spin`})):(l(),p(r(oe),{key:1})),c[10]||=t(` Speichern`,-1)]),_:1},8,[`disabled`])]),_:1},8,[`title`]),a(`form`,{class:`grid grid-cols-1 items-start gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]`,onSubmit:_($,[`prevent`])},[a(`div`,I,[e(w,null,{default:d(()=>[a(`div`,L,[e(D,{id:`poll-title`,label:`Titel bzw. Frage`,error:r(Y).errors.title},{default:d(()=>[e(r(O),{id:`poll-title`,modelValue:r(Y).title,"onUpdate:modelValue":c[0]||=e=>r(Y).title=e,maxlength:`200`,placeholder:`z. B. Wie gefällt Ihnen das neue Kantinenangebot?`,class:`text-base`},null,8,[`modelValue`])]),_:1},8,[`error`]),e(D,{id:`poll-description`,label:`Einleitung (optional)`,error:r(Y).errors.description},{default:d(()=>[e(r(M),{id:`poll-description`,modelValue:r(Y).description,"onUpdate:modelValue":c[1]||=e=>r(Y).description=e,rows:`3`,maxlength:`5000`},null,8,[`modelValue`])]),_:1},8,[`error`])])]),_:1}),Q.value?(l(),o(`p`,R,[e(r(se),{class:`mt-0.5 size-4 shrink-0 text-destructive`}),t(` Es gibt bereits `+f(r(J).responses)+` `+f(r(J).responses===1?`Teilnahme`:`Teilnahmen`)+`. Tippfehler lassen sich korrigieren – neue oder entfernte Antworten verfälschen aber die Ergebnisse. `,1)])):h(``,!0),r(Y).errors.questions?(l(),o(`p`,z,f(r(Y).errors.questions),1)):h(``,!0),(l(!0),o(u,null,s(r(Y).questions,(n,_)=>(l(),p(w,{key:n.id},{default:d(()=>[a(`div`,B,[a(`div`,V,[a(`span`,H,[(l(),p(m(q[n.type].icon),{class:`size-3.5`})),t(` Frage `+f(_+1)+` · `+f(q[n.type].label),1)]),c[11]||=a(`span`,{class:`flex-1`},null,-1),e(r(j),{type:`button`,variant:`ghost`,size:`icon`,class:`size-8`,disabled:_===0,"aria-label":`Nach oben`,onClick:e=>Z(_,-1)},{default:d(()=>[e(r(x))]),_:1},8,[`disabled`,`onClick`]),e(r(j),{type:`button`,variant:`ghost`,size:`icon`,class:`size-8`,disabled:_===r(Y).questions.length-1,"aria-label":`Nach unten`,onClick:e=>Z(_,1)},{default:d(()=>[e(r(b))]),_:1},8,[`disabled`,`onClick`]),e(r(j),{type:`button`,variant:`ghost`,size:`icon`,class:`size-8 text-muted-foreground hover:text-destructive`,disabled:r(Y).questions.length===1,"aria-label":`Frage entfernen`,onClick:e=>r(Y).questions.splice(_,1)},{default:d(()=>[e(r(C))]),_:1},8,[`disabled`,`onClick`])]),e(r(O),{modelValue:n.label,"onUpdate:modelValue":e=>n.label=e,maxlength:`300`,placeholder:r(Y).questions.length===1?`Frage (z. B. wie der Titel)`:`Frage`,"aria-label":`Frage ${_+1}`},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`]),n.options?(l(),o(`div`,U,[(l(!0),o(u,null,s(n.options,(t,i)=>(l(),o(`div`,{key:t.id,class:`flex items-center gap-2`},[a(`span`,W,f(i+1)+`.`,1),e(r(O),{modelValue:t.label,"onUpdate:modelValue":e=>t.label=e,maxlength:`200`,placeholder:`Antwort ${i+1}`,class:`h-9`,"aria-label":`Antwort ${i+1}`},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`]),e(r(j),{type:`button`,variant:`ghost`,size:`icon`,class:`size-8 shrink-0 text-muted-foreground`,disabled:n.options.length<=2,"aria-label":`Antwort entfernen`,onClick:e=>n.options.splice(i,1)},{default:d(()=>[e(r(ce))]),_:1},8,[`disabled`,`onClick`])]))),128)),n.options.length<20?(l(),p(r(j),{key:0,type:`button`,variant:`ghost`,size:`sm`,class:`justify-self-start`,onClick:e=>n.options.push({id:K(),label:``})},{default:d(()=>[e(r(ae)),c[12]||=t(` Antwort hinzufügen`,-1)]),_:1},8,[`onClick`])):h(``,!0)])):h(``,!0),n.type===`scale`?(l(),o(`div`,ue,[e(D,{id:`scale-${n.id}`,label:`Stufen`},{default:d(()=>[i(a(`select`,{id:`scale-${n.id}`,"onUpdate:modelValue":e=>n.scale=e,class:`h-9 rounded-md border bg-background px-2 text-sm`},[...c[13]||=[a(`option`,{value:5},`1 bis 5`,-1),a(`option`,{value:10},`1 bis 10`,-1)]],8,de),[[g,n.scale,void 0,{number:!0}]])]),_:2},1032,[`id`]),e(D,{id:`min-${n.id}`,label:`1 bedeutet`},{default:d(()=>[e(r(O),{id:`min-${n.id}`,modelValue:n.min_label,"onUpdate:modelValue":e=>n.min_label=e,maxlength:`60`,class:`h-9`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`id`]),e(D,{id:`max-${n.id}`,label:`${n.scale} bedeutet`},{default:d(()=>[e(r(O),{id:`max-${n.id}`,modelValue:n.max_label,"onUpdate:modelValue":e=>n.max_label=e,maxlength:`60`,class:`h-9`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`id`,`label`])])):h(``,!0),a(`div`,fe,[a(`label`,pe,[e(r(S),{modelValue:n.required,"onUpdate:modelValue":e=>n.required=e},null,8,[`modelValue`,`onUpdate:modelValue`]),c[14]||=t(` Pflichtfrage`,-1)]),n.type===`multiple`?(l(),o(`label`,me,[c[15]||=t(` Höchstens `,-1),e(r(O),{modelValue:n.max,"onUpdate:modelValue":e=>n.max=e,modelModifiers:{number:!0},type:`number`,min:`1`,max:n.options.length-1,placeholder:`alle`,class:`h-8 w-20`},null,8,[`modelValue`,`onUpdate:modelValue`,`max`]),c[16]||=t(` Antworten `,-1)])):h(``,!0)])])]),_:2},1024))),128)),a(`div`,he,[c[17]||=a(`span`,{class:`mr-1 self-center text-sm text-muted-foreground`},`Frage hinzufügen:`,-1),(l(),o(u,null,s(q,(n,i)=>e(r(j),{key:i,type:`button`,variant:`outline`,size:`sm`,disabled:r(Y).questions.length>=30,onClick:e=>X(i)},{default:d(()=>[(l(),p(m(n.icon))),t(` `+f(n.label),1)]),_:2},1032,[`disabled`,`onClick`])),64))])]),a(`div`,ge,[e(w,{title:`Veröffentlichung`},{default:d(()=>[a(`div`,_e,[a(`label`,ve,[c[18]||=a(`span`,null,[a(`span`,{class:`font-medium`},`Veröffentlicht`),a(`span`,{class:`block text-xs text-muted-foreground`},`Sonst nur für die Redaktion sichtbar.`)],-1),e(r(S),{modelValue:r(Y).published,"onUpdate:modelValue":c[2]||=e=>r(Y).published=e},null,8,[`modelValue`])]),r(Y).published?(l(),p(D,{key:0,id:`poll-start`,label:`Beginn (optional)`,hint:`Leer = sofort.`,error:r(Y).errors.published_at},{default:d(()=>[e(r(O),{id:`poll-start`,modelValue:r(Y).published_at,"onUpdate:modelValue":c[3]||=e=>r(Y).published_at=e,type:`datetime-local`},null,8,[`modelValue`])]),_:1},8,[`error`])):h(``,!0),e(D,{id:`poll-end`,label:`Ende (optional)`,hint:`Leer = läuft, bis Sie sie beenden.`,error:r(Y).errors.closes_at},{default:d(()=>[e(r(O),{id:`poll-end`,modelValue:r(Y).closes_at,"onUpdate:modelValue":c[4]||=e=>r(Y).closes_at=e,type:`datetime-local`},null,8,[`modelValue`])]),_:1},8,[`error`]),a(`label`,ye,[a(`span`,null,[c[19]||=a(`span`,{class:`font-medium`},`Benachrichtigen`,-1),a(`span`,be,f(r(J)?.announced?`Bereits angekündigt.`:`Die Zielgruppe bekommt zum Start einen Hinweis.`),1)]),e(r(S),{modelValue:r(Y).announce,"onUpdate:modelValue":c[5]||=e=>r(Y).announce=e,disabled:r(J)?.announced},null,8,[`modelValue`,`disabled`])])])]),_:1}),e(w,{title:`Ergebnisse & Datenschutz`},{default:d(()=>[a(`div`,xe,[e(D,{id:`poll-visibility`,label:`Ergebnisse sichtbar`,error:r(Y).errors.results_visibility},{default:d(()=>[i(a(`select`,{id:`poll-visibility`,"onUpdate:modelValue":c[6]||=e=>r(Y).results_visibility=e,class:`h-9 w-full rounded-md border bg-background px-2 text-sm`},[(l(!0),o(u,null,s(y.visibilityOptions,(e,t)=>(l(),o(`option`,{key:t,value:t},f(e),9,Se))),128))],512),[[g,r(Y).results_visibility]])]),_:1},8,[`error`]),a(`label`,Ce,[c[20]||=a(`span`,null,[a(`span`,{class:`font-medium`},`Anonym`),a(`span`,{class:`block text-xs text-muted-foreground`},`Ohne Namen gespeichert – auch die Redaktion sieht nicht, wer wie abgestimmt hat.`)],-1),e(r(S),{modelValue:r(Y).anonymous,"onUpdate:modelValue":c[7]||=e=>r(Y).anonymous=e,disabled:Q.value},null,8,[`modelValue`,`disabled`])]),r(Y).errors.anonymous?(l(),o(`p`,we,f(r(Y).errors.anonymous),1)):h(``,!0),c[21]||=a(`p`,{class:`text-xs text-muted-foreground`},`Freitext-Antworten sieht nur die Redaktion.`,-1)])]),_:1}),e(w,{title:`Wer darf teilnehmen?`},{default:d(()=>[a(`p`,Te,[e(r(k),{class:`mt-0.5 size-4 shrink-0`}),t(` `+f(De.value?`Nur Personen, die mindestens eine Angabe erfüllen.`:`Alle – oder unten eingrenzen.`),1)]),e(A,{modelValue:r(Y).audience,"onUpdate:modelValue":c[8]||=e=>r(Y).audience=e,options:y.audienceOptions,"exclude-hint":`Sehen die Umfrage nie – auch wenn oben etwas passt.`},null,8,[`modelValue`,`options`])]),_:1})])],32)]),_:1},8,[`title`]))}};export{G as default}; |