inhaus-plugin-gruppen/dist/chunks/GroupDialog-DkTJQL7Q.js
Friederich Loheide 5bdfb8a082 Gruppen-Plugin 1.0.0
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 17:17:10 +00:00

1 line
No EOL
5 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{n as e,t}from"./loader-circle-CxzeMpQS.js";import{Fragment as n,createBlock as r,createCommentVNode as i,createElementBlock as a,createElementVNode as o,createTextVNode as s,createVNode as c,mergeModels as l,openBlock as u,renderList as d,toDisplayString as f,unref as p,useModel as m,vModelCheckbox as h,vModelRadio as g,watch as _,withCtx as v,withDirectives as y,withModifiers as b}from"vue";import{useForm as x}from"@inertiajs/vue3";import{Button as S,Dialog as C,DialogContent as w,DialogDescription as T,DialogFooter as E,DialogHeader as D,DialogTitle as O,FormField as k,Input as A,Textarea as j}from"@inhaus/ui";var M=e({name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]}),N=e({name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]}),P=e({name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]}),F=e({name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]}),I=e({name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]}),L={class:`ih:grid ih:gap-2`},R=[`value`],z={class:`ih:font-medium`},B={class:`ih:block ih:text-xs ih:text-muted-foreground`},V={key:0,class:`ih:flex ih:items-center ih:gap-2 ih:text-sm`},H={__name:`GroupDialog`,props:l({group:{type:Object,default:null},privacy:{type:Object,required:!0},privacyHints:{type:Object,required:!0}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let l=e,M=m(e,`open`),N=x({name:``,description:``,privacy:`open`,cover:null,remove_cover:!1});_(M,e=>{e&&(N.clearErrors(),N.defaults({name:l.group?.name??``,description:l.group?.description??``,privacy:l.group?.privacy??`open`,cover:null,remove_cover:!1}),N.reset())});function P(){N.post(l.group?`/gruppen/${l.group.slug}`:`/gruppen`,{forceFormData:!0,preserveScroll:!0,onSuccess:()=>M.value=!1})}return(l,m)=>(u(),r(p(C),{open:M.value,"onUpdate:open":m[6]||=e=>M.value=e},{default:v(()=>[c(p(w),{class:`ih:sm:max-w-lg`},{default:v(()=>[c(p(D),null,{default:v(()=>[c(p(O),null,{default:v(()=>[s(f(e.group?`Gruppe bearbeiten`:`Gruppe gründen`),1)]),_:1}),c(p(T),null,{default:v(()=>[s(f(e.group?`Name, Beschreibung, Art und Titelbild.`:`Zu einem Thema, einem Hobby oder einem Projekt – Sie verwalten die Gruppe.`),1)]),_:1})]),_:1}),o(`form`,{id:`group-form`,class:`ih:grid ih:gap-4`,onSubmit:b(P,[`prevent`])},[c(p(k),{id:`g-name`,label:`Name`,error:p(N).errors.name},{default:v(()=>[c(p(A),{id:`g-name`,modelValue:p(N).name,"onUpdate:modelValue":m[0]||=e=>p(N).name=e,maxlength:`100`,placeholder:`z. B. Laufgruppe Mainz`},null,8,[`modelValue`])]),_:1},8,[`error`]),c(p(k),{id:`g-description`,label:`Worum geht es? (optional)`,error:p(N).errors.description},{default:v(()=>[c(p(j),{id:`g-description`,modelValue:p(N).description,"onUpdate:modelValue":m[1]||=e=>p(N).description=e,rows:`3`,maxlength:`2000`},null,8,[`modelValue`])]),_:1},8,[`error`]),o(`fieldset`,L,[m[7]||=o(`legend`,{class:`ih:mb-1 ih:text-sm ih:font-medium`},`Wer darf rein?`,-1),(u(!0),a(n,null,d(e.privacy,(t,n)=>(u(),a(`label`,{key:n,class:`ih:flex ih:cursor-pointer ih:items-start ih:gap-3 ih:rounded-md ih:border ih:p-3 ih:text-sm ih:has-[:checked]:border-brand ih:has-[:checked]:bg-brand-soft/50`},[y(o(`input`,{"onUpdate:modelValue":m[2]||=e=>p(N).privacy=e,type:`radio`,name:`privacy`,value:n,class:`ih:mt-0.5 ih:size-4 ih:accent-[var(--color-brand)]`},null,8,R),[[g,p(N).privacy]]),o(`span`,null,[o(`span`,z,f(t),1),o(`span`,B,f(e.privacyHints[n]),1)])]))),128))]),c(p(k),{id:`g-cover`,label:`Titelbild (optional)`,error:p(N).errors.cover},{default:v(()=>[o(`input`,{id:`g-cover`,type:`file`,accept:`image/jpeg,image/png,image/webp`,class:`ih:text-sm`,onChange:m[3]||=e=>p(N).cover=e.target.files[0]??null},null,32)]),_:1},8,[`error`]),e.group?.cover_url?(u(),a(`label`,V,[y(o(`input`,{"onUpdate:modelValue":m[4]||=e=>p(N).remove_cover=e,type:`checkbox`},null,512),[[h,p(N).remove_cover]]),m[8]||=s(` Titelbild entfernen`,-1)])):i(``,!0)],32),c(p(E),null,{default:v(()=>[c(p(S),{variant:`ghost`,onClick:m[5]||=e=>M.value=!1},{default:v(()=>[...m[9]||=[s(`Abbrechen`,-1)]]),_:1}),c(p(S),{type:`submit`,form:`group-form`,disabled:p(N).processing||!p(N).name.trim()},{default:v(()=>[p(N).processing?(u(),r(p(t),{key:0,class:`ih:animate-spin`})):i(``,!0),s(` `+f(e.group?`Speichern`:`Gründen`),1)]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`]))}};export{N as a,P as i,I as n,M as o,F as r,H as t};