1import{e as be,r as c,f as se,j as e,u as Ne,p as we}from"./react-vendor-oGnIhQt2.js";import{s as g,C as ye,b as _e,d as ke,j as D,t as te,a1 as Se,e as Te,B,I as me,h as G,M as he,u as f,a5 as ue,T as xe,c as ae}from"./index-DVrUGVMO.js";import{t as Me,p as J}from"./dateOnly-qgaHYHLv.js";import{T as pe,a as fe,b as Z,c as x,d as je,e as p}from"./table-DvG70JRn.js";import{S as I,a as F,b as R,c as $,d as m}from"./select-BXVXY3ZZ.js";import{T as Ce,a as Ae,b as le,c as ce}from"./tabs-CAIOeLJC.js";import{S as ge}from"./skeleton-DWPvOFy9.js";import{D as Ee,a as Le,b as De,c as Ie,d as Fe,e as Re}from"./dialog-D5Nmo3zm.js";import $e from"./bell-D_JbS6cZ.js";import qe from"./megaphone-B2pf5dra.js";import ze from"./trash-2-CuVn9ViH.js";import Pe from"./send-BiVRYLvO.js";import{c as U,f as Ve,d as ve}from"./date-fns-DU_j6nL5.js";import{d as Y}from"./de-Djqs-V1s.js";import ne from"./clock-EadJ_jlU.js";import Ke from"./phone-CkKmleTP.js";import Oe from"./circle-check-BhvD5Ahv.js";import We from"./sparkles-C8iH6Yi1.js";import Ue from"./external-link-BNRKMFHq.js";import"./radix-core-kiNkrX5-.js";import"./chevron-up-D4F-9ALS.js";const Be=["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"];function oe(r){const[u,v]=r.split("-");return v?`${Be[parseInt(v,10)-1]} ${u.slice(2)}`:r}const ee={new:"Neu",contacted:"Informiert",converted:"Gebucht",archived:"Archiviert"},He={new:"bg-blue-500/10 text-blue-600",contacted:"bg-amber-500/10 text-amber-700",converted:"bg-green-500/10 text-green-700",archived:"bg-muted text-muted-foreground"},de="[email protected]";function Qe(){const r=be(),[u,v]=c.useState(""),[h,b]=c.useState("all"),[l,N]=c.useState("active"),[C,_]=c.useState(null),{data:A,isLoading:k}=se({queryKey:["template-interest-all"],queryFn:async()=>{const{data:s,error:a}=await g.from("template_interest").select("*").order("created_at",{ascending:!1});if(a)throw a;return s??[]}}),w=c.useMemo(()=>A??[],[A]),S=c.useMemo(()=>Array.from(new Set(w.map(s=>s.template_id))),[w]),{data:T}=se({queryKey:["interest-templates",S],enabled:S.length>0,queryFn:async()=>{const{data:s,error:a}=await g.from("trip_templates").select("id, name").in("id",S);if(a)throw a;return s??[]}}),y=c.useMemo(()=>new Map((T??[]).map(s=>[s.id,s.name])),[T]),E=s=>!s.unsubscribed_at&&s.status!=="archived"&&s.status!=="converted",q=c.useMemo(()=>{const s=new Map;return w.forEach(a=>{const n=s.get(a.template_id)??[];n.push(a),s.set(a.template_id,n)}),Array.from(s.entries()).map(([a,n])=>{const t=n.filter(E),i=new Map;return t.forEach(o=>o.preferred_months.forEach(j=>i.set(j,(i.get(j)??0)+1))),{templateId:a,name:y.get(a)??"Unbekannte Reise",total:n.length,active:t.length,neu:n.filter(o=>o.status==="new"&&!o.unsubscribed_at).length,informiert:n.filter(o=>o.status==="contacted").length,gebucht:n.filter(o=>o.status==="converted").length,months:Array.from(i.entries()).sort((o,j)=>j[1]-o[1]).slice(0,6)}}).filter(a=>a.active>0).sort((a,n)=>n.active-a.active)},[w,y]),L=c.useMemo(()=>w.filter(s=>{if(h!=="all"&&s.template_id!==h)return!1;if(l==="active"){if(!E(s))return!1}else if(l!=="all"&&s.status!==l)return!1;if(u){const a=u.toLowerCase();if(!`${s.first_name} ${s.last_name}`.toLowerCase().includes(a)&&!s.email.toLowerCase().includes(a))return!1}return!0}),[w,h,l,u]),z=async(s,a)=>{const{error:n}=await g.from("template_interest").update({status:a}).eq("id",s);if(n){f.error("Fehler beim Speichern");return}f.success("Status aktualisiert"),r.invalidateQueries({queryKey:["template-interest-all"]})},P=async s=>{if(!confirm("Diesen Eintrag löschen?"))return;const{error:a}=await g.from("template_interest").delete().eq("id",s);if(a){f.error("Fehler");return}f.success("Gelöscht"),r.invalidateQueries({queryKey:["template-interest-all"]})};return k?e.jsx(ge,{className:"h-64 w-full"}):e.jsxs("div",{className:"space-y-6",children:[q.length===0?e.jsxs("div",{className:"glass-card p-12 text-center",children:[e.jsx($e,{className:"h-12 w-12 mx-auto text-muted-foreground/40 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aktuell keine aktiven Interessenten."})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:q.map(s=>e.jsxs(ye,{children:[e.jsxs(_e,{className:"pb-3",children:[e.jsxs(ke,{className:"text-base flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate",children:s.name}),e.jsxs(D,{variant:"secondary",className:"shrink-0 gap-1",children:[e.jsx(te,{className:"h-3 w-3"})," ",s.active]})]}),e.jsxs(Se,{children:[s.neu," neu · ",s.informiert," informiert · ",s.gebucht," gebucht"]})]}),e.jsxs(Te,{className:"space-y-3",children:[s.months.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:s.months.map(([a,n])=>e.jsxs(D,{variant:"outline",className:"text-xs",children:[oe(a)," ",e.jsx("span",{className:"ml-1 font-semibold",children:n})]},a))}),e.jsxs(B,{size:"sm",variant:"outline",className:"gap-2",onClick:()=>_({id:s.templateId,name:s.name}),children:[e.jsx(qe,{className:"h-3.5 w-3.5"}),"Termin bekannt geben"]})]})]},s.templateId))}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-3",children:[e.jsx(me,{placeholder:"Suche nac
1h Name oder E-Mailâ¦",value:u,onChange:s=>v(s.target.value),className:"md:max-w-xs"}),e.jsxs(I,{value:h,onValueChange:b,children:[e.jsx(F,{className:"md:w-64",children:e.jsx(R,{placeholder:"Reise"})}),e.jsxs($,{children:[e.jsx(m,{value:"all",children:"Alle Reisen"}),Array.from(y.entries()).map(([s,a])=>e.jsx(m,{value:s,children:a},s))]})]}),e.jsxs(I,{value:l,onValueChange:N,children:[e.jsx(F,{className:"md:w-48",children:e.jsx(R,{})}),e.jsxs($,{children:[e.jsx(m,{value:"active",children:"Aktiv (neu + informiert)"}),e.jsx(m,{value:"all",children:"Alle Status"}),Object.entries(ee).map(([s,a])=>e.jsx(m,{value:s,children:a},s))]})]})]}),L.length===0?e.jsx("div",{className:"glass-card p-12 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"Keine Einträge mit den aktuellen Filtern."})}):e.jsx("div",{className:"glass-card overflow-x-auto",children:e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsxs(Z,{children:[e.jsx(x,{children:"Name"}),e.jsx(x,{children:"Reise"}),e.jsx(x,{children:"Kontakt"}),e.jsx(x,{children:"Wunschmonate"}),e.jsx(x,{children:"Quelle"}),e.jsx(x,{children:"Eingetragen"}),e.jsx(x,{children:"Status"}),e.jsx(x,{})]})}),e.jsx(je,{children:L.map(s=>e.jsxs(Z,{className:s.unsubscribed_at?"opacity-50":"",children:[e.jsxs(p,{className:"font-medium",children:[s.first_name," ",s.last_name]}),e.jsx(p,{className:"text-sm",children:y.get(s.template_id)??"â"}),e.jsx(p,{children:e.jsxs("div",{className:"text-sm",children:[e.jsx("a",{href:`mailto:${s.email}`,className:"text-primary hover:underline",children:s.email}),s.phone&&e.jsx("div",{className:"text-xs text-muted-foreground",children:s.phone}),s.unsubscribed_at&&e.jsx("div",{className:"text-xs text-destructive",children:"Abgemeldet"})]})}),e.jsx(p,{children:s.preferred_months.length===0?e.jsx(D,{variant:"secondary",children:"Saison egal"}):e.jsx("div",{className:"flex flex-wrap gap-1 max-w-[220px]",children:s.preferred_months.map(a=>e.jsx(D,{variant:"outline",className:"text-xs",children:oe(a)},a))})}),e.jsx(p,{className:"text-xs text-muted-foreground",children:s.discovery_source??"â"}),e.jsx(p,{className:"text-xs text-muted-foreground",title:U(new Date(s.created_at),"dd.MM.yyyy HH:mm"),children:Ve(new Date(s.created_at),{addSuffix:!0,locale:Y})}),e.jsx(p,{children:e.jsxs(I,{value:s.status,onValueChange:a=>z(s.id,a),children:[e.jsx(F,{className:`w-[140px] ${He[s.status]??""}`,children:e.jsx(R,{children:ee[s.status]??s.status})}),e.jsx($,{children:Object.entries(ee).map(([a,n])=>e.jsx(m,{value:a,children:n},a))})]})}),e.jsx(p,{children:e.jsx(B,{size:"icon",variant:"ghost",onClick:()=>P(s.id),title:"Löschen",children:e.jsx(ze,{className:"h-4 w-4 text-destructive"})})})]},s.id))})]})}),e.jsx(Ge,{template:C,onClose:()=>_(null),onSent:()=>r.invalidateQueries({queryKey:["template-interest-all"]})})]})}function Ge({template:r,onClose:u,onSent:v}){const[h,b]=c.useState(""),[l,N]=c.useState(null),[C,_]=c.useState(!1),[A,k]=c.useState(!1),[w,S]=c.useState(!1),[T,y]=c.useState(!1),{data:E,isLoading:q}=se({queryKey:["announce-trips",r==null?void 0:r.id],enabled:!!r,queryFn:async()=>{const{data:a,error:n}=await g.from("trips").select("id, name, start_date, end_date, price, status").eq("template_id",r.id).in("status",["planning","active"]).gt("start_date",Me()).order("start_date",{ascending:!0});if(n)throw n;return a??[]}}),L=()=>{b(""),N(null),S(!1),y(!1),k(!1)},z=async a=>{b(a),N(null),S(!1),_(!0);try{const{data:n,error:t}=await g.functions.invoke("notify-template-interest",{body:{trip_id:a,dryRun:!0}});if(t)throw t;if(n!=null&&n.skipped){f.info("Nicht möglich",{description:`Grund: ${n.reason}`});return}N(n)}catch(n){console.error(n),f.error("Vorschau fehlgeschlagen")}finally{_(!1)}},P=async()=>{k(!0);try{const{data:a,error:n}=await g.functions.invoke("notify-template-interest",{body:{trip_id:h,testEmail:de}});if(n)throw n;if(a!=null&&a.error)throw new Error(a.error);S(!0),f.success(`Testmail an ${de} gesendet`)}catch(a){console.error(a),f.error("Testmail fehlgeschlagen",{description:a==null?void 0:a.message})}finally{k(!1)}},s=async()=>{var a;if(l&&confirm(`Wirklich an ${l.recipients.length} Interessenten senden?`)){y(!0);try{const{data:n,error:t}=await g.functions.invoke("notify-template-interest",{body:{trip_id:h}});if(t)throw t;if(n!=null&&n.error)throw new Error(n.error);(n==null?void 0:n.failed)>0?f.warning(`${n.sent} gesendet, ${n.failed} fehlgeschlagen`,{description:(a=n.failures)==null?void 0:a.map(i=>i.email).join(", ")}):f.success(`${n.sent} Mails versendet`),v(),u(),L()}catch(n){console.error(n),f.error("Versand fehlgeschlagen",{description:n==null?void 0:n.message})}finally{y(!1)}}};return e.jsx(Ee,{open:!!r,onOpenChange:a=>{a||(u(),L())},children:e.jsxs(Le,{className:"max-w-lg",children:[e.jsxs(De,{children:[e.jsxs(Ie,{children:["Termin bekannt geben: ",r==null?void 0:r.name]}),e.jsx(Fe,{children:"Informiert alle aktiven Interessenten, die zu diesem Termin noch keine Mail erhalten haben."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-1.5",children:"Termin auswählen"}),q?e.jsx(ge,{className:"h-10 w-full"}):(E??[]).length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keine zukünftigen buchbaren Termine für diese Reise."}):e.jsxs(I,{value:h,onValueChange:z,children:[e.jsx(F,{children:e.jsx(R,{placeholder:"Termin wählenâ¦"})}),e.jsx($,{children:(E??[]).map(a=>e.jsxs(m,{value:a.id,children:[U(J(a.start_date),"dd.MM.yyyy")," â ",U(J(a.end_date),"dd.MM.yyyy"),a.price?` · ab â¬${a.price.toLocaleStr
1ing("de-DE")}`:""]},a.id))})]})]}),C&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(G,{className:"h-4 w-4 animate-spin"})," Lade Empfänger-Vorschauâ¦"]}),l&&e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:[l.recipients.length," Empfänger",l.alreadyNotified>0&&e.jsxs("span",{className:"text-muted-foreground font-normal",children:[" · ",l.alreadyNotified," bereits informiert"]})]}),l.recipients.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Alle Interessenten wurden zu diesem Termin bereits informiert."}):e.jsx("ul",{className:"text-sm space-y-1 max-h-40 overflow-y-auto",children:l.recipients.map(a=>e.jsxs("li",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate",children:a.name||a.email}),e.jsx(D,{variant:"outline",className:"text-xs shrink-0",children:a.variant==="match"?"Monats-Match":"Standard"})]},a.id))})]})]}),e.jsxs(Re,{className:"flex-col sm:flex-row gap-2",children:[e.jsxs(B,{variant:"outline",className:"gap-2",onClick:P,disabled:!l||l.recipients.length===0||A||T,children:[A?e.jsx(G,{className:"h-4 w-4 animate-spin"}):e.jsx(he,{className:"h-4 w-4"}),"Testmail an mich"]}),e.jsxs(B,{className:"gap-2",onClick:s,disabled:!w||!l||l.recipients.length===0||T,title:w?void 0:"Bitte zuerst eine Testmail senden",children:[T?e.jsx(G,{className:"h-4 w-4 animate-spin"}):e.jsx(Pe,{className:"h-4 w-4"}),"An ",(l==null?void 0:l.recipients.length)??0," Interessenten senden"]})]})]})})}const Je={realistic:{label:"Realistisch",className:"bg-green-50 text-green-700 border-green-200 dark:bg-green-950/30 dark:text-green-400 dark:border-green-800",icon:ue},possible:{label:"Möglich",className:"bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-950/30 dark:text-amber-400 dark:border-amber-800",icon:ne},unlikely:{label:"Unwahrscheinlich",className:"bg-red-50 text-red-700 border-red-200 dark:bg-red-950/30 dark:text-red-400 dark:border-red-800",icon:xe}};function Xe(r){if(!r.trip)return"unlikely";const u=J(r.trip.start_date),v=J(r.trip.end_date),h=new Date;if(v<h)return"unlikely";const b=ve(u,h),l=r.trip.max_group_size??0,N=r.participants_count??0,C=l>0&&N>=l;return b<30?"unlikely":b>60&&(!C||l===0)?"realistic":"possible"}function vs(){const[r,u]=c.useState([]),[v,h]=c.useState(!0),[b,l]=c.useState(""),[N,C]=c.useState("waiting"),[_,A]=c.useState("all"),[k,w]=c.useState("all"),[S,T]=c.useState(null),y=Ne(),[E,q]=we(),L=E.get("tab")==="interests"?"interests":"waitlist",z=async()=>{h(!0);try{const{data:t,error:i}=await g.from("trip_waitlist").select("*").order("created_at",{ascending:!0});if(i)throw i;const o=Array.from(new Set((t||[]).map(d=>d.trip_id))),j=Array.from(new Set((t||[]).map(d=>d.profile_id).filter(Boolean))),[V,M,H]=await Promise.all([o.length?g.from("trips").select("id, name, destination, start_date, end_date, max_group_size, status").in("id",o):Promise.resolve({data:[],error:null}),j.length?g.from("participant_profiles").select("id, first_name, last_name, email, phone").in("id",j):Promise.resolve({data:[],error:null}),o.length?g.from("participants").select("trip_id").in("trip_id",o).eq("is_guide",!1):Promise.resolve({data:[],error:null})]),K=new Map((V.data||[]).map(d=>[d.id,d])),O=new Map((M.data||[]).map(d=>[d.id,d])),W=new Map;(H.data||[]).forEach(d=>{W.set(d.trip_id,(W.get(d.trip_id)||0)+1)});const X=(t||[]).map(d=>{const ie=K.get(d.trip_id)||null,re=W.get(d.trip_id)||0;return{...d,trip:ie,profile:d.profile_id&&O.get(d.profile_id)||null,participants_count:re,likelihood:Xe({trip:ie,participants_count:re})}});u(X)}catch(t){console.error(t),f.error("Fehler beim Laden der Warteliste")}finally{h(!1)}};c.useEffect(()=>{z()},[]);const P=c.useMemo(()=>r.filter(t=>{var i,o,j,V;if(N!=="all"&&t.status!==N||_!=="all"&&t.likelihood!==_||k!=="all"&&t.trip_id!==k)return!1;if(b){const M=b.toLowerCase(),H=`${t.first_name??((i=t.profile)==null?void 0:i.first_name)??""} ${t.last_name??((o=t.profile)==null?void 0:o.last_name)??""}`.toLowerCase(),K=(t.email??((j=t.profile)==null?void 0:j.email)??"").toLowerCase(),O=(((V=t.trip)==null?void 0:V.name)??"").toLowerCase();if(!H.includes(M)&&!K.includes(M)&&!O.includes(M))return!1}return!0}),[r,b,N,_,k]),s=c.useMemo(()=>{const t=r.filter(i=>i.status==="waiting");return{total:t.length,trips:new Set(t.map(i=>i.trip_id)).size,unlikely:t.filter(i=>i.likelihood==="unlikely").length,possible:t.filter(i=>i.likelihood==="possible").length,realistic:t.filter(i=>i.likelihood==="realistic").length}},[r]),a=c.useMemo(()=>{const t=new Map;return r.forEach(i=>
1{i.trip&&t.set(i.trip_id,i.trip.name)}),Array.from(t.entries())},[r]),n=async t=>{T(t.id);try{const{data:i,error:o}=await g.functions.invoke("waitlist-recommend-alternatives",{body:{waitlistId:t.id}});if(o)throw o;i!=null&&i.skipped?f.info("Ãbersprungen",{description:i.reason||"Keine passenden Alternativen gefunden."}):(f.success("Empfehlungs-Mail wurde versendet"),z())}catch(i){console.error(i),f.error("Versand fehlgeschlagen")}finally{T(null)}};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Warteliste & Interessen"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Nachfrage ohne passenden Termin: Wartelisten pro Reise und Interessenten pro Vorlage."})]})}),e.jsxs(Ce,{value:L,onValueChange:t=>q(t==="interests"?{tab:"interests"}:{},{replace:!0}),children:[e.jsxs(Ae,{children:[e.jsx(le,{value:"waitlist",children:"Warteliste"}),e.jsx(le,{value:"interests",children:"Interessenten"})]}),e.jsx(ce,{value:"waitlist",className:"space-y-6 mt-6",children:v?e.jsx("div",{className:"flex items-center justify-center min-h-[40vh]",children:e.jsx(G,{className:"h-8 w-8 animate-spin text-primary"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsx(Q,{icon:te,label:"Aktiv wartend",value:s.total,color:"text-primary"}),e.jsx(Q,{icon:ne,label:"Reisen betroffen",value:s.trips,color:"text-foreground"}),e.jsx(Q,{icon:ue,label:"Realistisch",value:s.realistic,color:"text-green-600"}),e.jsx(Q,{icon:ne,label:"Möglich",value:s.possible,color:"text-amber-600"}),e.jsx(Q,{icon:xe,label:"Unwahrscheinlich",value:s.unlikely,color:"text-red-600"})]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-3",children:[e.jsx(me,{placeholder:"Suche nach Name, E-Mail oder Reiseâ¦",value:b,onChange:t=>l(t.target.value),className:"md:max-w-xs"}),e.jsxs(I,{value:N,onValueChange:C,children:[e.jsx(F,{className:"md:w-44",children:e.jsx(R,{})}),e.jsxs($,{children:[e.jsx(m,{value:"all",children:"Alle Status"}),e.jsx(m,{value:"waiting",children:"Wartend"}),e.jsx(m,{value:"notified",children:"Benachrichtigt"}),e.jsx(m,{value:"booked",children:"Gebucht"}),e.jsx(m,{value:"cancelled",children:"Abgemeldet"}),e.jsx(m,{value:"expired",children:"Abgelaufen"})]})]}),e.jsxs(I,{value:_,onValueChange:A,children:[e.jsx(F,{className:"md:w-48",children:e.jsx(R,{})}),e.jsxs($,{children:[e.jsx(m,{value:"all",children:"Alle Wahrscheinlichkeiten"}),e.jsx(m,{value:"realistic",children:"Realistisch"}),e.jsx(m,{value:"possible",children:"Möglich"}),e.jsx(m,{value:"unlikely",children:"Unwahrscheinlich"})]})]}),e.jsxs(I,{value:k,onValueChange:w,children:[e.jsx(F,{className:"md:w-64",children:e.jsx(R,{placeholder:"Reise"})}),e.jsxs($,{children:[e.jsx(m,{value:"all",children:"Alle Reisen"}),a.map(([t,i])=>e.jsx(m,{value:t,children:i},t))]})]})]}),P.length===0?e.jsxs("div",{className:"glass-card p-12 text-center",children:[e.jsx(te,{className:"h-12 w-12 mx-auto text-muted-foreground/40 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Keine Einträge mit den aktuellen Filtern."})]}):e.jsx("div",{className:"glass-card overflow-x-auto",children:e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsxs(Z,{children:[e.jsx(x,{children:"Person"}),e.jsx(x,{children:"Reise"}),e.jsx(x,{children:"Wartet seit"}),e.jsx(x,{children:"Wahrscheinlichkeit"}),e.jsx(x,{children:"Status"}),e.jsx(x,{children:"Empfehlung"}),e.jsx(x,{children:"Aktionen"})]})}),e.jsx(je,{children:P.map(t=>{var K,O,W,X,d;const i=`${t.first_name??((K=t.profile)==null?void 0:K.first_name)??""} ${t.last_name??((O=t.profile)==null?void 0:O.last_name)??""}`.trim()||t.email||((W=t.profile)==null?void 0:W.email)||"Unbekannt",o=t.email??((X=t.profile)==null?void 0:X.email),j=t.phone??((d=t.profile)==null?void 0:d.phone),V=ve(new Date,new Date(t.created_at)),M=Je[t.likelihood],H=M.icon;return e.jsxs(Z,{children:[e.jsxs(p,{children:[e.jsx("div",{className:"font-medium text-foreground",children:i}),e.jsxs("div",{className:"space-y-0.5",children:[o&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(he,{className:"h-3 w-3"}),e.jsx("a",{href:`mailto:${o}`,className:"hover:text-primary",children:o})]}),j&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ke,{className:"h-3 w-3"}),j]})]})]}),e.jsx(p,{children:t.trip?e.jsxs("button",{onClick:()=>y(`/admin/trips/${t.trip.id}`),className:"text-left hover:text-primary",children:[e.jsx("div",{className:"font-medium",children:t.trip.name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[U(J(t.trip.start_date),"dd.MM.yyyy",{locale:Y})," ·"," ",t.participants_count,"/",t.trip.max_group_size??"â"," Plätze"]})]}):e.jsx("span",{className:"text-muted-foreground",children:"â"})}),e.jsxs(p,{children:[e.jsxs("span",{className:"text-sm",children:[V," Tage"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:U(new Date(t.created_at),"dd.MM.yyyy",{locale:Y})})]}),e.jsx(p,{children:e.jsxs(D,{variant:"outline",className:ae("gap-1",M.className),children:[e.jsx(H,{className:"h-3 w-3"}),M.label]})}),e.jsx(p,{children:e.jsx(D,{variant:"outline",children:t.status})}),e.jsx(p,{children:t.recommendation_sent_at?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[e.jsx(Oe,{className:"h-3 w-3"}
1),U(new Date(t.recommendation_sent_at),"dd.MM.yyyy",{locale:Y})]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"â"})}),e.jsx(p,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.status==="waiting"&&t.likelihood==="unlikely"&&!t.recommendation_sent_at&&e.jsxs(B,{size:"sm",variant:"outline",onClick:()=>n(t),disabled:S===t.id,className:"gap-1",children:[S===t.id?e.jsx(G,{className:"h-3 w-3 animate-spin"}):e.jsx(We,{className:"h-3 w-3"}),"Empfehlen"]}),t.trip&&e.jsx(B,{size:"sm",variant:"ghost",onClick:()=>y(`/admin/trips/${t.trip.id}?tab=waitlist`),children:e.jsx(Ue,{className:"h-3 w-3"})})]})})]},t.id)})})]})})]})}),e.jsx(ce,{value:"interests",className:"mt-6",children:e.jsx(Qe,{})})]})]})}function Q({icon:r,label:u,value:v,color:h}){return e.jsxs("div",{className:"glass-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(r,{className:ae("h-4 w-4",h)}),u]}),e.jsx("div",{className:ae("text-2xl font-semibold mt-1",h),children:v})]})}export{vs as WaitlistOverviewPage};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.