inhaus-plugin-kleinanzeigen/dist/pages/Show.js
Friederich Loheide 2be070eb67 Kleinanzeigen 1.2.0: Detailseite im einheitlichen Seitenkopf
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 04:19:02 +00:00

1 line
No EOL
12 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{n as t,t as n}from"../chunks/ListingCard-DfH_TzXE.js";import{n as r,t as ee}from"../chunks/loader-circle-DBP4Qhm5.js";import{t as te}from"../chunks/flag-DsBVcwMd.js";import{t as ne}from"../chunks/heart-CyCnSX5a.js";import{t as re}from"../chunks/image-off-BfSjK3tM.js";import{n as ie,t as ae}from"../chunks/trash-DzQOFBxr.js";import{t as i}from"../chunks/shield-check-CrHENMih.js";import{Fragment as a,computed as o,createBlock as s,createCommentVNode as c,createElementBlock as l,createElementVNode as u,createSlots as oe,createTextVNode as d,createVNode as f,normalizeClass as p,openBlock as m,ref as h,renderList as g,resolveDynamicComponent as se,toDisplayString as _,unref as v,watch as ce,withCtx as y,withModifiers as le}from"vue";import{Link as b,router as x,useForm as S,usePage as C}from"@inertiajs/vue3";import{AppLayout as w,Button as T,Dialog as E,DialogContent as D,DialogDescription as O,DialogFooter as k,DialogHeader as A,DialogTitle as j,PageHeader as M,PersonAvatar as N,Textarea as P,formatDate as F,toast as I}from"@inhaus/ui";var L=e({name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]}),R=e({name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]}),z=e({name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]}),B=e({name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]}),V=e({name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]}),H={class:`ih:flex ih:flex-wrap ih:items-center ih:gap-2 ih:text-xs`},U={class:`ih:rounded ih:bg-brand-soft ih:px-2 ih:py-0.5 ih:font-semibold ih:text-brand-text`},W={key:0,class:`ih:rounded ih:bg-foreground ih:px-2 ih:py-0.5 ih:font-semibold ih:text-background`},ue={key:1,class:`ih:text-base ih:font-semibold ih:text-brand-text`},de={key:0,class:`ih:mb-4 ih:rounded-md ih:border ih:bg-muted ih:px-4 ih:py-3 ih:text-sm`},fe={class:`ih:grid ih:gap-6 ih:lg:grid-cols-[minmax(0,1fr)_22rem]`},pe={class:`ih:grid ih:min-w-0 ih:content-start ih:gap-6`},me={class:`ih:overflow-hidden ih:rounded-xl ih:border ih:bg-card`,"aria-label":`Fotos`},he={class:`ih:relative ih:flex ih:aspect-[4/3] ih:items-center ih:justify-center ih:bg-muted ih:sm:aspect-[16/10]`},ge=[`src`,`alt`],_e={class:`ih:absolute ih:right-3 ih:bottom-3 ih:rounded ih:bg-foreground/70 ih:px-2 ih:py-0.5 ih:text-xs ih:text-background ih:tabular-nums`},ve={key:0,class:`ih:flex ih:gap-2 ih:overflow-x-auto ih:p-3`},ye=[`aria-label`,`aria-current`,`onClick`],be=[`src`],xe={class:`ih:rounded-xl ih:border ih:bg-card ih:p-5 ih:sm:p-6`},Se={class:`ih:flex ih:flex-wrap ih:gap-x-6 ih:gap-y-2 ih:text-sm ih:text-muted-foreground`},Ce={key:0,class:`ih:flex ih:items-center ih:gap-1.5`},we={key:1,class:`ih:flex ih:items-center ih:gap-1.5`},Te={class:`ih:text-[15px] ih:leading-relaxed ih:whitespace-pre-line`},Ee={class:`ih:grid ih:content-start ih:gap-4`},De={key:0,class:`ih:rounded-xl ih:border ih:bg-card ih:p-5`},Oe={class:`ih:min-w-0`},ke={class:`ih:block ih:font-semibold`},Ae={class:`ih:block ih:truncate ih:text-[13px] ih:text-muted-foreground`},je={key:0,class:`ih:mt-2 ih:text-xs ih:text-muted-foreground`},Me={for:`kontakt`,class:`ih:text-sm ih:font-medium`},Ne={key:0,class:`ih:text-[13px] ih:text-destructive`},Pe={class:`ih:text-xs ih:text-muted-foreground`},Fe=[`href`],Ie={key:1,class:`ih:flex ih:gap-2`},Le={key:2,class:`ih:flex ih:items-center ih:gap-2 ih:text-sm`},Re={key:1,class:`ih:mt-10`},ze={class:`ih:grid ih:grid-cols-2 ih:gap-3 ih:md:grid-cols-4`},G={__name:`Show`,props:{listing:{type:Object,required:!0},more:{type:Array,default:()=>[]}},setup(e){let G=e,Be=C();ce(()=>Be.props.flash?.status,e=>e&&I.success(e),{immediate:!0});let K=o(()=>G.listing),q=h(0),J=o(()=>K.value.photos[q.value]),Y=e=>q.value=(q.value+e+K.value.photos.length)%K.value.photos.length,X=S({message:`Hallo ${K.value.seller?.name?.split(` `)[0]??``}, ist „${K.value.title}“ noch zu haben?`}),Ve=()=>X.post(`/kleinanzeigen/${K.value.id}/kontakt`,{preserveScroll:!0,onSuccess:()=>X.reset()}),Z=h(!1),Q=S({reason:``}),He=()=>Q.post(`/kleinanzeigen/${K.value.id}/melden`,{preserveScroll:!0,onSuccess:()=>{Z.value=!1,Q.reset()}});function Ue(){x.visit(`/kleinanzeigen/${K.value.id}/merken`,{method:K.value.favorite?`delete`:`post`,preserveScroll:!0})}function We(){window.confirm(`Anzeige löschen?`)&&x.delete(`/kleinanzeigen/${K.value.id}`)}let $=o(()=>({pending:`Diese Anzeige wartet auf Freigabe und ist noch nicht öffentlich.`,rejected:`Diese Anzeige wurde nicht freigegeben.`,done:`Diese Anzeige ist erledigt.`,expired:`Diese Anzeige ist abgelaufen.`})[K.value.status]);return(o,h)=>(m(),s(v(w),{title:K.value.title},{default:y(()=>[f(v(M),{title:K.value.title,breadcrumbs:[{label:`Kleinanzeigen`,href:`/kleinanzeigen`}]},oe({description:y(()=>[u(`span`,H,[u(`span`,U,_(K.value.type_label),1),u(`span`,null,_(K.value.category_label),1),K.value.reserved?(m(),l(`span`,W,`Reserviert`)):c(``,!0),K.value.price?(m(),l(`span`,ue,_(K.value.price),1)):c(``,!0)])]),_:2},[K.value.own||K.value.can_moderate?{name:`actions`,fn:y(()=>[K.value.own?(m(),s(v(T),{key:0,variant:`outline`,size:`sm`,"as-child":``},{default:y(()=>[f(v(b),{href:`/kleinanzeigen/${K.value.id}/bearbeiten`},{default:y(()=>[f(v(ie)),h[7]||=d(` Bearbeiten`,-1)]),_:1},8,[`href`])]),_:1})):c(``,!0),f(v(T),{variant:`ghost`,size:`sm`,class:`ih:text-destructive ih:hover:text-destructive`,onClick:We},{default:y(()=>[f(v(ae)),h[8]||=d(` Löschen`,-1)]),_:1})]),key:`0`}:void 0]),1032,[`title`]),$.value?(m(),l(`p`,de,[d(_($.value),1),K.value.review_note?(m(),l(a,{key:0},[d(` Hinweis: `+_(K.value.review_note),1)],64)):c(``,!0)])):c(``,!0),u(`div`,fe,[u(`div`,pe,[u(`section`,me,[u(`div`,he,[J.value?(m(),l(`img`,{key:0,src:J.value.url,alt:`${K.value.title} – Foto ${q.value+1}`,class:`ih:max-h-full ih:max-w-full ih:object-contain`},null,8,ge)):(m(),s(v(re),{key:1,class:`ih:size-10 ih:text-muted-foreground`,"stroke-width":1.5})),K.value.photos.length>1?(m(),l(a,{key:2},[u(`button`,{type:`button`,class:`ih:absolute ih:left-3 ih:grid ih:size-10 ih:place-items-center ih:rounded-full ih:bg-card/90 ih:shadow`,"aria-label":`Vorheriges Foto`,onClick:h[0]||=e=>Y(-1)},[f(v(r),{class:`ih:size-5`})]),u(`button`,{type:`button`,class:`ih:absolute ih:right-3 ih:grid ih:size-10 ih:place-items-center ih:rounded-full ih:bg-card/90 ih:shadow`,"aria-label":`Nächstes Foto`,onClick:h[1]||=e=>Y(1)},[f(v(R),{class:`ih:size-5`})]),u(`span`,_e,_(q.value+1)+` / `+_(K.value.photos.length),1)],64)):c(``,!0)]),K.value.photos.length>1?(m(),l(`div`,ve,[(m(!0),l(a,null,g(K.value.photos,(e,t)=>(m(),l(`button`,{key:e.id,type:`button`,class:p([`ih:size-16 ih:shrink-0 ih:overflow-hidden ih:rounded-md ih:border-2`,t===q.value?`ih:border-brand`:`ih:border-transparent ih:opacity-70 ih:hover:opacity-100`]),"aria-label":`Foto ${t+1}`,"aria-current":t===q.value,onClick:e=>q.value=t},[u(`img`,{src:e.thumb_url,alt:``,class:`ih:size-full ih:object-cover`},null,8,be)],10,ye))),128))])):c(``,!0)]),u(`section`,xe,[u(`dl`,Se,[K.value.location?(m(),l(`div`,Ce,[h[9]||=u(`dt`,{class:`ih:sr-only`},`Ort`,-1),f(v(t),{class:`ih:size-4`,"aria-hidden":`true`}),u(`dd`,null,_(K.value.location),1)])):c(``,!0),K.value.published_at?(m(),l(`div`,we,[h[10]||=u(`dt`,{class:`ih:sr-only`},`Eingestellt`,-1),f(v(L),{class:`ih:size-4`,"aria-hidden":`true`}),u(`dd`,null,`seit `+_(v(F)(K.value.published_at)),1)])):c(``,!0)]),h[11]||=u(`h2`,{class:`ih:mt-6 ih:mb-2 ih:text-sm ih:font-semibold`},`Beschreibung`,-1),u(`p`,Te,_(K.value.description),1)])]),u(`aside`,Ee,[K.value.seller?(m(),l(`section`,De,[f(v(b),{href:`/personen/${K.value.seller.id}`,class:`ih:flex ih:items-center ih:gap-3 ih:rounded-md ih:hover:bg-accent/50`},{default:y(()=>[f(v(N),{person:K.value.seller,class:`ih:size-12`},null,8,[`person`]),u(`span`,Oe,[u(`span`,ke,_(K.value.seller.name),1),u(`span`,Ae,_([K.value.seller.department,K.value.seller.location].filter(Boolean).join(` · `)),1)])]),_:1},8,[`href`]),K.value.seller.listings>1?(m(),l(`p`,je,_(K.value.seller.listings)+` Anzeigen online`,1)):c(``,!0),K.value.contact?(m(),l(`form`,{key:1,class:`ih:mt-4 ih:grid ih:gap-2 ih:border-t ih:pt-4`,onSubmit:le(Ve,[`prevent`])},[u(`label`,Me,`Nachricht an `+_(K.value.seller.name.split(` `)[0]),1),f(v(P),{id:`kontakt`,modelValue:v(X).message,"onUpdate:modelValue":h[2]||=e=>v(X).message=e,rows:`4`,maxlength:`2000`},null,8,[`modelValue`]),v(X).errors.message?(m(),l(`p`,Ne,_(v(X).errors.message),1)):c(``,!0),f(v(T),{type:`submit`,disabled:v(X).processing||!v(X).message.trim()},{default:y(()=>[v(X).processing?(m(),s(v(ee),{key:0,class:`ih:animate-spin`})):(m(),s(se(K.value.contact===`chat`?v(B):v(z)),{key:1})),d(` `+_(K.value.contact===`chat`?`Im Chat schreiben`:`Per E-Mail schreiben`),1)]),_:1},8,[`disabled`]),u(`p`,Pe,_(K.value.contact===`chat`?`Öffnet ein Gespräch unter „Nachrichten“.`:`Die Antwort kommt per E-Mail; die Adresse der anbietenden Person bleibt verborgen.`),1)],32)):c(``,!0),K.value.phone?(m(),l(`a`,{key:2,href:`tel:${K.value.phone.replace(/[^0-9+]/g,``)}`,class:`ih:mt-3 ih:flex ih:items-center ih:gap-2 ih:text-sm ih:font-medium ih:text-brand-text ih:hover:underline`},[f(v(V),{class:`ih:size-4`}),d(` `+_(K.value.phone),1)],8,Fe)):c(``,!0)])):c(``,!0),K.value.own?c(``,!0):(m(),l(`div`,Ie,[f(v(T),{variant:`outline`,class:`ih:flex-1`,"aria-pressed":K.value.favorite,onClick:Ue},{default:y(()=>[f(v(ne),{class:p(K.value.favorite?`ih:fill-current ih:text-brand-text`:``)},null,8,[`class`]),d(` `+_(K.value.favorite?`Gemerkt`:`Merken`),1)]),_:1},8,[`aria-pressed`]),f(v(T),{variant:`ghost`,class:`ih:text-muted-foreground`,onClick:h[3]||=e=>Z.value=!0},{default:y(()=>[f(v(te)),h[12]||=d(` Melden`,-1)]),_:1})])),K.value.can_moderate&&K.value.status===`pending`?(m(),l(`p`,Le,[f(v(i),{class:`ih:size-4 ih:text-brand-text`}),h[14]||=d(),f(v(b),{href:`/kleinanzeigen/moderation`,class:`ih:font-medium ih:text-brand-text ih:hover:underline`},{default:y(()=>[...h[13]||=[d(`Zur Freigabe`,-1)]]),_:1})])):c(``,!0)])]),e.more.length?(m(),l(`section`,Re,[h[15]||=u(`h2`,{class:`ih:mb-4 ih:text-lg ih:font-semibold`},`Das könnte Sie auch interessieren`,-1),u(`div`,ze,[(m(!0),l(a,null,g(e.more,e=>(m(),s(n,{key:e.id,listing:e},null,8,[`listing`]))),128))])])):c(``,!0),f(v(E),{open:Z.value,"onUpdate:open":h[6]||=e=>Z.value=e},{default:y(()=>[f(v(D),{class:`ih:sm:max-w-md`},{default:y(()=>[f(v(A),null,{default:y(()=>[f(v(j),null,{default:y(()=>[...h[16]||=[d(`Anzeige melden`,-1)]]),_:1}),f(v(O),null,{default:y(()=>[...h[17]||=[d(`Was stimmt nicht? Die Moderation sieht sich die Anzeige an.`,-1)]]),_:1})]),_:1}),f(v(P),{modelValue:v(Q).reason,"onUpdate:modelValue":h[4]||=e=>v(Q).reason=e,rows:`3`,maxlength:`500`,placeholder:`z. B. unpassend, doppelt, kein Mitarbeiterangebot …`,"aria-label":`Grund`},null,8,[`modelValue`]),f(v(k),null,{default:y(()=>[f(v(T),{variant:`ghost`,onClick:h[5]||=e=>Z.value=!1},{default:y(()=>[...h[18]||=[d(`Abbrechen`,-1)]]),_:1}),f(v(T),{disabled:v(Q).processing||!v(Q).reason.trim(),onClick:He},{default:y(()=>[...h[19]||=[d(`Melden`,-1)]]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`])]),_:1},8,[`title`]))}};export{G as default};