Loheide-eu-mitarbeiterplatt.../public/build/assets/PollForm-C3eOZrYq.js
Friederich Loheide 268742983a
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m17s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m28s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 6m32s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 6m48s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 8m51s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 8m52s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 7m31s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 52s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 7m51s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m22s
KI-Assistent: OpenAI und Ollama als Anbieter (0.35.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 13:57:37 +00:00

1 line
No EOL
7.4 KiB
JavaScript
Raw 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,_ as i,b as a,bt as o,er as s,g as c,mt as l,o as u,qt as d,tr as f,v as p,y as m}from"./runtime-core.esm-bundler-B8D2lM98.js";import{w as h,y as g}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{a as _}from"./dist--2OKCVzt.js";import{t as v}from"./circle-check-K9QH5jex.js";import{t as y}from"./loader-circle-Wr6tQn-J.js";import{t as ee}from"./lock-yku43otw.js";import{_ as b,u as x}from"./app-9hFE_0ay.js";var S={class:`grid gap-6`},C={class:`text-sm text-muted-foreground`},w={class:`text-sm font-semibold`},T={key:0,class:`text-muted-foreground`},E={key:0,class:`grid gap-2.5`},D={class:`flex items-baseline justify-between gap-3 text-sm`},O={class:`min-w-0`},k={class:`shrink-0 text-muted-foreground tabular-nums`},A={key:0,class:`text-xs`},j={class:`h-2 overflow-hidden rounded-full bg-muted`},M={key:1,class:`grid gap-2`},N={class:`text-sm`},P={class:`font-semibold tabular-nums`},F={class:`text-muted-foreground`},I=[`aria-label`],L=[`title`],R={class:`text-[11px] text-muted-foreground tabular-nums`},z={key:0,class:`flex justify-between text-[11px] text-muted-foreground`},B={class:`text-sm text-muted-foreground`},V={key:0,class:`grid max-h-80 gap-2 overflow-y-auto`},H={__name:`PollResults`,props:{results:{type:Object,required:!0},compact:{type:Boolean,default:!1}},setup(e){return(n,r)=>(l(),a(`div`,S,[i(`p`,C,f(e.results.total)+` `+f(e.results.total===1?`Teilnahme`:`Teilnahmen`),1),(l(!0),a(u,null,o(e.results.questions,(n,c)=>(l(),a(`section`,{key:n.id,class:`grid gap-3`},[i(`h3`,w,[e.results.questions.length>1?(l(),a(`span`,T,f(c+1)+`. `,1)):m(``,!0),t(f(n.label),1)]),n.options?(l(),a(`ul`,E,[(l(!0),a(u,null,o(n.options,n=>(l(),a(`li`,{key:n.id,class:`grid gap-1`},[i(`div`,D,[i(`span`,O,f(n.label),1),i(`span`,k,[t(f(n.percent)+` %`,1),e.compact?m(``,!0):(l(),a(`span`,A,` · `+f(n.votes),1))])]),i(`div`,j,[i(`div`,{class:`h-full rounded-full bg-brand transition-[width] duration-500`,style:s({width:`${n.percent}%`})},null,4)])]))),128))])):n.type===`scale`?(l(),a(`div`,M,[i(`p`,N,[r[0]||=t(`Durchschnitt: `,-1),i(`span`,P,f(n.average===null?`–`:n.average.toLocaleString(`de-DE`)),1),r[1]||=t(),i(`span`,F,`von `+f(n.scale),1)]),i(`div`,{class:`flex h-20 items-end gap-1`,role:`img`,"aria-label":`Verteilung der Antworten von 1 bis ${n.scale}`},[(l(!0),a(u,null,o(n.distribution,e=>(l(),a(`div`,{key:e.value,class:`flex flex-1 flex-col items-center gap-1`},[i(`div`,{class:`w-full rounded-t-sm bg-brand/75`,style:s({height:`${n.answered?Math.max(3,e.votes/Math.max(...n.distribution.map(e=>e.votes),1)*56):3}px`}),title:`${e.value}: ${e.votes}`},null,12,L),i(`span`,R,f(e.value),1)]))),128))],8,I),n.min_label||n.max_label?(l(),a(`div`,z,[i(`span`,null,f(n.min_label),1),i(`span`,null,f(n.max_label),1)])):m(``,!0)])):n.type===`text`?(l(),a(u,{key:2},[i(`p`,B,f(n.answered)+` `+f(n.answered===1?`Antwort`:`Antworten`),1),n.texts?.length?(l(),a(`ul`,V,[(l(!0),a(u,null,o(n.texts,(e,t)=>(l(),a(`li`,{key:t,class:`rounded-md bg-muted/60 px-3 py-2 text-sm whitespace-pre-line`},f(e),1))),128))])):m(``,!0)],64)):m(``,!0)]))),128))]))}},U=[`disabled`],W={class:`mb-2.5 text-sm font-semibold`},G={key:0,class:`text-muted-foreground`},K={key:1,class:`font-normal text-muted-foreground`},q={key:2,class:`block text-xs font-normal text-muted-foreground`},J=[`onUpdate:modelValue`,`name`,`value`],Y=[`checked`,`onChange`],X={key:1,class:`grid gap-1.5`},Z={class:`flex flex-wrap gap-1.5`},Q=[`onUpdate:modelValue`,`name`,`value`],$={key:3,class:`text-[13px] text-destructive`},te={key:0,class:`text-[13px] text-destructive`},ne={class:`flex flex-wrap items-center gap-3`},re={key:0,class:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`},ie={key:0,class:`mb-5 flex items-center gap-2 text-sm font-medium text-brand-text`},ae={key:1,class:`mb-5 text-sm text-muted-foreground`},oe={key:3,class:`text-sm text-muted-foreground`},se={__name:`PollForm`,props:{poll:{type:Object,required:!0},compact:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(S){let C=S,w=_({answers:Object.fromEntries(C.poll.questions.map(e=>[e.id,e.type===`multiple`?[]:null]))});function T(e,t){let n=w.answers[e.id],r=n.indexOf(t);r>=0?n.splice(r,1):(!e.max||n.length<e.max)&&n.push(t)}let E=c(()=>C.poll.questions.every(e=>{let t=w.answers[e.id];return!e.required||(Array.isArray(t)?t.length:t!==null&&t!==``)}));function D(){w.post(`/umfragen/${C.poll.id}/abstimmen`,{preserveScroll:!0})}let O=c(()=>w.errors.answers??null);return(c,_)=>(l(),a(`div`,null,[S.poll.can_vote?(l(),a(`form`,{key:0,class:`grid gap-6`,onSubmit:h(D,[`prevent`])},[(l(!0),a(u,null,o(S.poll.questions,(e,c)=>(l(),a(`fieldset`,{key:e.id,class:`grid gap-2.5`,disabled:S.disabled},[i(`legend`,W,[S.poll.questions.length>1?(l(),a(`span`,G,f(c+1)+`. `,1)):m(``,!0),t(f(e.label)+` `,1),e.required?m(``,!0):(l(),a(`span`,K,` (optional)`)),e.type===`multiple`?(l(),a(`span`,q,f(e.max?`Bis zu ${e.max} Antworten`:`Mehrere Antworten möglich`),1)):m(``,!0)]),e.type===`single`||e.type===`multiple`?(l(!0),a(u,{key:0},o(e.options,i=>(l(),a(`label`,{key:i.id,class:`flex cursor-pointer items-center gap-3 rounded-md border px-3.5 py-2.5 text-sm transition-colors hover:bg-accent/50 has-[:checked]:border-brand has-[:checked]:bg-brand-soft`},[e.type===`single`?r((l(),a(`input`,{key:0,"onUpdate:modelValue":t=>n(w).answers[e.id]=t,type:`radio`,name:`q-${S.poll.id}-${e.id}`,value:i.id,class:`size-4 accent-[var(--color-brand)]`},null,8,J)),[[g,n(w).answers[e.id]]]):(l(),a(`input`,{key:1,type:`checkbox`,checked:n(w).answers[e.id].includes(i.id),class:`size-4 accent-[var(--color-brand)]`,onChange:t=>T(e,i.id)},null,40,Y)),t(` `+f(i.label),1)]))),128)):e.type===`scale`?(l(),a(`div`,X,[i(`div`,Z,[(l(!0),a(u,null,o(e.scale,o=>(l(),a(`label`,{key:o,class:`grid size-10 cursor-pointer place-items-center rounded-md border text-sm font-medium tabular-nums transition-colors hover:bg-accent/50 has-[:checked]:border-brand has-[:checked]:bg-brand has-[:checked]:text-brand-foreground`},[r(i(`input`,{"onUpdate:modelValue":t=>n(w).answers[e.id]=t,type:`radio`,name:`q-${S.poll.id}-${e.id}`,value:o,class:`sr-only`},null,8,Q),[[g,n(w).answers[e.id]]]),t(` `+f(o),1)]))),128))]),e.min_label||e.max_label?(l(),a(`div`,{key:0,class:`flex justify-between gap-3 text-xs text-muted-foreground`,style:s({maxWidth:`${e.scale*2.5+(e.scale-1)*.375}rem`})},[i(`span`,null,`1 = `+f(e.min_label),1),i(`span`,null,f(e.scale)+` = `+f(e.max_label),1)],4)):m(``,!0)])):(l(),p(n(x),{key:2,modelValue:n(w).answers[e.id],"onUpdate:modelValue":t=>n(w).answers[e.id]=t,rows:`3`,maxlength:`2000`},null,8,[`modelValue`,`onUpdate:modelValue`])),n(w).errors[`answers.${e.id}`]?(l(),a(`p`,$,f(n(w).errors[`answers.${e.id}`]),1)):m(``,!0)],8,U))),128)),O.value?(l(),a(`p`,te,f(O.value),1)):m(``,!0),i(`div`,ne,[e(n(b),{type:`submit`,disabled:n(w).processing||!E.value||S.disabled},{default:d(()=>[n(w).processing?(l(),p(n(y),{key:0,class:`animate-spin`})):m(``,!0),_[0]||=t(` Abstimmen `,-1)]),_:1},8,[`disabled`]),S.poll.anonymous?(l(),a(`span`,re,[e(n(ee),{class:`size-3.5`}),_[1]||=t(` Anonym – Ihre Antworten werden ohne Namen gespeichert.`,-1)])):m(``,!0)])],32)):(l(),a(u,{key:1},[S.poll.voted?(l(),a(`p`,ie,[e(n(v),{class:`size-4`}),_[2]||=t(` Sie haben teilgenommen – danke!`,-1)])):S.poll.open?m(``,!0):(l(),a(`p`,ae,`Diese Umfrage ist beendet.`)),S.poll.results?(l(),p(H,{key:2,results:S.poll.results,compact:S.compact},null,8,[`results`,`compact`])):S.poll.results_note?(l(),a(`p`,oe,f(S.poll.results_note),1)):m(``,!0)],64))]))}};export{se as t};