PageSourceSearch

https://edgemxtiming.com/assets/OrgReconciliationPage-2QSknSTD.js

js edgemxtiming.com collected 2026-09-24 14:42:21 UTC 23,336 bytes, 2 lines download raw bytes

1import{r as N,a0 as z,j as e,B as y,s as F,u as C,b as w,I as U,a4 as ne,l as G,S as P,n as k,o as L,q as B,t as S}from"./index-BCH4IFx8.js";import{B as A}from"./BpSpinner-Bqvfph1h.js";import{C as M,b as V,c as $,d as H,a as K}from"./card-DaE3Hwfn.js";import{E as me}from"./estimated-progress-CETNSrc9.js";import{d as he,a as ue,R as pe}from"./generateReconciliationCsv-D_QdC8tf.js";import{T as E,a as T,b as p,c as o,d as I,e as t}from"./table-BgVITkDQ.js";import{S as ie}from"./search-GvbQAZxx.js";import{F as ge}from"./file-text-BuQtBEyd.js";import"./progress-CL2A5cKM.js";import"./collapsible-xcd2iWHA.js";import"./index-DKPz-1vL.js";import"./triangle-alert-m5K6MENR.js";import"./format-ybceeo2k.js";import"./en-US-CGO0aXMi.js";import"./jspdf.plugin.autotable-R0NBoJzi.js";const x=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(i||0);function je({orgId:i,periodStart:d,periodEnd:u}){const[m,s]=N.useState(null),f=z({mutationFn:async()=>{const{data:n,error:h}=await F.functions.invoke("stripe-connected-ledger-audit",{body:{organization_id:i,period_start:d,period_end:u}});if(h)throw h;if(n!=null&&n.error)throw new Error(n.error);return n},onSuccess:n=>{s(n),C.success("Stripe ledger loaded")},onError:n=>C.error((n==null?void 0:n.message)??"Ledger audit failed")}),c=m==null?void 0:m.stripe,g=m==null?void 0:m.registrations,a=c&&g?c.totals.gross_charges-g.gross_stripe:0;return e.jsxs(M,{children:[e.jsxs(V,{children:[e.jsx($,{className:"text-base",children:"Stripe connected-account ledger diagnostic"}
1),e.jsxs(H,{children:["Pulls every balance transaction on the org's connected Stripe account for the selected period and reconciles the Stripe ledger totals against the ",e.jsx("code",{children:"registrations"})," table. Use this to find the exact source of any gap."]})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs(y,{onClick:()=>f.mutate(),disabled:f.isPending||!i||!d||!u,children:[f.isPending?e.jsx(A,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ie,{className:"mr-2 h-4 w-4"}),"Run diagnostic"]}),m&&c&&g&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Connected account: ",e.jsx("code",{children:m.stripe_account_id}),m.balance_now&&e.jsxs(e.Fragment,{children:[" • Live balance: ",x(m.balance_now.available)," available / ",x(m.balance_now.pending)," pending"]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Stripe balance-transactions by category"}),e.jsxs(E,{children:[e.jsx(T,{children:e.jsxs(p,{children:[e.jsx(o,{children:"Reporting category"}),e.jsx(o,{className:"text-right",children:"Count"}),e.jsx(o,{className:"text-right",children:"Gross"}),e.jsx(o,{className:"text-right",children:"Fee"}),e.jsx(o,{className:"text-right",children:"Net"})]})}),e.jsxs(I,{children:[Object.entries(c.by_type).sort((n,h)=>Math.abs(h[1].gross)-Math.abs(n[1].gross)).map(([n,h])=>e.jsxs(p,{children:[e.jsx(t,{className:"font-mono text-xs",children:n}),e.jsx(t,{className:"text-right",children:h.count}),e.jsx(t,{className:"text-right",children:x(h.gross)}),e.jsx(t,{className:"text-right",children:x(h.fee)}),e.jsx(t,{className:"text-right",children:x(h.net)})]},n)),e.jsxs(p,{className:"font-semibold",children:[e.jsx(t,{children:"Net activity in period"}),e.jsx(t,{}),e.jsx(t,{}),e.jsx(t,{}),e.jsx(t,{className:"text-right",children:x(c.totals.net_activity)})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Side-by-side: Stripe ledger vs registrations DB"}),e.jsxs(E,{children:[e.jsx(T,{children:e.jsxs(p,{children:[e.jsx(o,{children:"Metric"}),e.jsx(o,{className:"text-right",children:"Stripe ledger"}),e.jsx(o,{className:"text-right",children:"Registrations DB"}),e.jsx(o,{className:"text-right",children:"Δ (Stripe − DB)"})]})}),e.jsxs(I,{children:[e.jsxs(p,{children:[e.jsx(t,{children:"Gross charges (Stripe)"}),e.jsx(t,{className:"text-right",children:x(c.totals.gross_charges)}),e.jsxs(t,{className:"text-right",children:[x(g.gross_stripe)," (",g.stripe_reg_count," regs)"]}),e.jsx(t,{className:"text-right",children:x(a)})]}),e.jsxs(p,{children:[e.jsx(t,{children:"Refunds"}),e.jsx(t,{className:"text-right",children:x(c.totals.refunds)}),e.jsxs(t,{className:"text-right",children:[x(g.refunded_gross)," (",g.refunded_count," regs)"]}),e.jsx(t,{className:"text-right",children:x(c.totals.refunds+g.refunded_gross)})]}),e.jsxs(p,{children:[e.jsx(t,{children:"Stripe processing fees (on charges)"}),e.jsx(t,{className:"text-right",children:x(c.totals.stripe_fees_on_charges)}),e.jsx(t,{className:"text-right",children:"—"}),e.jsx(t,{className:"text-right",children:"—"})]}),e.jsxs(p,{children:[e.jsx(t,{children:"Application fees (Beyond Pro platform fees)"}),e.jsx(t,{className:"text-right",children:x(c.totals.application_fees)}),e.jsx(t,{className:"text-right",children:x(g.bp_platform_fees_stored)}),e.jsx(t,{className:"text-right",children:x(c.totals.application_fees+g.bp_platform_fees_stored)})]}),e.jsxs(p,{children:[e.jsx(t,{children:"Transfers out of connected account"}),e.jsx(t,{className:"text-right",children:x(c.totals.transfers_out)}),e.jsx(t,{className:"text-right",children:"—"}),e.jsx(t,{className:"text-right",children:"—"})]}),e.jsxs(p,{children:[e.jsx(t,{children:"Payouts out to bank"}),e.jsx(t,{className:"text-right",children:x(c.totals.payouts_out)}),e.jsx(t,{className:"text-right",children:"—"}),e.jsx(t,{className:"text-right",children:"—"})]}),e.jsxs(p,{children:[e.jsx(t,{children:"Adjustments / other"}),e.jsx(t,{className:"text-right",children:x(c.totals.adjustments)}),e.jsx(t,{className:"text-right",children:"—"}),e.jsx(t,{className:"text-right",children:"—"})]})]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-semibold text-sm mb-2",children:["All balance transactions (",c.transactions.length,")"]}),e.jsx("div",{className:"max-h-[500px] overflow-auto border rounded",children:e.jsxs(E,{children:[e.jsx(T,{children:e.jsxs(p,{children:[e.jsx(o,{children:"Date"}),e.jsx(o,{children:"Category"}),e.jsx(o,{children:"Description"}),e.jsx(o,{children:"Source"}),e.jsx(o,{className:"text-right",children:"Gross"}),e.jsx(o,{className:"text-right",children:"Fee"}),e.jsx(o,{className:"text-right",children:"Net"})]})}),e.jsx(I,{children:c.transactions.slice().sort((n,h)=>n.created.localeCompare(h.created)).map(n=>e.jsxs(p,{children:[e.jsx(t,{className:"text-xs whitespace-nowrap",children:new Date(n.created).toLocaleStr
1ing()}),e.jsx(t,{className:"font-mono text-xs",children:n.reporting_category}),e.jsx(t,{className:"text-xs",children:n.description}),e.jsx(t,{className:"font-mono text-xs",children:n.source}),e.jsx(t,{className:"text-right text-xs",children:x(n.gross)}),e.jsx(t,{className:"text-right text-xs",children:x(n.fee)}),e.jsx(t,{className:"text-right text-xs",children:x(n.net)})]},n.id))})]})})]})]})]})]})}const l=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(i||0);function fe(i){const d=["registration_id","created_at","phase","rider","event_name","payment_status","stripe_payment_intent_id","charge_id","subtotal","total_amount","gross_amount","refunded_amount","net_charged","stripe_fee","refund_fee","bp_fee","bp_fee_stored","net_owed","stripe_error"],u=s=>{const f=s==null?"":String(s);return/[",\n]/.test(f)?`"${f.replace(/"/g,'""')}"`:f},m=[d.join(",")];for(const s of i)m.push([s.registration_id,s.created_at,s.phase,s.rider,s.event_name??"",s.payment_status,s.stripe_payment_intent_id??"",s.charge_id??"",s.subtotal.toFixed(2),s.total_amount.toFixed(2),s.gross_amount.toFixed(2),s.refunded_amount.toFixed(2),s.net_charged.toFixed(2),s.stripe_fee.toFixed(2),s.refund_fee.toFixed(2),s.bp_fee.toFixed(2),s.bp_fee_stored.toFixed(2),s.net_owed.toFixed(2),s.stripe_error??""].map(u).join(","));return m.join(`
2`)}function _e({orgId:i,orgName:d}){const[u,m]=N.useState(""),[s,f]=N.useState(null),c=z({mutationFn:async()=>{const{data:a,error:n}=await F.functions.invoke("platform-hold-registrations-audit",{body:{organization_id:i,cutoff:u||void 0}});if(n)throw n;if(a!=null&&a.error)throw new Error(a.error);return a},onSuccess:a=>{f(a),C.success(`Loaded ${a.rows.length} Stripe registrations`)},onError:a=>C.error((a==null?void 0:a.message)??"Failed to load")}),g=()=>{if(!s)return;const a=new Blob([fe(s.rows)],{type:"text/csv;charset=utf-8"}),n=URL.createObjectURL(a),h=document.createElement("a");h.href=n,h.download=`stripe-registrations-${(d||"org").replace(/\W+/g,"_")}-${s.cutoff.slice(0,10)}.csv`,h.click(),URL.revokeObjectURL(n)};return e.jsxs(M,{children:[e.jsxs(V,{children:[e.jsx($,{className:"text-base",children:"All Stripe registrations — actual fees from Stripe"}
2),e.jsxs(H,{children:["Pulls every Stripe payment for this org and fetches the ACTUAL charge amount, Stripe processing fee (from the BalanceTransaction), application/BP fee, and any refunds live from Stripe. Rows are tagged ",e.jsx("code",{children:"pre_onboarding"})," vs"," ",e.jsx("code",{children:"post_onboarding"}),". Net owed = (gross − refunded) − (stripe_fee − refund_fee) − bp_fee. For pre-onboarding rows where no application_fee_amount exists, bp_fee falls back to the computed tier floor."]})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-3 items-end",children:[e.jsxs("div",{children:[e.jsx(w,{className:"text-xs",htmlFor:"cutoff",children:"Onboarding cutoff override (optional)"}),e.jsx(U,{id:"cutoff",type:"datetime-local",value:u,onChange:a=>m(a.target.value?new Date(a.target.value).toISOString():""),className:"w-56"})]}),e.jsxs(y,{onClick:()=>c.mutate(),disabled:c.isPending||!i,children:[c.isPending?e.jsx(A,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ie,{className:"mr-2 h-4 w-4"}),"Load all Stripe registrations"]}),s&&e.jsxs(y,{variant:"outline",onClick:g,children:[e.jsx(ne,{className:"mr-2 h-4 w-4"})," Download CSV"]})]}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-3 text-sm",children:[e.jsx(_,{label:"Registrations",value:String(s.totals.count)}),e.jsx(_,{label:"Gross charged",value:l(s.totals.gross_amount)}),e.jsx(_,{label:"Refunded",value:l(s.totals.refunded_amount)}),e.jsx(_,{label:"Stripe fees (net)",value:l(s.totals.stripe_fee-s.totals.refund_fee)}),e.jsx(_,{label:"BP fees",value:l(s.totals.bp_fee)}),e.jsx(_,{label:"Net owed to org",value:l(s.totals.net_owed),highlight:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[e.jsx(ae,{label:"Pre-onboarding (platform-hold)",b:s.totals.pre}),e.jsx(ae,{label:"Post-onboarding (direct/destination)",b:s.totals.post})]}),e.jsxs("div",{className:"rounded border p-3 bg-muted/30 text-sm space-y-2",children:[e.jsxs("div",{className:"text-xs font-medium",children:["BP service costs to debit (over window ",new Date(s.bp_service_costs.window_start).toLocaleDateString()," → ",new Date(s.bp_service_costs.window_end).toLocaleDateString(),")"]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 text-xs",children:[e.jsx(_,{label:"Timing",value:l(s.bp_service_costs.timing_cost)}),e.jsx(_,{label:"Messaging (email + SMS)",value:l(s.bp_service_costs.messaging_cost)}),e.jsx(_,{label:"AI usage",value:l(s.bp_service_costs.ai_cost)}),e.jsx(_,{label:"Manual adjustments",value:l(s.bp_service_costs.manual_adjustments)}),e.jsx(_,{label:"Total costs",value:l(s.bp_service_costs.total)})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 items-baseline pt-2 border-t",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Net owed (before BP costs)"}),e.jsx("div",{className:"tabular-nums font-medium",children:l(s.totals.net_owed)}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"− BP service costs"}),e.jsxs("div",{className:"tabular-nums",children:["−",l(s.bp_service_costs.total)]}),e.jsx("div",{className:"text-xs font-medium ml-auto",children:"Net owed after costs"}),e.jsx("div",{className:"tabular-nums font-semibold text-base",children:l(s.net_owed_after_costs)})]}),s.payouts_paid&&e.jsxs("div",{className:"flex flex-wrap gap-4 items-baseline pt-2 border-t",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Net owed after costs"}),e.jsx("div",{className:"tabular-nums font-medium",children:l(s.net_owed_after_costs)}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["− Payouts already paid (",s.payouts_paid.count,")"]}),e.jsxs("div",{className:"tabular-nums",children:["−",l(s.payouts_paid.amount)]}),e.jsx("div",{className:"text-xs font-semibold ml-auto",children:"Net still owed to org"}),e.jsx("div",{className:"tabular-nums font-bold text-lg",children:l(s.net_owed_after_costs_and_payouts??0)})]}),s.payouts_paid&&(s.payouts_paid.stripe_transfers||s.payouts_paid.paper_checks)&&e.jsxs("div",{className:"pt-2 border-t space-y-1",children:[e.jsx("div",{className:"text-xs font-medium",children:"Payments already made to org"}),s.payouts_paid.stripe_transfers&&e.jsxs("div",{className:"flex flex-wrap gap-4 items-baseline text-xs",children:[e.jsxs("div",{className:"text-muted-foreground",children:["Stripe transfers (",s.payouts_paid.stripe_transfers.count,")"]}),e.jsxs("div",{className:"tabular-nums",children:["−",l(s.payouts_paid.stripe_transfers.amount)]}),s.payouts_paid.stripe_transfers.error&&e.jsxs("div",{className:"text-destructive",children:["Stripe error: ",s.payouts_paid.stripe_transfers.error]})]}),s.payouts_paid.paper_checks&&s.payouts_paid.paper_checks.count>0&&e.jsxs("div",{className:"flex flex-wrap gap-4 items-baseline text-xs",children:[e.jsxs("div",{className:"text-muted-foreground",children:["Paper check / manual payouts (",s.payouts_paid.paper_checks.count,")"]}),e.jsxs("div",{className:"tabular-nums",children:["−",l(s.payouts_paid.paper_checks.amount)]})]})]}),s.bp_service_costs.error&&e.jsxs("div",{className:"text-xs text-destructive",children:["Cost lookup error: ",s.bp_service_costs.error]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Onboarded at: ",s.onboarded_at?new Date(s.onboarded_at).toLocaleStr
2ing():"—"," · Stripe account: ",e.jsx("code",{children:s.stripe_account_id??"—"}),s.totals.refunded_count>0&&e.jsxs(e.Fragment,{children:[" · ",s.totals.refunded_count," with refunds"]}),s.totals.errors>0&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"text-destructive",children:[s.totals.errors," Stripe lookup errors"]})]})]}),e.jsx("div",{className:"rounded border overflow-x-auto max-h-[560px]",children:e.jsxs(E,{children:[e.jsx(T,{className:"sticky top-0 bg-background",children:e.jsxs(p,{children:[e.jsx(o,{children:"Date"}),e.jsx(o,{children:"Phase"}),e.jsx(o,{children:"Rider"}),e.jsx(o,{children:"Event"}),e.jsx(o,{className:"text-right",children:"Gross"}),e.jsx(o,{className:"text-right",children:"Refunded"}),e.jsx(o,{className:"text-right",children:"Stripe fee"}),e.jsx(o,{className:"text-right",children:"BP fee"}),e.jsx(o,{className:"text-right",children:"Net owed"}),e.jsx(o,{children:"Status"})]})}),e.jsx(I,{children:s.rows.map(a=>e.jsxs(p,{children:[e.jsx(t,{className:"whitespace-nowrap text-xs",children:new Date(a.created_at).toLocaleDateString()}),e.jsx(t,{className:"text-xs",children:e.jsx("span",{className:a.phase==="pre_onboarding"?"text-amber-700":"text-emerald-700",children:a.phase==="pre_onboarding"?"pre":"post"})}),e.jsx(t,{className:"text-xs",children:a.rider||"—"}),e.jsx(t,{className:"text-xs",children:a.event_name??"—"}),e.jsx(t,{className:"text-right tabular-nums",children:l(a.gross_amount)}),e.jsx(t,{className:"text-right tabular-nums",children:a.refunded_amount>0?l(a.refunded_amount):"—"}),e.jsx(t,{className:"text-right tabular-nums",children:l(a.stripe_fee-a.refund_fee)}),e.jsx(t,{className:"text-right tabular-nums",children:l(a.bp_fee)}),e.jsx(t,{className:"text-right tabular-nums font-medium",children:l(a.net_owed)}),e.jsx(t,{className:"text-xs",children:a.stripe_error?e.jsx("span",{className:"text-destructive",title:a.stripe_error,children:"error"}):a.payment_status})]},a.registration_id))})]})})]})]})]})}function _({label:i,value:d,highlight:u}){return e.jsxs("div",{className:`rounded border p-3 ${u?"bg-primary/5 border-primary/30":""}`,children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:i}),e.jsx("div",{className:"text-base font-semibold tabular-nums",children:d})]})}function ae({label:i,b:d}){return e.jsxs("div",{className:"rounded border p-3",children:[e.jsx("div",{className:"text-xs font-medium mb-2",children:i}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Count"}),e.jsx("span",{className:"tabular-nums text-right",children:d.count}),e.jsx("span",{className:"text-muted-foreground",children:"Gross"}),e.jsx("span",{className:"tabular-nums text-right",children:l(d.gross_amount)}),e.jsx("span",{className:"text-muted-foreground",children:"Refunded"}),e.jsx("span",{className:"tabular-nums text-right",children:l(d.refunded_amount)}),e.jsx("span",{className:"text-muted-foreground",children:"Net charged"}),e.jsx("span",{className:"tabular-nums text-right",children:l(d.net_charged)}),e.jsx("span",{className:"text-muted-foreground",children:"Stripe fees (net)"}),e.jsx("span",{className:"tabular-nums text-right",children:l(d.stripe_fee-d.refund_fee)}),e.jsx("span",{className:"text-muted-foreground",children:"BP fees"}),e.jsx("span",{className:"tabular-nums text-right",children:l(d.bp_fee)}),e.jsx("span",{className:"text-muted-foreground font-medium",children:"Net owed"}),e.jsx("span",{className:"tabular-nums text-right font-medium",children:l(d.net_owed)})]})]})}function re(i){if(!i)return null;const[d,u,m]=i.split("-").map(Number);return!d||!u||!m?null:new Date(d,u-1,m)}function Te(){var X,Y,Z;const[i,d]=N.useState(""),[u,m]=N.useState("dates"),[s,f]=N.useState(""),[c,g]=N.useState(""),[a,n]=N.useState("all"),[h,W]=N.useState("all"),[v,le]=N.useState(null),{data:D,isLoading:oe}=G({queryKey:["recon-orgs"],queryFn:async()=>{const{data:r,error:j}=await F.from("organizations").select("id, name, slug").eq("is_active",!0).order("name");if(j)throw j;return r??[]}}),{data:ce,isLoading:de}=G({queryKey:["recon-events",i],enabled:!!i,queryFn:async()=>{const{data:r,error:j}=await F.from("events").select("id, name, event_date, parent_event_id").eq("organization_id",i).is("parent_event_id",null).order("event_date",{ascending:!1});if(j)throw j;return r??[]}}),{data:Q,isLoading:xe}=G({queryKey:["recon-rounds",a],enabled:a!=="all",queryFn:async()=>{const{data:r,error:j}=await F.from("events").select("id, name, event_date").eq("parent_event_id",a).order("event_date",{ascending:!0});if(j)throw j;return r??[]}}),O=h!=="all"?h:a,J=!!i&&(u==="dates"?!!s&&!!c:a!=="all"),b=z({mutationFn:async r=>{if(!i)throw new Error("Select an organization");let j,q;if(u==="dates"){const se=re(s),te=re(c);if(!se||!te)throw new Error("Select a date range");j=se.toISOString(),q=new Date(te.getTime()+24*60*60*1e3).toISOString()}else{if(a==="all")throw new Error("Select an event or series");j=new Date(2015,0,1).toISOString(),q=new Date(Date.now()+24*60*60*1e3).toISOString()}const{data:R,error:ee}=await F.functions.invoke("org-reconciliation-report",{body:{organization_id:i,period_start:j,period_end:q,force_refresh:r===!0,...O&&O!=="all"?{event_id:O}:{}}});if(ee)throw ee;if(R!=null&&R.error)throw new Error(R.error);return R},onSuccess:r=>{le(r),C.success("Report generated")},onError:r=>C.error((r==null?void 0:r.message)??"Failed to generate report")});return e.jsxs("div",{className:"container mx-auto py-6 space-y-4 max-w-5xl",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Org Reconciliation"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate a full money-flow reconciliation for any organization. Download the PDF or CSV to share with the org admin."})]}),e.jsxs(M,{children:[e.jsxs(V,{children:[e.jsx($,{className:"text-base",children:"Report inputs"}),e.jsx(H,{children:"Report by a date range, or by a single event / series. Dates are Mountain Time."})]}),e.jsxs(K,{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-3 items-end",children:[e.jsxs("div",{className:"min-w-[240px]",children:[e.jsx(w,{className:"text-xs",children:"Organization"}),e.jsxs(P,{value:i,onValueChange:r=>{d(r),n("all")},children:[e.jsx(k,{children:e.jsx(L,{placeholder:oe?"Loading…":"Select organization"})}),e.jsx(B,{children:(D??[]).map(r=>
2e.jsx(S,{value:r.id,children:r.name},r.id))})]})]}),e.jsxs("div",{className:"min-w-[200px]",children:[e.jsx(w,{className:"text-xs",children:"Report by"}),e.jsxs(P,{value:u,onValueChange:r=>m(r),children:[e.jsx(k,{children:e.jsx(L,{})}),e.jsxs(B,{children:[e.jsx(S,{value:"dates",children:"Date range"}),e.jsx(S,{value:"event",children:"Event / series"})]})]})]}),u==="event"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-w-[240px]",children:[e.jsx(w,{className:"text-xs",children:"Event / series"}),e.jsxs(P,{value:a,onValueChange:r=>{n(r),W("all")},disabled:!i,children:[e.jsx(k,{children:e.jsx(L,{placeholder:de?"Loading…":"Select event or series"})}),e.jsx(B,{children:(ce??[]).map(r=>e.jsxs(S,{value:r.id,children:[r.name,r.event_date?` · ${String(r.event_date).slice(0,10)}`:""]},r.id))})]})]}),a!=="all"&&(Q??[]).length>0&&e.jsxs("div",{className:"min-w-[240px]",children:[e.jsx(w,{className:"text-xs",children:"Round"}),e.jsxs(P,{value:h,onValueChange:W,children:[e.jsx(k,{children:e.jsx(L,{placeholder:xe?"Loading…":"Whole series"})}),e.jsxs(B,{children:[e.jsx(S,{value:"all",children:"Whole series (all rounds)"}),(Q??[]).map(r=>e.jsxs(S,{value:r.id,children:[r.name,r.event_date?` · ${String(r.event_date).slice(0,10)}`:""]},r.id))]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(w,{className:"text-xs",htmlFor:"rec-from",children:"From"}),e.jsx(U,{id:"rec-from",type:"date",value:s,onChange:r=>f(r.target.value),className:"w-44"})]}),e.jsxs("div",{children:[e.jsx(w,{className:"text-xs",htmlFor:"rec-to",children:"To"}),e.jsx(U,{id:"rec-to",type:"date",value:c,onChange:r=>g(r.target.value),className:"w-44"})]})]}),e.jsxs(y,{onClick:()=>b.mutate(!1),disabled:b.isPending||!J,children:[b.isPending?e.jsx(A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Generate report"]}),e.jsx(y,{variant:"outline",onClick:()=>b.mutate(!0),disabled:b.isPending||!J,title:"Re-check every charge against Stripe live. Slower, but guaranteed current.",children:"Re-verify with Stripe"})]}),b.isPending&&e.jsx(me,{active:!0,expectedSeconds:b.variables===!0?70:45,label:b.variables===!0?"Re-checking every charge against Stripe live…":"Building the report — registrations, fees, and costs…"})]})]}),v&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:()=>he(v),children:[e.jsx(ge,{className:"mr-2 h-4 w-4"})," Download PDF"]}),e.jsxs(y,{variant:"outline",onClick:()=>ue(v),children:[e.jsx(ne,{className:"mr-2 h-4 w-4"})," Download CSV"]})]}),e.jsx(pe,{data:v}),!((X=v.scope)!=null&&X.event_id)&&e.jsx(je,{orgId:i,periodStart:v.period_start,periodEnd:v.period_end}),!((Y=v.scope)!=null&&Y.event_id)&&e.jsx(_e,{orgId:i,orgName:(Z=D==null?void 0:D.find(r=>r.id===i))==null?void 0:Z.name})]})]})}export{Te 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.