1import{j as e}from"./vendor-radix-DLGwGdby.js";import{a as y,q as _,B as C,L as T,D as u,C as c,e as i,b as h,c as j,h as P,A as S}from"./index-Cz1Nuibl.js";import{T as g,a as p,b as m,c as n,d as N,e as a}from"./table-DxmE8Wef.js";import{f as d}from"./currencyConstants-Cgim7hCA.js";import{A as k,W as A,T as B,x as O,y as L,o as R}from"./vendor-lucide-BWW0XcuW.js";import"./vendor-recharts-dzgay_RI.js";import"./vendor-datefns-CU7NMMYW.js";const q={pending:"bg-warning/10 text-warning",processing:"bg-info/10 text-info",paid:"bg-success/10 text-success",failed:"bg-destructive/10 text-destructive"};function D({status:l}){const{t:x}=y();return e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${q[l]??"bg-muted text-muted-foreground"}`,children:x(`dashboard.mentor.instructor.settlement.statuses.${l}`,{defaultValue:l.replace(/\b\w/g,t=>t.toUpperCase())})})}function f(l,x){return l?new Date(l).toLocaleDateString(x,{year:"numeric",month:"short",day:"numeric"}):"â"}function W(){const{t:l,i18n:x}=y(),t=(s,v,w)=>l(`dashboard.mentor.instructor.settlement.${s}`,{defaultValue:v,...w}),r=x.resolvedLanguage==="ar"?"ar":"en",{data:o,isLoading:b}=_({queryKey:["instructor-settlement"],queryFn:()=>P.get(`${S}/master-classes/instructor/settlement`)});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(T,{to:"/dashboard/instructor",children:[e.jsx(k,{className:"h-4 w-4 me-1"}),t("back","Back")]})}),e.jsxs("h1",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(A,{className:"h-5 w-5"}),t("title","Payouts & Settlement")]})]}),b?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[1,2,3,4].map(s=>e.jsx(u,{className:"h-24 rounded-xl"},s))}),e.jsx(u,{className:"h-64 rounded-xl"})]}):!o||o.cohorts.length===0?e.jsx(c,{children:e.jsx(i,{className:"p-8 text-center text-muted-foreground",children:t("empty","No settlement data yet. Earnings appear here once learners enroll in your paid cohorts.")})}):e.jsxs(e.Fragment,{children:[o.totals.map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:t("balance","Balance ({{currency}})",{currency:s.currency})}),e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(c,{children:e.jsxs(i,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(B,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl font-bold",dir:"ltr",children:d(s.net_earnings,s.currency,{locale:r})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("netEarnings","Net earnings")})]})]})}),e.jsx(c,{children:e.jsxs(i,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-warning/10",children:e.jsx(O,{className:"h-4 w-4 text-warning"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl font-bold",dir:"ltr",children:d(s.settled_refunds,s.currency,{locale:r})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("settledRefunds","Settled refunds")})]})]})}),e.jsx(c,{children:e.jsxs(i,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-success/10",children:e.jsx(L,{className:"h-4 w-4 text-success"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl font-bold",dir:"ltr",children:d(s.paid_out,s.currency,{locale:r})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("paidOut","Paid out")})]})]})}),e.jsx(c,{children:e.jsxs(i,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-info/10",children:e.jsx(R,{className:"h-4 w-4 text-info"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl font-bold",dir:"ltr",children:d(s.outstanding,s.currency,{locale:r})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.pending_payout>0?t("outstandingPending","Outstanding ({{amount}} pending)",{amount:d(s.pending_payout,s.currency,{locale:r})}):t("outstanding","Outstanding")})]})]})})]})]},s.currency)),e.jsxs(c,{children:[e.jsx(h,{children:e.jsx(j,{className:"text-base",children:t("breakdown","Per-cohort breakdown")})}),e.jsx(i,{className:"overflow-x-auto",children:e.jsxs(g,{children:[e.jsx(p,{children:e.jsxs(m,{children:[e.jsx(n,{children:t("columns.cohort","Cohort")}),e.jsx(n,{className:"text-end",children:t("columns.gross","Gross")}),e.jsx(n,{className:"text-end",children:t("columns.commission","Commission")}),e.jsx(n,{className:"text-end",children:t("columns.net","Net")}),e.jsx(n,{className:"text-end",children:t("columns.refunds","Refunds")}),e.jsx(n,{className:"text-end",children:t("columns.paidOut","Paid out")}),e.jsx(n,{className:"text-end",children:t("columns.outstanding","Outstanding")})]})}),e.jsx(N,{children:o.cohorts.map(s=>e.jsxs(m,{children:[e.jsxs(a,{children:[e.jsx("div",{className:"font-medium",children:s.class_title}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.cohort_name})]}),e.jsx(a,{dir:"ltr",className:"text-end",children:d(s.gross_revenue,s.currency,{locale:r})}),e.jsxs(a,{dir:"ltr",className:"text-end text-muted-foreground",children:["â",d(s.platform_commission,s.currency,{locale:r})]}),e.jsx(a,{dir:"ltr",className:"text-end",children:d(s.net_earnings,s.currency,{locale:r})}),e.jsxs(a,{dir:"ltr",className:"text-end text-muted-foreground",children:["â",d(s.settled_refunds,s.currency,{locale:r})]}),e.jsx(a,{dir:"ltr",className:"text-end",children:d(s.paid_out,s.currency,{locale:r})}),e.jsx(a,{dir:"ltr",className:"text-end font-semibold",children:d(s.outstanding,s.currency,{locale:r})})]},s.cohort_id))})]})})]}),e.jsxs(c,{children:[e.jsx(h,{children:e.jsx(j,{className:"text-base",children:t("history","Payout history")})}),e.jsx(i,{className:"overflow-x-auto",children:o.payouts.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-4",children:t("noPayouts","No payouts recorded yet.")}):e.jsxs(g,{children:[e.jsx(p,{children:e.jsxs(m,{children:[e.jsx(n,{children:t("columns.cohort","Cohort")}),e.jsx(n,{className:"text-end",children:t("columns.amount","Amount")}),e.jsx(n,{children:t("columns.status","Status")}),e.jsx(n,{children:t("columns.requested","Requested")}),e.jsx(n,{children:t("columns.paid","Paid")}),e.jsx(n,{children:t("columns.notes","Notes")})]})}),e.jsx(N,{children:o.payouts.map(s=>e.jsxs(m,{children:[e.jsx(a,{children:s.cohort_name}),e.jsx(a,{dir:"ltr",className:"text-end",children:d(s.amount,s.currency,{locale:r})}),e.jsx(a,{children:e.jsx(D,{status:s.status})}),e.jsx(a,{dir:"ltr",children:f(s.created_at,r)}
1),e.jsx(a,{dir:"ltr",children:f(s.paid_at,r)}),e.jsx(a,{className:"max-w-[16rem] truncate text-muted-foreground",children:s.notes??"â"})]},s.id))})]})})]})]})]})}export{W 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.