inhaus-plugin-kleinanzeigen/dist/pages/Index.js
Friederich Loheide f05c44733f Kleinanzeigen-Plugin 1.0.0
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 17:06:02 +00:00

1 line
No EOL
8.1 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{t}from"../chunks/ListingCard-DfH_TzXE.js";import{t as n}from"../chunks/heart-CyCnSX5a.js";import{t as ee}from"../chunks/plus-CThDQH9c.js";import{t as te}from"../chunks/shield-check-CrHENMih.js";import{Fragment as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createElementVNode as s,createTextVNode as c,createVNode as l,normalizeClass as u,openBlock as d,ref as ne,renderList as f,toDisplayString as p,unref as m,vModelText as h,watch as g,withCtx as _,withDirectives as re}from"vue";import{Link as v,router as ie,usePage as y}from"@inertiajs/vue3";import{AppLayout as b,Button as x,EmptyState as S,PageHeader as C,toast as w}from"@inhaus/ui";var T=e({name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]}),E=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`}]]}),D=e({name:`shopping-bag`,size:24,node:[[`path`,{d:`M16 10a4 4 0 0 1-8 0`,key:`1ltviw`}],[`path`,{d:`M3.103 6.034h17.794`,key:`awc11p`}],[`path`,{d:`M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z`,key:`o988cm`}]]}),O={key:0,class:`ih:rounded-full ih:bg-brand ih:px-1.5 ih:text-[11px] ih:text-brand-foreground`},k={key:0,class:`ih:text-muted-foreground`},A={class:`ih:grid ih:gap-6 ih:lg:grid-cols-[15rem_minmax(0,1fr)]`},j={class:`ih:grid ih:content-start ih:gap-5`},M={class:`ih:relative`},N={"aria-label":`Art`,class:`ih:flex ih:flex-wrap ih:gap-1.5`},P=[`aria-pressed`],F=[`aria-pressed`,`onClick`],I={"aria-label":`Kategorien`,class:`ih:hidden ih:lg:block`},L={class:`ih:grid ih:gap-0.5 ih:text-sm`},R=[`onClick`],ae={class:`ih:text-xs ih:text-muted-foreground ih:tabular-nums`},z=[`value`],B=[`value`],V={class:`ih:min-w-0`},H={class:`ih:mb-4 ih:flex ih:flex-wrap ih:items-center ih:gap-3`},U={class:`ih:flex-1 ih:text-sm ih:text-muted-foreground`},W=[`aria-pressed`],G=[`value`],K=[`value`],q={key:0,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:1,class:`ih:rounded-lg ih:border ih:bg-card`},oe={key:2,class:`ih:mt-6 ih:flex ih:items-center ih:justify-between ih:text-sm`,"aria-label":`Seiten`},se={key:1},ce={class:`ih:text-muted-foreground`},le={key:3},Y={__name:`Index`,props:{listings:{type:Array,required:!0},pagination:{type:Object,required:!0},filters:{type:Object,required:!0},types:{type:Object,required:!0},categories:{type:Object,required:!0},counts:{type:Object,default:()=>({})},pending:{type:Number,default:null},mine:{type:Number,default:0}},setup(e){let Y=e,X=y();g(()=>X.props.flash?.status,e=>e&&w.success(e),{immediate:!0});let Z=ne(Y.filters.q),Q;g(Z,e=>{clearTimeout(Q),Q=setTimeout(()=>$({q:e}),350)});function $(e){let t={...Y.filters,...e};ie.get(`/kleinanzeigen`,Object.fromEntries(Object.entries(t).filter(([e,t])=>t&&(e!==`sortierung`||t!==`neu`))),{preserveState:!0,preserveScroll:!0})}let ue={neu:`Neueste zuerst`,preis:`Preis aufsteigend`,"preis-ab":`Preis absteigend`};return(ne,g)=>(d(),i(m(b),{title:`Kleinanzeigen`},{default:_(()=>[l(m(C),{title:`Kleinanzeigen`,description:`Von Kolleginnen und Kollegen für Kolleginnen und Kollegen – verkaufen, verschenken, suchen, tauschen.`},{actions:_(()=>[e.pending===null?a(``,!0):(d(),i(m(x),{key:0,variant:`outline`,"as-child":``},{default:_(()=>[l(m(v),{href:`/kleinanzeigen/moderation`},{default:_(()=>[l(m(te)),g[6]||=c(` Freigabe`,-1),e.pending?(d(),o(`span`,O,p(e.pending),1)):a(``,!0)]),_:1})]),_:1})),l(m(x),{variant:`outline`,"as-child":``},{default:_(()=>[l(m(v),{href:`/kleinanzeigen/meine`},{default:_(()=>[l(m(T)),g[7]||=c(` Meine Anzeigen`,-1),e.mine?(d(),o(`span`,k,`(`+p(e.mine)+`)`,1)):a(``,!0)]),_:1})]),_:1}),l(m(x),{"as-child":``},{default:_(()=>[l(m(v),{href:`/kleinanzeigen/neu`},{default:_(()=>[l(m(ee)),g[8]||=c(` Anzeige aufgeben`,-1)]),_:1})]),_:1})]),_:1}),s(`div`,A,[s(`aside`,j,[s(`div`,M,[l(m(E),{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`}),re(s(`input`,{"onUpdate:modelValue":g[0]||=e=>Z.value=e,type:`search`,placeholder:`Suchen`,"aria-label":`Anzeigen durchsuchen`,class:`ih:h-10 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,512),[[h,Z.value]])]),s(`nav`,N,[s(`button`,{type:`button`,class:u([`ih:rounded-full ih:border ih:px-3 ih:py-1 ih:text-[13px]`,e.filters.typ?`ih:bg-card ih:hover:bg-accent`:`ih:border-brand ih:bg-brand ih:text-brand-foreground`]),"aria-pressed":!e.filters.typ,onClick:g[1]||=e=>$({typ:null})},`Alle`,10,P),(d(!0),o(r,null,f(e.types,(t,n)=>(d(),o(`button`,{key:n,type:`button`,class:u([`ih:rounded-full ih:border ih:px-3 ih:py-1 ih:text-[13px]`,e.filters.typ===n?`ih:border-brand ih:bg-brand ih:text-brand-foreground`:`ih:bg-card ih:hover:bg-accent`]),"aria-pressed":e.filters.typ===n,onClick:e=>$({typ:n})},p(t),11,F))),128))]),s(`nav`,I,[g[9]||=s(`h2`,{class:`ih:mb-1.5 ih:text-xs ih:font-semibold ih:tracking-wider ih:text-muted-foreground ih:uppercase`},`Kategorien`,-1),s(`ul`,L,[s(`li`,null,[s(`button`,{type:`button`,class:u([`ih:flex ih:w-full ih:justify-between ih:rounded ih:px-2 ih:py-1.5 ih:text-left`,e.filters.kategorie?`ih:hover:bg-accent`:`ih:bg-brand-soft ih:font-medium ih:text-brand-text`]),onClick:g[2]||=e=>$({kategorie:null})},`Alle Kategorien`,2)]),(d(!0),o(r,null,f(e.categories,(t,n)=>(d(),o(`li`,{key:n},[s(`button`,{type:`button`,class:u([`ih:flex ih:w-full ih:justify-between ih:gap-2 ih:rounded ih:px-2 ih:py-1.5 ih:text-left`,e.filters.kategorie===n?`ih:bg-brand-soft ih:font-medium ih:text-brand-text`:`ih:hover:bg-accent`]),onClick:e=>$({kategorie:n})},[s(`span`,null,p(t),1),s(`span`,ae,p(e.counts[n]??0),1)],10,R)]))),128))])]),s(`select`,{class:`ih:h-10 ih:rounded-md ih:border ih:bg-card ih:px-2 ih:text-sm ih:lg:hidden`,"aria-label":`Kategorie`,value:e.filters.kategorie??``,onChange:g[3]||=e=>$({kategorie:e.target.value||null})},[g[10]||=s(`option`,{value:``},`Alle Kategorien`,-1),(d(!0),o(r,null,f(e.categories,(t,n)=>(d(),o(`option`,{key:n,value:n},p(t)+` (`+p(e.counts[n]??0)+`)`,9,B))),128))],40,z)]),s(`section`,V,[s(`div`,H,[s(`p`,U,p(e.pagination.total)+` `+p(e.pagination.total===1?`Anzeige`:`Anzeigen`),1),s(`button`,{type:`button`,class:u([`ih:inline-flex ih:items-center ih:gap-1.5 ih:rounded-md ih:border ih:px-3 ih:py-1.5 ih:text-sm`,e.filters.merkliste?`ih:border-brand ih:bg-brand-soft ih:text-brand-text`:`ih:bg-card ih:hover:bg-accent`]),"aria-pressed":e.filters.merkliste,onClick:g[4]||=t=>$({merkliste:e.filters.merkliste?null:1})},[l(m(n),{class:u([`ih:size-4`,e.filters.merkliste?`ih:fill-current`:``])},null,8,[`class`]),g[11]||=c(` Merkliste `,-1)],10,W),s(`select`,{class:`ih:h-9 ih:rounded-md ih:border ih:bg-card ih:px-2 ih:text-sm`,"aria-label":`Sortierung`,value:e.filters.sortierung,onChange:g[5]||=e=>$({sortierung:e.target.value})},[(d(),o(r,null,f(ue,(e,t)=>s(`option`,{key:t,value:t},p(e),9,K)),64))],40,G)]),e.listings.length?(d(),o(`div`,q,[(d(!0),o(r,null,f(e.listings,e=>(d(),i(t,{key:e.id,listing:e},null,8,[`listing`]))),128))])):(d(),o(`div`,J,[l(m(S),{icon:m(D),title:e.filters.q||e.filters.typ||e.filters.kategorie||e.filters.merkliste?`Keine passenden Anzeigen`:`Noch keine Anzeigen`,text:`Etwas übrig oder auf der Suche? Geben Sie die erste Anzeige auf.`},null,8,[`icon`,`title`])])),e.pagination.last>1?(d(),o(`nav`,oe,[e.pagination.prev?(d(),i(m(v),{key:0,href:e.pagination.prev,"preserve-scroll":``,class:`ih:font-medium ih:text-brand-text ih:hover:underline`},{default:_(()=>[...g[12]||=[c(`← Zurück`,-1)]]),_:1},8,[`href`])):(d(),o(`span`,se)),s(`span`,ce,`Seite `+p(e.pagination.current)+` von `+p(e.pagination.last),1),e.pagination.next?(d(),i(m(v),{key:2,href:e.pagination.next,"preserve-scroll":``,class:`ih:font-medium ih:text-brand-text ih:hover:underline`},{default:_(()=>[...g[13]||=[c(`Weiter →`,-1)]]),_:1},8,[`href`])):(d(),o(`span`,le))])):a(``,!0)])])]),_:1}))}};export{Y as default};