inhaus-plugin-kleinanzeigen/dist/pages/Moderation.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
4.8 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{t}from"../chunks/flag-DsBVcwMd.js";import{t as n}from"../chunks/image-off-BfSjK3tM.js";import{Fragment as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createElementVNode as s,createTextVNode as c,createVNode as l,openBlock as u,ref as d,renderList as f,toDisplayString as p,unref as m,watch as h,withCtx as g}from"vue";import{Link as _,router as v,usePage as y}from"@inertiajs/vue3";import{AppLayout as b,Button as x,EmptyState as S,PageHeader as C,Panel as w,Textarea as T,toast as E}from"@inhaus/ui";var D=e({name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]}),O=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`}]]}),k={class:`ih:-mx-5 ih:divide-y ih:border-t`},A={class:`ih:min-w-0 ih:flex-1`},j={class:`ih:text-xs ih:text-muted-foreground`},M={key:1,class:`ih:grid ih:gap-4`},N={class:`ih:grid ih:grid-cols-3 ih:content-start ih:gap-1 ih:md:grid-cols-2`},P=[`src`],F={key:0,class:`ih:col-span-2 ih:grid ih:aspect-[4/3] ih:place-items-center ih:rounded ih:bg-muted ih:text-muted-foreground`},I={class:`ih:min-w-0`},L={class:`ih:text-xs ih:text-muted-foreground`},R={key:0,class:`ih:font-medium ih:text-brand-text`},z={class:`ih:mt-2 ih:line-clamp-4 ih:text-sm ih:whitespace-pre-line`},B={key:1,class:`ih:mt-3 ih:grid ih:gap-2`},V={class:`ih:flex ih:gap-2`},H={key:2,class:`ih:mt-3 ih:flex ih:gap-2`},U={key:2,class:`ih:rounded-lg ih:border ih:bg-card`},W={__name:`Moderation`,props:{pending:{type:Array,required:!0},reported:{type:Array,required:!0}},setup(e){let W=y();h(()=>W.props.flash?.status,e=>e&&E.success(e),{immediate:!0});let G=d({}),K=d(null),q=e=>v.post(`/kleinanzeigen/${e.id}/freigeben`,{},{preserveScroll:!0});function J(e){v.post(`/kleinanzeigen/${e.id}/zurueckgeben`,{note:G.value[e.id]??``},{preserveScroll:!0,onSuccess:()=>K.value=null})}let Y=(e,t)=>v.post(`/kleinanzeigen/${e.id}/meldungen`,{action:t},{preserveScroll:!0});return(d,h)=>(u(),i(m(b),{title:`Kleinanzeigen – Freigabe`},{default:g(()=>[l(m(C),{title:`Freigabe`,description:`Neue und geänderte Anzeigen prüfen. Die anbietende Person bekommt Bescheid.`,breadcrumbs:[{label:`Kleinanzeigen`,href:`/kleinanzeigen`}]}),e.reported.length?(u(),i(m(w),{key:0,title:`Gemeldet`,class:`ih:mb-6`},{default:g(()=>[s(`ul`,k,[(u(!0),o(r,null,f(e.reported,e=>(u(),o(`li`,{key:e.id,class:`ih:flex ih:flex-wrap ih:items-center ih:gap-3 ih:px-5 ih:py-3`},[l(m(t),{class:`ih:size-4 ih:shrink-0 ih:text-destructive`}),s(`div`,A,[l(m(_),{href:e.url,class:`ih:font-medium ih:hover:underline`},{default:g(()=>[c(p(e.title),1)]),_:2},1032,[`href`]),s(`p`,j,p(e.seller)+` · `+p(e.reasons.join(` / `)),1)]),l(m(x),{size:`sm`,variant:`outline`,onClick:t=>Y(e,`keep`)},{default:g(()=>[...h[1]||=[c(`In Ordnung`,-1)]]),_:1},8,[`onClick`]),l(m(x),{size:`sm`,variant:`outline`,class:`ih:text-destructive ih:hover:text-destructive`,onClick:t=>Y(e,`remove`)},{default:g(()=>[...h[2]||=[c(`Offline nehmen`,-1)]]),_:1},8,[`onClick`])]))),128))])]),_:1})):a(``,!0),e.pending.length?(u(),o(`div`,M,[(u(!0),o(r,null,f(e.pending,e=>(u(),o(`article`,{key:e.id,class:`ih:grid ih:gap-4 ih:rounded-lg ih:border ih:bg-card ih:p-4 ih:shadow-xs ih:md:grid-cols-[12rem_minmax(0,1fr)]`},[s(`div`,N,[(u(!0),o(r,null,f(e.photos.slice(0,4),e=>(u(),o(`img`,{key:e.id,src:e.thumb_url,alt:``,class:`ih:aspect-[4/3] ih:w-full ih:rounded ih:object-cover`},null,8,P))),128)),e.photos.length?a(``,!0):(u(),o(`span`,F,[l(m(n),{class:`ih:size-6`})]))]),s(`div`,I,[s(`p`,L,p(e.type_label)+` · `+p(e.category_label)+` · von `+p(e.seller?.name),1),l(m(_),{href:e.url,class:`ih:text-lg ih:font-semibold ih:hover:underline`},{default:g(()=>[c(p(e.title),1)]),_:2},1032,[`href`]),e.price?(u(),o(`p`,R,p(e.price),1)):a(``,!0),s(`p`,z,p(e.description),1),K.value===e.id?(u(),o(`div`,B,[l(m(T),{modelValue:G.value[e.id],"onUpdate:modelValue":t=>G.value[e.id]=t,rows:`2`,maxlength:`500`,placeholder:`Begründung für die anbietende Person`,"aria-label":`Begründung`},null,8,[`modelValue`,`onUpdate:modelValue`]),s(`div`,V,[l(m(x),{size:`sm`,disabled:!(G.value[e.id]??``).trim(),onClick:t=>J(e)},{default:g(()=>[...h[3]||=[c(`Zurückgeben`,-1)]]),_:1},8,[`disabled`,`onClick`]),l(m(x),{size:`sm`,variant:`ghost`,onClick:h[0]||=e=>K.value=null},{default:g(()=>[...h[4]||=[c(`Abbrechen`,-1)]]),_:1})])])):(u(),o(`div`,H,[l(m(x),{size:`sm`,onClick:t=>q(e)},{default:g(()=>[l(m(D)),h[5]||=c(` Freigeben`,-1)]),_:1},8,[`onClick`]),l(m(x),{size:`sm`,variant:`outline`,onClick:t=>K.value=e.id},{default:g(()=>[l(m(O)),h[6]||=c(` Zurückgeben …`,-1)]),_:1},8,[`onClick`])]))])]))),128))])):(u(),o(`div`,U,[l(m(S),{icon:m(D),title:`Alles erledigt`,text:`Keine Anzeigen warten auf Freigabe.`},null,8,[`icon`])]))]),_:1}))}};export{W as default};