inhaus-plugin-verleih/dist/pages/Show.js
Friederich Loheide 4fc163e93e Verleih 1.1.0: Detailseite im einheitlichen Seitenkopf
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 04:19:04 +00:00

1 line
No EOL
12 KiB
JavaScript
Raw Permalink 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{t as e}from"../chunks/createLucideIcon-CYyWUN7r.js";import{n as t,t as n}from"../chunks/x-CV132X1X.js";import{n as r,r as i,t as a}from"../chunks/StatusBadge-CZaj6wAi.js";import{t as o}from"../chunks/loader-circle-km1SveWx.js";import{t as s}from"../chunks/trash-COMUOW6h.js";import{Fragment as c,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createSlots as ee,createTextVNode as m,createVNode as h,mergeModels as g,onBeforeUnmount as te,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,PageHeader as ie,PersonAvatar as ae,Textarea as R,formatDate as z,toast as oe}from"@inhaus/ui";var B=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:g({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),i=D({location:t.defaultLocation??``,from:``,until:``,message:``});function a(){i.post(`/verleih/${t.item.id}/anfragen`,{preserveScroll:!0,onSuccess:()=>{n.value=!1,i.reset(`from`,`until`,`message`)}})}return(t,s)=>(_(),u(b(A),{open:n.value,"onUpdate:open":s[5]||=e=>n.value=e},{default:C(()=>[h(b(j),{class:`ih:sm:max-w-lg`},{default:C(()=>[h(b(P),null,{default:C(()=>[h(b(F),null,{default:C(()=>[m(`„`+y(e.item.title)+`“ anfragen`,1)]),_:1}),h(b(M),null,{default:C(()=>[s[6]||=m(` Das Team bekommt Ihre Anfrage im Portal und per E-Mail und meldet sich bei Ihnen. `,-1),e.item.lent?(_(),f(c,{key:0},[m(` Gerade ist es verliehen – Sie können es trotzdem für später anfragen.`)],64)):d(``,!0)]),_:1})]),_:1}),p(`form`,{id:`verleih-anfrage`,class:`ih:grid ih:gap-4`,onSubmit:w(a,[`prevent`])},[h(b(I),{id:`vl-location`,label:`Wo soll es hin?`,error:b(i).errors.location},{default:C(()=>[h(b(L),{id:`vl-location`,modelValue:b(i).location,"onUpdate:modelValue":s[0]||=e=>b(i).location=e,maxlength:`200`,placeholder:`z. B. Verwaltung, Besprechungsraum 2. OG`,required:``},null,8,[`modelValue`])]),_:1},8,[`error`]),p(`div`,G,[h(b(I),{id:`vl-from`,label:`Ab (optional)`,error:b(i).errors.from},{default:C(()=>[h(b(L),{id:`vl-from`,modelValue:b(i).from,"onUpdate:modelValue":s[1]||=e=>b(i).from=e,type:`date`,min:b(r)},null,8,[`modelValue`,`min`])]),_:1},8,[`error`]),h(b(I),{id:`vl-until`,label:`Bis (optional)`,error:b(i).errors.until},{default:C(()=>[h(b(L),{id:`vl-until`,modelValue:b(i).until,"onUpdate:modelValue":s[2]||=e=>b(i).until=e,type:`date`,min:b(i).from||b(r)},null,8,[`modelValue`,`min`])]),_:1},8,[`error`])]),h(b(I),{id:`vl-message`,label:`Nachricht (optional)`,error:b(i).errors.message},{default:C(()=>[h(b(R),{id:`vl-message`,modelValue:b(i).message,"onUpdate:modelValue":s[3]||=e=>b(i).message=e,rows:`3`,maxlength:`2000`,placeholder:`z. B. Anlass, Ansprechperson vor Ort …`},null,8,[`modelValue`])]),_:1},8,[`error`])],32),h(b(N),null,{default:C(()=>[h(b(k),{variant:`outline`,onClick:s[4]||=e=>n.value=!1},{default:C(()=>[...s[7]||=[m(`Abbrechen`,-1)]]),_:1}),h(b(k),{type:`submit`,form:`verleih-anfrage`,disabled:b(i).processing||!b(i).location.trim()},{default:C(()=>[b(i).processing?(_(),u(b(o),{key:0,class:`ih:animate-spin`})):(_(),u(b(H),{key:1})),s[8]||=m(` Anfrage senden `,-1)]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`]))}},q={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 ih:text-sm`},ge={class:`ih:flex ih:gap-2`},_e={key:0,class:`ih:flex ih:gap-2`},ve={key:1,class:`ih:flex ih:gap-2`},ye={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`},be={class:`ih:flex ih:items-center ih:gap-1.5 ih:font-medium`},xe={key:0,class:`ih:rounded-lg ih:border ih:bg-card ih:p-5`},Se={class:`ih:grid ih:gap-3`},Ce={class:`ih:min-w-0`},we={class:`ih:font-medium`},Te={class:`ih:text-xs ih:text-muted-foreground`},Ee=[`aria-label`],De=[`src`,`alt`],J={__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 g=e,x=O();S(()=>x.props.flash?.status,e=>e&&oe.success(e),{immediate:!0});let R=l(()=>g.item),G=v(!1),J=v(!1),Y=e=>e.key===`Escape`&&(J.value=!1);S(J,e=>e?window.addEventListener(`keydown`,Y):window.removeEventListener(`keydown`,Y)),te(()=>window.removeEventListener(`keydown`,Y));let X=v(!1),Z=D({location:``}),Oe=()=>Z.post(`/verleih/${R.value.id}/zurueck`,{preserveScroll:!0,onSuccess:()=>X.value=!1}),ke=()=>window.confirm(`Anfrage zurückziehen?`)&&E.delete(`/verleih/anfragen/${g.myRequest.id}`,{preserveScroll:!0}),Q=()=>window.confirm(`„${R.value.title}“ endgültig löschen?`)&&E.delete(`/verleih/${R.value.id}`),$=(e,t)=>[e?`ab ${z(e)}`:null,t?`bis ${z(t)}`:null].filter(Boolean).join(` `);return(l,g)=>(_(),u(b(re),{title:R.value.title},{default:C(()=>[h(b(ie),{title:R.value.title,breadcrumbs:[{label:e.labels.title,href:`/verleih`}]},ee({description:C(()=>[h(a,{lent:R.value.lent,class:`ih:mt-1 ih:w-fit ih:border`},null,8,[`lent`])]),_:2},[e.canManage?{name:`actions`,fn:C(()=>[h(b(k),{variant:`outline`,size:`sm`,"as-child":``},{default:C(()=>[h(b(T),{href:`/verleih/${R.value.id}/bearbeiten`},{default:C(()=>[h(b(V)),g[9]||=m(` Bearbeiten`,-1)]),_:1},8,[`href`])]),_:1}),h(b(k),{variant:`ghost`,size:`sm`,class:`ih:text-destructive ih:hover:text-destructive`,onClick:Q},{default:C(()=>[h(b(s)),g[10]||=m(` Löschen`,-1)]),_:1})]),key:`0`}:void 0]),1032,[`title`,`breadcrumbs`]),p(`div`,q,[p(`div`,se,[R.value.image_url?(_(),f(`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":`${R.value.title} vergrößern`,onClick:g[0]||=e=>J.value=!0},[p(`img`,{src:R.value.image_url,alt:R.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)):(_(),f(`div`,ue,[h(b(i),{class:`ih:size-10`,"stroke-width":1.5})])),R.value.description?(_(),f(`section`,de,[p(`div`,{class:`verleih-text ih:text-[15px] ih:leading-relaxed`,innerHTML:R.value.description},null,8,fe)])):d(``,!0)]),p(`aside`,pe,[p(`section`,me,[p(`dl`,he,[p(`div`,ge,[g[11]||=p(`dt`,{class:`ih:sr-only`},`Aktueller Standort`,-1),h(b(r),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),p(`dd`,null,y(R.value.location||`Standort nicht angegeben`),1)]),R.value.lent&&(R.value.lent_since||R.value.lent_until)?(_(),f(`div`,_e,[g[12]||=p(`dt`,{class:`ih:sr-only`},`Zeitraum`,-1),h(b(t),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),p(`dd`,null,`Verliehen `+y($(R.value.lent_since,R.value.lent_until)),1)])):d(``,!0),R.value.lent_to?(_(),f(`div`,ve,[g[13]||=p(`dt`,{class:`ih:sr-only`},`Ausgeliehen von`,-1),h(b(W),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),p(`dd`,null,[h(b(T),{href:`/personen/${R.value.lent_to.id}`,class:`ih:hover:underline`},{default:C(()=>[m(y(R.value.lent_to.name),1)]),_:1},8,[`href`])])])):d(``,!0)]),e.myRequest?(_(),f(`div`,ye,[p(`p`,be,[h(b(B),{class:`ih:size-4`}),m(` Angefragt am `+y(b(z)(e.myRequest.created_at)),1)]),p(`p`,null,`Nach „`+y(e.myRequest.location)+`“ `+y($(e.myRequest.from,e.myRequest.until))+` – das Team meldet sich.`,1),p(`button`,{type:`button`,class:`ih:w-fit ih:text-xs ih:font-medium ih:underline`,onClick:ke},`Anfrage zurückziehen`)])):(_(),u(b(k),{key:1,size:`lg`,class:`ih:w-full`,onClick:g[1]||=e=>G.value=!0},{default:C(()=>[h(b(H)),m(` `+y(e.labels.singular)+` anfragen`,1)]),_:1})),e.canManage&&R.value.lent?(_(),u(b(k),{key:2,variant:`outline`,class:`ih:w-full`,onClick:g[2]||=e=>X.value=!0},{default:C(()=>[h(b(U)),g[14]||=m(` Zurückgenommen`,-1)]),_:1})):d(``,!0)]),e.canManage&&e.requests.length?(_(),f(`section`,xe,[g[16]||=p(`h2`,{class:`ih:mb-3 ih:text-sm ih:font-semibold`},`Anfragen`,-1),p(`ul`,Se,[(_(!0),f(c,null,ne(e.requests,e=>(_(),f(`li`,{key:e.id,class:`ih:flex ih:gap-3 ih:text-sm`},[h(b(ae),{person:e.user,class:`ih:size-8`},null,8,[`person`]),p(`div`,Ce,[p(`p`,null,[p(`span`,we,y(e.user?.name),1),m(` · `+y(e.location),1)]),p(`p`,Te,y(e.status_label)+` · `+y(b(z)(e.created_at)),1)])]))),128))]),h(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(()=>[...g[15]||=[m(`Alle Anfragen`,-1)]]),_:1})])):d(``,!0)])]),h(K,{open:G.value,"onUpdate:open":g[3]||=e=>G.value=e,item:R.value,labels:e.labels,"default-location":e.defaultLocation},null,8,[`open`,`item`,`labels`,`default-location`]),h(b(A),{open:X.value,"onUpdate:open":g[6]||=e=>X.value=e},{default:C(()=>[h(b(j),{class:`ih:sm:max-w-md`},{default:C(()=>[h(b(P),null,{default:C(()=>[h(b(F),null,{default:C(()=>[m(`„`+y(R.value.title)+`“ zurückgenommen`,1)]),_:1}),h(b(M),null,{default:C(()=>[...g[17]||=[m(`Danach ist es wieder verfügbar. Wo ist es jetzt?`,-1)]]),_:1})]),_:1}),p(`form`,{id:`verleih-zurueck`,onSubmit:w(Oe,[`prevent`])},[h(b(I),{id:`vl-return`,label:`Neuer Standort`,error:b(Z).errors.location},{default:C(()=>[h(b(L),{id:`vl-return`,modelValue:b(Z).location,"onUpdate:modelValue":g[4]||=e=>b(Z).location=e,maxlength:`200`,placeholder:`z. B. Lager Künstlerteam`},null,8,[`modelValue`])]),_:1},8,[`error`])],32),h(b(N),null,{default:C(()=>[h(b(k),{variant:`outline`,onClick:g[5]||=e=>X.value=!1},{default:C(()=>[...g[18]||=[m(`Abbrechen`,-1)]]),_:1}),h(b(k),{type:`submit`,form:`verleih-zurueck`,disabled:b(Z).processing},{default:C(()=>[b(Z).processing?(_(),u(b(o),{key:0,class:`ih:animate-spin`})):d(``,!0),g[19]||=m(` Speichern`,-1)]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`]),J.value?(_(),f(`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":R.value.title,onClick:g[8]||=e=>J.value=!1},[p(`img`,{src:R.value.image_url,alt:R.value.title,class:`ih:size-full ih:object-contain`},null,8,De),p(`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:g[7]||=w(e=>J.value=!1,[`stop`])},[h(b(n))])],8,Ee)):d(``,!0)]),_:1},8,[`title`]))}};export{J as default};