1import{d as x,r as n,j as e,e as u}from"./index-C98cF--x.js";import{i as g}from"./fee-engine.functions-B6OlanvC.js";import{A as h,S as r,f as s,P as i}from"./AdminUI-BIcvd4GG.js";import"./auth-middleware-CDdXXbpt.js";import"./inbox-bLVK3vbt.js";import"./triangle-alert-v66o_bs1.js";function y(){const d=x(g),[a,c]=n.useState(null),[o,m]=n.useState(!0);if(n.useEffect(()=>{d().then(c).finally(()=>m(!1))},[]),o||!a)return e.jsxs("div",{className:"p-10 flex items-center gap-2 text-muted-foreground",children:[e.jsx(u,{className:"animate-spin",size:16})," Loading revenue..."]});const l=a.kpis;return e.jsxs(h,{eyebrow:"Brokerage ⢠Platform fees ⢠Reconciliation",title:"Revenue Command Center",subtitle:"Unified revenue across Concord Energy Services, US Diesel, and future verticals â supplier-funded fees, monthly commissions, and per-gallon platform fees in one ledger.",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[e.jsx(r,{label:"Expected revenue",value:s(l.expectedRevenue),accent:"gold",delta:`${l.agreements} agreements`}),e.jsx(r,{label:"Paid to date",value:s(l.paidRevenue),accent:"emerald",delta:"settled commissions"}),e.jsx(r,{label:"Outstanding",value:s(l.outstanding),accent:"rose",delta:"awaiting collection"}),e.jsx(r,{label:"MRR",value:s(l.mrr),accent:"blue",delta:"active monthly plans"})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[e.jsx(r,{label:"Projected annual",value:s(l.projectedAnnual),accent:"gold"}),e.jsx(r,{label:"Gallons managed",value:l.gallons.toLocaleString(),accent:"blue",delta:"US Diesel volume"}),e.jsx(r,{label:"Programs live",value:String(a.byProgram.length),accent:"emerald"}),e.jsx(r,{label:"Suppliers paying",value:String(a.bySupplier.length),accent:"gold"})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6 mb-6",children:[e.jsx("div",{className:"xl:col-span-2",children:e.jsx(i,{title:"Revenue by program",children:e.jsxs("div",{className:"divide-y divide-white/5",children:[a.byProgram.map(t=>e.jsxs("div",{className:"py-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:t.program.name}),e.jsxs("div",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:[t.program.vertical," ⢠",t.agreements_count," agreements"]})]}),e.jsxs("div",{className:"text-right text-xs",children:[e.jsx("div",{className:"text-gold font-display text-base",children:s(t.expected)}),e.jsxs("div",{className:"text-muted-foreground",children:[s(t.paid)," paid · ",s(t.outstanding)," due"]})]})]},t.program.id)),a.byProgram.length===0&&e.jsx("div",{className:"text-sm text-muted-foreground py-6",children:"No programs yet."})]})})}),e.jsx(i,{title:"Monthly trend",children:e.jsxs("div",{className:"space-y-2",children:[a.trend.length===0&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"No payments recorded yet."}),a.trend.map(t=>e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:t.month}),e.jsx("span",{className:"text-emerald-300 font-mono",children:s(t.amount)})]},t.month))]})})]}),e.jsx(i,{title:"Recent transactions",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left py-2",children:"When"}),e.jsx("th",{className:"text-left",children:"Type"}),e.jsx("th",{className:"text-left",children:"Trigger"}),e.jsx("th",{className:"text-right",children:"Basis"}),e.jsx("th",{className:"text-right",children:"Fee"}),e.jsx("th",{className:"text-left pl-2",children:"Status"})]})}),e.jsxs("tbody",{className:"divide-y divide-white/5",children:[a.recent.map(t=>e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 text-muted-foreground",children:new Date(t.occurred_at).toLocaleString()}),e.jsx("td",{children:t.transaction_type}),e.jsx("td",{className:"text-muted-foreground",children:t.trigger_event??"â"}),e.jsx("td",{className:"text-right text-muted-foreground",children:t.basis_quantity?`${t.basis_quantity} ${t.basis_unit??""}`:t.basis_amount?s(Number(t.basis_amount)):"â"}),e.jsx("td",{className:"text-right text-gold font-mono",children:s(Number(t.fee_amount))}),e.jsx("td",{className:"pl-2 text-muted-foreground",children:t.status})]},t.id)),a.recent.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-6 text-center text-muted-foreground",children:"No transactions yet."})})]})]})})})]})}export{y as component};
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.