1import{a as g,j as e}from"./trpc-vendor-Bta84Nsh.js";import{t as T,g as d}from"./index-_3-B0itT.js";import{S as h,a as p,b as f,c as j,d as n}from"./select-DqcHU93A.js";import{L}from"./react-vendor-DpXpH6G7.js";import{b as I,F as B,p as E,U as P,G as $,au as z,bz as C,as as F,K as k,n as D,aY as U}from"./ui-vendor-NEZNvIbV.js";const b={online:{label:"Online",icon:$,color:"bg-green-500/20 text-green-400 border-green-500/30"},appointment:{label:"Termin",icon:P,color:"bg-blue-500/20 text-blue-400 border-blue-500/30"},studio:{label:"Studio",icon:E,color:"bg-gray-500/20 text-gray-400 border-gray-500/30"}},V={pending:"Ausstehend",confirmed:"Bestätigt",cancelled:"Storniert"};function N(s){if(!s)return 0;const o=typeof s=="number"?s:new Date(s).getTime();return Math.floor((Date.now()-o)/864e5)}function K(){const[s,o]=g.useState("all"),[x,v]=g.useState(()=>{try{return localStorage.getItem("signups_status")??"pending"}catch{return"pending"}}),{data:r,isLoading:S}=T.publicSignup.list.useQuery({}),w=t=>{v(t);try{localStorage.setItem("signups_status",t)}catch{}},m=(r??[]).filter(t=>!(s!=="all"&&(t.contractSource??"online")!==s||x!=="all"&&t.status!==x)),a={all:(r??[]).length,pending:(r??[]).filter(t=>t.status==="pending").length,confirmed:(r??[]).filter(t=>t.status==="confirmed").length,overduePending:(r??[]).filter(t=>t.status==="pending"&&N(t.createdAt)>=3).length};return e.jsxs("div",{className:"p-6 max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Vertragsanmeldungen"}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Online-, Termin- und Studio-Verträge im Ãberblick."}),a.overduePending>0&&e.jsxs("p",{className:"mt-2 inline-flex items-center gap-1.5 text-xs text-red-400 bg-red-500/10 border border-red-500/30 px-2 py-1 rounded",children:[e.jsx(I,{className:"w-3 h-3"}),a.overduePending," ",a.overduePending===1?"Anmeldung wartet":"Anmeldungen warten"," seit â¥3 Tagen auf Bestätigung"]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(h,{value:x,onValueChange:w,children:[e.jsx(p,{className:"w-44 h-9",children:e.jsx(f,{})}),e.jsxs(j,{children:[e.jsxs(n,{value:"all",children:["Alle Status (",a.all,")"]}),e.jsxs(n,{value:"pending",children:["Ausstehend (",a.pending,")"]}),e.jsxs(n,{value:"confirmed",children:["Bestätigt (",a.confirmed,")"]}),e.jsx(n,{value:"cancelled",children:"Storniert"})]})]}),e.jsxs(h,{value:s,onValueChange:o,children:[e.jsx(p,{className:"w-40 h-9",children:e.jsx(f,{placeholder:"Alle Quellen"})}),e.jsxs(j,{children:[e.jsx(n,{value:"all",children:"Alle Quellen"}),e.jsx(n,{value:"online",children:"Online"}),e.jsx(n,{value:"appointment",children:"Termin"}),e.jsx(n,{value:"studio",children:"Studio"})]})]})]})]}),S?e.jsx("div",{className:"text-center py-16 text-muted-foreground",children:"Lädt..."}):m.length===0?e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(B,{className:"w-12 h-12 mx-auto opacity-30 mb-4"}),"Keine Anmeldungen gefunden."]}):e.jsx("div",{className:"space-y-3",children:m.map(t=>{const y=t.contractSource??"online",u=b[y]??b.online,A=u.icon,l=N(t.createdAt),i=t.status==="pending",c=i&&l>=3;return e.jsx("div",{className:`bg-card rounded-xl border p-5 ${c?"border-red-500/40 bg-red-500/5":i&&l>=1?"border-yellow-500/30":""}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2 flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4 text-orange-500"}),e.jsxs("span",{className:"font-semibold",children:[t.firstName," ",t.lastName]})]}),e.jsx(d,{variant:"outline",className:"text-xs",children:t.contractTypeName??`Typ #${t.contractTypeId}`}),e.jsxs(d,{variant:"outline",className:`text-xs ${u.color}`,children:[e.jsx(A,{className:"w-3 h-3 mr-1"}),u.label]}),e.jsxs(d,{variant:"outline",className:`text-xs ${i?c?"bg-red-500/15 text-red-400 border-red-500/30":"bg-yellow-500/15 text-yellow-400 border-yellow-500/30":t.status==="confirmed"?"bg-green-500/15 text-green-400 border-green-500/30":"bg-zinc-500/15 text-zinc-400 border-zinc-500/30"}`,children:[i&&e.jsx(C,{className:"w-3 h-3 mr-1"}),V[t.status]??t.status]}),i&&l>0&&e.jsxs(d,{variant:"outline",className:`text-xs ${c?"bg-red-500/15 text-red-400 border-red-500/30 animate-pulse":"bg-zinc-500/10 text-zinc-400"}`,children:[l===1?"1 Tag":`${l} Tage`," alt",c?" â ï¸":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground flex-wrap",children:[t.phone&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"w-3.5 h-3.5"}),t.phone]}),t.email&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(k,{className:"w-3.5 h-3.5"}),t.email]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"w-3.5 h-3.5"}),new Date(t.createdAt).toLocaleDateString("de-DE")]})]}),t.address&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.address}),t.sepaIban&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["IBAN: ",t.sepaIban]})]}),t.leadId&&e.jsx(L,{href:`/leads/${t.leadId}`,children:e.jsxs("a",{className:"text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 shrink-0",children:["Lead öffnen ",e.jsx(U,{className:"w-3 h-3"})]})})]})},t.id)})})]})}export{K as default};
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.