1import{j as e}from"./query-BQ5zDiGB.js";import{r as n,L as o}from"./react-vendor-DHsc3q5k.js";import{s as N}from"./index-CUsCJzIz.js";import"./ui-Blg_AY2b.js";import"./supabase-CpRTRdvQ.js";const m={all:"All",compliance:"Compliance review",operations:"Operations",blocked:"Blocked",terminal:"Terminal"},g=["STATEMENT_REVIEW","KYC_IN_REVIEW"],f=["KYC_APPROVED","MANDATE_PENDING_SIGN","BO_TRANSFER_PENDING","BO_TRANSFER_COMPLETE"],E=["PROMOTED","REJECTED"],b={DRAFT:"bg-muted/15 text-muted",STATEMENT_REVIEW:"bg-info/15 text-info",KYC_IN_REVIEW:"bg-warning/15 text-warning",KYC_APPROVED:"bg-info/15 text-info",MANDATE_PENDING_SIGN:"bg-warning/15 text-warning",BO_TRANSFER_PENDING:"bg-warning/15 text-warning",BO_TRANSFER_COMPLETE:"bg-info/15 text-info",PROMOTED:"bg-success/15 text-success",REJECTED:"bg-danger/15 text-danger"};function w(){const[a,p]=n.useState("compliance"),[i,h]=n.useState([]),[r,l]=n.useState(!0),[c,d]=n.useState("");return n.useEffect(()=>{let t=!1;l(!0),d("");let s=N.from("migration_applicants").select("id, applicant_ref, full_name, email, source_firm, desired_path, status, blocker_reason, blocked_at, created_at").order("created_at",{ascending:!1}).limit(200);return a==="compliance"?s=s.in("status",g):a==="operations"?s=s.in("status",f):a==="blocked"?s=s.not("blocked_at","is",null):a==="terminal"&&(s=s.in("status",E)),s.then(({data:u,error:x})=>{t||(x?d(x.message):h(u??[]),l(!1))}),()=>{t=!0}},[a]),e.jsx("div",{className:"min-h-screen bg-background px-6 py-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Migration funnel"}),e.jsx("p",{className:"text-sm text-muted mt-1",children:"Compliance review queue and operational pipeline."})]}),e.jsx(o,{to:"/admin/clients",className:"text-sm text-muted hover:text-primary",children:"Customers â"})]}),e.jsx("div",{className:"flex gap-2 flex-wrap mb-4",children:Object.keys(m).map(t=>e.jsx("button",{onClick:()=>p(t),className:`px-3 py-1.5 rounded-full text-xs font-semibold transition ${a===t?"bg-primary text-white":"bg-secondary text-foreground hover:bg-secondary/80"}`,children:m[t]},t))}),c&&e.jsx("div",{className:"text-sm text-danger bg-danger/10 border border-danger/30 rounded-lg px-3 py-2 mb-4",children:c}),e.jsx("div",{className:"bg-white rounded-2xl shadow-sm border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-secondary/50 text-xs uppercase tracking-wide text-muted",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-3",children:"Applicant"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Source"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Path"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Status"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Blocker"}),e.jsx("th",{className:"text-right px-4 py-3",children:"Created"})]})}),e.jsxs("tbody",{className:"divide-y divide-border",children:[r&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-6 text-center text-muted",children:"Loadingâ¦"})}),!r&&i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-6 text-center text-muted",children:"No applicants in this view."})}),i.map(t=>e.jsxs("tr",{className:"hover:bg-secondary/30",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs(o,{to:`/admin/migrations/${t.applicant_ref}`,className:"block",children:[e.jsx("div",{className:"font-semibold text-foreground",children:t.full_name}),e.jsxs("div",{className:"text-xs text-muted font-mono",children:[t.applicant_ref.slice(0,12),"â¦"]})]})}),e.jsx("td",{className:"px-4 py-3 text-foreground",children:t.source_firm}),e.jsx("td",{className:"px-4 py-3 text-xs",children:t.desired_path}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded font-semibold ${b[t.status]??"bg-muted/15 text-muted"}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3 text-xs text-muted max-w-xs truncate",children:t.blocked_at?t.blocker_reason??"(unspecified)":"â"}),e.jsx("td",{className:"px-4 py-3 text-right text-xs text-muted",children:new Date(t.created_at).toLocaleDateString()})]},t.id))]})]})}),e.jsxs("p",{className:"text-xs text-muted mt-4 text-center",children:[i.length," applicant(s) shown. Limit 200; tighten the filter if you have more in flight."]})]})})}export{w as AdminMigrationsPage};
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.