inhaus-plugin-verleih/dist/pages/Show.js
Friederich Loheide dea1c7061a Rückweg als Pfad im Seitenkopf, Symbol im Kopf (1.0.2)
Passt zu den neuen Seitenköpfen ab Inhaus 0.48 (Kopfband): kein eigener
Zurück-Link mehr über dem Kopf.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 19:54:45 +00:00

1 line
No EOL
12 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{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 ee,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 y,toDisplayString as b,unref as x,useModel as S,watch as C,withCtx as w,withModifiers as T}from"vue";import{Link as E,router as D,useForm as O,usePage as te}from"@inertiajs/vue3";import{AppLayout as ne,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 re,Textarea as R,formatDate as z,toast as ie}from"@inhaus/ui";var ae=e({name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]}),oe=e({name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]}),B=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`}]]}),V=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`}]]}),H=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`}]]}),U=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`]}),W={class:`ih:grid ih:gap-4 ih:sm:grid-cols-2`},G={__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=S(e,`open`),r=new Date().toISOString().slice(0,10),i=O({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)=>(_(),l(x(A),{open:n.value,"onUpdate:open":s[5]||=e=>n.value=e},{default:w(()=>[m(x(j),{class:`ih:sm:max-w-lg`},{default:w(()=>[m(x(P),null,{default:w(()=>[m(x(F),null,{default:w(()=>[p(`„`+b(e.item.title)+`“ anfragen`,1)]),_:1}),m(x(M),null,{default:w(()=>[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:T(a,[`prevent`])},[m(x(I),{id:`vl-location`,label:`Wo soll es hin?`,error:x(i).errors.location},{default:w(()=>[m(x(L),{id:`vl-location`,modelValue:x(i).location,"onUpdate:modelValue":s[0]||=e=>x(i).location=e,maxlength:`200`,placeholder:`z. B. Verwaltung, Besprechungsraum 2. OG`,required:``},null,8,[`modelValue`])]),_:1},8,[`error`]),f(`div`,W,[m(x(I),{id:`vl-from`,label:`Ab (optional)`,error:x(i).errors.from},{default:w(()=>[m(x(L),{id:`vl-from`,modelValue:x(i).from,"onUpdate:modelValue":s[1]||=e=>x(i).from=e,type:`date`,min:x(r)},null,8,[`modelValue`,`min`])]),_:1},8,[`error`]),m(x(I),{id:`vl-until`,label:`Bis (optional)`,error:x(i).errors.until},{default:w(()=>[m(x(L),{id:`vl-until`,modelValue:x(i).until,"onUpdate:modelValue":s[2]||=e=>x(i).until=e,type:`date`,min:x(i).from||x(r)},null,8,[`modelValue`,`min`])]),_:1},8,[`error`])]),m(x(I),{id:`vl-message`,label:`Nachricht (optional)`,error:x(i).errors.message},{default:w(()=>[m(x(R),{id:`vl-message`,modelValue:x(i).message,"onUpdate:modelValue":s[3]||=e=>x(i).message=e,rows:`3`,maxlength:`2000`,placeholder:`z. B. Anlass, Ansprechperson vor Ort …`},null,8,[`modelValue`])]),_:1},8,[`error`])],32),m(x(N),null,{default:w(()=>[m(x(k),{variant:`outline`,onClick:s[4]||=e=>n.value=!1},{default:w(()=>[...s[7]||=[p(`Abbrechen`,-1)]]),_:1}),m(x(k),{type:`submit`,form:`verleih-anfrage`,disabled:x(i).processing||!x(i).location.trim()},{default:w(()=>[x(i).processing?(_(),l(x(o),{key:0,class:`ih:animate-spin`})):(_(),l(x(V),{key:1})),s[8]||=p(` Anfrage senden `,-1)]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`]))}},K={class:`ih:mb-4 ih:flex ih:flex-wrap ih:items-center ih:justify-between ih:gap-3`},q={key:0,class:`ih:flex ih:gap-2`},se={class:`ih:grid ih:gap-6 ih:lg:grid-cols-[minmax(0,1fr)_22rem]`},ce={class:`ih:grid ih:min-w-0 ih:content-start ih:gap-6`},le=[`aria-label`],ue=[`src`,`alt`],de={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`},fe={key:2,class:`ih:rounded-lg ih:border ih:bg-card ih:p-5`},pe=[`innerHTML`],me={class:`ih:grid ih:content-start ih:gap-4 ih:lg:sticky ih:lg:top-24`},he={class:`ih:grid ih:gap-4 ih:rounded-lg ih:border ih:bg-card ih:p-5`},ge={class:`ih:grid ih:gap-2`},_e={class:`ih:text-xl ih:leading-snug ih:font-semibold`},ve={class:`ih:grid ih:gap-2 ih:text-sm`},ye={class:`ih:flex ih:gap-2`},be={key:0,class:`ih:flex ih:gap-2`},xe={key:1,class:`ih:flex ih:gap-2`},Se={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`},Ce={class:`ih:flex ih:items-center ih:gap-1.5 ih:font-medium`},we={key:0,class:`ih:rounded-lg ih:border ih:bg-card ih:p-5`},Te={class:`ih:grid ih:gap-3`},J={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,S=te();C(()=>S.props.flash?.status,e=>e&&ie.success(e),{immediate:!0});let R=ee(()=>h.item),W=v(!1),Y=v(!1),X=e=>e.key===`Escape`&&(Y.value=!1);C(Y,e=>e?window.addEventListener(`keydown`,X):window.removeEventListener(`keydown`,X)),g(()=>window.removeEventListener(`keydown`,X));let Z=v(!1),Q=O({location:``}),Ae=()=>Q.post(`/verleih/${R.value.id}/zurueck`,{preserveScroll:!0,onSuccess:()=>Z.value=!1}),je=()=>window.confirm(`Anfrage zurückziehen?`)&&D.delete(`/verleih/anfragen/${h.myRequest.id}`,{preserveScroll:!0}),Me=()=>window.confirm(`„${R.value.title}“ endgültig löschen?`)&&D.delete(`/verleih/${R.value.id}`),$=(e,t)=>[e?`ab ${z(e)}`:null,t?`bis ${z(t)}`:null].filter(Boolean).join(` `);return(ee,h)=>(_(),l(x(ne),{title:R.value.title},{default:w(()=>[f(`div`,K,[m(x(E),{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:w(()=>[m(x(ae),{class:`ih:size-4`}),p(` `+b(e.labels.title),1)]),_:1}),e.canManage?(_(),d(`div`,q,[m(x(k),{variant:`outline`,size:`sm`,"as-child":``},{default:w(()=>[m(x(E),{href:`/verleih/${R.value.id}/bearbeiten`},{default:w(()=>[m(x(B)),h[9]||=p(` Bearbeiten`,-1)]),_:1},8,[`href`])]),_:1}),m(x(k),{variant:`ghost`,size:`sm`,class:`ih:text-destructive ih:hover:text-destructive`,onClick:Me},{default:w(()=>[m(x(s)),h[10]||=p(` Löschen`,-1)]),_:1})])):u(``,!0)]),f(`div`,se,[f(`div`,ce,[R.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":`${R.value.title} vergrößern`,onClick:h[0]||=e=>Y.value=!0},[f(`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,ue)],8,le)):(_(),d(`div`,de,[m(x(i),{class:`ih:size-10`,"stroke-width":1.5})])),R.value.description?(_(),d(`section`,fe,[f(`div`,{class:`verleih-text ih:text-[15px] ih:leading-relaxed`,innerHTML:R.value.description},null,8,pe)])):u(``,!0)]),f(`aside`,me,[f(`section`,he,[f(`div`,ge,[m(a,{lent:R.value.lent,class:`ih:w-fit ih:border`},null,8,[`lent`]),f(`h1`,_e,b(R.value.title),1)]),f(`dl`,ve,[f(`div`,ye,[h[11]||=f(`dt`,{class:`ih:sr-only`},`Aktueller Standort`,-1),m(x(r),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),f(`dd`,null,b(R.value.location||`Standort nicht angegeben`),1)]),R.value.lent&&(R.value.lent_since||R.value.lent_until)?(_(),d(`div`,be,[h[12]||=f(`dt`,{class:`ih:sr-only`},`Zeitraum`,-1),m(x(t),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),f(`dd`,null,`Verliehen `+b($(R.value.lent_since,R.value.lent_until)),1)])):u(``,!0),R.value.lent_to?(_(),d(`div`,xe,[h[13]||=f(`dt`,{class:`ih:sr-only`},`Ausgeliehen von`,-1),m(x(U),{class:`ih:mt-0.5 ih:size-4 ih:shrink-0 ih:text-muted-foreground`,"aria-hidden":`true`}),f(`dd`,null,[m(x(E),{href:`/personen/${R.value.lent_to.id}`,class:`ih:hover:underline`},{default:w(()=>[p(b(R.value.lent_to.name),1)]),_:1},8,[`href`])])])):u(``,!0)]),e.myRequest?(_(),d(`div`,Se,[f(`p`,Ce,[m(x(oe),{class:`ih:size-4`}),p(` Angefragt am `+b(x(z)(e.myRequest.created_at)),1)]),f(`p`,null,`Nach „`+b(e.myRequest.location)+`“ `+b($(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(x(k),{key:1,size:`lg`,class:`ih:w-full`,onClick:h[1]||=e=>W.value=!0},{default:w(()=>[m(x(V)),p(` `+b(e.labels.singular)+` anfragen`,1)]),_:1})),e.canManage&&R.value.lent?(_(),l(x(k),{key:2,variant:`outline`,class:`ih:w-full`,onClick:h[2]||=e=>Z.value=!0},{default:w(()=>[m(x(H)),h[14]||=p(` Zurückgenommen`,-1)]),_:1})):u(``,!0)]),e.canManage&&e.requests.length?(_(),d(`section`,we,[h[16]||=f(`h2`,{class:`ih:mb-3 ih:text-sm ih:font-semibold`},`Anfragen`,-1),f(`ul`,Te,[(_(!0),d(c,null,y(e.requests,e=>(_(),d(`li`,{key:e.id,class:`ih:flex ih:gap-3 ih:text-sm`},[m(x(re),{person:e.user,class:`ih:size-8`},null,8,[`person`]),f(`div`,J,[f(`p`,null,[f(`span`,Ee,b(e.user?.name),1),p(` · `+b(e.location),1)]),f(`p`,De,b(e.status_label)+` · `+b(x(z)(e.created_at)),1)])]))),128))]),m(x(E),{href:`/verleih/anfragen`,class:`ih:mt-3 ih:inline-block ih:text-sm ih:font-medium ih:text-brand-text ih:hover:underline`},{default:w(()=>[...h[15]||=[p(`Alle Anfragen`,-1)]]),_:1})])):u(``,!0)])]),m(G,{open:W.value,"onUpdate:open":h[3]||=e=>W.value=e,item:R.value,labels:e.labels,"default-location":e.defaultLocation},null,8,[`open`,`item`,`labels`,`default-location`]),m(x(A),{open:Z.value,"onUpdate:open":h[6]||=e=>Z.value=e},{default:w(()=>[m(x(j),{class:`ih:sm:max-w-md`},{default:w(()=>[m(x(P),null,{default:w(()=>[m(x(F),null,{default:w(()=>[p(`„`+b(R.value.title)+`“ zurückgenommen`,1)]),_:1}),m(x(M),null,{default:w(()=>[...h[17]||=[p(`Danach ist es wieder verfügbar. Wo ist es jetzt?`,-1)]]),_:1})]),_:1}),f(`form`,{id:`verleih-zurueck`,onSubmit:T(Ae,[`prevent`])},[m(x(I),{id:`vl-return`,label:`Neuer Standort`,error:x(Q).errors.location},{default:w(()=>[m(x(L),{id:`vl-return`,modelValue:x(Q).location,"onUpdate:modelValue":h[4]||=e=>x(Q).location=e,maxlength:`200`,placeholder:`z. B. Lager Künstlerteam`},null,8,[`modelValue`])]),_:1},8,[`error`])],32),m(x(N),null,{default:w(()=>[m(x(k),{variant:`outline`,onClick:h[5]||=e=>Z.value=!1},{default:w(()=>[...h[18]||=[p(`Abbrechen`,-1)]]),_:1}),m(x(k),{type:`submit`,form:`verleih-zurueck`,disabled:x(Q).processing},{default:w(()=>[x(Q).processing?(_(),l(x(o),{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":R.value.title,onClick:h[8]||=e=>Y.value=!1},[f(`img`,{src:R.value.image_url,alt:R.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]||=T(e=>Y.value=!1,[`stop`])},[m(x(n))])],8,Oe)):u(``,!0)]),_:1},8,[`title`]))}};export{Y as default};