inhaus-plugin-verleih/dist/pages/Index.js
Friederich Loheide dce39774a2 Vorschau zeigt immer das ganze Bild, eingepasst mit Rand (1.0.1)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 16:39:16 +00:00

1 line
No EOL
7.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{t as e}from"../chunks/createLucideIcon-CYyWUN7r.js";import{n as t,r as n,t as r}from"../chunks/StatusBadge-CZaj6wAi.js";import{t as i}from"../chunks/inbox-CWQqWjak.js";import{Fragment as a,createBlock as o,createCommentVNode as s,createElementBlock as c,createElementVNode as l,createTextVNode as u,createVNode as d,normalizeClass as f,openBlock as p,ref as m,renderList as h,toDisplayString as g,unref as _,vModelText as v,watch as y,withCtx as b,withDirectives as x}from"vue";import{Link as S,router as C,usePage as w}from"@inertiajs/vue3";import{AppLayout as T,Button as E,EmptyState as D,PageHeader as O,formatDate as k,toast as A}from"@inhaus/ui";var j=e({name:`images`,size:24,node:[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]}),M=e({name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]}),N=e({name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]}),P=e({name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]}),F={class:`ih:group ih:flex ih:flex-col ih:overflow-hidden ih:rounded-lg ih:border ih:bg-card ih:shadow-xs ih:transition-shadow ih:hover:shadow-md`},I=[`src`,`alt`],L={key:1,class:`ih:grid ih:size-full ih:place-items-center`},R={class:`ih:flex ih:flex-1 ih:flex-col ih:gap-1 ih:p-3`},z={key:0,class:`ih:mt-auto ih:flex ih:items-center ih:gap-1 ih:pt-1 ih:text-xs ih:text-muted-foreground`},B={class:`ih:truncate`},V={__name:`ItemCard`,props:{item:{type:Object,required:!0}},setup(e){return(i,a)=>(p(),c(`article`,F,[d(_(S),{href:e.item.url,prefetch:``,class:`ih:relative ih:block ih:aspect-[4/3] ih:overflow-hidden ih:bg-muted ih:p-3 ih:pt-9`},{default:b(()=>[e.item.thumb_url?(p(),c(`img`,{key:0,src:e.item.thumb_url,alt:e.item.title,loading:`lazy`,class:`ih:size-full ih:object-contain ih:transition-transform ih:duration-300 ih:group-hover:scale-[1.02]`},null,8,I)):(p(),c(`span`,L,[d(_(n),{class:`ih:size-8 ih:text-muted-foreground`,"stroke-width":1.5})])),d(r,{lent:e.item.lent,class:`ih:absolute ih:top-2 ih:left-2`},null,8,[`lent`])]),_:1},8,[`href`]),l(`div`,R,[d(_(S),{href:e.item.url,prefetch:``,class:`ih:line-clamp-2 ih:text-[15px] ih:leading-snug ih:font-semibold ih:hover:underline`},{default:b(()=>[u(g(e.item.title),1)]),_:1},8,[`href`]),e.item.location?(p(),c(`p`,z,[d(_(t),{class:`ih:size-3.5 ih:shrink-0`}),l(`span`,B,g(e.item.location),1)])):s(``,!0)])]))}},ee={key:0,class:`ih:rounded-full ih:bg-brand ih:px-1.5 ih:text-[11px] ih:text-brand-foreground`},H={key:0,class:`ih:mb-6 ih:rounded-lg ih:border ih:bg-card ih:p-4`,"aria-labelledby":`meine-anfragen`},U={class:`ih:divide-y`},W={class:`ih:text-muted-foreground`},G={key:0,class:`ih:text-muted-foreground`},K={class:`ih:ml-auto ih:text-xs ih:text-muted-foreground`},q=[`onClick`],J={class:`ih:mb-5 ih:flex ih:flex-wrap ih:items-center ih:gap-3`},Y={class:`ih:flex ih:flex-wrap ih:gap-1.5`,"aria-label":`Status`},X=[`aria-pressed`,`onClick`],Z={class:`ih:tabular-nums ih:opacity-75`},Q={class:`ih:relative ih:ml-auto ih:w-full ih:sm:w-64`},$=[`placeholder`,`aria-label`],te={key:1,class:`ih:grid ih:grid-cols-2 ih:gap-3 ih:sm:gap-4 ih:md:grid-cols-3 ih:xl:grid-cols-4`},ne={key:2,class:`ih:rounded-lg ih:border ih:bg-card`},re={key:3,class:`ih:mt-6 ih:flex ih:items-center ih:gap-1.5 ih:text-xs ih:text-muted-foreground`},ie={__name:`Index`,props:{items:{type:Array,required:!0},filters:{type:Object,required:!0},counts:{type:Object,required:!0},labels:{type:Object,required:!0},canManage:{type:Boolean,default:!1},pendingRequests:{type:Number,default:null},myRequests:{type:Array,default:()=>[]}},setup(e){let t=e,n=w();y(()=>n.props.flash?.status,e=>e&&A.success(e),{immediate:!0});let r=m(t.filters.q),F;y(r,e=>{clearTimeout(F),F=setTimeout(()=>I({q:e}),300)});function I(e){let n={...t.filters,...e};C.get(`/verleih`,Object.fromEntries(Object.entries(n).filter(([,e])=>e)),{preserveState:!0,preserveScroll:!0,replace:!0})}let L=[{value:null,label:`Alle`,count:`all`},{value:`verfuegbar`,label:`Verfügbar`,count:`available`},{value:`verliehen`,label:`Verliehen`,count:`lent`}],R=e=>window.confirm(`Anfrage zurückziehen?`)&&C.delete(`/verleih/anfragen/${e.id}`,{preserveScroll:!0});return(t,n)=>(p(),o(_(T),{title:e.labels.title},{default:b(()=>[d(_(O),{title:e.labels.title,description:`Alle ${e.labels.plural} auf einen Blick – verfügbar oder verliehen, und wo sie gerade sind.`},{actions:b(()=>[e.canManage?(p(),c(a,{key:0},[d(_(E),{variant:`outline`,"as-child":``},{default:b(()=>[d(_(S),{href:`/verleih/anfragen`},{default:b(()=>[d(_(i)),n[1]||=u(` Anfragen`,-1),e.pendingRequests?(p(),c(`span`,ee,g(e.pendingRequests),1)):s(``,!0)]),_:1})]),_:1}),d(_(E),{"as-child":``},{default:b(()=>[d(_(S),{href:`/verleih/neu`},{default:b(()=>[d(_(M)),u(` `+g(e.labels.singular)+` erfassen`,1)]),_:1})]),_:1})],64)):s(``,!0)]),_:1},8,[`title`,`description`]),e.myRequests.length?(p(),c(`section`,H,[n[2]||=l(`h2`,{id:`meine-anfragen`,class:`ih:mb-2 ih:text-sm ih:font-semibold`},`Ihre Anfragen`,-1),l(`ul`,U,[(p(!0),c(a,null,h(e.myRequests,e=>(p(),c(`li`,{key:e.id,class:`ih:flex ih:flex-wrap ih:items-center ih:gap-x-3 ih:gap-y-1 ih:py-2 ih:text-sm`},[d(_(S),{href:e.item.url,class:`ih:font-medium ih:hover:underline`},{default:b(()=>[u(g(e.item.title),1)]),_:2},1032,[`href`]),l(`span`,W,`nach `+g(e.location),1),l(`span`,{class:f([`ih:rounded-full ih:px-2 ih:py-0.5 ih:text-xs ih:font-medium`,e.status===`accepted`?`ih:bg-brand ih:text-brand-foreground`:e.status===`pending`?`ih:bg-brand-soft ih:text-brand-text`:`ih:bg-muted ih:text-muted-foreground`])},g(e.status_label),3),e.note?(p(),c(`span`,G,`„`+g(e.note)+`“`,1)):s(``,!0),l(`span`,K,g(_(k)(e.created_at)),1),e.status===`pending`?(p(),c(`button`,{key:1,type:`button`,class:`ih:text-xs ih:font-medium ih:text-muted-foreground ih:hover:text-destructive`,onClick:t=>R(e)},`Zurückziehen`,8,q)):s(``,!0)]))),128))])])):s(``,!0),l(`div`,J,[l(`nav`,Y,[(p(),c(a,null,h(L,t=>l(`button`,{key:t.label,type:`button`,class:f([`ih:inline-flex ih:items-center ih:gap-1.5 ih:rounded-full ih:border ih:px-3 ih:py-1 ih:text-[13px]`,e.filters.status===t.value?`ih:border-brand ih:bg-brand ih:text-brand-foreground`:`ih:bg-card ih:hover:bg-accent`]),"aria-pressed":e.filters.status===t.value,onClick:e=>I({status:t.value})},[u(g(t.label)+` `,1),l(`span`,Z,g(e.counts[t.count]),1)],10,X)),64))]),l(`div`,Q,[d(_(N),{class:`ih:pointer-events-none ih:absolute ih:top-1/2 ih:left-2.5 ih:size-4 ih:-translate-y-1/2 ih:text-muted-foreground`}),x(l(`input`,{"onUpdate:modelValue":n[0]||=e=>r.value=e,type:`search`,placeholder:`${e.labels.plural} oder Orte suchen`,"aria-label":`${e.labels.plural} durchsuchen`,class:`ih:h-9 ih:w-full ih:rounded-md ih:border ih:border-input ih:bg-card ih:pr-3 ih:pl-8 ih:text-sm ih:shadow-xs ih:focus-visible:ring-3 ih:focus-visible:ring-ring/30 ih:focus-visible:outline-none`},null,8,$),[[v,r.value]])])]),e.items.length?(p(),c(`div`,te,[(p(!0),c(a,null,h(e.items,e=>(p(),o(V,{key:e.id,item:e},null,8,[`item`]))),128))])):(p(),c(`div`,ne,[d(_(D),{icon:_(j),title:e.filters.q||e.filters.status?`Keine passenden ${e.labels.plural}`:`Noch keine ${e.labels.plural}`,text:e.canManage&&!e.filters.q&&!e.filters.status?`Legen Sie mit „${e.labels.singular} erfassen“ los – oder übernehmen Sie den Bestand aus WordPress (Administration → Portal → Verleih).`:``},null,8,[`icon`,`title`,`text`])])),e.canManage?(p(),c(`p`,re,[d(_(P),{class:`ih:size-3.5`}),n[3]||=u(` Bezeichnungen und Übernahme aus WordPress: Administration → Portal → Verleih `,-1)])):s(``,!0)]),_:1},8,[`title`]))}};export{ie as default};