inhaus-plugin-verleih/dist/pages/Index.js
Friederich Loheide 9d44e11b75 Verleih 1.2.0: einheitliche Werkzeugleiste mit Listenansicht
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 19:57:14 +00:00

1 line
No EOL
7.7 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,isRef as f,normalizeClass as p,openBlock as m,renderList as h,toDisplayString as g,unref as _,watch as v,withCtx as y}from"vue";import{Link as b,router as x,usePage as S}from"@inertiajs/vue3";import{AppLayout as C,Button as w,EmptyState as T,ListToolbar as E,PageHeader as D,formatDate as O,toast as k,useListView 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:`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`}]]}),P={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`},F=[`src`,`alt`],I={key:1,class:`ih:grid ih:size-full ih:place-items-center`},L={class:`ih:flex ih:flex-1 ih:flex-col ih:gap-1 ih:p-3`},R={key:0,class:`ih:mt-auto ih:flex ih:items-center ih:gap-1 ih:pt-1 ih:text-xs ih:text-muted-foreground`},z={class:`ih:truncate`},B={__name:`ItemCard`,props:{item:{type:Object,required:!0}},setup(e){return(i,a)=>(m(),c(`article`,P,[d(_(b),{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:y(()=>[e.item.thumb_url?(m(),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,F)):(m(),c(`span`,I,[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`,L,[d(_(b),{href:e.item.url,prefetch:``,class:`ih:line-clamp-2 ih:text-[15px] ih:leading-snug ih:font-semibold ih:hover:underline`},{default:y(()=>[u(g(e.item.title),1)]),_:1},8,[`href`]),e.item.location?(m(),c(`p`,R,[d(_(t),{class:`ih:size-3.5 ih:shrink-0`}),l(`span`,z,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`},V={key:0,class:`ih:mb-6 ih:rounded-lg ih:border ih:bg-card ih:p-4`,"aria-labelledby":`meine-anfragen`},H={class:`ih:divide-y`},U={class:`ih:text-muted-foreground`},W={key:0,class:`ih:text-muted-foreground`},G={class:`ih:ml-auto ih:text-xs ih:text-muted-foreground`},K=[`onClick`],q={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`},J={key:2,class:`ih:divide-y ih:rounded-lg ih:border ih:bg-card`},Y={class:`ih:grid ih:size-12 ih:shrink-0 ih:place-items-center ih:overflow-hidden ih:rounded-md ih:bg-muted`},X=[`src`],Z={class:`ih:grid ih:min-w-0 ih:flex-1`},Q={class:`ih:truncate ih:font-medium`},$={key:0,class:`ih:truncate ih:text-xs ih:text-muted-foreground`},te={key:3,class:`ih:rounded-lg ih:border ih:bg-card`},ne={key:4,class:`ih:mt-6 ih:flex ih:items-center ih:gap-1.5 ih:text-xs ih:text-muted-foreground`},re={__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=S();v(()=>n.props.flash?.status,e=>e&&k.success(e),{immediate:!0});let P=A(`verleih`,`grid`);function F(e){let n={...t.filters,...e};x.get(`/verleih`,Object.fromEntries(Object.entries(n).filter(([,e])=>e)),{preserveState:!0,preserveScroll:!0,replace:!0})}let I=[{value:null,label:`Alle`,count:`all`},{value:`verfuegbar`,label:`Verfügbar`,count:`available`},{value:`verliehen`,label:`Verliehen`,count:`lent`}],L=e=>window.confirm(`Anfrage zurückziehen?`)&&x.delete(`/verleih/anfragen/${e.id}`,{preserveScroll:!0});return(t,n)=>(m(),o(_(C),{title:e.labels.title},{default:y(()=>[d(_(D),{title:e.labels.title,icon:`images`,description:`Alle ${e.labels.plural} auf einen Blick – verfügbar oder verliehen, und wo sie gerade sind.`},{actions:y(()=>[e.canManage?(m(),c(a,{key:0},[d(_(w),{variant:`outline`,"as-child":``},{default:y(()=>[d(_(b),{href:`/verleih/anfragen`},{default:y(()=>[d(_(i)),n[3]||=u(` Anfragen`,-1),e.pendingRequests?(m(),c(`span`,ee,g(e.pendingRequests),1)):s(``,!0)]),_:1})]),_:1}),d(_(w),{"as-child":``},{default:y(()=>[d(_(b),{href:`/verleih/neu`},{default:y(()=>[d(_(M)),u(` `+g(e.labels.singular)+` erfassen`,1)]),_:1})]),_:1})],64)):s(``,!0)]),_:1},8,[`title`,`description`]),e.myRequests.length?(m(),c(`section`,V,[n[4]||=l(`h2`,{id:`meine-anfragen`,class:`ih:mb-2 ih:text-sm ih:font-semibold`},`Ihre Anfragen`,-1),l(`ul`,H,[(m(!0),c(a,null,h(e.myRequests,e=>(m(),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(_(b),{href:e.item.url,class:`ih:font-medium ih:hover:underline`},{default:y(()=>[u(g(e.item.title),1)]),_:2},1032,[`href`]),l(`span`,U,`nach `+g(e.location),1),l(`span`,{class:p([`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?(m(),c(`span`,W,`„`+g(e.note)+`“`,1)):s(``,!0),l(`span`,G,g(_(O)(e.created_at)),1),e.status===`pending`?(m(),c(`button`,{key:1,type:`button`,class:`ih:text-xs ih:font-medium ih:text-muted-foreground ih:hover:text-destructive`,onClick:t=>L(e)},`Zurückziehen`,8,K)):s(``,!0)]))),128))])])):s(``,!0),d(_(E),{filters:I.map(t=>({value:t.value,label:t.label,count:e.counts[t.count]})),filter:e.filters.status||null,"filter-label":`Status`,search:e.filters.q??``,"search-placeholder":`${e.labels.plural} oder Orte suchen`,view:_(P),"onUpdate:view":n[0]||=e=>f(P)?P.value=e:null,"onUpdate:filter":n[1]||=e=>F({status:e}),"onUpdate:search":n[2]||=e=>F({q:e})},null,8,[`filters`,`filter`,`search`,`search-placeholder`,`view`]),e.items.length&&_(P)===`grid`?(m(),c(`div`,q,[(m(!0),c(a,null,h(e.items,e=>(m(),o(B,{key:e.id,item:e},null,8,[`item`]))),128))])):e.items.length?(m(),c(`ul`,J,[(m(!0),c(a,null,h(e.items,e=>(m(),c(`li`,{key:e.id},[d(_(b),{href:e.url,class:`ih:flex ih:items-center ih:gap-3 ih:px-4 ih:py-2.5 ih:hover:bg-accent/60`},{default:y(()=>[l(`span`,Y,[e.thumb_url?(m(),c(`img`,{key:0,src:e.thumb_url,alt:``,class:`ih:max-h-full ih:max-w-full ih:object-contain`},null,8,X)):(m(),o(_(j),{key:1,class:`ih:size-5 ih:text-muted-foreground`}))]),l(`span`,Z,[l(`span`,Q,g(e.title),1),e.location?(m(),c(`span`,$,g(e.location),1)):s(``,!0)]),d(r,{lent:e.lent,class:`ih:shrink-0 ih:border`},null,8,[`lent`])]),_:2},1032,[`href`])]))),128))])):(m(),c(`div`,te,[d(_(T),{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?(m(),c(`p`,ne,[d(_(N),{class:`ih:size-3.5`}),n[5]||=u(` Bezeichnungen und Übernahme aus WordPress: Administration → Portal → Verleih `,-1)])):s(``,!0)]),_:1},8,[`title`]))}};export{re as default};