Loheide-eu-mitarbeiterplatt.../public/build/assets/Editor-DgF2pHgS.js
Friederich Loheide 34d6cdbf1c
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m20s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m17s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m18s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m10s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m44s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m51s
Reine Redaktionsrechte öffnen nicht mehr das Backend (0.25.1)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 09:16:48 +00:00

1 line
No EOL
6.8 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,Ht as n,On as r,Zn as i,_ as a,b as o,g as s,mt as c,qt as l,tr as u,v as d,vn as f,y as p}from"./runtime-core.esm-bundler-B8D2lM98.js";import{w as m}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{a as h,i as g,s as _}from"./dist--2OKCVzt.js";import{t as v}from"./arrow-left-DROE4wuA.js";import{d as y}from"./useMediaList-DTleUmzW.js";import{t as b}from"./loader-circle-Wr6tQn-J.js";import{i as x}from"./PopoverTrigger-Cah311ye.js";import{t as S}from"./save-Bjo-pGWz.js";import{t as ee}from"./trash-CONUPzoz.js";import{t as te}from"./x-DU8daajy.js";import{C,Rt as w,T,b as E,d as D,m as O,p as k,ut as A,v as j,w as M}from"./app-CHAHYOVM.js";import{n as N,t as P}from"./useMediaPicker-CyPLmg21.js";var F={class:`grid min-w-0 gap-6`},I={class:`grid gap-5`},L={class:`flex items-center gap-3 text-sm font-medium`},ne={class:`grid gap-4 sm:grid-cols-2`},R={class:`grid gap-4 sm:grid-cols-2`},z={class:`grid gap-6`},B={class:`flex items-center justify-between gap-3 text-sm`},V={key:0,class:`relative overflow-hidden rounded-md border`},H=[`src`],U={key:1,class:`mt-2 text-[13px] text-destructive`},W={class:`-mt-1 mb-3 flex items-start gap-2 text-[13px] text-muted-foreground`},G={__name:`Editor`,props:{event:{type:Object,default:null},audienceOptions:{type:Object,required:!0}},setup(G){let K=G,q=()=>{let e=new Date;return e.setHours(e.getHours()+1,0,0,0),new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)},J=K.event,Y=h({title:J?.title??``,all_day:J?.all_day??!1,starts_at:J?.starts_at??q(),ends_at:J?.ends_at??``,location:J?.location??``,online_url:J?.online_url??``,description:J?.description??``,image_path:J?.image_path??null,is_published:J?.is_published??!0,audience:J?.audience??{}}),X=f(J?.image_url??null),Z=s(()=>Y.all_day?`date`:`datetime-local`);n(()=>Y.all_day,e=>{Y.starts_at=e?Y.starts_at.slice(0,10):`${Y.starts_at.slice(0,10)}T09:00`,Y.ends_at=Y.ends_at?e?Y.ends_at.slice(0,10):`${Y.ends_at.slice(0,10)}T17:00`:``});let Q=P({upload:(e,t)=>y(`/redaktion/termine/bilder`,e,{onProgress:t}),contextLabel:`Bei diesem Termin`,contextPaths:()=>[Y.image_path].filter(Boolean)});async function re(){let e=await Q.pick({title:`Titelbild wählen`});e?.[0]&&(Y.image_path=e[0].path,X.value=e[0].url)}let ie=s(()=>Object.values(Y.audience??{}).some(e=>e?.length));function $(){let e={preserveScroll:!0};J?Y.put(`/redaktion/termine/${J.id}`,e):Y.post(`/redaktion/termine`,e)}function ae(){window.confirm(`Termin „${J.title}“ löschen?`)&&_.delete(`/redaktion/termine/${J.id}`)}return(n,s)=>(c(),d(T,{title:r(J)?`Bearbeiten: ${r(J).title}`:`Neuer Termin`},{default:l(()=>[e(M,{title:r(J)?`Termin bearbeiten`:`Neuer Termin`,breadcrumbs:[{label:`Termine`,href:`/termine`}]},{actions:l(()=>[r(J)?(c(),d(r(k),{key:0,variant:`ghost`,class:`text-destructive hover:text-destructive`,onClick:ae},{default:l(()=>[e(r(ee)),s[10]||=t(` Löschen`,-1)]),_:1})):p(``,!0),e(r(k),{disabled:r(Y).processing,onClick:$},{default:l(()=>[r(Y).processing?(c(),d(r(b),{key:0,class:`animate-spin`})):(c(),d(r(S),{key:1})),s[11]||=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:m($,[`prevent`])},[a(`div`,F,[e(C,null,{default:l(()=>[a(`div`,I,[e(E,{id:`ev-title`,label:`Titel`,error:r(Y).errors.title},{default:l(()=>[e(r(D),{id:`ev-title`,modelValue:r(Y).title,"onUpdate:modelValue":s[0]||=e=>r(Y).title=e,maxlength:`160`,placeholder:`z. B. Sommerfest 2026`,class:`text-base`},null,8,[`modelValue`])]),_:1},8,[`error`]),a(`label`,L,[e(r(x),{modelValue:r(Y).all_day,"onUpdate:modelValue":s[1]||=e=>r(Y).all_day=e},null,8,[`modelValue`]),s[12]||=t(` Ganztägig `,-1)]),a(`div`,ne,[e(E,{id:`ev-start`,label:`Beginn`,error:r(Y).errors.starts_at},{default:l(()=>[e(r(D),{id:`ev-start`,modelValue:r(Y).starts_at,"onUpdate:modelValue":s[2]||=e=>r(Y).starts_at=e,type:Z.value},null,8,[`modelValue`,`type`])]),_:1},8,[`error`]),e(E,{id:`ev-end`,label:`Ende (optional)`,error:r(Y).errors.ends_at},{default:l(()=>[e(r(D),{id:`ev-end`,modelValue:r(Y).ends_at,"onUpdate:modelValue":s[3]||=e=>r(Y).ends_at=e,type:Z.value,min:r(Y).starts_at},null,8,[`modelValue`,`type`,`min`])]),_:1},8,[`error`])]),a(`div`,R,[e(E,{id:`ev-location`,label:`Ort`,error:r(Y).errors.location},{default:l(()=>[e(r(D),{id:`ev-location`,modelValue:r(Y).location,"onUpdate:modelValue":s[4]||=e=>r(Y).location=e,maxlength:`255`,placeholder:`z. B. Kantine, Haus A`},null,8,[`modelValue`])]),_:1},8,[`error`]),e(E,{id:`ev-online`,label:`Online-Link`,error:r(Y).errors.online_url},{default:l(()=>[e(r(D),{id:`ev-online`,modelValue:r(Y).online_url,"onUpdate:modelValue":s[5]||=e=>r(Y).online_url=e,type:`url`,maxlength:`500`,placeholder:`https://…`},null,8,[`modelValue`])]),_:1},8,[`error`])]),e(E,{id:`ev-description`,label:`Beschreibung`,error:r(Y).errors.description},{default:l(()=>[e(j,{modelValue:r(Y).description,"onUpdate:modelValue":s[6]||=e=>r(Y).description=e,bordered:``,"min-height":`12rem`,placeholder:`Worum geht es? Programm, Anmeldung, Mitbringen …`},null,8,[`modelValue`])]),_:1},8,[`error`])])]),_:1})]),a(`div`,z,[e(C,{title:`Veröffentlichung`},{default:l(()=>[a(`label`,B,[s[13]||=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(x),{modelValue:r(Y).is_published,"onUpdate:modelValue":s[7]||=e=>r(Y).is_published=e},null,8,[`modelValue`])]),r(J)?.url&&r(J).is_published?(c(),d(r(g),{key:0,href:r(J).url,class:`mt-3 inline-flex items-center gap-1 text-[13px] text-brand-text hover:underline`},{default:l(()=>[e(r(v),{class:`size-3.5`}),s[14]||=t(` Zum Termin`,-1)]),_:1},8,[`href`])):p(``,!0)]),_:1}),e(C,{title:`Titelbild`},{default:l(()=>[r(Y).image_path?(c(),o(`div`,V,[a(`img`,{src:X.value,alt:``,class:`aspect-video w-full object-cover`},null,8,H),a(`button`,{type:`button`,class:`absolute top-2 right-2 grid size-7 place-items-center rounded-full bg-black/60 text-white hover:bg-black/80`,"aria-label":`Bild entfernen`,onClick:s[8]||=e=>r(Y).image_path=null},[e(r(te),{class:`size-4`})])])):p(``,!0),e(r(k),{type:`button`,variant:`outline`,class:i([`w-full`,{"mt-3":r(Y).image_path}]),onClick:re},{default:l(()=>[e(r(w)),t(` `+u(r(Y).image_path?`Anderes Bild`:`Bild wählen oder hochladen`),1)]),_:1},8,[`class`]),r(Y).errors.image_path?(c(),o(`p`,U,u(r(Y).errors.image_path),1)):p(``,!0)]),_:1}),e(C,{title:`Wer sieht den Termin?`},{default:l(()=>[a(`p`,W,[e(r(A),{class:`mt-0.5 size-4 shrink-0`}),t(` `+u(ie.value?`Nur Personen, die mindestens eine Angabe erfüllen.`:`Alle – oder unten eingrenzen.`),1)]),e(O,{modelValue:r(Y).audience,"onUpdate:modelValue":s[9]||=e=>r(Y).audience=e,options:G.audienceOptions,"exclude-hint":`Sehen den Termin nie – auch wenn oben etwas passt.`},null,8,[`modelValue`,`options`])]),_:1})])],32),e(N,{picker:r(Q)},null,8,[`picker`])]),_:1},8,[`title`]))}};export{G as default};