1 line
No EOL
12 KiB
JavaScript
1 line
No EOL
12 KiB
JavaScript
import{t as e}from"../chunks/createLucideIcon-CYyWUN7r.js";import{n as t,t as n}from"../chunks/x-CV132X1X.js";import{n as r,t as i}from"../chunks/loader-circle-DBP4Qhm5.js";import{n as a,r as o,t as s}from"../chunks/StatusBadge-CZaj6wAi.js";import{t as ee}from"../chunks/trash-COMUOW6h.js";import{Fragment as c,computed as te,createBlock as l,createCommentVNode as u,createElementBlock as d,createElementVNode as f,createTextVNode as p,createVNode as m,mergeModels as h,onBeforeUnmount as g,openBlock as _,ref as v,renderList as ne,toDisplayString as y,unref as b,useModel as x,watch as S,withCtx as C,withModifiers as w}from"vue";import{Link as T,router as E,useForm as D,usePage as O}from"@inertiajs/vue3";import{AppLayout as re,Button as k,Dialog as A,DialogContent as j,DialogDescription as M,DialogFooter as N,DialogHeader as P,DialogTitle as F,FormField as I,Input as L,PersonAvatar as R,Textarea as z,formatDate as B,toast as ie}from"@inhaus/ui";var ae=e({name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]}),V=e({name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]}),H=e({name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]}),U=e({name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]}),W=e({name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]}),G={class:`ih:grid ih:gap-4 ih:sm:grid-cols-2`},K={__name:`RequestDialog`,props:h({item:{type:Object,required:!0},labels:{type:Object,required:!0},defaultLocation:{type:String,default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=x(e,`open`),r=new Date().toISOString().slice(0,10),a=D({location:t.defaultLocation??``,from:``,until:``,message:``});function o(){a.post(`/verleih/${t.item.id}/anfragen`,{preserveScroll:!0,onSuccess:()=>{n.value=!1,a.reset(`from`,`until`,`message`)}})}return(t,s)=>(_(),l(b(A),{open:n.value,"onUpdate:open":s[5]||=e=>n.value=e},{default:C(()=>[m(b(j),{class:`ih:sm:max-w-lg`},{default:C(()=>[m(b(P),null,{default:C(()=>[m(b(F),null,{default:C(()=>[p(`„`+y(e.item.title)+`“ anfragen`,1)]),_:1}),m(b(M),null,{default:C(()=>[s[6]||=p(` Das Team bekommt Ihre Anfrage im Portal und per E-Mail und meldet sich bei Ihnen. `,-1),e.item.lent?(_(),d(c,{key:0},[p(` Gerade ist es verliehen – Sie können es trotzdem für später anfragen.`)],64)):u(``,!0)]),_:1})]),_:1}),f(`form`,{id:`verleih-anfrage`,class:`ih:grid ih:gap-4`,onSubmit:w(o,[`prevent`])},[m(b(I),{id:`vl-location`,label:`Wo soll es hin?`,error:b(a).errors.location},{default:C(()=>[m(b(L),{id:`vl-location`,modelValue:b(a).location,"onUpdate:modelValue":s[0]||=e=>b(a).location=e,maxlength:`200`,placeholder:`z. B. Verwaltung, Besprechungsraum 2. OG`,required:``},null,8,[`modelValue`])]),_:1},8,[`error`]),f(`div`,G,[m(b(I),{id:`vl-from`,label:`Ab (optional)`,error:b(a).errors.from},{default:C(()=>[m(b(L),{id:`vl-from`,modelValue:b(a).from,"onUpdate:modelValue":s[1]||=e=>b(a).from=e,type:`date`,min:b(r)},null,8,[`modelValue`,`min`])]),_:1},8,[`error`]),m(b(I),{id:`vl-until`,label:`Bis (optional)`,error:b(a).errors.until},{default:C(()=>[m(b(L),{id:`vl-until`,modelValue:b(a).until,"onUpdate:modelValue":s[2]||=e=>b(a).until=e,type:`date`,min:b(a).from||b(r)},null,8,[`modelValue`,`min`])]),_:1},8,[`error`])]),m(b(I),{id:`vl-message`,label:`Nachricht (optional)`,error:b(a).errors.message},{default:C(()=>[m(b(z),{id:`vl-message`,modelValue:b(a).message,"onUpdate:modelValue":s[3]||=e=>b(a).message=e,rows:`3`,maxlength:`2000`,placeholder:`z. B. Anlass, Ansprechperson vor Ort …`},null,8,[`modelValue`])]),_:1},8,[`error`])],32),m(b(N),null,{default:C(()=>[m(b(k),{variant:`outline`,onClick:s[4]||=e=>n.value=!1},{default:C(()=>[...s[7]||=[p(`Abbrechen`,-1)]]),_:1}),m(b(k),{type:`submit`,form:`verleih-anfrage`,disabled:b(a).processing||!b(a).location.trim()},{default:C(()=>[b(a).processing?(_(),l(b(i),{key:0,class:`ih:animate-spin`})):(_(),l(b(H),{key:1})),s[8]||=p(` Anfrage senden `,-1)]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`]))}},q={class:`ih:mb-4 ih:flex ih:flex-wrap ih:items-center ih:justify-between ih:gap-3`},J={key:0,class:`ih:flex ih:gap-2`},oe={class:`ih:grid ih:gap-6 ih:lg:grid-cols-[minmax(0,1fr)_22rem]`},se={class:`ih:grid ih:min-w-0 ih:content-start ih:gap-6`},ce=[`aria-label`],le=[`src`,`alt`],ue={key:1,class:`ih:grid ih:aspect-[4/3] ih:place-items-center ih:rounded-lg ih:border ih:bg-muted ih:text-muted-foreground`},de={key:2,class:`ih:rounded-lg ih:border ih:bg-card ih:p-5`},fe=[`innerHTML`],pe={class:`ih:grid ih:content-start ih:gap-4 ih:lg:sticky ih:lg:top-24`},me={class:`ih:grid ih:gap-4 ih:rounded-lg ih:border ih:bg-card ih:p-5`},he={class:`ih:grid ih:gap-2`},ge={class:`ih:text-xl ih:leading-snug ih:font-semibold`},_e={class:`ih:grid ih:gap-2 ih:text-sm`},ve={class:`ih:flex ih:gap-2`},ye={key:0,class:`ih:flex ih:gap-2`},be={key:1,class:`ih:flex ih:gap-2`},xe={key:0,class:`ih:grid ih:gap-2 ih:rounded-md ih:bg-brand-soft ih:p-3 ih:text-sm ih:text-brand-text`},Se={class:`ih:flex ih:items-center ih:gap-1.5 ih:font-medium`},Ce={key:0,class:`ih:rounded-lg ih:border ih:bg-card ih:p-5`},we={class:`ih:grid ih:gap-3`},Te={class:`ih:min-w-0`},Ee={class:`ih:font-medium`},De={class:`ih:text-xs ih:text-muted-foreground`},Oe=[`aria-label`],ke=[`src`,`alt`],Y={__name:`Show`,props:{item:{type:Object,required:!0},labels:{type:Object,required:!0},canManage:{type:Boolean,default:!1},myRequest:{type:Object,default:null},defaultLocation:{type:String,default:null},requests:{type:Array,default:()=>[]}},setup(e){let h=e,x=O();S(()=>x.props.flash?.status,e=>e&&ie.success(e),{immediate:!0});let z=te(()=>h.item),G=v(!1),Y=v(!1),X=e=>e.key===`Escape`&&(Y.value=!1);S(Y,e=>e?window.addEventListener(`keydown`,X):window.removeEventListener(`keydown`,X)),g(()=>window.removeEventListener(`keydown`,X));let Z=v(!1),Q=D({location:``}),Ae=()=>Q.post(`/verleih/${z.value.id}/zurueck`,{preserveScroll:!0,onSuccess:()=>Z.value=!1}),je=()=>window.confirm(`Anfrage zurückziehen?`)&&E.delete(`/verleih/anfragen/${h.myRequest.id}`,{preserveScroll:!0}),Me=()=>window.confirm(`„${z.value.title}“ endgültig löschen?`)&&E.delete(`/verleih/${z.value.id}`),$=(e,t)=>[e?`ab ${B(e)}`:null,t?`bis ${B(t)}`:null].filter(Boolean).join(` `);return(te,h)=>(_(),l(b(re),{title:z.value.title},{default:C(()=>[f(`div`,q,[m(b(T),{href:`/verleih`,class:`ih:inline-flex ih:items-center ih:gap-1 ih:text-sm ih:font-medium ih:text-muted-foreground ih:hover:text-foreground`},{default:C(()=>[m(b(r),{class:`ih:size-4`}),p(` `+y(e.labels.title),1)]),_:1}),e.canManage?(_(),d(`div`,J,[m(b(k),{variant:`outline`,size:`sm`,"as-child":``},{default:C(()=>[m(b(T),{href:`/verleih/${z.value.id}/bearbeiten`},{default:C(()=>[m(b(V)),h[9]||=p(` Bearbeiten`,-1)]),_:1},8,[`href`])]),_:1}),m(b(k),{variant:`ghost`,size:`sm`,class:`ih:text-destructive ih:hover:text-destructive`,onClick:Me},{default:C(()=>[m(b(ee)),h[10]||=p(` Löschen`,-1)]),_:1})])):u(``,!0)]),f(`div`,oe,[f(`div`,se,[z.value.image_url?(_(),d(`button`,{key:0,type:`button`,class:`ih:grid ih:place-items-center ih:rounded-lg ih:border ih:bg-muted ih:p-4 ih:sm:p-8`,"aria-label":`${z.value.title} vergrößern`,onClick:h[0]||=e=>Y.value=!0},[f(`img`,{src:z.value.image_url,alt:z.value.title,class:`ih:max-h-[70vh] ih:w-auto ih:max-w-full ih:object-contain ih:shadow-md`},null,8,le)],8,ce)):(_(),d(`div`,ue,[m(b(o),{class:`ih:size-10`,"stroke-width":1.5})])),z.value.description?(_(),d(`section`,de,[f(`div`,{class:`verleih-text ih:text-[15px] ih:leading-relaxed`,innerHTML:z.value.description},null,8,fe)])):u(``,!0)]),f(`aside`,pe,[f(`section`,me,[f(`div`,he,[m(s,{lent:z.value.lent,class:`ih:w-fit ih:border`},null,8,[`lent`]),f(`h1`,ge,y(z.value.title),1)]),f(`dl`,_e,[f(`div`,ve,[h[11]||=f(`dt`,{class:`ih:sr-only`},`Aktueller Standort`,-1),m(b(a),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),f(`dd`,null,y(z.value.location||`Standort nicht angegeben`),1)]),z.value.lent&&(z.value.lent_since||z.value.lent_until)?(_(),d(`div`,ye,[h[12]||=f(`dt`,{class:`ih:sr-only`},`Zeitraum`,-1),m(b(t),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),f(`dd`,null,`Verliehen `+y($(z.value.lent_since,z.value.lent_until)),1)])):u(``,!0),z.value.lent_to?(_(),d(`div`,be,[h[13]||=f(`dt`,{class:`ih:sr-only`},`Ausgeliehen von`,-1),m(b(W),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),f(`dd`,null,[m(b(T),{href:`/personen/${z.value.lent_to.id}`,class:`ih:hover:underline`},{default:C(()=>[p(y(z.value.lent_to.name),1)]),_:1},8,[`href`])])])):u(``,!0)]),e.myRequest?(_(),d(`div`,xe,[f(`p`,Se,[m(b(ae),{class:`ih:size-4`}),p(` Angefragt am `+y(b(B)(e.myRequest.created_at)),1)]),f(`p`,null,`Nach „`+y(e.myRequest.location)+`“ `+y($(e.myRequest.from,e.myRequest.until))+` – das Team meldet sich.`,1),f(`button`,{type:`button`,class:`ih:w-fit ih:text-xs ih:font-medium ih:underline`,onClick:je},`Anfrage zurückziehen`)])):(_(),l(b(k),{key:1,size:`lg`,class:`ih:w-full`,onClick:h[1]||=e=>G.value=!0},{default:C(()=>[m(b(H)),p(` `+y(e.labels.singular)+` anfragen`,1)]),_:1})),e.canManage&&z.value.lent?(_(),l(b(k),{key:2,variant:`outline`,class:`ih:w-full`,onClick:h[2]||=e=>Z.value=!0},{default:C(()=>[m(b(U)),h[14]||=p(` Zurückgenommen`,-1)]),_:1})):u(``,!0)]),e.canManage&&e.requests.length?(_(),d(`section`,Ce,[h[16]||=f(`h2`,{class:`ih:mb-3 ih:text-sm ih:font-semibold`},`Anfragen`,-1),f(`ul`,we,[(_(!0),d(c,null,ne(e.requests,e=>(_(),d(`li`,{key:e.id,class:`ih:flex ih:gap-3 ih:text-sm`},[m(b(R),{person:e.user,class:`ih:size-8`},null,8,[`person`]),f(`div`,Te,[f(`p`,null,[f(`span`,Ee,y(e.user?.name),1),p(` · `+y(e.location),1)]),f(`p`,De,y(e.status_label)+` · `+y(b(B)(e.created_at)),1)])]))),128))]),m(b(T),{href:`/verleih/anfragen`,class:`ih:mt-3 ih:inline-block ih:text-sm ih:font-medium ih:text-brand-text ih:hover:underline`},{default:C(()=>[...h[15]||=[p(`Alle Anfragen`,-1)]]),_:1})])):u(``,!0)])]),m(K,{open:G.value,"onUpdate:open":h[3]||=e=>G.value=e,item:z.value,labels:e.labels,"default-location":e.defaultLocation},null,8,[`open`,`item`,`labels`,`default-location`]),m(b(A),{open:Z.value,"onUpdate:open":h[6]||=e=>Z.value=e},{default:C(()=>[m(b(j),{class:`ih:sm:max-w-md`},{default:C(()=>[m(b(P),null,{default:C(()=>[m(b(F),null,{default:C(()=>[p(`„`+y(z.value.title)+`“ zurückgenommen`,1)]),_:1}),m(b(M),null,{default:C(()=>[...h[17]||=[p(`Danach ist es wieder verfügbar. Wo ist es jetzt?`,-1)]]),_:1})]),_:1}),f(`form`,{id:`verleih-zurueck`,onSubmit:w(Ae,[`prevent`])},[m(b(I),{id:`vl-return`,label:`Neuer Standort`,error:b(Q).errors.location},{default:C(()=>[m(b(L),{id:`vl-return`,modelValue:b(Q).location,"onUpdate:modelValue":h[4]||=e=>b(Q).location=e,maxlength:`200`,placeholder:`z. B. Lager Künstlerteam`},null,8,[`modelValue`])]),_:1},8,[`error`])],32),m(b(N),null,{default:C(()=>[m(b(k),{variant:`outline`,onClick:h[5]||=e=>Z.value=!1},{default:C(()=>[...h[18]||=[p(`Abbrechen`,-1)]]),_:1}),m(b(k),{type:`submit`,form:`verleih-zurueck`,disabled:b(Q).processing},{default:C(()=>[b(Q).processing?(_(),l(b(i),{key:0,class:`ih:animate-spin`})):u(``,!0),h[19]||=p(` Speichern`,-1)]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`]),Y.value?(_(),d(`div`,{key:0,class:`ih:fixed ih:inset-0 ih:z-50 ih:grid ih:place-items-center ih:bg-black/85 ih:p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":z.value.title,onClick:h[8]||=e=>Y.value=!1},[f(`img`,{src:z.value.image_url,alt:z.value.title,class:`ih:size-full ih:object-contain`},null,8,ke),f(`button`,{type:`button`,class:`ih:absolute ih:top-4 ih:right-4 ih:grid ih:size-10 ih:place-items-center ih:rounded-full ih:bg-white/15 ih:text-white`,"aria-label":`Schließen`,onClick:h[7]||=w(e=>Y.value=!1,[`stop`])},[m(b(n))])],8,Oe)):u(``,!0)]),_:1},8,[`title`]))}};export{Y as default}; |