PageSourceSearch

https://rasi-synthetic-hr.vercel.app/assets/FinancePersonaPage-DRFqacrH.js

js rasi-synthetic-hr.vercel.app collected 2026-10-03 07:37:44 UTC 1,070,898 bytes, 27 lines download raw bytes

1import{r as t,j as a,a as dt}from"./vendor-react-CnnbmH0_.js";import{u as rt,D as ct}from"./DomainWorkspace-DKTb6Rax.js";import{H as it}from"./HubLiveMetrics-tRW8mvUU.js";import{E as ze}from"./EmptyState-D2B-edY2.js";import{B as pt}from"./BrowserTasksPanel-BapPY2su.js";import{c as S,t as k,A as Ka,e as ve,d as mt,i as lt}from"./index-B2OQ8b6_.js";import{B as j}from"./Button-Ctp2Y-WT.js";import{I as ge}from"./ImportData-BGKWKyRE.js";import{U as Xa,_ as Ge,v as W,aC as Be,a2 as X,R as H,S as Na,y as He,t as Z,p as ma,b8 as qe,X as oa,bp as Da,F as Qa,cH as ae,ah as Ue,a3 as la,d9 as We,aK as Ta,m as Je,W as Za,bL as xt,aE as ht,da as ut,a8 as Ae,aw as $a,db as gt,bx as Ye,k as Ve,bv as xa,Y as Ne,dc as Xe,a7 as bt,bn as ft,dd as Pt,de as vt,L as Bt,bZ as At,df as Nt,o as Ze,V as Dt,A as Ke,as as wt,n as De,bU as at,bV as et,i as Ct,T as be,b_ as yt,b4 as jt,aH as fe,B as It,bs as kt,D as Ft}from"./vendor-ui-Cy8RpR6q.js";import{c as Et}from"./Dashboard-DsUTv6hq.js";import{u as ee}from"./vendor-routing-C5D9NAgx.js";import{S as we}from"./indian-states-D_oK6RKl.js";import"./index-CK0-HVoE.js";import{L as St}from"./LoadingState-Clpv8jr0.js";import"./vendor-observability-DI0Oez8v.js";import"./PageHeader-DV8ztIf9.js";import"./EmptyState-CtunsfaX.js";import"./ErrorState-CcPfMdRH.js";import"./Skeleton-CKBn2yzs.js";import"./index-BR42CI16.js";import"./users-B3j0SjAz.js";import"./tally-DyOGFY4V.js";import"./vendor-motion-Dgz3DBbi.js";import"./vendor-auth-DNBNrwrO.js";import"./vendor-ux-ChjvAmS1.js";import"./useTranslation-DBO3FXDX.js";import"./vendor-flow-DGi8CiTA.js";import"./vendor-charts-BsQW0Sox.js";const na=e=>`${e<0?"-":""}₹${Math.abs(Math.round(e)).toLocaleString("en-IN")}`,se=e=>new Date(e+"T00:00:00").toLocaleDateString("en-IN",{day:"numeric",month:"short"});function Rt(){const[e,u]=t.useState(""),[g,p]=t.useState("90"),[l,f]=t.useState(null),[s,n]=t.useState(!1),[x,o]=t.useState(null),A=async()=>{const c=Number(e);if(!e.trim()||Number.isNaN(c)){o("Enter your current cash balance to forecast from.");return}o(null),n(!0);try{const m=await S("/hubs/finance/forecast",{method:"POST",body:JSON.stringify({opening_balance:c,horizon_days:Number(g)||90,include_payroll:!0})});m.success&&m.data?f(m.data):o(m.error||"Forecast failed")}catch{o("Could not run the forecast.")}finally{n(!1)}};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:54:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"54","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:55:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"55","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:56:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"56","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(Xa,{className:"w-4 h-4 text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:57:10","data-matrix-name":"TrendingUp","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"57","data-component-file":"CashflowForecast.tsx","data-component-name":"TrendingUp","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-accent-bright%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:58:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"58","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Cash-flow forecast"})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:60:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"60","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(ge,{type:"invoices",label:"Import invoices","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:61:10","data-matrix-name":"ImportData","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"61","data-component-file":"CashflowForecast.tsx","data-component-name":"ImportData","data-component-content":"%7B%22type%22%3A%22invoices%22%2C%22label%22%3A%22Import%20invoices%22%7D"}),a.jsx(ge,{type:"expenses",label:"Import expenses","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:62:10","data-matrix-name":"ImportData","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"62","data-component-file":"CashflowForecast.tsx","data-component-name":"ImportData","data-component-content":"%7B%22type%22%3A%22expenses%22%2C%22label%22%3A%22Import%20expenses%22%7D"})]})]}),a.jsx("p",{className:"text-[11px] text-text-subtle -mt-1","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:65:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"65","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20-mt-1%22%7D",children:"Import invoices & expenses, then forecast — the projection reads your real receivables and payables."}),a.jsxs("div",{className:"flex flex-wrap items-end gap-2","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:67:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"67","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-end%20gap-2%22%7D",children:[a.jsxs("div",{className:"flex-1 min-w-[160px]","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:68:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"68","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-1%20min-w-%5B160px%5D%22%7D",children:[a.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:69:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"69","data-component-file":"CashflowForecast.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20uppercase%20tracking-wide%20text-text-subtle%20mb-1%22%7D",children:"Current cash balance (₹)"}
1),a.jsx("input",{value:e,onChange:c=>u(c.target.value),placeholder:"e.g. 500000",inputMode:"numeric",className:"w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:70:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"70","data-component-file":"CashflowForecast.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22e.g.%20500000%22%2C%22inputMode%22%3A%22numeric%22%2C%22className%22%3A%22w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2.5%20py-1.5%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"})]}),a.jsxs("div",{className:"w-24","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:73:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"73","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-24%22%7D",children:[a.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:74:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"74","data-component-file":"CashflowForecast.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20uppercase%20tracking-wide%20text-text-subtle%20mb-1%22%7D",children:"Days"}),a.jsxs("select",{value:g,onChange:c=>p(c.target.value),className:"w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-2 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:75:10","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"75","data-component-file":"CashflowForecast.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2%20py-1.5%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D",children:[a.jsx("option",{value:"30","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:77:12","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"77","data-component-file":"CashflowForecast.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%2230%22%7D",children:"30"}),a.jsx("option",{value:"60","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:77:42","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"77","data-component-file":"CashflowForecast.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%2260%22%7D",children:"60"}),a.jsx("option",{value:"90","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:77:72","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"77","data-component-file":"CashflowForecast.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%2290%22%7D",children:"90"}),a.jsx("option",{value:"180","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:77:102","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"77","data-component-file":"CashflowForecast.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22180%22%7D",children:"180"})]})]}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:Ge,loading:s,onClick:A,"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:80:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"80","data-component-file":"CashflowForecast.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Forecast"})]}),x&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:82:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"82","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:x}),l&&a.jsxs("div",{className:"space-y-3 pt-2 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:85:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"85","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%20pt-2%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[l.runway_days!==null?a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-danger/30 bg-danger/5 p-2.5","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:88:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"88","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20rounded-lg%20border%20border-danger%2F30%20bg-danger%2F5%20p-2.5%22%7D",children:[a.jsx(W,{className:"w-4 h-4 text-danger flex-none mt-0.5","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:89:14","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"89","data-component-file":"CashflowForecast.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-danger%20flex-none%20mt-0.5%22%7D"}),a.jsxs("p",{className:"text-xs text-danger-bright","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:90:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"90","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger-bright%22%7D",children:[a.jsxs("strong",{"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:91:16","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"91","data-component-file":"CashflowForecast.tsx","data-component-name":"strong",children:["Runway: ",l.runway_days," days."]})," Cash goes negative around ",se(l.runway_date)," on this trajectory. Collect receivables faster or cut burn."]})]}):l.low_balance_alert.triggered?a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-warning-fill/30 bg-warning-fill/5 p-2.5","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:95:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"95","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20rounded-lg%20border%20border-warning-fill%2F30%20bg-warning-fill%2F5%20p-2.5%22%7D",children:[a.jsx(W,{className:"w-4 h-4 text-warning flex-none mt-0.5","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:96:14","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"96","data-component-file":"CashflowForecast.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning%20flex-none%20mt-0.5%22%7D"}),a.jsxs("p",{className:"text-xs text-warning-bright","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:97:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"97","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-warning-bright%22%7D",children:["Balance dips below a 30-day buffer (",na(l.low_balance_alert.threshold),") around ",l.low_balance_alert.first_breach_date?se(l.low_balance_alert.first_breach_date):"—",". Watch collections."]})]}):a.jsx("div",{className:"rounded-lg border border-success-fill/30 bg-success-fill/5 p-2.5","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:102:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"102","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-success-fill%2F30%20bg-success-fill%2F5%20p-2.5%22%7D",children:a.jsxs("p",{className:"text-xs text-success-bright","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:103:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"103","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-success-bright%22%7D",children:["Healthy: balance stays positive across the ",l.horizon_days,"-day horizon."]})}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:108:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"108","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20md%3Agrid-cols-4%20gap-2%22%7D",children:[{label:"Closing balance",value:l.closing_balance,accent:l.closing_balance>=0},{label:"Min balance",value:l.min_balance.amount,accent:l.min_balance.amount>=0},{label:"Total inflow",value:l.total_inflow},{label:"Avg daily burn",value:l.avg_daily_burn}].map(c=>a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] p-2.5","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:115:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"115","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%20p-2.5%22%7D",children:[a.jsx("p",{className:"text-[10px] text-text-subtle uppercase tracking-wide","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:116:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"116","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20uppercase%20tracking-wide%22%7D",children:c.label}),a.jsx("p",{className:`text-sm font-bold tabular-nums ${c.accent===!1?"text-danger":"text-white"}`,"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:117:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"117","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:na(c.value)})]},c.label))}),a.jsx("div",{className:"overflow-x-auto","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:123:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"123","data-component-file":"CashflowForecast.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22overflow-x-auto%22%7D",children:a.jsxs("table",{className:"w-full text-xs","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:124:12","data-matrix-name":"table","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"124","data-component-file":"CashflowForecast.tsx","data-component-name":"table","data-component-content":"%7B%22className%22%3A%22w-full%2
10text-xs%22%7D",children:[a.jsx("thead",{"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:125:14","data-matrix-name":"thead","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"125","data-component-file":"CashflowForecast.tsx","data-component-name":"thead",children:a.jsxs("tr",{className:"text-left text-text-subtle text-[10px] uppercase tracking-wide","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:126:16","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"126","data-component-file":"CashflowForecast.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22text-left%20text-text-subtle%20text-%5B10px%5D%20uppercase%20tracking-wide%22%7D",children:[a.jsx("th",{className:"py-1.5 pr-3","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:127:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"127","data-component-file":"CashflowForecast.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22py-1.5%20pr-3%22%7D",children:"Week of"}),a.jsx("th",{className:"pr-3 text-right","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:127:58","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"127","data-component-file":"CashflowForecast.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22pr-3%20text-right%22%7D",children:"In"}),a.jsx("th",{className:"pr-3 text-right","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:128:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"128","data-component-file":"CashflowForecast.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22pr-3%20text-right%22%7D",children:"Out"}),a.jsx("th",{className:"pr-3 text-right","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:128:58","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"128","data-component-file":"CashflowForecast.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22pr-3%20text-right%22%7D",children:"Net"}),a.jsx("th",{className:"text-right","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:128:98","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"128","data-component-file":"CashflowForecast.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22text-right%22%7D",children:"Balance"})]})}),a.jsx("tbody",{"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:131:14","data-matrix-name":"tbody","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"131","data-component-file":"CashflowForecast.tsx","data-component-name":"tbody",children:l.weeks.map((c,m)=>a.jsxs("tr",{className:"border-t border-white/[0.04] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:133:18","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"133","data-component-file":"CashflowForecast.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22border-t%20border-white%2F%5B0.04%5D%20text-text-soft%22%7D",children:[a.jsx("td",{className:"py-1.5 pr-3 text-white","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:134:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"134","data-component-file":"CashflowForecast.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20pr-3%20text-white%22%7D",children:se(c.week_start)}),a.jsx("td",{className:"pr-3 text-right tabular-nums text-success","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:135:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"135","data-component-file":"CashflowForecast.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22pr-3%20text-right%20tabular-nums%20text-success%22%7D",children:na(c.inflow)}),a.jsx("td",{className:"pr-3 text-right tabular-nums text-text-muted","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:136:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"136","data-component-file":"CashflowForecast.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22pr-3%20text-right%20tabular-nums%20text-text-muted%22%7D",children:na(c.outflow)}),a.jsx("td",{className:`pr-3 text-right tabular-nums ${c.net<0?"text-danger":"text-text-soft"}`,"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:137:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"137","data-component-file":"CashflowForecast.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:na(c.net)}),a.jsx("td",{className:`text-right tabular-nums font-semibold ${c.end_balance<0?"text-danger":"text-white"}`,"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:138:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"138","data-component-file":"CashflowForecast.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:na(c.end_balance)})]},m))})]})}),a.jsxs("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:146:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"146","data-component-file":"CashflowForecast.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:["From your data: ",na(l.inputs_summary.from_data.invoice_inflow)," invoices in, ",na(l.inputs_summary.from_data.expense_outflow)," expenses out. Assumed: ",na(l.inputs_summary.assumed.opening_balance)," opening",l.inputs_summary.assumed.recurring_out>0?`, ${na(l.inputs_summary.assumed.recurring_out)}/mo recurring out`:"","."]}),a.jsxs("details",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:150:10","data-matrix-name":"details","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"150","data-component-file":"CashflowForecast.tsx","data-component-name":"details","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:[a.jsx("summary",{className:"cursor-pointer hover:text-text-muted","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:151:12","data-matrix-name":"summary","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"151","data-component-file":"CashflowForecast.tsx","data-component-name":"summary","data-component-content":"%7B%22className%22%3A%22cursor-pointer%20hover%3Atext-text-muted%22%7D",children:"Assumptions"}),a.jsx("ul",{className:"mt-1.5 space-y-1 list-disc list-inside","data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:152:12","data-matrix-name":"ul","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"152","data-component-file":"CashflowForecast.tsx","data-component-name":"ul","data-component-content":"%7B%22className%22%3A%22mt-1.5%20space-y-1%20list-disc%20list-inside%22%7D",children:l.assumptions.map((c,m)=>a.jsx("li",{"data-matrix-id":"src/pages/dashboard/personas/CashflowForecast.tsx:152:101","data-matrix-name":"li","data-component-path":"src/pages/dashboard/personas/CashflowForecast.tsx","data-component-line":"152","data-component-file":"CashflowForecast.tsx","data-component-name":"li",children:c},m))})]})]})]})}const oe=()=>({open:!1,booking:!1,msg:null,err:null}),de=e=>`${e.currency||"INR"}
1 ${Number(e.amount).toLocaleString("en-IN")}`;function _t({onClose:e,onCreated:u}){const[g,p]=t.useState(""),[l,f]=t.useState(""),[s,n]=t.useState(""),[x,o]=t.useState(""),[A,c]=t.useState(!1),[m,v]=t.useState(null),N=async()=>{if(!g.trim()){v("Claimant name is required.");return}const E=Number(l);if(!Number.isFinite(E)||E<=0){v("Enter a valid amount.");return}c(!0),v(null);try{const O=await S("/hubs/finance/expenses",{method:"POST",body:JSON.stringify({claimant_name:g.trim(),amount:E,category:s.trim()||void 0,description:x.trim()||void 0})});O.success?(u(),e()):v(O.error||"Could not create the claim.")}catch{v("Could not create the claim.")}finally{c(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:e,"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:67:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"67","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22fixed%20inset-0%20z-50%20flex%20items-center%20justify-center%20bg-black%2F60%20backdrop-blur-sm%20p-4%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("div",{className:"w-full max-w-md bg-surface border border-white/[0.08] rounded-2xl shadow-2xl",onClick:E=>E.stopPropagation(),"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:68:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"68","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-full%20max-w-md%20bg-surface%20border%20border-white%2F%5B0.08%5D%20rounded-2xl%20shadow-2xl%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:69:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"69","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20px-5%20py-4%20border-b%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:70:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"70","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"New expense claim"}),a.jsx("button",{onClick:e,className:"p-1.5 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","aria-label":"Close",title:"Close","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:71:10","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"71","data-component-file":"ExpensesQueue.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%2C%22title%22%3A%22Close%22%7D",children:a.jsx(oa,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:71:154","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"71","data-component-file":"ExpensesQueue.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"})})]}),a.jsxs("div",{className:"p-5 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:73:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"73","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22p-5%20space-y-3%22%7D",children:[a.jsx("input",{value:g,onChange:E=>p(E.target.value),placeholder:"Claimant name (e.g. Ramesh K.)",className:"w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:74:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"74","data-component-file":"ExpensesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Claimant%20name%20(e.g.%20Ramesh%20K.)%22%2C%22className%22%3A%22w-full%2
10bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:76:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"76","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:l,onChange:E=>f(E.target.value),placeholder:"Amount (₹)",inputMode:"decimal",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:77:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"77","data-component-file":"ExpensesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Amount%20(%E2%82%B9)%22%2C%22inputMode%22%3A%22decimal%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("input",{value:s,onChange:E=>n(E.target.value),placeholder:"Category (optional)",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:79:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"79","data-component-file":"ExpensesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Category%20(optional)%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"})]}),a.jsx("textarea",{value:x,onChange:E=>o(E.target.value),placeholder:"What was it for? (optional)",rows:3,className:"w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16] resize-y","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:82:10","data-matrix-name":"textarea","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"82","data-component-file":"ExpensesQueue.tsx","data-component-name":"textarea","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22What%20was%20it%20for%3F%20(optional)%22%2C%22rows%22%3A3%2C%22className%22%3A%22w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%20resize-y%22%7D"}),m&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:84:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"84","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:m}),a.jsxs("div",{className:"flex items-center gap-2 pt-1","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:85:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"85","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20pt-1%22%7D",children:[a.jsx(j,{size:"sm",variant:"primary",loading:A,onClick:N,"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:86:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"86","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Submit claim"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:e,"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:87:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"87","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})]})})}function Ot(){const{user:e}=Et(),[u,g]=t.useState([]),[p,l]=t.useState(!1),[f,s]=t.useState(!1),[n,x]=t.useState(!1),[o,A]=t.useState(null),[c,m]=t.useState(null),[v,N]=t.useState(null),[E,O]=t.useState({}),[D,Q]=t.useState(!1),[r,h]=t.useState({}),B=(b,F)=>h(I=>({...I,[b]:{...I[b]||oe(),...F}})),w=b=>h(F=>{var I;return{...F,[b]:{...F[b]||oe(),open:!((I=F[b])!=null&&I.open)}}}),_=async()=>
1{l(!0),A(null);try{const b=await S("/hubs/finance/expenses?limit=100");b.success&&Array.isArray(b.data)?g(b.data):A(b.error||"Could not load expense claims")}catch{A("Could not load expense claims.")}finally{l(!1)}},i=async()=>{var b;x(!0),A(null),m(null);try{const F=await S("/hubs/finance/expenses",{method:"POST",body:JSON.stringify({claimant_name:((b=e==null?void 0:e.email)==null?void 0:b.split("@")[0])||"Sample Employee",amount:1450,category:"meals",description:"[Sample] Client lunch — Taj, Mumbai",expense_date:new Date().toISOString().slice(0,10)})});F.success?(m("Sample claim created and auto-categorised. Approve it in Human Review to book it."),await _()):A(F.error||"Could not create the sample claim.")}catch{A("Could not create the sample claim.")}finally{x(!1)}};t.useEffect(()=>{_()},[]);const d=async()=>{s(!0),m(null),A(null);try{const b=await S("/hubs/finance/expenses/process-all",{method:"POST"});b.success&&b.data?(m(b.data.total?`Processed ${b.data.processed} of ${b.data.total} claim(s); ${b.data.queued} queued for approval.`:"All claims already processed."),await _()):A(b.error||"Processing failed")}catch{A("Could not process claims.")}finally{s(!1)}},P=async b=>{if(!b.ai_approval_id){B(b.id,{err:"Process the claim first."});return}B(b.id,{booking:!0,err:null,msg:null});try{const F=await S(`/hubs/finance/expenses/${b.id}/book`,{method:"POST",body:JSON.stringify({approval_id:b.ai_approval_id})});F.success&&F.data?(B(b.id,{booking:!1,msg:`Booked via ${F.data.channel}${F.data.ref?` (ref ${F.data.ref})`:""}.`}),await _()):B(b.id,{booking:!1,err:F.error||"Could not book the expense."})}catch{B(b.id,{booking:!1,err:"Could not book the expense."})}},C=u.filter(b=>b.status==="pending"&&(!b.ai_triaged_at||!b.ai_approval_id)&&!b.booked_at).length,y=[...u].sort((b,F)=>Number(F.amount)-Number(b.amount));return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:173:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"173","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:174:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"174","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:175:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"175","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(Be,{className:"w-4 h-4 text-success","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:176:10","data-matrix-name":"Receipt","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"176","data-component-file":"ExpensesQueue.tsx","data-component-name":"Receipt","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-success%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:177:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"177","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Expense claims"})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:179:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"179","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"secondary",leftIcon:X,onClick:()=>Q(!0),"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:180:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"180","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"New claim"}),a.jsx(j,{size:"sm",variant:"secondary",leftIcon:H,loading:p,onClick:_,"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:181:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"181","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]})]}),D&&a.jsx(_t,{onClose:()=>Q(!1),onCreated:()=>void _(),"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:185:18","data-matrix-name":"NewExpenseModal","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"185","data-component-file":"ExpensesQueue.tsx","data-component-name":"NewExpenseModal","data-component-content":"%7B%22onClose%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onCreated%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),o&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:186:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"186","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:o}),!o&&u.length===0&&!p&&a.jsxs("div",{className:"rounded-lg border border-dashed border-white/[0.12] bg-white/[0.02] p-4 text-center space-y-2","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:189:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"189","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-dashed%20border-white%2F%5B0.12%5D%20bg-white%2F%5B0.02%5D%20p-4%20text-center%20space-y-2%22%7D",children:[a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:190:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"190","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"No expense claims yet."}),a.jsx("p",{className:"text-[11px] text-text-subtle max-w-md mx-auto","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:191:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"191","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20max-w-md%20mx-auto%22%7D",children:"See it in under a minute: create one sample claim — the agent categorises and policy-checks it, you approve in Human Review, and it books."}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:Na,loading:n,onClick:i,"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:192:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"192","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Try it with a sample claim"}),a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:193:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"193","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:"A real claim through the real pipeline — pre-filled and tagged “sample.”"})]}),u.length>0&&a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:198:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"198","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-4 text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:199:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"199","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-4%20text-%5B11px%5D%20text-text-muted%22%7D",children:[a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:200:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"200","data-component-file":"ExpensesQueue.tsx","data-component-name":"span",children:["Total: ",a.jsx("strong",{className:"text-white","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:200:25","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"200","data-component-file":"ExpensesQueue.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22text-white%22%7D",children:u.length})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:201:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"201","data-component-file":"ExpensesQueue.tsx","data-component-name":"span",children:["Unprocessed: ",a.jsx("strong",{className:C?"text-warning":"text-success","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:201:31","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"201","data-component-file":"ExpensesQueue.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:C})]}),C>0&&a.jsx(j,{size:"sm",variant:"primary",leftIcon:Na,loading:f,onClick:d,className:"ml-auto","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:203:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"203","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22ml-auto%22%7D",children:"Process all"})]}),c&&a.jsx("p",{className:"text-xs text-success","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:208:19","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"208","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-success%22%7D",children:c}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:210:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"210","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:y.slice(0,8).map(b=>{var R;const F=r[b.id]||oe(),I=!!b.booked_at,L=Array.isArray(b.ai_flags)?b.ai_flags:[];return a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02]","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:216:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"216","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%22%7D",children:[a.jsxs("button",{onClick:()=>w(b.id),className:"w-full flex items-center justify-between p-2 text-left hover:bg-white/[0.02] transition-colors","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:217:18","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"217","data-component-file":"ExpensesQueue.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22w-full%2
10flex%20items-center%20justify-between%20p-2%20text-left%20hover%3Abg-white%2F%5B0.02%5D%20transition-colors%22%7D",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:218:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"218","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(He,{className:`w-3.5 h-3.5 text-text-subtle transition-transform ${F.open?"rotate-90":""}`,"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:219:22","data-matrix-name":"ChevronRight","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"219","data-component-file":"ExpensesQueue.tsx","data-component-name":"ChevronRight","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:220:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"220","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-xs text-white truncate","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:221:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"221","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%20truncate%22%7D",children:[b.claimant_name," · ",de(b)]}),a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:222:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"222","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:b.ai_category||b.category||"uncategorised"})]})]}),a.jsx("div",{className:"flex items-center gap-2 flex-none ml-2","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:225:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"225","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20flex-none%20ml-2%22%7D",children:b.status==="reimbursed"?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-success","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:227:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"227","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-success%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:227:100","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"227","data-component-file":"ExpensesQueue.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," reimbursed"]}):I?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:229:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"229","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-accent-bright%22%7D",children:[a.jsx(ma,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:229:106","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"229","data-component-file":"ExpensesQueue.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})," owed to ",((R=b.claimant_name)==null?void 0:R.split(" ")[0])||"them"]}):b.ai_approval_id?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-warning","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:231:28","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"231","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-warning%22%7D",children:[a.jsx(ma,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:231:102","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"231","data-component-file":"ExpensesQueue.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})," awaiting approval"]}):b.ai_triaged_at?a.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:233:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"233","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-text-muted%22%7D",children:"processed"}):a.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:234:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"234","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-text-muted%22%7D",children:"new"})})]}),F.open&&a.jsxs("div",{className:"border-t border-white/[0.06] p-2.5 space-y-2","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:239:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"239","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22border-t%20border-white%2F%5B0.06%5D%20p-2.5%20sp
1ace-y-2%22%7D",children:[a.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:240:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"240","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20gap-x-4%20gap-y-1%20text-%5B10px%5D%20text-text-subtle%22%7D",children:[a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:241:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"241","data-component-file":"ExpensesQueue.tsx","data-component-name":"span",children:["Claimant: ",a.jsx("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:241:40","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"241","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:b.claimant_name})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:242:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"242","data-component-file":"ExpensesQueue.tsx","data-component-name":"span",children:["Amount: ",a.jsx("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:242:38","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"242","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:de(b)})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:243:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"243","data-component-file":"ExpensesQueue.tsx","data-component-name":"span",children:["Category: ",a.jsx("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:243:40","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"243","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:b.ai_category||b.category||"—"})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:244:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"244","data-component-file":"ExpensesQueue.tsx","data-component-name":"span",children:["Date: ",a.jsx("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:244:36","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"244","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:b.expense_date||"—"})]}),b.ai_policy_compliant!=null&&a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:246:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"246","data-component-file":"ExpensesQueue.tsx","data-component-name":"span",children:["Policy: ",a.jsx("span",{className:b.ai_policy_compliant?"text-success":"text-warning","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:246:40","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"246","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:b.ai_policy_compliant?"compliant":"flagged"})]})]}),b.description&&a.jsx("p",{className:"text-xs text-text-soft whitespace-pre-wrap","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:249:40","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"249","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-soft%20whitespace-pre-wrap%22%7D",children:b.description}),I&&b.status!=="reimbursed"&&a.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] p-2.5","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:255:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"255","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-2.5%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:256:26","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"256","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%22%7D",children:["You owe ",b.claimant_name," ",de(b),". Record it once you have actually paid them — Zapheit does not move the money."]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:260:26","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"260","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-2%20mt-2%22%7D",children:[a.jsx("input",{value:E[b.id]||"",onChange:$=>O(G=>({...G,[b.id]:$.target.value})),placeholder:"UTR or cheque no. (optional)",className:"flex-1 min-w-[180px] bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-[11px] text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:261:28","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"261","data-component-file":"ExpensesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BLogicalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22UTR%20or%20cheque%20no.%20(optional)%22%2C%22className%22%3A%22flex-1%20min-w-%5B180px%5D%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
1nded-lg%20px-2.5%20py-1.5%20text-%5B11px%5D%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"secondary",loading:v===b.id,onClick:async()=>{N(b.id);try{const $=await S(`/hubs/finance/expenses/${b.id}/reimburse`,{method:"POST",body:JSON.stringify({reference:(E[b.id]||"").trim()||void 0})});$.success?(m(`Reimbursement recorded for ${b.claimant_name}.`),await _()):A($.error||"Could not record the reimbursement.")}catch{A("Could not record the reimbursement.")}finally{N(null)}},"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:267:28","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"267","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Mark reimbursed"})]})]}),L.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:288:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"288","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20gap-1.5%22%7D",children:L.map(($,G)=>a.jsxs("span",{className:"text-[10px] text-warning-bright bg-amber-400/10 border border-amber-400/20 rounded px-1.5 py-0.5","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:290:28","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"290","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-warning-bright%20bg-amber-400%2F10%20border%20border-amber-400%2F20%20rounded%20px-1.5%20py-0.5%22%7D",children:[$.type||"flag",$.detail?`: ${$.detail}`:""]},G))}),I?a.jsxs("p",{className:"inline-flex items-center gap-1 text-[11px] text-success","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:296:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"296","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B11px%5D%20text-success%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:296:95","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"296","data-component-file":"ExpensesQueue.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Approved & booked via ",b.book_channel,"."]}):a.jsxs(a.Fragment,{children:[b.ai_approval_id&&a.jsxs("p",{className:"inline-flex items-center gap-1 text-[10px] text-warning","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:300:28","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"300","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-warning%22%7D",children:[a.jsx(ma,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:300:99","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"300","data-component-file":"ExpensesQueue.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})," Queued — approve in ",a.jsx("span",{className:"font-semibold","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:300:149","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"300","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-semibold%22%7D",children:"Human Review"})," and it books automatically."]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:302:26","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"302","data-component-file":"ExpensesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20flex-wrap%22%7D",children:[a.jsx(j,{size:"sm",variant:"primary",leftIcon:qe,loading:F.booking,disabled:!b.ai_approval_id,onClick:()=>P(b),"data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:303:28","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"303","data-component-file":"ExpensesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BMemberExpression%5D%22%2C%22disabled%22%3A%22%5BUnaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Approve & book"}),b.ai_approval_id&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-warning","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:307:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"307","data-component-file":"ExpensesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-warning%22%7D",children:[a.jsx(ma,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:307:104","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"307","data-component-file":"ExpensesQueue.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})," approve in Human Review first"]})]}),F.msg&&a.jsx("p",{className:"text-[11px] text-success","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:310:37","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"310","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-success%22%7D",children:F.msg}),F.err&&a.jsx("p",{className:"text-[11px] text-danger","data-matrix-id":"src/pages/dashboard/personas/ExpensesQueue.tsx:311:37","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ExpensesQueue.tsx","data-component-line":"311","data-component-file":"ExpensesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger%22%7D",children:F.err})]})]})]},b.id)})})]})]})}const Ce={issued:"bg-warning-fill/15 text-warning-bright",paid:"bg-success-fill/15 text-success-bright",void:"bg-slate-500/15 text-text-muted"};function Lt(e){return Math.max(0,Math.floor((Date.now()-new Date(`${e}T00:00:00Z`).getTime())/864e5))}function Qt(){const[e,u]=t.useState([]),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState(!1),[x,o]=t.useState(!1),[A,c]=t.useState(null),[m,v]=t.useState(null),[N,E]=t.useState({customer_name:"",customer_email:"",invoice_number:"",amount:"",due_date:""}),O=t.useCallback(async()=>{p(!0);const i=await S("/receivables?limit=100");i.success&&Array.isArray(i.data)&&u(i.data),p(!1)},[]);t.useEffect(()=>{O()},[O]);const[D,Q]=t.useState(!1),r=async()=>{Q(!0);const i=await S("/receivables/sync-tally",{method:"POST",body:JSON.stringify({})});i.success?k.success("Asked Tally for outstanding bills — they appear here once the Bridge responds (~10s when online)."):k.error(i.error||"Could not request the Tally sync."),Q(!1),setTimeout(()=>{O()},12e3)},h=async()=>{f(!0);const i=await S("/receivables/seed-sample",{method:"POST",body:JSON.stringify({})});i.success?(k.success("Sample created — the agent is drafting the reminder. Approve it in Human Review."),await O()):k.error(i.error||"Could not create the sample."),f(!1)},B=async()=>
1{if(!N.customer_name||!N.amount||!N.due_date){k.error("Customer, amount and due date are required.");return}o(!0);const i=await S("/receivables",{method:"POST",body:JSON.stringify({...N,amount:Number(N.amount)})});i.success?(k.success("Receivable added. Overdue invoices get a drafted reminder automatically."),n(!1),E({customer_name:"",customer_email:"",invoice_number:"",amount:"",due_date:""}),await O()):k.error(i.error||"Could not add the receivable."),o(!1)},w=async i=>{c(i);const d=await S(`/receivables/${i}/process`,{method:"POST",body:JSON.stringify({})});d.success?(k.success("Reminder drafted — waiting for your approval in Human Review."),await O()):k.error(d.error||"Could not draft the reminder."),c(null)},_=async i=>{v(i);const d=await S(`/receivables/${i}/mark-paid`,{method:"POST",body:JSON.stringify({})});d.success?(k.success("Marked paid — posted to the ledger."),await O()):k.error(d.error||"Could not mark this receivable paid."),v(null)};return a.jsxs("div",{className:"rounded-2xl border border-white/[0.06] bg-surface/60 p-5","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:110:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"110","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-2xl%20border%20border-white%2F%5B0.06%5D%20bg-surface%2F60%20p-5%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:111:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"111","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20gap-3%20mb-3%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:112:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"112","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:113:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"113","data-component-file":"ReceivablesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Ge,{className:"h-4 w-4 text-success","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:113:82","data-matrix-name":"IndianRupee","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"113","data-component-file":"ReceivablesQueue.tsx","data-component-name":"IndianRupee","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-success%22%7D"})," Receivables chase"]}),a.jsx("p",{className:"mt-0.5 text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:114:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"114","data-component-file":"ReceivablesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-0.5%20text-%5B11px%5D%20text-text-subtle%22%7D",children:"Overdue invoices get an agent-drafted reminder. You approve; it goes out by email/WhatsApp."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:116:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"116","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:O,"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:117:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"117","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),a.jsx(j,{size:"sm",variant:"secondary",loading:D,onClick:r,"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:118:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"118","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Sync from Tally"}),e.length===0&&!g&&a.jsx(j,{size:"sm",variant:"secondary",leftIcon:Na,loading:l,onClick:h,"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:120:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"120","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Try with a sample"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:X,onClick:()=>n(i=>!i),"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:122:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"122","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"New receivable"})]})]}),s&&a.jsxs("div",{className:"mb-4 grid gap-2 rounded-xl border border-success-fill/20 bg-success-fill/[0.04] p-3 sm:grid-cols-2","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:127:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"127","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mb-4%20grid%20gap-2%20rounded-xl%20border%20border-success-fill%2F20%20bg-success-fill%2F%5B0.04%5D%20p-3%20sm%3Agrid-cols-2%22%7D",children:[a.jsx("input",{value:N.customer_name,onChange:i=>E({...N,customer_name:i.target.value}),placeholder:"Customer name *",className:"rounded-lg border border-white/10 bg-surface px-3 py-2 text-xs text-text-bright placeholder:text-text-faint focus:outline-none focus:border-success-fill/50","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:128:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"128","data-component-file":"ReceivablesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Customer%20name%20*%22%2C%22className%22%3A%22rounded-lg%20border%20border-white%2F10%20bg-surface%20px-3%20py-2%20text-xs%20text-text-bright%20placeholder%3Atext-text-faint%20focus%3Aoutline-none%20focus%3Aborder-success-fill%2F50%22%7D"}),a.jsx("input",{value:N.customer_email,onChange:i=>E({...N,customer_email:i.target.value}),placeholder:"Customer email (for the reminder)",className:"rounded-lg border border-white/10 bg-surface px-3 py-2 text-xs text-text-bright placeholder:text-text-faint focus:outline-none focus:border-success-fill/50","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:129:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"129","data-component-file":"ReceivablesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Customer%20email%20(for%20the%20reminder)%22%2C%22className%22%3A%22rounded-lg%20border%20border-white%2F10%20bg-surface%20px-3%20py-2%20text-xs%20text-text-bright%20placeholder%3Atext-text-faint%20focus%3Aoutline-none%20focus%3Aborder-success-fill%2F50%22%7D"}),a.jsx("input",{value:N.invoice_number,onChange:i=>E({...N,invoice_number:i.target.value}),placeholder:"Invoice no.",className:"rounded-lg border border-white/10 bg-surface px-3 py-2 text-xs text-text-bright placeholder:text-text-faint focus:outline-none focus:border-success-fill/50","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:130:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"130","data-component-file":"ReceivablesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Invoice%20no.%22%2C%22className%22%3A%22rounded-lg%20border%20border-white%2F10%20bg-surface%20px-3%20py-2%20text-xs%20text-text-bright%20placeholder%3Atext-text-faint%20focus%3Aoutline-none%20focus%3Aborder-success-fill%2F50%22%7D"}),a.jsx("input",{value:N.amount,onChange:i=>E({...N,amount:i.target.value}),placeholder:"Amount (₹) *",inputMode:"decimal",className:"rounded-lg border border-white/10 bg-surface px-3 py-2 text-xs text-text-bright placeholder:text-text-faint focus:outline-none focus:border-success-fill/50","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:131:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"131","data-component-file":"ReceivablesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Amount%20(%E2%82%B9)%20*%22%2C%22inputMode%22%3A%22decimal%22%2C%22className%22%3A%22rounded-lg%20border%20border-white%2F10%20bg-surface%20px-3%20py-2%20text-xs%20text-text-bright%20placeholder%3Atext-text-faint%20focus%3Aoutline-none%20focus%3Aborder-success-fill%2F50%22%7D"}),a.jsx("input",{value:N.due_date,onChange:i=>E({...N,due_date:i.target.value}),type:"date",className:"rounded-lg border border-white/10 bg-surface px-3 py-2 text-xs text-text-bright focus:outline-none focus:border-success-fill/50","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:132:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"132","data-component-file":"ReceivablesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22type%22%3A%22date%22%2C%22className%22%3A%22rounded-lg%20border%20border-white%2F10%20bg-surface%20px-3%20py-2%20text-xs%20text-text-bright%20focus%3Aoutline-none%20focus%3Aborder-success-fill%2F50%22%7D"}),a.jsxs("div",{className:"flex items-center justify-end gap-2","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:133:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"133","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-end%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>n(!1),"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:134:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"134","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"}),a.jsx(j,{size:"sm",variant:"primary",loading:x,onClick:B,"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:135:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"135","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Add"})]})]}),g&&e.length===0&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:140:39","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"140","data-component-file":"ReceivablesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Loading…"}),!g&&e.length===0&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:142:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"142","data-component-file":"ReceivablesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"No receivables yet. Add the invoices you're owed (or try the sample) and the agent chases the overdue ones — with your sign-off on every message."}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:145:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"145","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:e.map(i=>{const d=Lt(i.due_date),P=i.status==="issued",C=P&&i.reminder_count>0,y=i.status==="issued",b=C?"reminded":i.status;return a.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-white/[0.04] bg-white/[0.02] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:153:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"153","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-3%20rounded-lg%20border%20border-white%2F%5B0.04%5D%20bg-white%2F%5B0.02%5D%20px-3%20py-2%22%7D",children:[a.jsx("span",{className:`inline-flex rounded-md px-1.5 py-0.5 text-[10px] font-medium ${C?"bg-info-fill/15 text-info-bright":Ce[i.status]||Ce.issued}`,"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:154:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"154","data-component-file":"ReceivablesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:b}),a.jsxs("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:155:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"155","data-component-file":"ReceivablesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:[a.jsxs("p",{className:"truncate text-xs text-text-bright",
1"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:156:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"156","data-component-file":"ReceivablesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22truncate%20text-xs%20text-text-bright%22%7D",children:[i.customer_name,i.invoice_number&&a.jsxs("span",{className:"text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:158:39","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"158","data-component-file":"ReceivablesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%22%7D",children:[" · ",i.invoice_number]}),i.source==="sample"&&a.jsx("span",{className:"ml-1 rounded bg-white/[0.06] px-1 text-[9px] uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:159:44","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"159","data-component-file":"ReceivablesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-1%20rounded%20bg-white%2F%5B0.06%5D%20px-1%20text-%5B9px%5D%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:"sample"})]}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:161:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"161","data-component-file":"ReceivablesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["₹",Number(i.total_amount).toLocaleString("en-IN")," · due ",i.due_date,d>0&&i.status!=="paid"&&a.jsxs("span",{className:"text-warning","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:163:52","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"163","data-component-file":"ReceivablesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-warning%22%7D",children:[" · ",d,"d overdue"]}),i.reminder_count>0&&a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:164:43","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"164","data-component-file":"ReceivablesQueue.tsx","data-component-name":"span",children:[" · ",i.reminder_count," reminder",i.reminder_count!==1?"s":""," sent"]})]})]}),P&&i.ai_approval_id&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-violet-300","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:168:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"168","data-component-file":"ReceivablesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-violet-300%22%7D",children:[a.jsx(ma,{className:"h-3 w-3","data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:168:93","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"168","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22h-3%20w-3%22%7D"})," awaiting your approval"]}),P&&!i.ai_approval_id&&a.jsx(j,{size:"sm",variant:"ghost",leftIcon:Da,loading:A===i.id,onClick:()=>w(i.id),"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:171:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"171","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Draft reminder"}),y&&a.jsx(j,{size:"sm",variant:"secondary",leftIcon:Z,loading:m===i.id,onClick:()=>_(i.id),"data-matrix-id":"src/pages/dashboard/personas/ReceivablesQueue.tsx:174:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ReceivablesQueue.tsx","data-component-line":"174","data-component-file":"ReceivablesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Mark paid"})]},i.id)})})]})}const Ca="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2 py-1.5 text-[11px] text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]",Sa=(e,u="INR")=>new Intl.NumberFormat("en-IN",{style:"currency",currency:u,maximumFractionDigits:0}).format(e),Tt=()=>new Date().toISOString().slice(0,10);function $t({onClose:e,onCreated:u}){const[g,p]=t.useState(""),[l,f]=t.useState(""),[s,n]=t.useState(""),[x,o]=t.useState(Tt()),[A,c]=t.useState(""),[m,v]=t.useState(""),[N,E]=t.useState(!1),[O,D]=t.useState(null),[Q,r]=t.useState([]),[h,B]=t.useState(!1),[w,_]=t.useState([{item_id:"",description:"",quantity:"1",rate:"",gst_rate:"18"}
1]);t.useEffect(()=>{(async()=>{const F=await S("/finance-items?limit=200");F.success&&F.data&&r(F.data.filter(I=>I.track_inventory))})()},[]);const i=(F,I)=>_(L=>L.map((R,$)=>$===F?{...R,...I}:R)),d=(F,I)=>{const L=Q.find(R=>R.id===I);if(!L){i(F,{item_id:""});return}i(F,{item_id:I,description:L.name,rate:L.purchase_rate!=null?String(L.purchase_rate):"",gst_rate:String(L.gst_rate)})},P=w.reduce((F,I)=>F+(Number(I.quantity)||0)*(Number(I.rate)||0),0),C=Number(s)||0,y=w.reduce((F,I)=>{const L=(Number(I.quantity)||0)*(Number(I.rate)||0),R=Math.round(L*((Number(I.gst_rate)||0)/100)*100)/100;return{taxable:Math.round((F.taxable+L)*100)/100,cgst:Math.round((F.cgst+R/2)*100)/100,sgst:Math.round((F.sgst+R/2)*100)/100}},{taxable:0,cgst:0,sgst:0}),b=async()=>{const F=Number(s);if(!g.trim()||!Number.isFinite(F)||F<=0){D("Vendor and a positive amount are required.");return}E(!0),D(null);try{const I=await S("/hubs/finance/invoices",{method:"POST",body:JSON.stringify({vendor_name:g.trim(),invoice_number:l.trim()||void 0,amount:F,issued_date:x||void 0,due_date:A||void 0,po_number:m.trim()||void 0,...h&&y.taxable>0?{taxable_value:y.taxable,cgst:y.cgst,sgst:y.sgst,igst:0}:{},line_items:h?w.filter(L=>L.item_id&&Number(L.quantity)>0).map(L=>{const R=(Number(L.quantity)||0)*(Number(L.rate)||0),$=Number(L.gst_rate)||0,G=Math.round(R*($/100)*100)/100;return{description:L.description.trim()||"Item",item_id:L.item_id,quantity:Number(L.quantity),rate:Number(L.rate)||0,gst_rate:$,cgst:Math.round(G/2*100)/100,sgst:Math.round(G/2*100)/100,igst:0}}):void 0})});I.success?(u(),e()):D(I.error||"Could not create the invoice.")}catch{D("Could not create the invoice.")}finally{E(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:e,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:134:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"134","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22fixed%20inset-0%20z-50%20flex%20items-center%20justify-center%20bg-black%2F60%20backdrop-blur-sm%20p-4%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("div",{className:"w-full max-w-md bg-surface border border-white/[0.08] rounded-2xl shadow-2xl",onClick:F=>F.stopPropagation(),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:135:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"135","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-full%20max-w-md%20bg-surface%20border%20border-white%2F%5B0.08%5D%20rounded-2xl%20shadow-2xl%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:136:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"136","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20px-5%20py-4%20border-b%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:137:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"137","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Record a supplier bill"}),a.jsx("button",{onClick:e,className:"p-1.5 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","aria-label":"Close",title:"Close","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:138:10","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"138","data-component-file":"InvoicesQueue.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%2C%22title%22%3A%22Close%22%7D",children:a.jsx(oa,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:138:154","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"138","data-component-file":"InvoicesQueue.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"})})]}),a.jsxs("div",{className:"p-5 space-y-3","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:140:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"140","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22p-5%20space-y-3%22%7D",children:[a.jsx("input",{value:g,onChange:F=>p(F.target.value),placeholder:"Vendor / dealer name",className:"w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:141:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"141","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Vendor%20%2F%20dealer%20name%22%2C%22className%22%3A%22w-full%2
10bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:142:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"142","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:l,onChange:F=>f(F.target.value),placeholder:"Invoice #",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:143:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"143","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Invoice%20%23%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("input",{value:s,onChange:F=>n(F.target.value),placeholder:"Amount (₹)",inputMode:"decimal",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:144:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"144","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Amount%20(%E2%82%B9)%22%2C%22inputMode%22%3A%22decimal%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:146:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"146","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-2%22%7D",children:[a.jsxs("label",{className:"text-[10px] text-text-subtle -mb-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:147:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"147","data-component-file":"InvoicesQueue.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20-mb-1.5%22%7D",children:["Invoice date",a.jsx("input",{type:"date",value:x,onChange:F=>o(F.target.value),className:"mt-1 w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-2 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:149:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"149","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22mt-1%20w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2.5%20py-2%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle -mb-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:151:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"151","data-component-file":"InvoicesQueue.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20-mb-1.5%22%7D",children:["Due date (optional)",a.jsx("input",{type:"date",value:A,onChange:F=>c(F.target.value),className:"mt-1 w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-2 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:153:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"153","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22mt-1%20w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
1nded-lg%20px-2.5%20py-2%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"})]})]}),a.jsx("input",{value:m,onChange:F=>v(F.target.value),placeholder:"PO number (optional)",className:"w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:156:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"156","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22PO%20number%20(optional)%22%2C%22className%22%3A%22w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),Q.length>0&&a.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] p-3","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:161:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"161","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-3%22%7D",children:[a.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:162:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"162","data-component-file":"InvoicesQueue.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2.5%20cursor-pointer%22%7D",children:[a.jsx("input",{type:"checkbox",checked:h,onChange:F=>B(F.target.checked),className:"mt-0.5 accent-accent","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:163:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"163","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22mt-0.5%20accent-accent%22%7D"}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:164:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"164","data-component-file":"InvoicesQueue.tsx","data-component-name":"span",children:[a.jsx("span",{className:"text-xs text-white","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:165:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"165","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%22%7D",children:"This bill includes stock"}),a.jsx("span",{className:"block text-[11px] text-text-subtle mt-0.5 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:166:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"166","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22block%20text-%5B11px%5D%20text-text-subtle%20mt-0.5%20leading-relaxed%22%7D",children:"Say what arrived and it becomes an asset instead of an expense — and its real cost is charged when you sell it. Leave this off for anything you buy and use up."})]})]}),h&&a.jsxs("div",{className:"mt-3 space-y-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:174:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"174","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20space-y-2%22%7D",children:[w.map((F,I)=>a.jsxs("div",{className:"grid grid-cols-12 gap-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:176:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"176","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-12%20gap-1.5%22%7D",children:[a.jsxs("select",{value:F.item_id,onChange:L=>d(I,L.target.value),className:"col-span-5 bg-white/[0.04] border border-white/[0.08] rounded-lg px-2 py-1.5 text-[11px] text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:177:22","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"177","data-component-file":"InvoicesQueue.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22col-span-5%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
1nded-lg%20px-2%20py-1.5%20text-%5B11px%5D%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:179:24","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"179","data-component-file":"InvoicesQueue.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Choose an item…"}),Q.map(L=>a.jsx("option",{value:L.id,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:180:43","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"180","data-component-file":"InvoicesQueue.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:L.name},L.id))]}),a.jsx("input",{value:F.quantity,onChange:L=>i(I,{quantity:L.target.value}),inputMode:"decimal",placeholder:"Qty",className:"col-span-3 bg-white/[0.04] border border-white/[0.08] rounded-lg px-2 py-1.5 text-[11px] text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:182:22","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"182","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Qty%22%2C%22className%22%3A%22col-span-3%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2%20py-1.5%20text-%5B11px%5D%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("input",{value:F.rate,onChange:L=>i(I,{rate:L.target.value}),inputMode:"decimal",placeholder:"Cost each",className:"col-span-3 bg-white/[0.04] border border-white/[0.08] rounded-lg px-2 py-1.5 text-[11px] text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:184:22","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"184","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Cost%20each%22%2C%22className%22%3A%22col-span-3%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2%20py-1.5%20text-%5B11px%5D%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("button",{onClick:()=>_(L=>L.length>1?L.filter((R,$)=>$!==I):L),className:"col-span-1 text-text-faint hover:text-danger text-xs","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:186:22","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"186","data-component-file":"InvoicesQueue.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22col-span-1%20text-text-faint%20hover%3Atext-danger%20text-xs%22%7D",children:"×"})]},I)),a.jsx("button",{onClick:()=>_(F=>[...F,{item_id:"",description:"",quantity:"1",rate:"",gst_rate:"18"}]),className:"text-[11px] text-text-muted hover:text-white","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:190:18","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"190","data-component-file":"InvoicesQueue.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20hover%3Atext-white%22%7D",children:"+ Another item"}),P>0&&(()=>{const F=Math.round((P+y.cgst+y.sgst)*100)/100,I=F>C+.005;return a.jsxs("p",{className:`text-[10px] leading-relaxed ${I?"text-danger":"text-text-subtle"}`,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:201:22","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"201","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:["These lines come to ",Sa(P)," plus ",Sa(y.cgst+y.sgst)," GST = ",Sa(F),"."," ",I?"That is more than the bill itself — correct the lines or the amount, or it will be refused.":F<C-.005?`The other ${Sa(C-F)} will be booked as an expense — freight, insurance or anything not itemised.`:"That is the whole bill."]})})()]})]}),O&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:216:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"216","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:O}),a.jsxs("div",{className:"flex items-center gap-2 pt-1","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:217:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"217","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20pt-1%22%7D",children:[a.jsx(j,{size:"sm",variant:"primary",loading:N,onClick:b,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:218:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"218","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Add invoice"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:e,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:219:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"219","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})]})})}function Mt(){const e=ee(),[u,g]=t.useState([]),[p,l]=t.useState(!1),[f,s]=t.useState(!1),[n,x]=t.useState(!1),[o,A]=t.useState(null),[c,m]=t.useState(null),[v,N]=t.useState(!1),[E,O]=t.useState({}),[D,Q]=t.useState(null),r=async()=>
1{l(!0),A(null);try{const R=await S("/hubs/finance/invoices?limit=100");R.success&&Array.isArray(R.data)?g(R.data):A(R.error||"Could not load invoices")}catch{A("Could not load invoices.")}finally{l(!1)}};t.useEffect(()=>{r()},[]);const h=async()=>{s(!0),m(null),A(null);try{const R=await S("/hubs/finance/invoices/process-all",{method:"POST"});R.success&&R.data?(m(R.data.total?`Validated ${R.data.processed} of ${R.data.total}; ${R.data.queued} queued for approval.`:"All invoices already processed."),await r()):A(R.error||"Processing failed")}catch{A("Could not process invoices.")}finally{s(!1)}},B=async()=>{x(!0),A(null),m(null);try{const R=await S("/hubs/finance/invoices",{method:"POST",body:JSON.stringify({vendor_name:"[Sample] Acme Supplies Pvt Ltd",invoice_number:"INV-2043",amount:184500,due_date:new Date(Date.now()+864e6).toISOString().slice(0,10),po_number:"PO-8810"})});R.success?(m("Sample invoice created and auto-validated. Approve it in Human Review to mark it matched & approved."),await r()):A(R.error||"Could not create the sample invoice.")}catch{A("Could not create the sample invoice.")}finally{x(!1)}},w=async R=>{const $=window.prompt('Payment reference (UTR, cheque no., or a test label like "TEST-REF-001") — leave blank if none:');if($===null)return;const G=$.trim()||void 0;Q(R),A(null);try{const K=await S(`/hubs/finance/invoices/${R}/mark-paid`,{method:"POST",body:JSON.stringify({reference:G})});K.success?(k.success("Marked paid — posted to the ledger."),await r()):k.error(K.error||"Could not mark this bill paid.")}catch{k.error("Could not mark this bill paid.")}finally{Q(null)}},_=u.filter(R=>R.status==="pending"&&(!R.ai_validated_at||!R.ai_approval_id)&&!R.approved_at).length,[i,d]=t.useState(null),[P,C]=t.useState({vendor_name:"",amount:"",invoice_number:"",issued_date:"",due_date:""}),[y,b]=t.useState(!1),F=R=>{d(R.id),C({vendor_name:R.vendor_name==="Unknown vendor"?"":R.vendor_name,amount:Number(R.amount)>0?String(R.amount):"",invoice_number:R.invoice_number||"",issued_date:R.issued_date||"",due_date:R.due_date||""})},I=async R=>{const $=Number(P.amount);if(!Number.isFinite($)||$<=0){k.error("Enter the amount shown on the bill.");return}b(!0);try{const G={amount:$};P.vendor_name.trim()&&(G.vendor_name=P.vendor_name.trim()),P.invoice_number.trim()&&(G.invoice_number=P.invoice_number.trim()),P.issued_date&&(G.issued_date=P.issued_date),P.due_date&&(G.due_date=P.due_date);const K=await S(`/hubs/finance/invoices/${R}`,{method:"PATCH",body:JSON.stringify(G)});K.success?(k.success("Bill updated."),d(null),r()):k.error(K.error||"Could not update that bill.")}finally{b(!1)}},L=[...u].sort((R,$)=>(R.status==="pending"?0:1)-($.status==="pending"?0:1));return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:333:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"333","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:334:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"334","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:335:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"335","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(Qa,{className:"w-4 h-4 text-info","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:336:10","data-matrix-name":"FileText","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"336","data-component-file":"InvoicesQueue.tsx","data-component-name":"FileText","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-info%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:337:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"337","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Bills from suppliers"})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:339:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"339","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"secondary",leftIcon:X,onClick:()=>N(!0),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:340:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"340","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"New invoice"}),a.jsx(j,{size:"sm",variant:"secondary",leftIcon:H,loading:p,onClick:r,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:341:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"341","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]})]}),v&&a.jsx($t,{onClose:()=>N(!1),onCreated:()=>void r(),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:345:18","data-matrix-name":"NewInvoiceModal","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"345","data-component-file":"InvoicesQueue.tsx","data-component-name":"NewInvoiceModal","data-component-content":"%7B%22onClose%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onCreated%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),o&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:346:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"346","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:o}),c&&a.jsx("p",{className:"text-xs text-success","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:347:15","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"347","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-success%22%7D",children:c}),!o&&u.length===0&&!p&&a.jsxs("div",{className:"rounded-lg border border-dashed border-white/[0.12] bg-white/[0.02] p-4 text-center space-y-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:350:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"350","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-dashed%20border-white%2F%5B0.12%5D%20bg-white%2F%5B0.02%5D%20p-4%20text-center%20space-y-2%22%7D",children:[a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:351:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"351","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"No invoices yet."}),a.jsx("p",{className:"text-[11px] text-text-subtle max-w-md mx-auto","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:352:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"352","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20max-w-md%20mx-auto%22%7D",children:"See it in under a minute: add one sample dealer invoice — the agent validates it, checks the PO match, flags anomalies, and queues it for your approval."}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:Na,loading:n,onClick:B,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:353:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"353","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Try it with a sample invoice"}),a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:354:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"354","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:"A real invoice through the real pipeline — pre-filled and tagged “sample.”"})]}),u.length>0&&a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:359:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"359","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-4 text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:360:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"360","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-4%20text-%5B11px%5D%20text-text-muted%22%7D",children:[a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:361:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"361","data-component-file":"InvoicesQueue.tsx","data-component-name":"span",children:["Total: ",a.jsx("strong",{className:"text-white","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:361:25","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"361","data-component-file":"InvoicesQueue.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22text-white%22%7D",children:u.length})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:362:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"362","data-component-file":"InvoicesQueue.tsx","data-component-name":"span",children:["To process: ",a.jsx("strong",{className:_?"text-warning":"text-success","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:362:30","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"362","data-component-file":"InvoicesQueue.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:_})]}),_>0&&a.jsx(j,{size:"sm",variant:"primary",leftIcon:Na,loading:f,onClick:h,className:"ml-auto","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:364:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"364","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22ml-auto%22%7D",children:"Validate all"})]}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:368:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"368","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:L.slice(0,8).map(R=>{const $=!!E[R.id],G=R.status==="paid",K=G||!!R.approved_at||R.status==="approved",Ba=Array.isArray(R.ai_flags)?R.ai_flags:[];return a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02]","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:375:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"375","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%22%7D",children:[a.jsxs("button",{onClick:()=>O(T=>({...T,[R.id]:!T[R.id]})),className:"w-full flex items-center justify-between p-2 text-left hover:bg-white/[0.02] transition-colors","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:376:18","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"376","data-component-file":"InvoicesQueue.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22w-full%2
10flex%20items-center%20justify-between%20p-2%20text-left%20hover%3Abg-white%2F%5B0.02%5D%20transition-colors%22%7D",children:[a.jsxs("div",{className:"min-w-0 flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:377:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"377","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(He,{className:`w-3.5 h-3.5 text-text-subtle transition-transform ${$?"rotate-90":""}`,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:378:22","data-matrix-name":"ChevronRight","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"378","data-component-file":"InvoicesQueue.tsx","data-component-name":"ChevronRight","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:379:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"379","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-xs text-white truncate","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:380:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"380","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%20truncate%22%7D",children:[R.vendor_name," · ",Number(R.amount)>0?Sa(Number(R.amount),R.currency||"INR"):a.jsx("span",{className:"text-warning-bright","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:383:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"383","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-warning-bright%22%7D",children:"amount not read"})]}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:385:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"385","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[R.invoice_number||"no number",R.due_date?` · due ${R.due_date}`:""]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-none ml-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:388:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"388","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20flex-none%20ml-2%22%7D",children:[Ba.length>0&&!K&&a.jsx(W,{className:"w-3.5 h-3.5 text-warning","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:389:56","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"389","data-component-file":"InvoicesQueue.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-warning%22%7D"}),G?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-success","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:391:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"391","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-success%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:391:100","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"391","data-component-file":"InvoicesQueue.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," paid"]}):K?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-success","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:393:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"393","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-success%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:393:100","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"393","data-component-file":"InvoicesQueue.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," approved"]}):R.ai_approval_id?a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-warning","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:395:28","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"395","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-warning%22%7D",children:[a.jsx(ma,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:395:102","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"395","data-component-file":"InvoicesQueue.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})," awaiting approval"]}):R.ai_validated_at?a.jsx("span",{className:"text-[10px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:397:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"397","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-muted%22%7D",children:"val
1idated"}):a.jsx("span",{className:"text-[10px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:398:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"398","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-muted%22%7D",children:"new"})]})]}),$&&a.jsxs("div",{className:"border-t border-white/[0.06] p-2.5 space-y-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:403:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"403","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22border-t%20border-white%2F%5B0.06%5D%20p-2.5%20space-y-2%22%7D",children:[a.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:404:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"404","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20gap-x-4%20gap-y-1%20text-%5B10px%5D%20text-text-subtle%22%7D",children:[a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:405:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"405","data-component-file":"InvoicesQueue.tsx","data-component-name":"span",children:["PO: ",a.jsx("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:405:34","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"405","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:R.po_number||"none"})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:406:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"406","data-component-file":"InvoicesQueue.tsx","data-component-name":"span",children:["Match: ",a.jsxs("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:406:37","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"406","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:[R.ai_match_confidence??"—","%"]})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:407:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"407","data-component-file":"InvoicesQueue.tsx","data-component-name":"span",children:["Status: ",a.jsx("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:407:38","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"407","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:R.matched_status})]})]}),Ba.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:410:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"410","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20gap-1.5%22%7D",children:Ba.map((T,z)=>a.jsx("span",{className:"text-[10px] text-warning-bright bg-amber-400/10 border border-amber-400/20 rounded px-1.5 py-0.5",title:T.detail||"","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:412:28","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"412","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-warning-bright%20bg-amber-400%2F10%20border%20border-amber-400%2F20%20rou
1nded%20px-1.5%20py-0.5%22%2C%22title%22%3A%22%5BLogicalExpression%5D%22%7D",children:T.type},z))}),G?a.jsxs("p",{className:"inline-flex items-center gap-1 text-[11px] text-success","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:417:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"417","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B11px%5D%20text-success%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:417:95","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"417","data-component-file":"InvoicesQueue.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Paid — payment posted to the ledger."]}):K?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"inline-flex items-center gap-1 text-[11px] text-success","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:420:26","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"420","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B11px%5D%20text-success%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:420:97","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"420","data-component-file":"InvoicesQueue.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Approved — matched & recorded. Not yet paid."]}),a.jsx("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:421:26","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"421","data-component-file":"InvoicesQueue.tsx","data-component-name":"div",children:a.jsx(j,{size:"sm",variant:"secondary",leftIcon:Z,loading:D===R.id,onClick:()=>w(R.id),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:421:31","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"421","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Mark paid"})})]}):R.ai_approval_id?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"inline-flex items-center gap-1 text-[10px] text-warning","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:425:26","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"425","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-1%20text-%5B10px%5D%20text-warning%22%7D",children:[a.jsx(ma,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:425:97","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"425","data-component-file":"InvoicesQueue.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})," Validated — approve in ",a.jsx("span",{className:"font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:425:150","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"425","data-component-file":"InvoicesQueue.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-semibold%22%7D",children:"Human Review"})," to mark matched & approved."]}),a.jsx("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:426:26","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"426","data-component-file":"InvoicesQueue.tsx","data-component-name":"div",children:a.jsx(j,{size:"sm",variant:"primary",onClick:()=>e("/dashboard/approvals"),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:426:31","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"426","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Review & approve →"})})]}):a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:429:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"429","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Not validated yet — use “Validate all”."}),!K&&(i===R.id?a.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] p-2 space-y-2","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:433:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"433","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-2%20space-y-2%22%7D",children:[a.jsx("p",{className:"text-[10px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:434:26","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"434","data-component-file":"InvoicesQueue.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-muted%22%7D",children:"Correct what the bill actually says, then approve it."}),a.jsxs("div",{className:"grid grid-cols-2 gap-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:435:26","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"435","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-1.5%22%7D",children:[a.jsx("input",{value:P.vendor_name,onChange:T=>C(z=>({...z,vendor_name:T.target.value})),placeholder:"Vendor",className:Ca,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:436:28","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"436","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Vendor%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:P.amount,onChange:T=>C(z=>({...z,amount:T.target.value})),placeholder:"Amount (₹)",inputMode:"decimal",className:Ca,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:437:28","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"437","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Amount%20(%E2%82%B9)%22%2C%22inputMode%22%3A%22decimal%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:P.invoice_number,onChange:T=>C(z=>({...z,invoice_number:T.target.value})),placeholder:"Bill number",className:Ca,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:438:28","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"438","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Bill%20number%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:P.issued_date,onChange:T=>C(z=>({...z,issued_date:T.target.value})),type:"date",title:"Bill date",className:Ca,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:439:28","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"439","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22type%22%3A%22date%22%2C%22title%22%3A%22Bill%20date%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:P.due_date,onChange:T=>C(z=>({...z,due_date:T.target.value})),type:"date",title:"Due date",className:Ca,"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:440:28","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"440","data-component-file":"InvoicesQueue.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22type%22%3A%22date%22%2C%22title%22%3A%22Due%20date%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsxs("div",{className:"flex gap-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:442:26","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"442","data-component-file":"InvoicesQueue.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20gap-1.5%22%7D",children:[a.jsx(j,{size:"sm",variant:"primary",loading:y,onClick:()=>I(R.id),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:443:28","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"443","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Save"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>d(null),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:444:28","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"444","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]})]}):a.jsx("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:448:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"448","data-component-file":"InvoicesQueue.tsx","data-component-name":"div",children:a.jsx(j,{size:"sm",variant:"ghost",leftIcon:ae,onClick:()=>F(R),"data-matrix-id":"src/pages/dashboard/personas/InvoicesQueue.tsx:449:26","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoicesQueue.tsx","data-component-line":"449","data-component-file":"InvoicesQueue.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:Number(R.amount)>0?"Edit details":"Add the amount"})}))]})]},R.id)})})]})]})}const zt=()=>({display_name:"",legal_name:"",is_customer:!0,is_vendor:!1,gstin:"",pan:"",email:"",ph
1one:"",billing:{line1:"",line2:"",city:"",state:"",pincode:""},shipping:{line1:"",line2:"",city:"",state:"",pincode:""},sameAsShipping:!0,default_payment_terms_days:"30",bank_account_name:"",bank_account_number:"",bank_ifsc:"",bank_name:"",notes:""}),q="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]";function ye(e){return e?[e.line1,e.line2,e.city,e.state,e.pincode].filter(Boolean).join(", "):""}function Gt({initial:e,onCancel:u,onSaved:g}){const[p,l]=t.useState(()=>{if(!e)return zt();const c=e.billing_address||{},m=e.shipping_address||{};return{display_name:e.display_name||"",legal_name:e.legal_name||"",is_customer:!!e.is_customer,is_vendor:!!e.is_vendor,gstin:e.gstin||"",pan:e.pan||"",email:e.email||"",phone:e.phone||"",billing:{line1:c.line1||"",line2:c.line2||"",city:c.city||"",state:c.state||"",pincode:c.pincode||""},shipping:{line1:m.line1||"",line2:m.line2||"",city:m.city||"",state:m.state||"",pincode:m.pincode||""},sameAsShipping:!m.line1,default_payment_terms_days:e.default_payment_terms_days==null?"":String(e.default_payment_terms_days),bank_account_name:e.bank_account_name||"",bank_account_number:e.bank_account_number||"",bank_ifsc:e.bank_ifsc||"",bank_name:e.bank_name||"",notes:e.notes||""}}),[f,s]=t.useState(!1),[n,x]=t.useState(null),o=c=>l(m=>({...m,...c})),A=async()=>{var m;if(!p.display_name.trim()){x("A name is required.");return}if(!p.is_customer&&!p.is_vendor){x("Tick customer, supplier, or both.");return}const c=p.default_payment_terms_days.trim();if(c!==""&&!(Number.isInteger(Number(c))&&Number(c)>=0)){x("Credit period must be a whole number of days (0 means due immediately).");return}s(!0),x(null);try{const v={display_name:p.display_name.trim(),legal_name:p.legal_name.trim()||void 0,is_customer:p.is_customer,is_vendor:p.is_vendor,gstin:p.gstin.trim()||void 0,pan:p.pan.trim()||void 0,email:p.email.trim()||void 0,phone:p.phone.trim()||void 0,billing_address:p.billing,shipping_address:p.sameAsShipping?p.billing:p.shipping,default_payment_terms_days:c===""?null:Number(c),bank_account_name:p.bank_account_name.trim()||void 0,bank_account_number:p.bank_account_number.trim()||void 0,bank_ifsc:p.bank_ifsc.trim().toUpperCase()||void 0,bank_name:p.bank_name.trim()||void 0,notes:p.notes.trim()||void 0},N=e?await S(`/ledger/parties/${e.id}`,{method:"PATCH",body:JSON.stringify(v)}):await S("/ledger/parties",{method:"POST",body:JSON.stringify(v)});N.success?(k.success(e?"Saved.":"Added."),g()):x(N.error||((m=N.errors)==null?void 0:m[0])||"Could not save.")}catch{x("Could not save.")}finally{s(!1)}};return a.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.02] p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:120:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"120","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:121:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"121","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:122:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"122","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:e?"Edit":"Add a customer or supplier"}),a.jsx("button",{onClick:u,className:"p-1 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","aria-label":"Close",title:"Close","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:123:8","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"123","data-component-file":"CustomersPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22p-1%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%2C%22title%22%3A%22Close%22%7D",children:a.jsx(oa,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:123:151","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"123","data-component-file":"CustomersPanel.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"})})]}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:126:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"126","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:p.display_name,onChange:c=>o({display_name:c.target.value}),placeholder:"Name *",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:127:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"127","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Name%20*%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.legal_name,onChange:c=>o({legal_name:c.target.value}),placeholder:"Registered name (optional)",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:128:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"128","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Registered%20name%20(optional)%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.email,onChange:c=>o({email:c.target.value}),placeholder:"Email — invoices are sent here",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:129:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"129","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Email%20%E2%80%94%20invoices%20are%20sent%20here%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.phone,onChange:c=>o({phone:c.target.value}),placeholder:"Phone",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:130:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"130","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Phone%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.gstin,onChange:c=>o({gstin:c.target.value.toUpperCase()}),maxLength:15,placeholder:"GSTIN (optional)",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:131:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"131","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22maxLength%22%3A15%2
1C%22placeholder%22%3A%22GSTIN%20(optional)%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.pan,onChange:c=>o({pan:c.target.value.toUpperCase()}),maxLength:10,placeholder:"PAN (optional)",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:132:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"132","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22maxLength%22%3A10%2C%22placeholder%22%3A%22PAN%20(optional)%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:134:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"134","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Their GSTIN decides whether you charge CGST+SGST or IGST — the state is read from it automatically."}),a.jsxs("div",{className:"flex items-center gap-4","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:138:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"138","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-4%22%7D",children:[a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:139:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"139","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%20text-%5B11px%5D%20text-text-soft%22%7D",children:[a.jsx("input",{type:"checkbox",checked:p.is_customer,onChange:c=>o({is_customer:c.target.checked}),className:"accent-accent","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:140:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"140","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22accent-accent%22%7D"}),"I sell to them"]}),a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:143:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"143","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%20text-%5B11px%5D%20text-text-soft%22%7D",children:[a.jsx("input",{type:"checkbox",checked:p.is_vendor,onChange:c=>o({is_vendor:c.target.checked}),className:"accent-accent","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:144:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"144","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22accent-accent%22%7D"}),"I buy from them"]})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:149:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"149","data-component-file":"CustomersPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted mb-1.5","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:150:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"150","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%20mb-1.5%22%7D",children:"Billing address"}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:151:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"151","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:p.billing.line1,onChange:c=>o({billing:{...p.billing,line1:c.target.value}}),placeholder:"Address line 1",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:152:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"152","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Address%20line%201%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.billing.line2,onChange:c=>o({billing:{...p.billing,line2:c.target.value}}),placeholder:"Address line 2",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:153:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"153","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Address%20line%202%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.billing.city,onChange:c=>o({billing:{...p.billing,city:c.target.value}}),placeholder:"City",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:154:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"154","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22City%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsxs("select",{value:p.billing.state,onChange:c=>o({billing:{...p.billing,state:c.target.value}}),className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:155:10","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"155","data-component-file":"CustomersPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:156:12","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"156","data-component-file":"CustomersPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"State…"}),we.map(c=>a.jsx("option",{value:c,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:157:36","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"157","data-component-file":"CustomersPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%7D",children:c},c))]}),a.jsx("input",{value:p.billing.pincode,onChange:c=>o({billing:{...p.billing,pincode:c.target.value}}),placeholder:"PIN code",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:159:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"159","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22PIN%20code%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]})]}),a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:163:6","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"163","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%20text-%5B11px%5D%20text-text-soft%22%7D",children:[a.jsx("input",{type:"checkbox",checked:p.sameAsShipping,onChange:c=>o({sameAsShipping:c.target.checked}),className:"accent-accent","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:164:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"164","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22accent-accent%22%7D"}),"Delivery address is the same"]}),!p.sameAsShipping&&a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:168:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"168","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:p.shipping.line1,onChange:c=>o({shipping:{...p.shipping,line1:c.target.value}}),placeholder:"Delivery line 1",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:169:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"169","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Delivery%20line%201%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.shipping.line2,onChange:c=>o({shipping:{...p.shipping,line2:c.target.value}}),placeholder:"Delivery line 2",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:170:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"170","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Delivery%20line%202%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:p.shipping.city,onChange:c=>o({shipping:{...p.shipping,city:c.target.value}}),placeholder:"City",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:171:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"171","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22City%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsxs("select",{value:p.shipping.state,onChange:c=>o({shipping:{...p.shipping,state:c.target.value}}),className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:172:10","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"172","data-component-file":"CustomersPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:173:12","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"173","data-component-file":"CustomersPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"State…"}),we.map(c=>a.jsx("option",{value:c,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:174:36","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"174","data-component-file":"CustomersPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%7D",children:c},c))]}),a.jsx("input",{value:p.shipping.pincode,onChange:c=>o({shipping:{...p.shipping,pincode:c.target.value}}),placeholder:"PIN code",className:q,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:176:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"176","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22PIN%20code%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:180:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"180","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:181:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"181","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Usual credit period (days)",a.jsx("input",{type:"number",min:0,value:p.default_payment_terms_days,onChange:c=>o({default_payment_terms_days:c.target.value}),placeholder:"e.g. 30",className:`${q} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:183:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"183","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22number%22%2C%22min%22%3A0%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22e.g.%2030%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:185:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"185","data-component-file":"CustomersPanel.tsx","data-component-name":"label","
1data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Notes",a.jsx("input",{value:p.notes,onChange:c=>o({notes:c.target.value}),placeholder:"Anything worth remembering",className:`${q} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:187:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"187","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Anything%20worth%20remembering%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]})]}),p.is_vendor&&a.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] p-3","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:194:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"194","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-3%22%7D",children:[a.jsx("p",{className:"text-[11px] text-white","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:195:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"195","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-white%22%7D",children:"Where you pay them"}),a.jsx("p",{className:"text-[10px] text-text-subtle mt-0.5 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:196:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"196","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-0.5%20leading-relaxed%22%7D",children:"Needed to include their bills in a payment run. Without it their bills are held back with the reason shown, rather than quietly left out of the file."}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 mt-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:200:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"200","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-1%20sm%3Agrid-cols-2%20gap-2%20mt-2%22%7D",children:[a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:201:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"201","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Account holder name",a.jsx("input",{value:p.bank_account_name,onChange:c=>o({bank_account_name:c.target.value}),placeholder:"Exactly as the bank has it",className:`${q} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:203:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"203","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Exactly%20as%20the%20bank%20has%20it%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:206:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"206","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Bank",a.jsx("input",{value:p.bank_name,onChange:c=>o({bank_name:c.target.value}),placeholder:"e.g. HDFC Bank",className:`${q} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:208:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"208","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22e.g.%20HDFC%20Bank%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:210:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"210","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Account number",a.jsx("input",{value:p.bank_account_number,onChange:c=>o({bank_account_number:c.target.value}),placeholder:"Account number",className:`${q} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:212:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"212","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Account%20number%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:214:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"214","data-component-file":"CustomersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["IFSC",a.jsx("input",{value:p.bank_ifsc,onChange:c=>o({bank_ifsc:c.target.value.toUpperCase()}),placeholder:"HDFC0001234",className:`${q} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:216:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"216","data-component-file":"CustomersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22HDFC0001234%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]})]}),a.jsx("p",{className:"text-[10px] text-text-faint mt-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:221:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"221","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20mt-2%22%7D",children:"The account holder name goes on the bank file. If it does not match what the bank has, the transfer bounces back."})]}),n&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:228:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"228","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:n}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:229:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"229","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"primary",loading:f,onClick:A,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:230:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"230","data-component-file":"CustomersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:e?"Save changes":"Add"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:u,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:231:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"231","data-component-file":"CustomersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})}function Ht(){const[e,u]=t.useState([]),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState(null),x=t.useCallback(async()=>{p(!0);try{const A=await S("/ledger/parties?limit=200");A.success&&Array.isArray(A.data)&&u(A.data)}finally{p(!1)}},[]);t.useEffect(()=>{x()},[x]);const o=async A=>
1{if(!window.confirm(`Remove ${A.display_name} from your list? Past invoices to them are not affected.`))return;const c=await S(`/ledger/parties/${A.id}`,{method:"PATCH",body:JSON.stringify({active:!1})});if(!c.success){k.error(c.error||"Could not remove.");return}const m=await S("/ledger/parties?limit=200");m.success&&Array.isArray(m.data)&&m.data.some(N=>N.id===A.id)?k.error("That did not save — the record is still here. Please try again."):k.success("Removed."),m.success&&Array.isArray(m.data)&&u(m.data)};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:268:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"268","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:269:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"269","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:270:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"270","data-component-file":"CustomersPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:271:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"271","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Ue,{className:"h-4 w-4 text-success","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:272:12","data-matrix-name":"Users","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"272","data-component-file":"CustomersPanel.tsx","data-component-name":"Users","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-success%22%7D"})," Customers & suppliers"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:274:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"274","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Set someone up once — their email, GSTIN and credit period fill in automatically on every invoice."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:278:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"278","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:x,"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:279:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"279","data-component-file":"CustomersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:X,onClick:()=>{n(null),f(!0)},"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:280:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"280","data-component-file":"CustomersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Add"})]})]}),(l||s)&&a.jsx(Gt,{initial:s||void 0,onCancel:()=>{f(!1),n(null)},onSaved:()=>{f(!1),n(null),x()},"data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:285:8","data-matrix-name":"PartyForm","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"285","data-component-file":"CustomersPanel.tsx","data-component-name":"PartyForm","data-component-content":"%7B%22initial%22%3A%22%5BLogicalExpression%5D%22%2C%22onCancel%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onSaved%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),!g&&e.length===0&&!l&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:293:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"293","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Nobody added yet. Add your first customer to start invoicing."}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:296:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"296","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:e.map(A=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-white/[0.02] border border-white/[0.05]","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:298:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"298","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-3%20px-3%20py-2%20rounded-lg%20bg-white%2F%5B0.02%5D%20border%20border-white%2F%5B0.05%5D%22%7D",children:[a.jsxs("div",{className:"flex-1 min-w-0","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:299:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"299","data-component-file":"CustomersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-1%20min-w-0%22%7D",children:[a.jsxs("p",{className:"text-xs font-medium text-white truncate","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:300:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"300","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-medium%20text-white%20truncate%22%7D",children:[A.display_name,a.jsx("span",{className:"ml-2 text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:302:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"302","data-component-file":"CustomersPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-2%20text-%5B10px%5D%20text-text-subtle%22%7D",children:A.is_customer&&A.is_vendor?"Customer & supplier":A.is_customer?"Customer":"Supplier"})]}),a.jsx("p",{className:"text-[11px] text-text-subtle truncate","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:306:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"306","data-component-file":"CustomersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20truncate%22%7D",children:[A.email,A.phone,A.gstin?`GSTIN ${A.gstin}
1`:null].filter(Boolean).join(" · ")||"No contact details yet"})]}),a.jsx("button",{onClick:()=>{f(!1),n(A)},title:"Edit",className:"p-1.5 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:310:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"310","data-component-file":"CustomersPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22title%22%3A%22Edit%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%7D",children:a.jsx(ae,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:311:14","data-matrix-name":"Pencil","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"311","data-component-file":"CustomersPanel.tsx","data-component-name":"Pencil","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})}),a.jsx("button",{onClick:()=>o(A),title:"Remove",className:"p-1.5 rounded-lg text-text-subtle hover:text-danger hover:bg-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:313:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"313","data-component-file":"CustomersPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22title%22%3A%22Remove%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-danger%20hover%3Abg-white%2F%5B0.06%5D%22%7D",children:a.jsx(la,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/CustomersPanel.tsx:314:14","data-matrix-name":"Trash2","data-component-path":"src/pages/dashboard/personas/CustomersPanel.tsx","data-component-line":"314","data-component-file":"CustomersPanel.tsx","data-component-name":"Trash2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})})]},A.id))})]})}const je=()=>({item_id:"",description:"",hsn_sac:"",quantity:"1",rate:"",gst_rate:"18"}),qt=()=>new Date().toISOString().slice(0,10),da=e=>Math.round(e*100)/100,ua=e=>`₹${Number(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,sa="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]";function Ut({existing:e,onClose:u,onSaved:g}){var Ba;const[p,l]=t.useState([]),[f,s]=t.useState([]),[n,x]=t.useState(null),[o,A]=t.useState(null),[c,m]=t.useState(!1),[v,N]=t.useState((e==null?void 0:e.customer_party_id)||""),[E,O]=t.useState((e==null?void 0:e.issue_date)||qt()),[D,Q]=t.useState("30"),[r,h]=t.useState((e==null?void 0:e.notes)||""),[B,w]=t.useState((Ba=e==null?void 0:e.line_items)!=null&&Ba.length?e.line_items.map(T=>({item_id:T.item_id||"",description:T.description,hsn_sac:T.hsn_sac||"",quantity:String(T.quantity),rate:String(T.rate),gst_rate:String(T.gst_rate)})):[je()]),[_,i]=t.useState(!1),[d,P]=t.useState(null),C=t.useRef(null);t.useEffect(()=>{(async()=>{var Y,U,ha;const[T,z,M]=await Promise.all([S("/ledger/parties?role=customer&limit=200"),S("/finance-items?limit=200"),S("/ar-invoices/issuer-status")]);T.success&&Array.isArray(T.data)&&l(T.data),z.success&&Array.isArray(z.data)&&s(z.data),M.success?(A(!!((Y=M.data)!=null&&Y.gst_registered)),m(!!((U=M.data)!=null&&U.no_office)),x(((ha=M.data)==null?void 0:ha.issuer)||null)):A(!0)})()},[]);const y=t.useMemo(()=>p.find(T=>T.id===v)||null,[p,v]);t.useEffect(()=>{e||!y||y.default_payment_terms_days!=null&&Q(String(y.default_payment_terms_days))},[y,e]);const b=D.trim()===""?null:Number(D),F=b!==null&&Number.isInteger(b)&&b>=0,I=t.useMemo(()=>{if(!E||!F)return"";const T=new Date(E+"T00:00:00");return T.setDate(T.getDate()+b),T.toISOString().slice(0,10)},[E,F,b]),L=(T,z)=>w(M=>M.map((Y,U)=>U===T?{...Y,...z}:Y)),R=(T,z)=>{var Y;const M=f.find(U=>U.id===z);if(!M){L(T,{item_id:""});return}L(T,{item_id:z,description:((Y=M.description)==null?void 0:Y.trim())||M.name,hsn_sac:M.hsn_sac||"",rate:String(M.rate),gst_rate:String(M.gst_rate)})},$=t.useMemo(()=>{const T=o?((n==null?void 0:n.gstin)||"").slice(0,2):"",z=(y==null?void 0:y.state_code)||"",M=!!T&&!!z&&T===z;let Y=0,U=0,ha=0,Ma=0;return{rows:B.map(za=>{const st=Number(za.quantity)||0,ot=Number(za.rate)||0,Ga=o===!1?0:Number(za.gst_rate)||0,wa=da(st*ot);let Ha=0,te=0,ne=0;return Ga>0&&(M?(Ha=da(wa*Ga/200),te=Ha):ne=da(wa*Ga/100)),Y=da(Y+wa),U=da(U+Ha),ha=da(ha+te),Ma=da(Ma+ne),{...za,gst_rate:String(Ga),lineSub:wa,lineTotal:da(wa+Ha+te+ne)}}),subtotal:Y,cgst:U,sgst:ha,igst:Ma,total:da(Y+U+ha+Ma)}}
1,[B,o,n,y]),G=async()=>{var z;if(!v){P("Choose a customer.");return}if(!F){P("Payment terms must be a whole number of days — use 0 for due immediately.");return}const T=B.filter(M=>M.description.trim()&&Number(M.rate)>0&&Number(M.quantity)>0);if(T.length===0){P("Add at least one line with a description, quantity and rate.");return}i(!0),P(null);try{const M={customer_name:y.display_name,customer_email:y.email||void 0,customer_gstin:y.gstin||void 0,issue_date:E,due_date:I||void 0,payment_terms:b===0?"Due immediately":`Net ${b}`,notes:r.trim()||void 0,line_items:T.map(U=>({description:U.description.trim(),item_id:U.item_id||void 0,hsn_sac:U.hsn_sac.trim()||void 0,quantity:Number(U.quantity),rate:Number(U.rate),gst_rate:o===!1?0:Number(U.gst_rate)||0}))},Y=e?await S(`/ar-invoices/${e.id}`,{method:"PATCH",body:JSON.stringify(M)}):await S("/ar-invoices",{method:"POST",body:JSON.stringify(M)});Y.success?(k.success(e?"Draft saved.":"Draft created."),g()):P(Y.error||((z=Y.errors)==null?void 0:z[0])||"Could not save the invoice.")}catch{P("Could not save the invoice.")}finally{i(!1)}},K=()=>{document.body.classList.add("printing-invoice"),window.print(),setTimeout(()=>document.body.classList.remove("printing-invoice"),500)};return dt.createPortal(a.jsxs("div",{className:"fixed inset-0 z-[100] bg-deep flex flex-col","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:201:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"201","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22fixed%20inset-0%20z-%5B100%5D%20bg-deep%20flex%20flex-col%22%7D",children:[a.jsx("style",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:202:6","data-matrix-name":"style","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"202","data-component-file":"InvoiceEditor.tsx","data-component-name":"style",children:`
2        @media print {
3          body.printing-invoice > * { visibility: hidden !important; }
4          body.printing-invoice #invoice-print-area,
5          body.printing-invoice #invoice-print-area * { visibility: visible !important; }
6          body.printing-invoice #invoice-print-area {
7            position: absolute !important; left: 0; top: 0; width: 100%;
8            box-shadow: none !important; border: none !important;
9          }
10        }
11      `}),a.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-white/[0.08] shrink-0","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:214:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"214","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20px-5%20py-3%20border-b%20border-white%2F%5B0.08%5D%20shrink-0%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:215:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"215","data-component-file":"InvoiceEditor.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:216:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"216","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:e?`Edit invoice${e.invoice_number?` ${e.invoice_number}`:" (draft)"}`:"New invoice"}),a.jsx("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:219:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"219","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:"Nothing is sent until you send it from the list."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:221:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"221","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:We,onClick:K,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:222:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"222","data-component-file":"InvoiceEditor.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Print"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:Ta,loading:_,onClick:G,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:223:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"223","data-component-file":"InvoiceEditor.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:e?"Save changes":"Save draft"}),a.jsx("button",{onClick:u,className:"p-1.5 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","aria-label":"Close",title:"Close","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:226:10","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"226","data-component-file":"InvoiceEditor.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%2C%22title%22%3A%22Close%22%7D",children:a.jsx(oa,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:227:12","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"227","data-component-file":"InvoiceEditor.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"})})]})]}),a.jsxs("div",{className:"flex-1 overflow-hidden grid lg:grid-cols-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:232:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"232","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-1%20overflow-hidden%20grid%20lg%3Agrid-cols-2%22%7D",children:[a.jsxs("div",{className:"overflow-y-auto p-5 space-y-4 border-r border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:234:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"234","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22overflow-y-auto%20p-5%20space-y-4%20border-r%20border-white%2F%5B0.06%5D%22%7D",children:[o===!1&&a.jsx("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.08] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:236:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"236","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.08%5D%20px-3%20py-2%22%7D",children:a.jsxs("p",{className:"text-[11px] text-text-soft leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:237:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"237","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20leading-relaxed%22%7D",children:[c?"No office is set up yet, so this invoice is issued without GST.":"Your business has no GSTIN on file, so it is not GST-registered — this is issued as a plain invoice with no GST."," ","That is correct below the GST registration threshold. If you are registered, add the GSTIN under ",a.jsx("strong",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:242:36","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"242","data-component-file":"InvoiceEditor.tsx","data-component-name":"strong",children:"HR & Payroll → Company → Offices"}),"."]})}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:247:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"247","data-component-file":"InvoiceEditor.tsx","data-component-name":"div",children:[a.jsx("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:248:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"248","data-component-file":"InvoiceEditor.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Customer *"}
11),a.jsxs("select",{value:v,onChange:T=>N(T.target.value),className:`${sa} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:249:12","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"249","data-component-file":"InvoiceEditor.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:250:14","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"250","data-component-file":"InvoiceEditor.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Choose a customer…"}),p.map(T=>a.jsx("option",{value:T.id,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:251:34","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"251","data-component-file":"InvoiceEditor.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:T.display_name},T.id))]}),p.length===0&&a.jsx("p",{className:"text-[10px] text-warning/90 mt-1","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:254:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"254","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-warning%2F90%20mt-1%22%7D",children:"No customers yet — add one under “Customers & suppliers” on the Sales tab first."}),y&&a.jsx("p",{className:"text-[10px] text-text-subtle mt-1","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:259:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"259","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-1%22%7D",children:[y.email,y.phone,y.gstin?`GSTIN ${y.gstin}`:"No GSTIN"].filter(Boolean).join(" · ")})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:265:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"265","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-2%22%7D",children:[a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:266:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"266","data-component-file":"InvoiceEditor.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Invoice date",a.jsx("input",{type:"date",value:E,onChange:T=>O(T.target.value),className:`${sa} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:268:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"268","data-component-file":"InvoiceEditor.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:270:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"270","data-component-file":"InvoiceEditor.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Payment terms (days)",a.jsx("input",{type:"number",min:0,value:D,onChange:T=>Q(T.target.value),placeholder:"30 — use 0 for immediate",className:`${sa} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:272:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"272","data-component-file":"InvoiceEditor.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22number%22%2C%22min%22%3A0%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%223
110%20%E2%80%94%20use%200%20for%20immediate%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-white/[0.03] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:275:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"275","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20rounded-lg%20bg-white%2F%5B0.03%5D%20px-3%20py-2%22%7D",children:[a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:276:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"276","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Due date (invoice date + terms)"}),a.jsx("p",{className:"text-xs font-medium text-white","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:277:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"277","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-medium%20text-white%22%7D",children:I?new Date(I+"T00:00:00").toLocaleDateString("en-IN",{day:"2-digit",month:"short",year:"numeric"}):"—"})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:282:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"282","data-component-file":"InvoiceEditor.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted mb-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:283:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"283","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%20mb-2%22%7D",children:"Line items"}),a.jsx("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:284:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"284","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:B.map((T,z)=>a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] p-2.5 space-y-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:286:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"286","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%20p-2.5%20space-y-2%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:287:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"287","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsxs("select",{value:T.item_id,onChange:M=>R(z,M.target.value),className:`${sa} flex-1`,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:288:20","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"288","data-component-file":"InvoiceEditor.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:289:22","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"289","data-component-file":"InvoiceEditor.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Pick from your list, or type below…"}),f.map(M=>a.jsxs("option",{value:M.id,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:290:41","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"290","data-component-file":"InvoiceEditor.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[M.name," — ₹",M.rate]},M.id))]}),a.jsx("button",{onClick:()=>w(M=>M.filter((Y,U)=>U!==z)),disabled:B.length===1,className:"p-1.5 rounded-lg text-text-faint hover:text-danger disabled:opacity-30 disabled:cursor-not-allowed","aria-label":"Delete",title:"Delete","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:292:20","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"292","data-component-file":"InvoiceEditor.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-faint%20hover%3Atext-danger%20disabled%3Aopacity-30%20disabled%3Acursor-not-allowed%22%2C%22title%22%3A%22Delete%22%7D",children:a.jsx(la,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:297:22","data-matrix-name":"Trash2","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"297","data-component-file":"InvoiceEditor.tsx","data-component-name":"Trash2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})})]}),a.jsx("input",{value:T.description,onChange:M=>L(z,{description:M.target.value}),placeholder:"Description *",className:sa,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:300:18","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"300","data-component-file":"InvoiceEditor.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Description%20*%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsxs("div",{className:"grid grid-cols-4 gap-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:301:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"301","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-4%20gap-1.5%22%7D",children:[a.jsx("input",{value:T.hsn_sac,onChange:M=>L(z,{hsn_sac:M.target.value}),placeholder:"HSN/SAC",className:sa,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:302:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"302","data-component-file":"InvoiceEditor.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22HSN%2FSAC%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:T.quantity,onChange:M=>L(z,{quantity:M.target.value}),inputMode:"decimal",placeholder:"Qty",className:sa,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:303:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"303","data-component-file":"InvoiceEditor.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Qty%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:T.rate,onChange:M=>L(z,{rate:M.target.value}),inputMode:"decimal",placeholder:"Rate ₹",className:sa,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:304:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"304","data-component-file":"InvoiceEditor.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Rate%20%E2%82%B9%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:o===!1?"":T.gst_rate,onChange:M=>L(z,{gst_rate:M.target.value}),disabled:o===!1,inputMode:"decimal",placeholder:o===!1?"No GST":"GST %",className:`${sa} disabled:opacity-40 disabled:cursor-not-allowed`,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:305:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"305","data-component-file":"InvoiceEditor.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BConditionalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22%5BConditionalExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]})]},z))}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:X,onClick:()=>w(T=>[...T,je()]),className:"mt-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:317:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"317","data-component-file":"InvoiceEditor.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22mt-2%22%7D",children:"Add line"})]}),a.jsx("textarea",{value:r,onChange:T=>h(T.target.value),rows:2,placeholder:"Notes shown on the invoice (optional)",className:`${sa} resize-none`,"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:320:10","data-matrix-name":"textarea","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"320","data-component-file":"InvoiceEditor.tsx","data-component-name":"textarea","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22rows%22%3A2%2C%22placeholder%22%3A%22Notes%20shown%20on%20the%20invoice%20(optional)%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),d&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:322:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"322","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:d})]}),a.jsxs("div",{className:"overflow-y-auto p-5 bg-surface/40","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:326:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"326","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22overflow-y-auto%20p-5%20bg-surface%2F40%22%7D",children:[a.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-subtle mb-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:327:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"327","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wide%20text-text-subtle%20mb-2%22%7D",children:"Preview — this is exactly what your customer receives"}),a.jsxs("div",{id:"invoice-print-area",ref:C,className:"bg-white text-slate-900 rounded-lg p-6 shadow-xl mx-auto",style:{maxWidth:640},"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:330:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"330","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22invoice-print-area%22%2C%22className%22%3A%22bg-white%20text-slate-900%20rounded-lg%20p-6%20shadow-xl%20mx-auto%22%2C%22style%22%3A%7B%22maxWidth%22%3A640%7D%7D",children:[a.jsxs("div",{className:"flex justify-between items-start pb-4 border-b border-slate-200","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:331:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"331","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-between%20items-start%20pb-4%20border-b%20border-slate-200%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:332:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"332","data-component-file":"InvoiceEditor.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-base font-bold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:333:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"333","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-base%20font-bold%22%7D",children:(n==null?void 0:n.name)||"Your business"}),((n==null?void 0:n.gstin)||(n==null?void 0:n.pan)||(n==null?void 0:n.cin))&&a.jsx("p",{className:"text-[10px] text-text-faint mt-0.5","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:336:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"336","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20mt-0.5%22%7D",children:[(n==null?void 0:n.gstin)&&`GSTIN: ${n.gstin}`,(n==null?void 0:n.pan)&&`PAN: ${n.pan}`,(n==null?void 0:n.cin)&&`CIN: ${n.cin}
11`].filter(Boolean).join("   ")}),((n==null?void 0:n.office_address)||(n==null?void 0:n.registered_address))&&a.jsx("p",{className:"text-[10px] text-text-subtle mt-1 max-w-[260px]","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:341:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"341","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-1%20max-w-%5B260px%5D%22%7D",children:(n==null?void 0:n.office_address)||(n==null?void 0:n.registered_address)})]}),a.jsxs("div",{className:"text-right","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:344:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"344","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22text-right%22%7D",children:[a.jsxs("p",{className:"text-lg font-bold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:346:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"346","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-lg%20font-bold%22%7D",children:[e!=null&&e.invoice_number?"":"DRAFT ",n!=null&&n.gstin?"TAX INVOICE":"INVOICE"]}),a.jsx("p",{className:"text-[10px] text-text-faint mt-0.5","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:349:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"349","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20mt-0.5%22%7D",children:e!=null&&e.invoice_number?`No. ${e.invoice_number}`:"Number assigned when you send it"}),a.jsxs("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:352:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"352","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:["Date: ",E]}),I&&a.jsxs("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:353:28","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"353","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:["Due: ",I]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 py-4","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:357:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"357","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-4%20py-4%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:358:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"358","data-component-file":"InvoiceEditor.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[9px] uppercase tracking-wide text-text-muted mb-1","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:359:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"359","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20uppercase%20tracking-wide%20text-text-muted%20mb-1%22%7D",children:"From"}),a.jsx("p",{className:"text-[11px] font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:360:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"360","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20font-semibold%22%7D",children:(n==null?void 0:n.name)||"—"}),((n==null?void 0:n.office_address)||(n==null?void 0:n.registered_address))&&a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:362:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"362","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:(n==null?void 0:n.office_address)||(n==null?void 0:n.registered_address)})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:365:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"365","data-component-file":"InvoiceEditor.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[9px] uppercase tracking-wide text-text-muted mb-1","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:366:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"366","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20uppercase%20tracking-wide%20text-text-muted%20mb-1%22%7D",children:"Bill to"}),a.jsx("p",{className:"text-[11px] font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:367:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"367","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20font-semibold%22%7D",children:(y==null?void 0:y.display_name)||"No customer chosen"}),(y==null?void 0:y.gstin)&&a.jsxs("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:368:36","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"368","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:["GSTIN: ",y.gstin]}),ye(y==null?void 0:y.billing_address)&&a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:370:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"370","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:ye(y==null?void 0:y.billing_address)}),(y==null?void 0:y.email)&&a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:372:36","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"372","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:y.email})]})]}),a.jsxs("table",{className:"w-full text-[10px]","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:376:12","data-matrix-name":"table","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"376","data-component-file":"InvoiceEditor.tsx","data-component-name":"table","data-component-content":"%7B%22className%22%3A%22w-full%2
110text-%5B10px%5D%22%7D",children:[a.jsx("thead",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:377:14","data-matrix-name":"thead","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"377","data-component-file":"InvoiceEditor.tsx","data-component-name":"thead",children:a.jsxs("tr",{className:"bg-slate-100 text-text-subtle uppercase tracking-wide","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:378:16","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"378","data-component-file":"InvoiceEditor.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22bg-slate-100%20text-text-subtle%20uppercase%20tracking-wide%22%7D",children:[a.jsx("th",{className:"text-left py-1.5 px-2 font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:379:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"379","data-component-file":"InvoiceEditor.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22text-left%20py-1.5%20px-2%20font-semibold%22%7D",children:"Description"}),a.jsx("th",{className:"text-left py-1.5 px-1 font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:380:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"380","data-component-file":"InvoiceEditor.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22text-left%20py-1.5%20px-1%20font-semibold%22%7D",children:"HSN/SAC"}),a.jsx("th",{className:"text-right py-1.5 px-1 font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:381:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"381","data-component-file":"InvoiceEditor.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22text-right%20py-1.5%20px-1%20font-semibold%22%7D",children:"Qty"}),a.jsx("th",{className:"text-right py-1.5 px-1 font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:382:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"382","data-component-file":"InvoiceEditor.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22text-right%20py-1.5%20px-1%20font-semibold%22%7D",children:"Rate"}),a.jsx("th",{className:"text-right py-1.5 px-1 font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:383:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"383","data-component-file":"InvoiceEditor.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22text-right%20py-1.5%20px-1%20font-semibold%22%7D",children:"Tax"}),a.jsx("th",{className:"text-right py-1.5 px-2 font-semibold","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:384:18","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"384","data-component-file":"InvoiceEditor.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22text-right%20py-1.5%20px-2%20font-semibold%22%7D",children:"Amount"})]})}),a.jsx("tbody",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:387:14","data-matrix-name":"tbody","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"387","data-component-file":"InvoiceEditor.tsx","data-component-name":"tbody",children:$.rows.map((T,z)=>a.jsxs("tr",{className:"border-b border-slate-100","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:389:18","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"389","data-component-file":"InvoiceEditor.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22border-b%20border-slate-100%22%7D",children:[a.jsx("td",{className:"py-1.5 px-2","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:390:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"390","data-component-file":"InvoiceEditor.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20px-2%22%7D",children:T.description||a.jsx("span",{className:"text-text-muted","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:390:66","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"390","data-component-file":"InvoiceEditor.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-muted%22%7D",children:"—"})}),a.jsx("td",{className:"py-1.5 px-1 text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:391:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"391","data-component-file":"InvoiceEditor.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20px-1%20text-text-subtle%22%7D",children:T.hsn_sac||"—"}),a.jsx("td",{className:"py-1.5 px-1 text-right","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:392:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"392","data-component-file":"InvoiceEditor.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20px-1%20text-right%22%7D",children:T.quantity||"—"}),a.jsx("td",{className:"py-1.5 px-1 text-right","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:393:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"393","data-component-file":"InvoiceEditor.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20px-1%20text-right%22%7D",children:Number(T.rate)?ua(Number(T.rate)):"—"}),a.jsx("td",{className:"py-1.5 px-1 text-right","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:394:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"394","data-component-file":"InvoiceEditor.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20px-1%20text-right%22%7D",children:n!=null&&n.gstin?`${T.gst_rate}%`:"—"}),a.jsx("td",{className:"py-1.5 px-2 text-right","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:395:20","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"395","data-component-file":"InvoiceEditor.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20px-2%20text-right%22%7D",children:ua(T.lineTotal)})]},z))})]}),a.jsx("div",{className:"flex justify-end mt-3","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:401:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"401","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-end%20mt-3%22%7D",children:a.jsxs("div",{className:"w-56 space-y-1","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:402:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"402","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-56%20space-y-1%22%7D",children:[a.jsxs("div",{className:"flex justify-between text-[10px]","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:403:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"403","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-between%20text-%5B10px%5D%22%7D",children:[a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:403:66","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"403","data-component-file":"InvoiceEditor.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:"Subtotal"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:403:115","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"403","data-component-file":"InvoiceEditor.tsx","data-component-name":"span",children:ua($.subtotal)})]}),$.cgst>0&&a.jsxs("div",{className:"flex justify-between text-[10px]","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:404:38","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"404","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-between%20text-%5B10px%5D%22%7D",children:[a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:404:88","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"404","data-component-file":"InvoiceEditor.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:"CGST"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:404:133","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"404","data-component-file":"InvoiceEditor.tsx","data-component-name":"span",children:ua($.cgst)})]}),$.sgst>0&&a.jsxs("div",{className:"flex justify-between text-[10px]","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:405:38","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"405","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-between%20text-%5B10px%5D%22%7D",children:[a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:405:88","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"405","data-component-file":"InvoiceEditor.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:"SGST"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:405:133","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"405","data-component-file":"InvoiceEditor.tsx","data-component-name":"span",children:ua($.sgst)})]}),$.igst>0&&a.jsxs("div",{className:"flex justify-between text-[10px]","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:406:38","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"406","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-between%20text-%5B10px%5D%22%7D",children:[a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:406:88","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"406","data-component-file":"InvoiceEditor.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:"IGST"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:406:133","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"406","data-component-file":"InvoiceEditor.tsx","data-component-name":"span",children:ua($.igst)})]}),a.jsxs("div",{className:"flex justify-between text-xs font-bold pt-1.5 border-t border-slate-300","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:407:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"407","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-between%20text-xs%20font-bold%20pt-1.5%20border-t%20border-slate-300%22%7D",children:[a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:408:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"408","data-component-file":"InvoiceEditor.tsx","data-component-name":"span",children:"Total"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:408:36","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"408","data-component-file":"InvoiceEditor.tsx","data-component-name":"span",children:ua($.total)})]})]})}),a.jsxs("div",{className:"mt-5 pt-3 border-t border-slate-200","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:413:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"413","data-component-file":"InvoiceEditor.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-5%20pt-3%20border-t%20border-slate-200%22%7D",children:[a.jsx("p",{className:"text-[9px] uppercase tracking-wide text-text-muted mb-1","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:414:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"414","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20uppercase%20tracking-wide%20text-text-muted%20mb-1%22%7D",children:"How to pay"}),a.jsxs("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:415:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"415","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:["Terms: ",b===0?"Due immediately":`Net ${b??"—"}`]}),(n==null?void 0:n.bank_account_number)&&a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:419:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"419","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:[n.bank_name,`A/c ${n.bank_account_number}`,n.bank_ifsc&&`IFSC ${n.bank_ifsc}
11`].filter(Boolean).join(" · ")}),(n==null?void 0:n.upi_id)&&a.jsxs("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:423:33","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"423","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:["UPI: ",n.upi_id]}),(n==null?void 0:n.payment_link_url)&&a.jsxs("p",{className:"text-[10px] text-slate-700 font-medium","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:425:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"425","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-slate-700%20font-medium%22%7D",children:["Pay online: ",n.payment_link_url]}),(n==null?void 0:n.payment_instructions)&&a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:427:47","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"427","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:n.payment_instructions}),!(n!=null&&n.bank_account_number)&&!(n!=null&&n.upi_id)&&!(n!=null&&n.payment_link_url)&&!(n!=null&&n.payment_instructions)&&a.jsx("p",{className:"text-[10px] text-amber-600","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:429:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"429","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-amber-600%22%7D",children:"Nothing set — your customer will not know how to pay. Set it up under “How customers pay you”."}),r.trim()&&a.jsx("p",{className:"text-[10px] text-text-faint mt-1.5","data-matrix-id":"src/pages/dashboard/personas/InvoiceEditor.tsx:433:31","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/InvoiceEditor.tsx","data-component-line":"433","data-component-file":"InvoiceEditor.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20mt-1.5%22%7D",children:r})]})]})]})]})]}),document.body)}const Ie={draft:"bg-slate-500/15 text-text-soft",issued:"bg-warning-fill/15 text-warning-bright",paid:"bg-success-fill/15 text-success-bright",void:"bg-slate-500/15 text-text-subtle",written_off:"bg-danger-fill/15 text-danger"};async function Wt(e){const u=await fetch(`${Ka}/ar-invoices/${e}/preview`,{headers:await ve()});if(!u.ok)throw new Error("Could not load the preview");const g=await u.blob(),p=URL.createObjectURL(g),l=document.createElement("a");l.href=p,l.target="_blank",l.rel="noopener",document.body.appendChild(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(p),6e4)}function Jt({invoice:e,onClose:u,onSent:g}){const[p,l]=t.useState(e.customer_email||""),[f,s]=t.useState(e.invoice_number?`Invoice ${e.invoice_number}`:"Your invoice"),[n,x]=t.useState(`Hi ${e.customer_name},
12
13Please find your invoice attached for ₹${Number(e.total_amount).toLocaleString("en-IN")}.
14
15Thank you.`),[o,A]=t.useState(!1),[c,m]=t.useState(null),v=async()=>{var N,E;if(!p.trim()){m("Recipient email is required.");return}A(!0),m(null);try{const O=await S(`/ar-invoices/${e.id}/send`,{method:"POST",body:JSON.stringify({recipient_email:p.trim(),subject:f.trim()||void 0,message:n.trim()||void 0})});O.success?(O.delivered?k.success(`Invoice ${((N=O.data)==null?void 0:N.invoice_number)||""} handed to the email provider for ${p.trim()}. If it does not arrive, check spam and use “Send again”.`):k.error(`Invoice ${((E=O.data)==null?void 0:E.invoice_number)||""} was issued and posted to the ledger, but delivery failed: ${O.delivery_error||"unknown error"}. It's safe to try sending again.`),g(),u()):m(O.error||"Could not send the invoice.")}catch{m("Could not send the invoice.")}finally{A(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:u,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:103:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"103","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22fixed%20inset-0%20z-50%20flex%20items-center%20justify-center%20bg-black%2F60%20backdrop-blur-sm%20p-4%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("div",{className:"w-full max-w-md max-h-[90vh] overflow-y-auto bg-surface border border-warning-fill/20 rounded-2xl shadow-2xl",onClick:N=>N.stopPropagation(),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:104:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"104","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-full%2
150max-w-md%20max-h-%5B90vh%5D%20overflow-y-auto%20bg-surface%20border%20border-warning-fill%2F20%20rounded-2xl%20shadow-2xl%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2 px-5 py-4 border-b border-white/[0.06] sticky top-0 bg-surface","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:105:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"105","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20px-5%20py-4%20border-b%20border-white%2F%5B0.06%5D%20sticky%20top-0%20bg-surface%22%7D",children:[a.jsx(W,{className:"w-4 h-4 text-warning","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:106:10","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"106","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:107:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"107","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Send this invoice?"})]}),a.jsxs("div",{className:"p-5 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:109:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"109","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22p-5%20space-y-3%22%7D",children:[a.jsxs("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] px-3 py-2.5 space-y-1","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:110:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"110","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.06%5D%20px-3%20py-2.5%20space-y-1%22%7D",children:[a.jsx("p",{className:"text-xs text-text-bright","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:111:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"111","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%22%7D",children:e.customer_name}),a.jsxs("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:112:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"112","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:["₹",Number(e.total_amount).toLocaleString("en-IN")]})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:115:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"115","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Send to (email)",a.jsx("input",{value:p,onChange:N=>l(N.target.value),placeholder:"[email protected]",className:"mt-1 w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-warning-fill/40","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:117:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"117","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22customer%40example.com%22%2C%22className%22%3A%22mt-1%20w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
15nded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-warning-fill%2F40%22%7D"})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:125:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"125","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Subject",a.jsx("input",{value:f,onChange:N=>s(N.target.value),className:"mt-1 w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-warning-fill/40","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:127:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"127","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22mt-1%20w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-warning-fill%2F40%22%7D"})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:134:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"134","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Message",a.jsx("textarea",{value:n,onChange:N=>x(N.target.value),rows:5,className:"mt-1 w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-warning-fill/40 resize-none","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:136:12","data-matrix-name":"textarea","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"136","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"textarea","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22rows%22%3A5%2C%22className%22%3A%22mt-1%20w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-warning-fill%2F40%20resize-none%22%7D"})]}),a.jsx("p",{className:"text-[10px] text-text-subtle -mt-1","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:143:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"143","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20-mt-1%22%7D",children:"Your payment details are added underneath automatically, and the invoice PDF is attached."}),a.jsx("div",{className:"rounded-lg bg-warning-fill/[0.06] border border-warning-fill/20 px-3 py-2.5","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:147:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"147","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-warning-fill%2F%5B0.06%5D%20border%20border-warning-fill%2F20%20px-3%20py-2.5%22%7D",children:a.jsxs("p",{className:"text-[11px] text-amber-200/90 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:148:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"148","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%20leading-relaxed%22%7D",children:[a.jsx("strong",{"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:149:14","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"149","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"strong",children:"This is the point of no return."})," Sending permanently assigns this invoice a real, sequential invoice number — it can never be reused or renumbered — and emails a real PDF to the address above right now. This cannot be undone; a mistake here needs a credit note or a correcting entry later, not an edit."]})}),c&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:156:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"156","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:c}),a.jsxs("div",{className:"flex items-center gap-2 pt-1","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:157:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"157","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20pt-1%22%7D",children:[a.jsx(j,{size:"sm",variant:"destructive",loading:o,disabled:!p.trim(),leftIcon:Da,onClick:v,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:158:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"158","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22destructive%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22disabled%22%3A%22%5BUnaryExpression%5D%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Send it — cannot be undone"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:u,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:161:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"161","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})]})})}function Yt({invoice:e,onClose:u,onVoided:g}){const[p,l]=t.useState(""),[f,s]=t.useState(!1),[n,x]=t.useState(null),o=async()=>
15{if(p.trim().length<3){x("Please say why this is being cancelled.");return}s(!0),x(null);try{const A=await S(`/ar-invoices/${e.id}/void`,{method:"POST",body:JSON.stringify({reason:p.trim()})});A.success?(k.success(`Invoice ${e.invoice_number||""} cancelled — a reversing entry was posted to your books.`),g(),u()):x(A.error||"Could not cancel it.")}catch{x("Could not cancel it.")}finally{s(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:u,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:194:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"194","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22fixed%20inset-0%20z-50%20flex%20items-center%20justify-center%20bg-black%2F60%20backdrop-blur-sm%20p-4%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("div",{className:"w-full max-w-md bg-surface border border-warning-fill/20 rounded-2xl shadow-2xl",onClick:A=>A.stopPropagation(),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:195:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"195","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-full%20max-w-md%20bg-surface%20border%20border-warning-fill%2F20%20rounded-2xl%20shadow-2xl%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2 px-5 py-4 border-b border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:196:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"196","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20px-
155%20py-4%20border-b%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsx(Za,{className:"w-4 h-4 text-warning","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:197:10","data-matrix-name":"Ban","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"197","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Ban","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:198:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"198","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Cancel this invoice?"})]}),a.jsxs("div",{className:"p-5 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:200:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"200","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22p-5%20space-y-3%22%7D",children:[a.jsxs("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] px-3 py-2.5 space-y-1","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:201:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"201","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.06%5D%20px-3%20py-2.5%20space-y-1%22%7D",children:[a.jsx("p",{className:"text-xs text-text-bright","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:202:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"202","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%22%7D",children:e.customer_name}),a.jsxs("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:203:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"203","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:["₹",Number(e.total_amount).toLocaleString("en-IN"),e.invoice_number&&a.jsxs("span",{className:"text-text-subtle font-normal","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:205:41","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"205","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20font-normal%22%7D",children:[" · ",e.invoice_number]})]})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:209:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"209","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Why is it being cancelled?",a.jsx("input",{value:p,onChange:A=>l(A.target.value),placeholder:"e.g. wrong amount, customer cancelled the order",className:"mt-1 w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-warning-fill/40","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:211:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"211","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22e.g.%20wrong%20amount%2C%20customer%20cancelled%20the%20order%22%2C%22className%22%3A%22mt-1%20w-full%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
15nded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-warning-fill%2F40%22%7D"})]}),a.jsx("div",{className:"rounded-lg bg-warning-fill/[0.06] border border-warning-fill/20 px-3 py-2.5","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:218:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"218","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-warning-fill%2F%5B0.06%5D%20border%20border-warning-fill%2F20%20px-3%20py-2.5%22%7D",children:a.jsx("p",{className:"text-[11px] text-amber-200/90 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:219:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"219","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%20leading-relaxed%22%7D",children:"The invoice and its number stay on record — they are never deleted, because a gap in a numbered sequence is what a GST audit looks for. A reversing entry is posted so your books no longer show this as money owed. Your customer is not told automatically."})}),n&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:226:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"226","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:n}),a.jsxs("div",{className:"flex items-center gap-2 pt-1","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:227:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"227","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20pt-1%22%7D",children:[a.jsx(j,{size:"sm",variant:"destructive",loading:f,disabled:p.trim().length<3,leftIcon:Za,onClick:o,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:228:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"228","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22destructive%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel this invoice"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:u,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:231:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"231","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Keep it"})]})]})]})})}function Vt(){const[e,u]=t.useState([]),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState(null),[x,o]=t.useState(null),[A,c]=t.useState(null),[m,v]=t.useState(""),[N,E]=t.useState(!1),[O,D]=t.useState(null),[Q,r]=t.useState(null),h=t.useCallback(async()=>{p(!0);const i=await S("/ar-invoices?limit=100");i.success&&Array.isArray(i.data)&&u(i.data),p(!1)},[]);t.useEffect(()=>{h()},[h]);const B=async i=>{r(i);try{await Wt(i)}catch{k.error("Could not load the preview.")}finally{r(null)}},w=async i=>{const d=await S(`/ar-invoices/${i}`);d.success&&d.data?(f(!1),n(d.data)):k.error("Could not open that invoice.")},_=async i=>{if(!window.confirm(`Delete this draft for ${i.customer_name}? It has no invoice number yet, so nothing is left behind.`))return;const d=await S(`/ar-invoices/${i.id}`,{method:"DELETE"});d.success?(k.success("Draft deleted."),h()):k.error(d.error||"Could not delete it.")};return a.jsxs("div",{className:"rounded-2xl border border-white/[0.06] bg-surface/60 p-5","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:282:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"282","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-2xl%20border%20border-white%2F%5B0.06%5D%20bg-surface%2F60%20p-5%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:283:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"283","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20gap-3%20mb-3%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:284:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"284","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:285:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"285","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Qa,{className:"h-4 w-4 text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:285:82","data-matrix-name":"FileText","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"285","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"FileText","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-accent-bright%22%7D"})," Invoices you send"]}),a.jsx("p",{className:"mt-0.5 text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:286:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"286","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-0.5%20text-%5B11px%5D%20text-text-subtle%22%7D",children:"Create a draft, preview the exact PDF, then send it — a real invoice number is only assigned when you send."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:288:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"288","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:h,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:289:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"289","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:X,onClick:()=>f(!0),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:290:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"290","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Create invoice"})]})]}),g&&e.length===0&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:294:43","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"294","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Loading…"}),!g&&e.length===0&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:296:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"296","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"No invoices yet. Create a draft, preview it, then send it to a real customer."}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:299:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"299","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:e.map(i=>a.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-white/[0.04] bg-white/[0.02] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:301:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"301","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-3%20rounded-lg%20border%20border-white%2F%5B0.04%5D%20bg-white%2F%5B0.02%5D%20px-3%20py-2%22%7D",children:[a.jsx("span",{className:`inline-flex rounded-md px-1.5 py-0.5 text-[10px] font-medium ${Ie[i.status]||Ie.draft}`,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:302:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"302","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:i.status}),a.jsxs("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:303:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"303","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:[a.jsxs("p",{className:"truncate text-xs text-text-bright","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:304:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"304","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22truncate%20text-xs%20text-text-bright%22%7D",children:[i.customer_name,i.invoice_number&&a.jsxs("span",{className:"text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:306:39","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"306","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%22%7D",children:[" · ",i.invoice_number]}),!i.invoice_number&&a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:307:40","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"307","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:" · no number yet"})]}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:309:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"309","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["₹",Number(i.total_amount).toLocaleStr
15ing("en-IN")," · ",i.issue_date,i.status==="issued"&&!i.sent_at&&a.jsx("span",{className:"text-warning","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:311:60","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"311","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-warning%22%7D",children:" · not yet delivered"})]})]}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:Je,loading:Q===i.id,onClick:()=>B(i.id),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:314:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"314","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Preview"}),i.status==="draft"&&a.jsxs(a.Fragment,{children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:ae,onClick:()=>w(i.id),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:317:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"317","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Edit"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:la,onClick:()=>_(i),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:318:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"318","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Delete"})]}),i.status!=="void"&&a.jsx(j,{size:"sm",variant:"secondary",leftIcon:Da,onClick:()=>D(i),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:322:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"322","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:i.status==="draft"?"Send":i.sent_at?"Send again":"Retry send"}),(i.status==="issued"||i.status==="paid")&&a.jsx(j,{size:"sm",variant:"ghost",leftIcon:Za,onClick:()=>o(i),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:327:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"327","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"}),i.status==="issued"&&a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>{c(i),v("")},"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:332:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"332","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Write off"})]},i.id))}),(l||s)&&a.jsx(Ut,{existing:s,onClose:()=>{f(!1),n(null)},onSaved:()=>{f(!1),n(null),h()},"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:339:8","data-matrix-name":"InvoiceEditor","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"339","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"InvoiceEditor","data-component-content":"%7B%22existing%22%3A%22%5BIdentifier%5D%22%2C%22onClose%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onSaved%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),O&&a.jsx(Jt,{invoice:O,onClose:()=>D(null),onSent:h,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:345:21","data-matrix-name":"SendConfirmModal","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"345","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"SendConfirmModal","data-component-content":"%7B%22invoice%22%3A%22%5BIdentifier%5D%22%2C%22onClose%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onSent%22%3A%22%5BIdentifier%5D%22%7D"}),x&&a.jsx(Yt,{invoice:x,onClose:()=>o(null),onVoided:h,"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:346:18","data-matrix-name":"VoidConfirmModal","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"346","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"VoidConfirmModal","data-component-content":"%7B%22invoice%22%3A%22%5BIdentifier%5D%22%2C%22onClose%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onVoided%22%3A%22%5BIdentifier%5D%22%7D"}),A&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:()=>c(null),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:352:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"352","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22fixed%20inset-0%20z-50%20flex%20items-center%20justify-center%20bg-black%2F60%20backdrop-blur-sm%20p-4%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:a.jsxs("div",{className:"w-full max-w-md bg-surface border border-white/[0.08] rounded-2xl shadow-2xl p-5",onClick:i=>i.stopPropagation(),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:353:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"353","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-full%2
150max-w-md%20bg-surface%20border%20border-white%2F%5B0.08%5D%20rounded-2xl%20shadow-2xl%20p-5%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsxs("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:354:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"354","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:["Write off ",A.invoice_number||"this invoice"]}),a.jsxs("p",{className:"text-[11px] text-text-muted mt-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:355:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"355","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mt-2%20leading-relaxed%22%7D",children:[A.customer_name," owes ₹",Number(A.total_amount).toLocaleString("en-IN")," and you have decided they are not going to pay. The sale stays in your books — it really happened — and the amount becomes a bad debt expense."]}),a.jsx("div",{className:"mt-3 px-3 py-2.5 rounded-lg bg-warning-fill/[0.07] border border-warning-fill/20","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:359:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"359","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20px-3%20py-2.5%20rounded-lg%20bg-warning-fill%2F%5B0.07%5D%20border%20border-warning-fill%2F20%22%7D",children:a.jsx("p",{className:"text-[11px] text-amber-100/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:360:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"360","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-100%2F80%20leading-relaxed%22%7D",children:"The GST on this invoice stays payable. Indian GST has no bad-debt relief, so writing the debt off does not recover tax you have already declared. To take the sale back instead, use Cancel."})}),a.jsxs("label",{className:"block text-[11px] text-text-muted mt-3","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:365:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"365","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B11px%5D%20text-text-muted%20mt-3%22%7D",children:["Why are you writing it off?",a.jsx("input",{value:m,onChange:i=>v(i.target.value),placeholder:"e.g. customer wound up, untraceable after 12 months",className:"w-full mt-1 bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:367:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"367","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22e.g.%20customer%20wound%20up%2C%20untraceable%20after%2012%20months%22%2C%22className%22%3A%22w-full%20mt-1%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("span",{className:"block text-[10px] text-text-faint mt-1","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:373:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"373","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-faint%20mt-1%22%7D",children:"This is the first thing an auditor asks about, and it goes on the ledger entry."})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-4","data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:377:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"377","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20mt-4%22%7D",children:[a.jsx(j,{size:"sm",variant:"destructive",loading:N,disabled:m.trim().length<3,onClick:async()=>{E(!0);
15try{const i=await S(`/ar-invoices/${A.id}/write-off`,{method:"POST",body:JSON.stringify({reason:m.trim()})});i.success?(k.success("Written off."),i.note&&k.error(i.note),c(null),await h()):k.error(i.error||"Could not write it off.")}catch{k.error("Could not write it off.")}finally{E(!1)}},"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:378:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"378","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22destructive%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Write it off"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>c(null),"data-matrix-id":"src/pages/dashboard/personas/ArInvoicesPanel.tsx:398:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ArInvoicesPanel.tsx","data-component-line":"398","data-component-file":"ArInvoicesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]})]})})]})}const qa=e=>`₹${Math.round(e).toLocaleString("en-IN")}`,Xt=["current","d1_30","d31_60","d61_90","d90_plus"];function Zt(){const[e,u]=t.useState(null),[g,p]=t.useState(!1),[l,f]=t.useState(null),s=async()=>{p(!0),f(null);try{const n=await S("/v1/accounting/aging");n.success&&n.data?u(n.data):f(n.error||"Could not load aging report")}catch{f("Could not load aging report.")}finally{p(!1)}};return t.useEffect(()=>{s()},[]),a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:37:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"37","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:38:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"38","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:39:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"39","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(ma,{className:"w-4 h-4 text-warning","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:40:10","data-matrix-name":"Clock","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"40","data-component-file":"AgingReport.tsx","data-component-name":"Clock","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:41:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"41","data-component-file":"AgingReport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Receivables aging"})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:43:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"43","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(ge,{type:"invoices",label:"Import invoices",onImported:()=>void s(),"data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:44:10","data-matrix-name":"ImportData","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"44","data-component-file":"AgingReport.tsx","data-component-name":"ImportData","data-component-content":"%7B%22type%22%3A%22invoices%22%2C%22label%22%3A%22Import%20invoices%22%2C%22onImported%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"secondary",leftIcon:H,loading:g,onClick:s,"data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:45:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"45","data-component-file":"AgingReport.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]})]}),l&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:48:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"48","data-component-file":"AgingReport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:l}),e&&e.totals.item_count===0&&!l&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:50:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"50","data-component-file":"AgingReport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"No unpaid invoices to age. Record receivables and they'll bucket here."}),e&&e.totals.item_count>0&&a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:53:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"53","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("div",{className:"grid grid-cols-5 ga
15p-1.5","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:54:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"54","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-5%20gap-1.5%22%7D",children:Xt.map(n=>{const x=e.buckets[n],o=n==="d61_90"||n==="d90_plus";return a.jsxs("div",{className:`rounded-lg border p-2 text-center ${o&&x.amount>0?"border-danger/30 bg-danger/5":"border-white/[0.06] bg-white/[0.02]"}`,"data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:59:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"59","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("p",{className:"text-[9px] text-text-subtle uppercase","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:60:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"60","data-component-file":"AgingReport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20text-text-subtle%20uppercase%22%7D",children:x.label}),a.jsx("p",{className:`text-xs font-bold tabular-nums ${o&&x.amount>0?"text-danger":"text-white"}`,"data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:61:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"61","data-component-file":"AgingReport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:qa(x.amount)}),a.jsx("p",{className:"text-[9px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:62:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"62","data-component-file":"AgingReport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20text-text-faint%22%7D",children:x.count})]},n)})}),a.jsxs("div",{className:"flex items-center gap-4 text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:67:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"67","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-4%20text-%5B11px%5D%20text-text-muted%22%7D",children:[a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:68:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"68","data-component-file":"AgingReport.tsx","data-component-name":"span",children:["Outstanding: ",a.jsx("strong",{className:"text-white","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:68:31","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"68","data-component-file":"AgingReport.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22text-white%22%7D",children:qa(e.totals.total_outstanding)})]}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:69:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"69","data-component-file":"AgingReport.tsx","data-component-name":"span",children:["Overdue: ",a.jsx("strong",{className:"text-warning","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:69:27","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"69","data-component-file":"AgingReport.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22text-warning%22%7D",children:qa(e.totals.total_overdue)})," (",Math.round(e.totals.overdue_ratio*100),"%)"]})]}),e.by_party.length>0&&a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:72:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"72","data-component-file":"AgingReport.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] text-text-subtle uppercase tracking-wide mb-1","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:73:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"73","data-component-file":"AgingReport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20uppercase%20tracking-wide%20mb-1%22%7D",children:"Top overdue by party"}),a.jsx("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:74:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"74","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:e.by_party.slice(0,5).map((n,x)=>a.jsxs("div",{className:"flex items-center justify-between text-xs","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:76:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"76","data-component-file":"AgingReport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20text-xs%22%7D",children:[a.jsx("span",{className:"text-text-soft truncate max-w-[200px]","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:77:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"77","data-component-file":"AgingReport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%20truncate%20max-w-%5B200px%5D%22%7D",children:n.party}),a.jsx("span",{className:"tabular-nums text-warning","data-matrix-id":"src/pages/dashboard/personas/AgingReport.tsx:78:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/AgingReport.tsx","data-component-line":"78","data-component-file":"AgingReport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22tabular-nums%20text-warning%22%7D",children:qa(n.overdue)})]},x))})]})]})]})}const Kt=["NOS","PCS","HRS","DAY","MTR","KG","LTR","SET","BOX"],ia="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]";function an({initial:e,gstRegistered:u,onCancel:g,onSaved:p}){const[l,f]=t.useState((e==null?void 0:e.name)||""),[s,n]=t.useState((e==null?void 0:e.description)||""),[x,o]=t.useState((e==null?void 0:e.hsn_sac)||""),[A,c]=t.useState(e?String(e.rate):""),[m,v]=t.useState(e?String(e.gst_rate):"18"),[N,E]=t.useState((e==null?void 0:e.unit)||"NOS"),[O,D]=t.useState((e==null?void 0:e.is_service)??!0),[Q,r]=t.useState((e==null?void 0:e.track_inventory)??!1),[h,B]=t.useState((e==null?void 0:e.purchase_rate)==null?"":String(e.purchase_rate)),[w,_]=t.useState(!1),[i,d]=t.useState(null),P=async()=>{var C;if(!l.trim()){d("A name is required.");return}if(!(Number(A)>=0)){d("Rate must be a number.");return}_(!0),d(null);
15try{const y={name:l.trim(),description:s.trim()||void 0,hsn_sac:x.trim()||void 0,rate:Number(A),gst_rate:u===!1?0:Number(m)||0,unit:N,is_service:O,track_inventory:O?!1:Q,purchase_rate:h.trim()===""?null:Number(h)},b=e?await S(`/finance-items/${e.id}`,{method:"PATCH",body:JSON.stringify(y)}):await S("/finance-items",{method:"POST",body:JSON.stringify(y)});b.success?(k.success(e?"Saved.":"Added."),p()):d(b.error||((C=b.errors)==null?void 0:C[0])||"Could not save.")}catch{d("Could not save.")}finally{_(!1)}};return a.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.02] p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:73:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"73","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:74:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"74","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:75:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"75","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:e?"Edit":"Add a product or service"}),a.jsx("button",{onClick:g,className:"p-1 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","aria-label":"Close",title:"Close","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:76:8","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"76","data-component-file":"ItemsPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22p-1%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%2C%22title%22%3A%22Close%22%7D",children:a.jsx(oa,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:76:151","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"76","data-component-file":"ItemsPanel.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"})})]}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:79:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"79","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:l,onChange:C=>f(C.target.value),placeholder:"Name *",className:ia,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:80:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"80","data-component-file":"ItemsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Name%20*%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:x,onChange:C=>o(C.target.value),placeholder:"HSN/SAC code (optional)",className:ia,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:81:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"81","data-component-file":"ItemsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22HSN%2FSAC%20code%20(optional)%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsx("input",{value:s,onChange:C=>n(C.target.value),placeholder:"Description that appears on the invoice (optional)",className:ia,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:83:6","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"83","data-component-file":"ItemsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Description%20that%20appears%20on%20the%20invoice%20(optional)%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:85:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"85","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20sm%3Agrid-cols-4%20gap-2%22%7D",children:[a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:86:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"86","data-component-file":"ItemsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Rate ₹",a.jsx("input",{value:A,onChange:C=>c(C.target.value),inputMode:"decimal",placeholder:"0.00",className:`${ia} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:88:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"88","data-component-file":"ItemsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%220.00%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:90:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"90","data-component-file":"ItemsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["GST %",a.jsx("input",{value:u===!1?"":m,onCh
15ange:C=>v(C.target.value),disabled:u===!1,inputMode:"decimal",placeholder:u===!1?"No GST":"18",title:u===!1?"Your business has no GSTIN on file, so it cannot charge GST.":void 0,className:`${ia} mt-1 disabled:opacity-40 disabled:cursor-not-allowed`,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:92:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"92","data-component-file":"ItemsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BConditionalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22%5BConditionalExpression%5D%22%2C%22title%22%3A%22%5BConditionalExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:102:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"102","data-component-file":"ItemsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Unit",a.jsx("select",{value:N,onChange:C=>E(C.target.value),className:`${ia} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:104:10","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"104","data-component-file":"ItemsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:Kt.map(C=>a.jsx("option",{value:C,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:105:30","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"105","data-component-file":"ItemsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%7D",children:C},C))})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:108:8","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"108","data-component-file":"ItemsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Type",a.jsxs("select",{value:O?"service":"goods",onChange:C=>D(C.target.value==="service"),className:`${ia} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:110:10","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"110","data-component-file":"ItemsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BConditionalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("option",{value:"service","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:111:12","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"111","data-component-file":"ItemsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22service%22%7D",children:"Service"}),a.jsx("option",{value:"goods","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:112:12","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"112","data-component-file":"ItemsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22goods%22%7D",children:"Goods"})]})]})]}),!O&&a.jsxs("div",{className:"rounded-lg border border-white/[0.08] bg-white/[0.02] p-3 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:120:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"120","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-3%20space-y-3%22%7D",children:[a.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:121:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"121","data-component-file":"ItemsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2.5%20cursor-pointer%22%7D",children:[a.jsx("input",{type:"checkbox",checked:Q,onChange:C=>r(C.target.checked),className:"mt-0.5 accent-accent","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:122:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"122","data-component-file":"ItemsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22mt-0.5%20accent-accent%22%7D"}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:124:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"124","data-component-file":"ItemsPanel.tsx","data-component-name":"span",children:[a.jsx("span",{className:"text-xs text-white","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:125:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"125","data-component-file":"ItemsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%22%7D",children:"Track stock for this item"}),a.jsx("span",{className:"block text-[11px] text-text-subtle mt-0.5 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:126:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"126","data-component-file":"ItemsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22block%20text-%5B11px%5D%20text-text-subtle%20mt-0.5%20leading-relaxed%22%7D",children:"Buying it adds to stock instead of going straight to expenses, and selling it charges what those units actually cost. Leave this off for things you buy and use up, like packaging — a stock list full of items nobody counts is worse than none."})]})]}),Q&&a.jsxs("label",{className:"block text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:135:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"135","data-component-file":"ItemsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B11px%5D%20text-text-muted%22%7D",children:["What you usually pay for it (per ",N.toLowerCase(),")",a.jsx("input",{value:h,onChange:C=>B(C.target.value),inputMode:"decimal",placeholder:"Optional",className:`${ia} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:137:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"137","data-component-file":"ItemsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Optional%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("span",{className:"block text-[10px] text-text-faint mt-1","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:139:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"139","data-component-file":"ItemsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-faint%20mt-1%22%7D",children:"Used when a supplier's bill names this item but no price. Once you have bought some, the real average cost takes over."})]}),(e==null?void 0:e.track_inventory)&&a.jsx("p",{className:"text-[10px] text-warning-bright/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:148:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"148","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-warning-bright%2F80%20leading-relaxed%22%7D",children:"Once stock has moved, tracking cannot simply be switched off — the value already in Inventory would stay there while future sales stopped costing anything. Adjust its stock to zero instead."})]}),i&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:157:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"157","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:i}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:158:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"158","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"primary",loading:w,onClick:P,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:159:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"159","data-component-file":"ItemsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:e?"Save changes":"Add"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:g,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:160:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"160","data-component-file":"ItemsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})}function en(){const[e,u]=t.useState([]),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState(null),[x,o]=t.useState(null),A=t.useCallback(async()=>{p(!0);try{const m=await S("/finance-items?limit=200");m.success&&Array.isArray(m.data)&&u(m.data)}finally{p(!1)}},[]);t.useEffect(()=>{A(),S("/ar-invoices/issuer-status").then(m=>{var v;m.success&&o(!!((v=m.data)!=null&&v.gst_registered))}).catch(()=>{})},[A]);const c=async m=>{if(!window.confirm(`Remove "${m.name}" from your list? Invoices that already use it are not affected.`))return;const v=await S(`/finance-items/${m.id}`,{method:"DELETE"});v.success?(k.success("Removed."),A()):k.error(v.error||"Could not remove.")};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:196:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"196","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
15nded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:197:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"197","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:198:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"198","data-component-file":"ItemsPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:199:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"199","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(xt,{className:"h-4 w-4 text-violet-400","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:200:12","data-matrix-name":"Package","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"200","data-component-file":"ItemsPanel.tsx","data-component-name":"Package","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-violet-400%22%7D"})," Products & services"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:202:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"202","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"What you sell. Pick one on an invoice and its rate, HSN/SAC and GST fill in for you."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:206:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"206","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:A,"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:207:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"207","data-component-file":"ItemsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:X,onClick:()=>{n(null),f(!0)},"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:208:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"208","data-component-file":"ItemsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Add"})]})]}),(l||s)&&a.jsx(an,{initial:s||void 0,gstRegistered:x,onCancel:()=>{f(!1),n(null)},onSaved:()=>{f(!1),n(null),A()},"data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:213:8","data-matrix-name":"ItemForm","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"213","data-component-file":"ItemsPanel.tsx","data-component-name":"ItemForm","data-component-content":"%7B%22initial%22%3A%22%5BLogicalExpression%5D%22%2C%22gstRegistered%22%3A%22%5BIdentifier%5D%22%2C%22onCancel%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onSaved%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),!g&&e.length===0&&!l&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:222:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"222","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Nothing added yet. Add what you sell so invoicing is a few clicks."}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:225:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"225","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:e.map(m=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-white/[0.02] border border-white/[0.05]","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:227:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"227","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-3%20px-3%20py-2%20rounded-lg%20bg-white%2F%5B0.02%5D%20border%20border-white%2F%5B0.05%5D%22%7D",children:[a.jsxs("div",{className:"flex-1 min-w-0","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:228:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"228","data-component-file":"ItemsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-1%20min-w-0%22%7D",children:[a.jsx("p",{className:"text-xs font-medium text-white truncate","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:229:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"229","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-medium%20text-white%20truncate%22%7D",children:m.name}),a.jsxs("p",{className:"text-[11px] text-text-subtle truncate","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:230:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"230","data-component-file":"ItemsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20truncate%22%7D",children:["₹",Number(m.rate).toLocaleStr
15ing("en-IN")," / ",m.unit,m.gst_rate>0?` · ${m.gst_rate}% GST`:"",m.hsn_sac?` · ${m.hsn_sac}`:""]})]}),a.jsx("button",{onClick:()=>{f(!1),n(m)},title:"Edit",className:"p-1.5 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:236:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"236","data-component-file":"ItemsPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22title%22%3A%22Edit%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%7D",children:a.jsx(ae,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:237:14","data-matrix-name":"Pencil","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"237","data-component-file":"ItemsPanel.tsx","data-component-name":"Pencil","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})}),a.jsx("button",{onClick:()=>c(m),title:"Remove",className:"p-1.5 rounded-lg text-text-subtle hover:text-danger hover:bg-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:239:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"239","data-component-file":"ItemsPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22title%22%3A%22Remove%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-danger%20hover%3Abg-white%2F%5B0.06%5D%22%7D",children:a.jsx(la,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ItemsPanel.tsx:240:14","data-matrix-name":"Trash2","data-component-path":"src/pages/dashboard/personas/ItemsPanel.tsx","data-component-line":"240","data-component-file":"ItemsPanel.tsx","data-component-name":"Trash2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})})]},m.id))})]})}const ga="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]";function tn(){const[e,u]=t.useState({bank_name:"",bank_account_name:"",bank_account_number:"",bank_ifsc:"",upi_id:"",payment_link_url:"",payment_instructions:""}),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState(!1),[x,o]=t.useState(null),A=t.useCallback(async()=>{p(!0);try{const v=await S("/finance-settings/payment-details");if(v.success&&v.data){if(v.data.no_office){n(!0);return}const N=v.data;u({bank_name:N.bank_name||"",bank_account_name:N.bank_account_name||"",bank_account_number:N.bank_account_number||"",bank_ifsc:N.bank_ifsc||"",upi_id:N.upi_id||"",payment_link_url:N.payment_link_url||"",payment_instructions:N.payment_instructions||""})}}finally{p(!1)}},[]);t.useEffect(()=>{A()},[A]);const c=async()=>{const v=e.payment_link_url.trim();if(v&&!/^https?:\/\//i.test(v)){o("The payment link must start with https:// — a half-typed link on an invoice is worse than none.");return}f(!0),o(null);try{const N=await S("/finance-settings/payment-details",{method:"PATCH",body:JSON.stringify(e)});N.success?k.success("Saved — this appears on invoices from now on."):o(N.error||"Could not save.")}catch{o("Could not save.")}finally{f(!1)}},m=!e.bank_account_number.trim()&&!e.upi_id.trim()&&!e.payment_link_url.trim()&&!e.payment_instructions.trim();return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:80:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"80","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:81:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"81","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:82:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"82","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:83:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"83","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(ht,{className:"h-4 w-4 text-warning","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:84:12","data-matrix-name":"Wallet","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"84","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"Wallet","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-warning%22%7D"})," How customers pay you"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:86:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"86","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Printed on every invoice. Use whatever you already have — we do not process the payment."})]}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:A,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:90:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"90","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]}),s?a.jsxs("p",{className:"text-xs text-warning/90","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:94:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"94","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-warning%2F90%22%7D",children:["Add your office first under ",a.jsx("strong",{"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:95:38","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"95","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"strong",children:"HR & Payroll → Company"}),", then set this up."]}):a.jsxs(a.Fragment,{children:[m&&!g&&a.jsx("div",{className:"rounded-lg bg-warning-fill/[0.06] border border-warning-fill/20 px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:100:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"100","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-warning-fill%2F%5B0.06%5D%20border%20border-warning-fill%2F20%20px-3%20py-2%22%7D",children:a.jsx("p",{className:"text-[11px] text-amber-200/90","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:101:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"101","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%22%7D",children:"Nothing set yet, so your invoices currently tell the customer no way to pay you."})}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:107:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"107","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted mb-1.5","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:108:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"108","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%20mb-1.5%22%7D",children:"Bank transfer"}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:109:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"109","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:e.bank_name,onChange:v=>u({...e,bank_name:v.target.value}),placeholder:"Bank name",className:ga,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:110:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"110","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Bank%20name%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:e.bank_account_name,onChange:v=>u({...e,bank_account_name:v.target.value}),placeholder:"Account holder name",className:ga,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:111:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"111","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Account%20holder%20name%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:e.bank_account_number,onChange:v=>u({...e,bank_account_number:v.target.value}),placeholder:"Account number",className:ga,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:112:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"112","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Account%20number%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:e.bank_ifsc,onChange:v=>u({...e,bank_ifsc:v.target.value.toUpperCase()}),placeholder:"IFSC",className:ga,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:113:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"113","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22IFSC%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]})]}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:117:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"117","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:118:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"118","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["UPI ID",a.jsx("input",{value:e.upi_id,onChange:v=>u({...e,upi_id:v.target.value}),placeholder:"yourbusiness@okhdfcbank",className:`${ga} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:120:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"120","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22yourbusiness%40okhdfcbank%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:122:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"122","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Your payment link (Razorpay, Paytm, anything)",a.jsx("input",{value:e.payment_link_url,onChange:v=>u({...e,payment_link_url:v.target.value}),placeholder:"https://rzp.io/l/yourlink",className:`${ga} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:124:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"124","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22https%3A%2F%2Frzp.io%2Fl%2Fyourlink%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]})]}),a.jsx("p",{className:"text-[10px] text-text-subtle -mt-1","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:127:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"127","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20-mt-1%22%7D",children:"Paste a link from whichever provider you already use — it appears on the invoice as a clickable “Pay online”. Zapheit never handles the money."}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:132:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"132","data
15-component-file":"PaymentDetailsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Anything else the customer should know",a.jsx("input",{value:e.payment_instructions,onChange:v=>u({...e,payment_instructions:v.target.value}),placeholder:"e.g. cheques payable to …, quote the invoice number as reference",className:`${ga} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:134:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"134","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22e.g.%20cheques%20payable%20to%20%E2%80%A6%2C%20quote%20the%20invoice%20number%20as%20reference%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),x&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:137:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"137","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:x}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:Ta,loading:l,onClick:c,"data-matrix-id":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx:138:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentDetailsPanel.tsx","data-component-line":"138","data-component-file":"PaymentDetailsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Save"})]})]})}const ke=()=>({item_id:"",description:"",hsn_sac:"",quantity:"1",rate:"",gst_rate:"18"}),ta="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]",ca=e=>`₹${Number(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;async function nn(e){const u=await fetch(`${Ka}/credit-notes/${e}/preview`,{headers:await ve()});if(!u.ok)throw new Error("Could not load the preview");const g=URL.createObjectURL(await u.blob()),p=document.createElement("a");p.href=g,p.target="_blank",p.rel="noopener",document.body.appendChild(p),p.click(),p.remove(),setTimeout(()=>URL.revokeObjectURL(g),6e4)}function sn({onClose:e,onCreated:u}){const[g,p]=t.useState([]),[l,f]=t.useState(""),[s,n]=t.useState(null),[x,o]=t.useState([]),[A,c]=t.useState(""),[m,v]=t.useState([ke()]),[N,E]=t.useState(!1),[O,D]=t.useState(null);t.useEffect(()=>{S("/ar-invoices?limit=200").then(w=>{w.success&&Array.isArray(w.data)&&p(w.data.filter(_=>_.status==="issued"||_.status==="paid"))}).catch(()=>{})},[]),t.useEffect(()=>{if(!l){n(null),o([]);return}S(`/credit-notes/headroom/${l}`).then(w=>{w.success&&w.data&&n(w.data)}).catch(()=>n(null)),S(`/ar-invoices/${l}`).then(w=>{var i;const _=w.success&&((i=w.data)==null?void 0:i.line_items)||[];o(_.filter(d=>d.item_id).map(d=>({item_id:d.item_id,description:d.description,quantity:Number(d.quantity),rate:Number(d.rate),gst_rate:Number(d.gst_rate),hsn_sac:d.hsn_sac??null})))}).catch(()=>o([]))},[l]);const Q=(w,_)=>v(i=>i.map((d,P)=>P===w?{...d,..._}:d)),r=m.reduce((w,_)=>{const i=(Number(_.quantity)||0)*(Number(_.rate)||0),d=(s==null?void 0:s.tax_character)==="none"?0:Number(_.gst_rate)||0;return w+i*(1+d/100)},0),h=!!s&&r>s.remaining+.005,B=async()=>{var _;if(!l){D("Choose the invoice this credits.");return}if(A.trim().length<3){D("Say why this credit note is being raised — it goes on the document and into your GST return.");return}const w=m.filter(i=>i.description.trim()&&Number(i.rate)>0&&Number(i.quantity)>0);if(w.length===0){D("Add at least one line with a description, quantity and rate.");return}E(!0),D(null);try{const i=await S("/credit-notes",{method:"POST",body:JSON.stringify({against_invoice_id:l,reason:A.trim(),line_items:w.map(d=>({description:d.description.trim(),hsn_sac:d.hsn_sac.trim()||void 0,item_id:d.item_id||void 0,quantity:Number(d.quantity),rate:Number(d.rate),gst_rate:(s==null?void 0:s.tax_character)==="none"?0:Number(d.gst_rate)||0}))})});i.success?(k.success("Draft credit note created — preview it, then issue it."),u(),e()):D(i.error||((_=i.errors)==null?void 0:_[0])||"Could not create the credit note.")}
15catch{D("Could not create the credit note.")}finally{E(!1)}};return a.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.02] p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:139:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"139","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-white%2F%5B0.08%5D%20bg-white%2F%5B0.02%5D%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:140:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"140","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:141:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"141","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"New credit note"}),a.jsx("button",{onClick:e,className:"p-1 rounded-lg text-text-subtle hover:text-white hover:bg-white/[0.06]","aria-label":"Close",title:"Close","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:142:8","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"142","data-component-file":"CreditNotesPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22p-1%20rounded-lg%20text-text-subtle%20hover%3Atext-white%20hover%3Abg-white%2F%5B0.06%5D%22%2C%22title%22%3A%22Close%22%7D",children:a.jsx(oa,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:142:150","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"142","data-component-file":"CreditNotesPanel.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"})})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:145:6","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"145","data-component-file":"CreditNotesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Against which invoice?",a.jsxs("select",{value:l,onChange:w=>f(w.target.value),className:`${ta} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:147:8","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"147","data-component-file":"CreditNotesPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:148:10","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"148","data-component-file":"CreditNotesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Choose an invoice you have sent…"}),g.map(w=>a.jsxs("option",{value:w.id,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:150:12","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"150","data-component-file":"CreditNotesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[w.invoice_number||"no number"," — ",w.customer_name," — ",ca(w.total_amount)]},w.id))]})]}),g.length===0&&a.jsx("p",{className:"text-[10px] text-warning/90","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:157:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"157","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-warning%2F90%22%7D",children:"No sent invoices yet — a credit note can only be raised against one you have actually issued."}),s&&a.jsxs("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] px-3 py-2 space-y-0.5","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:161:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"161","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.06%5D%20px-3%20py-2%20space-y-0.5%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:162:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"162","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%22%7D",children:["Invoice ",ca(s.invoice_total),s.already_credited>0&&a.jsxs(a.Fragment,{children:[" · already credited ",ca(s.already_credited)]})," ","· ",a.jsxs("strong",{"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:165:19","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"165","data-component-file":"CreditNotesPanel.tsx","data-component-name":"strong",children:["you can credit up to ",ca(s.remaining)]})]}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:167:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"167","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[s.tax_character==="none"?"This invoice charged no GST, so this credit note charges none either.":`This invoice charged ${s.tax_character==="intra"?"CGST + SGST":"IGST"}, so the credit note uses the same heads.`," ","Must be issued by ",s.deadline," under GST."]})]}),a.jsx("input",{value:A,onChange:w=>c(w.target.value),placeholder:"Why? e.g. overcharged one unit, goods returned",className:ta,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:176:6","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"176","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Why%3F%20e.g.%20overcharged%20one%20unit%2C%20goods%20returned%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:178:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"178","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted mb-2","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:179:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"179","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%20mb-2%22%7D",children:"What is being credited"}),a.jsx("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:180:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"180","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:m.map((w,_)=>a.jsxs("div",{className:"grid grid-cols-12 gap-1.5 items-center","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:182:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"182","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-12%20gap-1.5%20items-center%22%7D",children:[x.length>0?a.jsxs("select",{value:w.item_id,onChange:i=>{const d=x.find(P=>P.item_id===i.target.value);if(!d){Q(_,{item_id:""});return}Q(_,{item_id:d.item_id,description:d.description,hsn_sac:d.hsn_sac||"",rate:String(d.rate),gst_rate:String(d.gst_rate)})},className:`col-span-4 ${ta}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:186:16","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"186","data-component-file":"CreditNotesPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:198:18","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"198","data-component-file":"CreditNotesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Something else…"}),x.map(i=>a.jsxs("option",{value:i.item_id,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:199:41","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"199","data-component-file":"CreditNotesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[i.description," (sold ",i.quantity,")"]},i.item_id))]}):a.jsx("input",{value:w.description,onChange:i=>Q(_,{description:i.target.value}),placeholder:"Description",className:`col-span-4 ${ta}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:202:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"202","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Description%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("input",{value:w.hsn_sac,onChange:i=>Q(_,{hsn_sac:i.target.value}),placeholder:"HSN/SAC",className:`col-span-2 ${ta}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:204:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"204","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22HSN%2FSAC%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("input",{value:w.quantity,onChange:i=>Q(_,{quantity:i.target.value}),inputMode:"decimal",placeholder:"Qty",className:`col-span-1 ${ta}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:205:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"205","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Qty%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("input",{value:w.rate,onChange:i=>Q(_,{rate:i.target.value}),inputMode:"decimal",placeholder:"Rate ₹",className:`col-span-2 ${ta}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:206:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"206","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Rate%20%E2%82%B9%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("input",{value:(s==null?void 0:s.tax_character)==="none"?"":w.gst_rate,onChange:i=>Q(_,{gst_rate:i.target.value}),disabled:(s==null?void 0:s.tax_character)==="none",inputMode:"decimal",placeholder:(s==null?void 0:s.tax_character)==="none"?"No GST":"GST %",className:`col-span-2 ${ta} disabled:opacity-40 disabled:cursor-not-allowed`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:207:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"207","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BConditionalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22%5BConditionalExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("button",{onClick:()=>v(i=>i.filter((d,P)=>P!==_)),disabled:m.length===1,className:"col-span-1 flex justify-center text-text-faint hover:text-danger disabled:opacity-30 disabled:cursor-not-allowed","aria-label":"Delete",title:"Delete","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:215:14","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"215","data-component-file":"CreditNotesPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22className%22%3A%22col-span-1%20flex%20justify-center%20text-text-faint%20hover%3Atext-danger%20disabled%3Aopacity-30%20disabled%3Acursor-not-allowed%22%2C%22title%22%3A%22Delete%22%7D",children:a.jsx(la,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:216:16","data-matrix-name":"Trash2","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"216","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Trash2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})})]},_))}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:X,onClick:()=>v(w=>[...w,ke()]),className:"mt-2","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:221:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"221","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%
1522%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22mt-2%22%7D",children:"Add line"})]}),a.jsxs("div",{className:`flex items-center justify-between rounded-lg px-3 py-2 ${h?"bg-danger/[0.08] border border-danger/25":"bg-white/[0.03]"}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:224:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"224","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:225:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"225","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Credit note total (server computes the exact split)"}),a.jsx("p",{className:`text-xs font-semibold ${h?"text-danger":"text-white"}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:226:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"226","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:ca(r)})]}),h&&s&&a.jsxs("p",{className:"text-[11px] text-danger","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:229:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"229","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger%22%7D",children:["That is more than the ",ca(s.remaining)," still creditable on this invoice — you cannot credit more than was charged."]}),O&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:234:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"234","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:O}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:235:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"235","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"primary",loading:N,disabled:h,onClick:B,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:236:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"236","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Save draft"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:e,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:237:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"237","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})}function on({note:e,onClose:u,onIssued:g}){const[p,l]=t.useState(e.customer_email||""),[f,s]=t.useState(`Credit note against invoice ${e.against_invoice_number||""}`.trim()),[n,x]=t.useState(`Hi ${e.customer_name},
16
17Please find attached a credit note for ${ca(e.total_amount)} against invoice ${e.against_invoice_number||""}.
18
19Reason: ${e.reason}
20
21Thank you.`),[o,A]=t.useState(!1),[c,m]=t.useState(null),v=async()=>{var N;if(!p.trim()){m("Recipient email is required.");return}A(!0),m(null);try{const E=await S(`/credit-notes/${e.id}/issue`,{method:"POST",body:JSON.stringify({recipient_email:p.trim(),subject:f.trim()||void 0,message:n.trim()||void 0})});if(E.success){const O=((N=E.data)==null?void 0:N.credit_note_number)||"";E.delivered?k.success(`Credit note ${O} issued and handed to the email provider. If it does not arrive, check spam.`):k.error(`Credit note ${O} was issued and posted to your books, but delivery failed: ${E.delivery_error||"unknown error"}. Safe to try again.`),g(),u()}else m(E.error||"Could not issue the credit note.")}catch{m("Could not issue the credit note.")}finally{A(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:u,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:271:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"271","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22fixed%20inset-0%20z-50%20flex%20items-center%20justify-center%20bg-black%2F60%20backdrop-blur-sm%20p-4%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("div",{className:"w-full max-w-md max-h-[90vh] overflow-y-auto bg-surface border border-warning-fill/20 rounded-2xl shadow-2xl",onClick:N=>N.stopPropagation(),"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:272:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"272","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22w-full%2
210max-w-md%20max-h-%5B90vh%5D%20overflow-y-auto%20bg-surface%20border%20border-warning-fill%2F20%20rounded-2xl%20shadow-2xl%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2 px-5 py-4 border-b border-white/[0.06] sticky top-0 bg-surface","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:273:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"273","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20px-5%20py-4%20border-b%20border-white%2F%5B0.06%5D%20sticky%20top-0%20bg-surface%22%7D",children:[a.jsx(W,{className:"w-4 h-4 text-warning","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:274:10","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"274","data-component-file":"CreditNotesPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:275:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"275","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Issue this credit note?"})]}),a.jsxs("div",{className:"p-5 space-y-3","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:277:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"277","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22p-5%20space-y-3%22%7D",children:[a.jsxs("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] px-3 py-2.5 space-y-1","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:278:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"278","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.06%5D%20px-3%20py-2.5%20space-y-1%22%7D",children:[a.jsx("p",{className:"text-xs text-text-bright","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:279:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"279","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%22%7D",children:e.customer_name}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:280:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"280","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:ca(e.total_amount)}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:281:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"281","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["against invoice ",e.against_invoice_number||"—"]})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:284:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"284","data-component-file":"CreditNotesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Send to (email)",a.jsx("input",{value:p,onChange:N=>l(N.target.value),placeholder:"[email protected]",className:`${ta} mt-1 focus:border-warning-fill/40`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:286:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"286","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22customer%40example.com%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:288:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"288","data-component-file":"CreditNotesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Subject",a.jsx("input",{value:f,onChange:N=>s(N.target.value),className:`${ta} mt-1 focus:border-warning-fill/40`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:290:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"290","data-component-file":"CreditNotesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"block text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:292:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"292","data-component-file":"CreditNotesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%22%7D",children:["Message",a.jsx("textarea",{value:n,onChange:N=>x(N.target.value),rows:5,className:`${ta} mt-1 focus:border-warning-fill/40 resize-none`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:294:12","data-matrix-name":"textarea","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"294","data-component-file":"CreditNotesPanel.tsx","data-component-name":"textarea","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22rows%22%3A5%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsx("div",{className:"rounded-lg bg-warning-fill/[0.06] border border-warning-fill/20 px-3 py-2.5","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:297:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"297","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-warning-fill%2F%5B0.06%5D%20border%20border-warning-fill%2F20%20px-3%20py-2.5%22%7D",children:a.jsxs("p",{className:"text-[11px] text-amber-200/90 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:298:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"298","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%20leading-relaxed%22%7D",children:[a.jsx("strong",{"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:299:14","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"299","data-component-file":"CreditNotesPanel.tsx","data-component-name":"strong",children:"This is the point of no return."})," Issuing permanently assigns a real, sequential credit-note number, posts an entry that reduces what this customer owes in your books, and emails the document to the address above. It cannot be undone."]})}),c&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:305:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"305","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:c}),a.jsxs("div",{className:"flex items-center gap-2 pt-1","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:306:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"306","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20pt-1%22%7D",children:[a.jsx(j,{size:"sm",variant:"destructive",loading:o,disabled:!p.trim(),leftIcon:Da,onClick:v,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:307:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"307","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22destructive%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22disabled%22%3A%22%5BUnaryExpression%5D%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Issue it — cannot be undone"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:u,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:310:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"310","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})]})})}function dn(){const[e,u]=t.useState([]),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState(null),[x,o]=t.useState(null),A=t.useCallback(async()=>{p(!0);try{const v=await S("/credit-notes?limit=100");v.success&&Array.isArray(v.data)&&u(v.data)}finally{p(!1)}},[]);t.useEffect(()=>{A()},[A]);const c=async v=>{o(v);try{await nn(v)}catch{k.error("Could not load the preview.")}finally{o(null)}},m=async v=>{if(!window.confirm(`Delete this draft credit note for ${v.customer_name}? It has no number yet, so nothing is left behind.`))return;const N=await S(`/credit-notes/${v.id}`,{method:"DELETE"});N.success?(k.success("Draft deleted."),A()):k.error(N.error||"Could not delete it.")};return a.jsxs("div",{className:"rounded-2xl border border-white/[0.06] bg-surface/60 p-5","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:349:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"349","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-2xl%20border%20border-white%2F%5B0.06%5D%20bg-surface%2F60%20p-5%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:350:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"350","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20gap-3%20mb-3%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:351:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"351","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:352:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"352","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(ut,{className:"h-4 w-4 text-danger","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:353:12","data-matrix-name":"FileMinus","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"353","data-component-file":"CreditNotesPanel.tsx","data-component-name":"FileMinus","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-danger%22%7D"})," Credit notes"]}),a.jsx("p",{className:"mt-0.5 text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:355:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"355","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-0.5%20text-%5B11px%5D%20text-text-subtle%22%7D",children:"Reduce what a customer owes on an invoice you already sent — a wrong amount, a return, a discount after the fact."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:359:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"359","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:A,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:360:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"360","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:X,onClick:()=>f(!0),"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:361:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"361","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"New credit note"})]})]}),l&&a.jsx(sn,{onClose:()=>f(!1),onCreated:A,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:365:17","data-matrix-name":"NewCreditNoteForm","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"365","data-component-file":"CreditNotesPanel.tsx","data-component-name":"NewCreditNoteForm","data-component-content":"%7B%22onClose%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onCreated%22%3A%22%5BIdentifier%5D%22%7D"}),!g&&e.length===0&&!l&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:368:8","data-matrix-name":"p","d
21ata-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"368","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"None yet. Raise one when an invoice you have already sent turns out to be too high."}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:371:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"371","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:e.map(v=>a.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-white/[0.04] bg-white/[0.02] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:373:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"373","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-3%20rounded-lg%20border%20border-white%2F%5B0.04%5D%20bg-white%2F%5B0.02%5D%20px-3%20py-2%22%7D",children:[a.jsx("span",{className:`inline-flex rounded-md px-1.5 py-0.5 text-[10px] font-medium ${v.status==="issued"?"bg-success-fill/15 text-success-bright":"bg-slate-500/15 text-text-soft"}`,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:374:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"374","data-component-file":"CreditNotesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:v.status}),a.jsxs("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:377:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"377","data-component-file":"CreditNotesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:[a.jsxs("p",{className:"truncate text-xs text-text-bright","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:378:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"378","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22truncate%20text-xs%20text-text-bright%22%7D",children:[v.customer_name,v.credit_note_number&&a.jsxs("span",{className:"text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:380:41","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"380","data-component-file":"CreditNotesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%22%7D",children:[" · ",v.credit_note_number]}),!v.credit_note_number&&a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:381:42","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"381","data-component-file":"CreditNotesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:" · no number yet"})]}),a.jsxs("p",{className:"truncate text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:383:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"383","data-component-file":"CreditNotesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22truncate%20text-%5B10px%5D%20text-text-subtle%22%7D",children:[ca(v.total_amount)," · against ",v.against_invoice_number||"—"," · ",v.reason]})]}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:Je,loading:x===v.id,onClick:()=>c(v.id),"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:387:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"387","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Preview"}),v.status==="draft"&&a.jsxs(a.Fragment,{children:[a.jsx(j,{size:"sm",variant:"secondary",leftIcon:Da,onClick:()=>n(v),"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:390:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"390","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Issue"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:la,onClick:()=>m(v),"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:391:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"391","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Delete"})]}),v.status==="issued"&&!v.sent_at&&a.jsx(j,{size:"sm",variant:"secondary",leftIcon:Da,onClick:()=>n(v),"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:395:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"395","data-component-file":"CreditNotesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Retry send"})]},v.id))}),s&&a.jsx(on,{note:s,onClose:()=>n(null),onIssued:A,"data-matrix-id":"src/pages/dashboard/personas/CreditNotesPanel.tsx:401:18","data-matrix-name":"IssueConfirmModal","data-component-path":"src/pages/dashboard/personas/CreditNotesPanel.tsx","data-component-line":"401","data-component-file":"CreditNotesPanel.tsx","data-component-name":"IssueConfirmModal","data-component-content":"%7B%22note%22%3A%22%5BIdentifier%5D%22%2C%22onClose%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onIssued%22%3A%22%5BIdentifier%5D%22%7D"})]})}const va=e=>
21`₹${Number(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,tt=()=>new Date().toISOString().slice(0,10),ya=()=>({account_id:"",party_id:"",side:"debit",amount:"",line_narration:""});function rn(){const[e,u]=t.useState([]),[g,p]=t.useState([]),[l,f]=t.useState([]),[s,n]=t.useState(null),[x,o]=t.useState(!0),[A,c]=t.useState(tt()),m=t.useCallback(async N=>{o(!0);const[E,O,D,Q]=await Promise.all([S("/ledger/accounts"),S("/ledger/parties?active=true"),S("/ledger/journals?limit=25"),S(`/ledger/trial-balance?as_of=${N}`)]);E.success&&E.data&&u(E.data),O.success&&O.data&&p(O.data),D.success&&D.data&&f(D.data),Q.success&&Q.data&&n(Q.data),o(!1)},[]);t.useEffect(()=>{m(A)},[m,A]);const v=t.useMemo(()=>[...e].sort((N,E)=>N.code.localeCompare(E.code)),[e]);return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:67:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"67","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsx(cn,{accounts:v,loading:x,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:68:6","data-matrix-name":"ChartOfAccounts","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"68","data-component-file":"LedgerPanel.tsx","data-component-name":"ChartOfAccounts","data-component-content":"%7B%22accounts%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx(pn,{parties:g,onChanged:()=>void m(A),"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:69:6","data-matrix-name":"PartyMaster","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"69","data-component-file":"LedgerPanel.tsx","data-component-name":"PartyMaster","data-component-content":"%7B%22parties%22%3A%22%5BIdentifier%5D%22%2C%22onChanged%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx(mn,{accounts:v,parties:g,onPosted:()=>void m(A),"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:70:6","data-matrix-name":"JournalPoster","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"70","data-component-file":"LedgerPanel.tsx","data-component-name":"JournalPoster","data-component-content":"%7B%22accounts%22%3A%22%5BIdentifier%5D%22%2C%22parties%22%3A%22%5BIdentifier%5D%22%2C%22onPosted%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx(ln,{journals:l,onReversed:()=>void m(A),"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:75:6","data-matrix-name":"JournalList","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"75","data-component-file":"LedgerPanel.tsx","data-component-name":"JournalList","data-component-content":"%7B%22journals%22%3A%22%5BIdentifier%5D%22%2C%22onReversed%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx(xn,{tb:s,asOf:A,setAsOf:c,onRefresh:()=>void m(A),loading:x,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:76:6","data-matrix-name":"TrialBalancePanel","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"76","data-component-file":"LedgerPanel.tsx","data-component-name":"TrialBalancePanel","data-component-content":"%7B%22tb%22%3A%22%5BIdentifier%5D%22%2C%22asOf%22%3A%22%5BIdentifier%5D%22%2C%22setAsOf%22%3A%22%5BIdentifier%5D%22%2C%22onRefresh%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%7D"})]})}function cn({accounts:e,loading:u}){var f;const[g,p]=t.useState(!1),l={asset:[],liability:[],equity:[],income:[],expense:[]};for(const s of e)(f=l[s.account_type])==null||f.push(s);return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:89:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"89","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
21nded-xl%20p-4%20space-y-2%22%7D",children:[a.jsxs("button",{onClick:()=>p(s=>!s),className:"w-full flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:90:6","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"90","data-component-file":"LedgerPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22w-full%20flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:91:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"91","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(Ae,{className:"w-4 h-4 text-info","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:92:10","data-matrix-name":"BookOpen","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"92","data-component-file":"LedgerPanel.tsx","data-component-name":"BookOpen","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-info%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:95:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"95","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Account categories"}),a.jsxs("span",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:96:10","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"96","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Chart of accounts · ",e.length,u?" · loading…":""]})]}),a.jsx("span",{className:"text-[11px] text-indigo-400","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:98:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"98","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-indigo-400%22%7D",children:g?"Hide":"Show"})]}),g&&a.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-3 pt-1","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:101:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"101","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20lg%3Agrid-cols-3%20gap-3%20pt-1%22%7D",children:["asset","liability","equity","income","expense"].map(s=>a.jsxs("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:103:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"103","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:[a.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:104:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"104","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wide%20text-text-subtle%22%7D",children:s}),l[s].map(n=>a.jsxs("p",{className:"text-[11px] text-text-soft flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:106:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"106","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx("span",{className:"text-text-subtle tabular-nums","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:107:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"107","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20tabular-nums%22%7D",children:n.code}),n.name,n.is_control&&a.jsxs("span",{className:"text-[9px] uppercase tracking-wide text-warning/80","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:109:35","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"109","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20uppercase%20tracking-wide%20text-warning%2F80%22%7D",children:["(",n.control_kind,")"]})]},n.id))]},s))})]})}function pn({parties:e,onChanged:u}){const[g,p]=t.useState(!1),[l,f]=t.useState(!1),[s,n]=t.useState({display_name:"",is_customer:!1,is_vendor:!1,gstin:"",pan:"",email:"",ph
21one:""}),x=async()=>{if(!s.display_name.trim()){k.error("Name is required.");return}if(!s.is_customer&&!s.is_vendor){k.error("Pick customer, vendor, or both.");return}f(!0);try{const o=await S("/ledger/parties",{method:"POST",body:JSON.stringify({display_name:s.display_name.trim(),is_customer:s.is_customer,is_vendor:s.is_vendor,gstin:s.gstin.trim()||void 0,pan:s.pan.trim()||void 0,email:s.email.trim()||void 0,phone:s.phone.trim()||void 0})});o.success?(k.success("Saved."),n({display_name:"",is_customer:!1,is_vendor:!1,gstin:"",pan:"",email:"",phone:""}),p(!1),u()):k.error(o.error||"Could not add this record.")}finally{f(!1)}};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:150:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"150","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:151:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"151","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:152:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"152","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(Ue,{className:"w-4 h-4 text-success","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:153:10","data-matrix-name":"Users","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"153","data-component-file":"LedgerPanel.tsx","data-component-name":"Users","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-success%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:154:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"154","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Customers & suppliers"}),a.jsxs("span",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:155:10","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"155","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[e.length," on file"]})]}),a.jsx(j,{size:"sm",variant:"secondary",leftIcon:X,onClick:()=>p(o=>!o),"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:157:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"157","data-component-file":"LedgerPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:g?"Cancel":"Add customer or supplier"})]}),a.jsx("p",{className:"text-[11px] text-text-subtle -mt-1","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:159:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"159","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20-mt-1%22%7D",children:"One record each — the same business is often both a customer and a supplier, so tick both."}),g&&a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2 rounded-xl border border-success-fill/20 bg-success-fill/[0.04] p-3","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:162:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"162","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%20rounded-xl%20border%20border-success-fill%2F20%20bg-success-fill%2F%5B0.04%5D%20p-3%22%7D",children:[a.jsx("input",{value:s.display_name,onChange:o=>n({...s,display_name:o.target.value}),placeholder:"Name *",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:163:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"163","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Name%20*%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
21nded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsxs("div",{className:"flex items-center gap-4 text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:164:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"164","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-4%20text-%5B11px%5D%20text-text-soft%22%7D",children:[a.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:165:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"165","data-component-file":"LedgerPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%20cursor-pointer%22%7D",children:[a.jsx("input",{type:"checkbox",checked:s.is_customer,onChange:o=>n({...s,is_customer:o.target.checked}),"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:165:72","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"165","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"})," Customer"]}),a.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:166:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"166","data-component-file":"LedgerPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%20cursor-pointer%22%7D",children:[a.jsx("input",{type:"checkbox",checked:s.is_vendor,onChange:o=>n({...s,is_vendor:o.target.checked}),"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:166:72","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"166","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"})," Vendor"]})]}),a.jsx("input",{value:s.gstin,onChange:o=>n({...s,gstin:o.target.value}),placeholder:"GSTIN (optional)",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:168:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"168","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22GSTIN%20(optional)%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("input",{value:s.pan,onChange:o=>n({...s,pan:o.target.value}),placeholder:"PAN (optional)",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:169:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"169","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22PAN%20(optional)%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
21nded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("input",{value:s.email,onChange:o=>n({...s,email:o.target.value}),placeholder:"Email (optional)",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:170:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"170","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Email%20(optional)%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("input",{value:s.phone,onChange:o=>n({...s,phone:o.target.value}),placeholder:"Phone (optional)",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:171:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"171","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Phone%20(optional)%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("div",{className:"sm:col-span-2 flex justify-end","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:172:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"172","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-2%20flex%20justify-end%22%7D",children:a.jsx(j,{size:"sm",variant:"primary",loading:l,onClick:x,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:173:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"173","data-component-file":"LedgerPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Add"})})]}),e.length>0&&a.jsx("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:179:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"179","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:e.slice(0,8).map(o=>a.jsxs("p",{className:"text-[11px] text-text-soft flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:181:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"181","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20flex%20items-center%20gap-2%22%7D",children:[a.jsx("span",{className:"text-white","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:182:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"182","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%22%7D",children:o.display_name}),o.is_customer&&a.jsx("span",{className:"text-[9px] uppercase tracking-wide text-info/80","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:183:32","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"183","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20uppercase%20tracking-wide%20text-info%2F80%22%7D",children:"customer"}),o.is_vendor&&a.jsx("span",{className:"text-[9px] uppercase tracking-wide text-warning/80","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:184:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"184","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B9px%5D%20uppercase%20tracking-wide%20text-warning%2F80%22%7D",children:"vendor"}),o.gstin&&a.jsx("span",{className:"text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:185:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"185","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%22%7D",children:o.gstin})]},o.id))})]})}function mn({accounts:e,parties:u,onPosted:g}){const[p,l]=t.useState(tt()),[f,s]=t.useState(""),[n,x]=t.useState([ya(),ya()]),[o,A]=t.useState(!1),[c,m]=t.useState(null),v=t.useMemo(()=>{let r=0,h=0;for(const B of n){const w=Number(B.amount)||0;B.side==="debit"?r+=w:h+=w}return{debit:Math.round(r*100)/100,credit:Math.round(h*100)/100}},[n]),N=Math.round((v.debit-v.credit)*100)/100,E=(r,h)=>x(B=>B.map((w,_)=>_===r?{...w,...h}:w)),O=()=>x(r=>[...r,ya()]),D=r=>x(h=>h.length>2?h.filter((B,w)=>w!==r):h),Q=async()=>{m(null);const r=[];for(const h of n){const B=Number(h.amount);if(!h.account_id||!Number.isFinite(B)||B<=0){m("Every line needs an account and a positive amount.");return}r.push({account_id:h.account_id,party_id:h.party_id||void 0,debit:h.side==="debit"?B:0,credit:h.side==="credit"?B:0,line_narration:h.line_narration.trim()||void 0})}A(!0);try{const h=await S("/ledger/journals",{method:"POST",body:JSON.stringify({journal_date:p,narration:f.trim()||void 0,source:"manual",lines:r})});h.success?(k.success("Entry saved."),s(""),x([ya(),ya()]),g()):m(h.error||"Could not post the journal.")}finally{A(!1)}};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:244:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"244","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
21nded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:245:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"245","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx($a,{className:"w-4 h-4 text-indigo-400","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:246:8","data-matrix-name":"Scale","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"246","data-component-file":"LedgerPanel.tsx","data-component-name":"Scale","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-indigo-400%22%7D"}),a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:247:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"247","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Add a book entry"}),a.jsx("span",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:248:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"248","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Journal entry"})]}),a.jsx("p",{className:"text-[11px] text-text-subtle -mt-1","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:250:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"250","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20-mt-1%22%7D",children:"This is final once saved — an entry can never be edited afterwards. To correct a mistake, cancel it with an opposite entry below; the original always stays on record."}),a.jsxs("div",{className:"grid sm:grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:255:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"255","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20sm%3Agrid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{type:"date",value:p,onChange:r=>l(r.target.value),className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:256:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"256","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-3%20py-2%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx("input",{value:f,onChange:r=>s(r.target.value),placeholder:"What is this for? (e.g. July office rent)",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:257:8","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"257","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22What%20is%20this%20for%3F%20(e.g.%20July%20office%20rent)%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
21nded-lg%20px-3%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"})]}),a.jsxs("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:260:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"260","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:[n.map((r,h)=>a.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr_auto] sm:grid-cols-[2fr_auto_1fr_1fr_auto] gap-2 items-center","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:262:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"262","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-%5B1fr_auto_1fr_auto%5D%20sm%3Agrid-cols-%5B2fr_auto_1fr_1fr_auto%5D%20gap-2%20items-center%22%7D",children:[a.jsxs("select",{value:r.account_id,onChange:B=>E(h,{account_id:B.target.value}),className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-2 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:263:12","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"263","data-component-file":"LedgerPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2.5%20py-2%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:264:14","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"264","data-component-file":"LedgerPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Account…"}),e.map(B=>a.jsxs("option",{value:B.id,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:265:33","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"265","data-component-file":"LedgerPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[B.code," · ",B.name]},B.id))]}),a.jsxs("select",{value:r.side,onChange:B=>E(h,{side:B.target.value}),className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-2 py-2 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:267:12","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"267","data-component-file":"LedgerPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2%20py-2%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D",children:[a.jsx("option",{value:"debit","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:268:14","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"268","data-component-file":"LedgerPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22debit%22%7D",children:"Dr"}),a.jsx("option",{value:"credit","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:269:14","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"269","data-component-file":"LedgerPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22credit%22%7D",children:"Cr"})]}),a.jsx("input",{value:r.amount,onChange:B=>E(h,{amount:B.target.value}),placeholder:"Amount (₹)",inputMode:"decimal",className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:271:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"271","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Amount%20(%E2%82%B9)%22%2C%22inputMode%22%3A%22decimal%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rou
21nded-lg%20px-2.5%20py-2%20text-xs%20text-white%20placeholder%3Atext-text-faint%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsxs("select",{value:r.party_id,onChange:B=>E(h,{party_id:B.target.value}),className:"hidden sm:block bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-2 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:272:12","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"272","data-component-file":"LedgerPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22hidden%20sm%3Ablock%20bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2.5%20py-2%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:273:14","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"273","data-component-file":"LedgerPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Party (optional)"}),u.map(B=>a.jsx("option",{value:B.id,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:274:32","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"274","data-component-file":"LedgerPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:B.display_name},B.id))]}),a.jsx("button",{onClick:()=>D(h),disabled:n.length<=2,className:"p-1.5 rounded-lg text-text-subtle hover:text-danger disabled:opacity-30 disabled:hover:text-text-subtle","aria-label":"Remove",title:"Remove","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:276:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"276","data-component-file":"LedgerPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22className%22%3A%22p-1.5%20rounded-lg%20text-text-subtle%20hover%3Atext-danger%20disabled%3Aopacity-30%20disabled%3Ahover%3Atext-text-subtle%22%2C%22title%22%3A%22Remove%22%7D",children:a.jsx(oa,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:276:230","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"276","data-component-file":"LedgerPanel.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})})]},h)),a.jsx("button",{onClick:O,className:"text-[11px] text-indigo-400 hover:text-indigo-300","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:279:8","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"279","data-component-file":"LedgerPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22text-%5B11px%5D%20text-indigo-400%20hover%3Atext-indigo-300%22%7D",children:"+ Add line"})]}),a.jsxs("div",{className:"flex items-center justify-between text-[11px] pt-1 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:282:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"282","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20text-%5B11px%5D%20pt-1%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsxs("span",{className:"text-text-muted","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:283:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"283","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-muted%22%7D",children:["Dr ",va(v.debit)," · Cr ",va(v.credit)]}),a.jsx("span",{className:N===0?"text-success":"text-warning","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:284:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"284","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:N===0?"Balanced":`Off by ${va(Math.abs(N))}`})]}),c&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:289:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"289","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:c}),a.jsx(j,{size:"sm",variant:"primary",loading:o,onClick:Q,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:291:6","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"291","data-component-file":"LedgerPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Save entry"})]})}function ln({journals:e,onReversed:u}){const[g,p]=t.useState(null),l=async f=>{if(f.status!=="reversed_out"&&window.confirm(`Reverse journal JV-${f.entry_seq}${f.narration?` (${f.narration})`:""}? This posts a NEW contra entry — the original is never edited.`)){p(f.id);try{const s=await S(`/ledger/journals/${f.id}/reverse`,{method:"POST",body:JSON.stringify({})});s.success?(k.success("Cancelling entry saved."),u()):k.error(s.error||"Could not reverse this journal.")}finally{p(null)}}};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:313:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"313","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
21nded-xl%20p-4%20space-y-2%22%7D",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:314:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"314","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Recent entries"}),e.length===0&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:315:32","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"315","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Nothing recorded yet."}),a.jsx("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:316:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"316","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:e.map(f=>a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-white/[0.04] bg-white/[0.02] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:318:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"318","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20gap-3%20rounded-lg%20border%20border-white%2F%5B0.04%5D%20bg-white%2F%5B0.02%5D%20px-3%20py-2%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:319:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"319","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-xs text-text-bright truncate","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:320:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"320","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%20truncate%22%7D",children:[a.jsxs("span",{className:"text-text-subtle tabular-nums","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:321:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"321","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20tabular-nums%22%7D",children:["JV-",f.entry_seq]})," · ",f.journal_date," · ",f.narration||a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:321:125","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"321","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:"(no narration)"})]}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:323:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"323","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[f.source,f.status==="reversed_out"?" · reversal":""]})]}
21),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:gt,loading:g===f.id,onClick:()=>l(f),"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:325:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"325","data-component-file":"LedgerPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel this"})]},f.id))})]})}function xn({tb:e,asOf:u,setAsOf:g,onRefresh:p,loading:l}){return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:337:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"337","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:338:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"338","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:339:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"339","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx("p",{className:"text-sm font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:340:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"340","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%22%7D",children:"Account balances"}),a.jsx("span",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:341:10","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"341","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Trial balance"})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:343:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"343","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx("input",{type:"date",value:u,onChange:f=>g(f.target.value),className:"bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:344:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"344","data-component-file":"LedgerPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22bg-white%2F%5B0.04%5D%20border%20border-white%2F%5B0.08%5D%20rounded-lg%20px-2.5%20py-1.5%20text-xs%20text-white%20outline-none%20focus%3Aborder-white%2F%5B0.16%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:l,onClick:p,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:345:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"345","data-component-file":"LedgerPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]})]}),e&&e.rows.length===0&&a.jsxs("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:349:37","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"349","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:["No postings as of ",e.as_of," yet."]}),e&&e.rows.length>0&&a.jsxs("div",{className:"overflow-x-auto","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:352:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"352","data-component-file":"LedgerPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22overflow-x-auto%22%7D",children:[a.jsxs("table",{className:"w-full text-[11px]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:353:10","data-matrix-name":"table","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"353","data-component-file":"LedgerPanel.tsx","data-component-name":"table","data-component-content":"%7B%22className%22%3A%22w-full%2
210text-%5B11px%5D%22%7D",children:[a.jsx("thead",{"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:354:12","data-matrix-name":"thead","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"354","data-component-file":"LedgerPanel.tsx","data-component-name":"thead",children:a.jsxs("tr",{className:"text-text-subtle text-left","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:355:14","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"355","data-component-file":"LedgerPanel.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20text-left%22%7D",children:[a.jsx("th",{className:"pb-1.5 font-medium","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:356:16","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"356","data-component-file":"LedgerPanel.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22pb-1.5%20font-medium%22%7D",children:"Account"}),a.jsx("th",{className:"pb-1.5 font-medium text-right","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:357:16","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"357","data-component-file":"LedgerPanel.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22pb-1.5%20font-medium%20text-right%22%7D",children:"Debit"}),a.jsx("th",{className:"pb-1.5 font-medium text-right","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:358:16","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"358","data-component-file":"LedgerPanel.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22pb-1.5%20font-medium%20text-right%22%7D",children:"Credit"})]})}),a.jsxs("tbody",{"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:361:12","data-matrix-name":"tbody","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"361","data-component-file":"LedgerPanel.tsx","data-component-name":"tbody",children:[e.rows.map(f=>a.jsxs("tr",{className:"border-t border-white/[0.04]","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:363:16","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"363","data-component-file":"LedgerPanel.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22border-t%20border-white%2F%5B0.04%5D%22%7D",children:[a.jsxs("td",{className:"py-1.5 text-text-soft","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:364:18","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"364","data-component-file":"LedgerPanel.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20text-text-soft%22%7D",children:[a.jsx("span",{className:"text-text-subtle tabular-nums","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:364:56","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"364","data-component-file":"LedgerPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20tabular-nums%22%7D",children:f.code})," ",f.name]}),a.jsx("td",{className:"py-1.5 text-right text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:365:18","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"365","data-component-file":"LedgerPanel.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20text-right%20text-text-bright%20tabular-nums%22%7D",children:f.debit>0?va(f.debit):""}),a.jsx("td",{className:"py-1.5 text-right text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:366:18","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"366","data-component-file":"LedgerPanel.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20text-right%20text-text-bright%20tabular-nums%22%7D",children:f.credit>0?va(f.credit):""})]},f.account_id)),a.jsxs("tr",{className:"border-t border-white/[0.08] font-semibold","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:369:14","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"369","data-component-file":"LedgerPanel.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22border-t%20border-white%2F%5B0.08%5D%20font-semibold%22%7D",children:[a.jsx("td",{className:"py-1.5 text-white","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:370:16","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"370","data-component-file":"LedgerPanel.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20text-white%22%7D",children:"Total"}),a.jsx("td",{className:"py-1.5 text-right text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:371:16","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"371","data-component-file":"LedgerPanel.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20text-right%20text-white%20tabular-nums%22%7D",children:va(e.total_debit)}),a.jsx("td",{className:"py-1.5 text-right text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:372:16","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"372","data-component-file":"LedgerPanel.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-1.5%20text-right%20text-white%20tabular-nums%22%7D",children:va(e.total_credit)})]})]})]}),a.jsx("p",{className:`mt-2 text-[11px] ${e.balanced?"text-success":"text-danger"}`,"data-matrix-id":"src/pages/dashboard/personas/LedgerPanel.tsx:376:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/LedgerPanel.tsx","data-component-line":"376","data-component-file":"LedgerPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:e.balanced?"Balanced.":"NOT balanced — this should never happen; contact support."})]})]})}const hn={pending:"text-text-muted",pending_approval:"text-yellow-400",completed:"text-success",skipped:"text-text-faint line-through"};function un(){const e=ee(),[u,g]=t.useState([]),[p,l]=t.useState(!0),[f,s]=t.useState(null),[n,x]=t.useState(!1),[o,A]=t.useState(null),c=new Date().toISOString().slice(0,7),m=()=>S(`/v1/accounting/close-checklist?month=${c}`).then(D=>{D.success&&Array.isArray(D.data)&&g(D.data)}).catch(()=>A({text:"Could not load the checklist. Refresh to try again.",ok:!1})).finally(()=>l(!1));t.useEffect(()=>{m()},[c]);async function v(D){s(D);try{const Q=await S(`/v1/accounting/close-checklist/${D}/complete`,{method:"POST"});Q.success?(g(r=>r.map(h=>{var B;return h.id===D?{...h,status:(B=Q.data)!=null&&B.pending_approval?"pending_approval":"completed"}:h})),A(null)):A({text:(Q==null?void 0:Q.error)||"That step could not be completed. Try again.",ok:!1})}catch{A({text:"That step could not be completed — the request did not get through.",ok:!1})}finally{s(null)}}async function N(){x(!0),A(null);try{const D=await S("/v1/accounting/close-checklist/run",{method:"POST",body:JSON.stringify({month:c})});D.success&&D.data?(A({text:`${D.data.completed} step(s) completed, ${D.data.queued} queued for your approval.`,ok:!0}),l(!0),await m()):A({text:(D==null?void 0:D.error)||"The close could not be run. Nothing was changed.",ok:!1})}catch{A({text:"The close could not be run — the request did not get through. Nothing was changed.",ok:!1})}finally{x(!1)}}if(p)return a.jsx("div",{className:"flex justify-center py-4","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:88:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"88","data-component-file":"MonthEndChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20justify-center%20py-4%22%7D",children:a.jsx(St,{"data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:88:64","data-matrix-name":"LoadingSpinner","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"88","data-component-file":"MonthEndChecklist.tsx","data-component-name":"LoadingSpinner"})});if(u.length===0)return a.jsx(ze,{type:"no-data",title:"No checklist yet",description:"The month-end checklist will appear here.","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:89:33","data-matrix-name":"EmptyState","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"89","data-component-file":"MonthEndChecklist.tsx","data-component-name":"EmptyState","data-component-content":"%7B%22type%22%3A%22no-data%22%2C%22title%22%3A%22No%20c
21hecklist%20yet%22%2C%22description%22%3A%22The%20month-end%20checklist%20will%20appear%20here.%22%7D"});const E=u.filter(D=>D.status==="completed").length,O=u.filter(D=>D.status==="pending").length;return a.jsxs("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:95:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"95","data-component-file":"MonthEndChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:96:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"96","data-component-file":"MonthEndChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20mb-2%22%7D",children:[a.jsxs("span",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:97:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"97","data-component-file":"MonthEndChecklist.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:["Closing ",c]}),a.jsxs("div",{className:"flex items-center gap-3","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:98:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"98","data-component-file":"MonthEndChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-3%22%7D",children:[a.jsxs("span",{className:"text-xs font-semibold text-text","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:99:10","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"99","data-component-file":"MonthEndChecklist.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-text%22%7D",children:[E,"/",u.length," done"]}),O>0&&a.jsx(j,{size:"sm",variant:"primary",loading:n,onClick:N,"data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:101:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"101","data-component-file":"MonthEndChecklist.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Run close"})]})]}),o&&a.jsx("p",{className:`text-[11px] mb-1 ${o.ok?"text-success":"text-danger"}`,"data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:106:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"106","data-component-file":"MonthEndChecklist.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:o.text}),u.map(D=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-surface/50 border border-white/[0.04]","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:109:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"109","data-component-file":"MonthEndChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-3%20px-3%20py-2%20rounded-lg%20bg-surface%2F50%20border%20border-white%2F%5B0.04%5D%22%7D",children:[a.jsxs("div",{className:"flex-1 min-w-0","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:110:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"110","data-component-file":"MonthEndChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-1%20min-w-0%22%7D",children:[a.jsx("p",{className:mt("text-xs font-medium",hn[D.status]),"data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:111:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"111","data-component-file":"MonthEndChecklist.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BCallExpression%5D%22%7D",children:D.title}),D.description&&a.jsx("p",{className:"text-[11px] text-text-muted truncate","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:112:33","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"112","data-component-file":"MonthEndChecklist.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20truncate%22%7D",children:D.description})]}),D.requires_hitl&&a.jsx("span",{className:"text-[10px] text-yellow-400 shrink-0","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:115:33","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"115","data-component-file":"MonthEndChecklist.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-yellow-400%20shrink-0%22%7D",children:"Needs your OK"}),D.status==="pending"&&a.jsx("button",{onClick:()=>v(D.id),disabled:f===D.id,className:"text-[11px] text-accent-bright hover:text-accent-faint disabled:opacity-50 shrink-0 transition-colors","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:117:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"117","data-component-file":"MonthEndChecklist.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22className%22%3A%22text-%5B11px%5D%20text-accent-bright%20hover%3Atext-accent-faint%20disabled%3Aopacity-50%20shrink-0%20transition-colors%22%7D",children:f===D.id?"…":"Mark done"}),D.status==="completed"&&a.jsx("span",{className:"text-[11px] text-success shrink-0","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:125:42","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"125","data-component-file":"MonthEndChecklist.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-success%20shrink-0%22%7D",children:"Done"}),D.status==="pending_approval"&&a.jsx("button",{onClick:()=>e("/dashboard/approvals"),className:"text-[11px] text-yellow-400 hover:text-yellow-300 shrink-0 transition-colors","data-matrix-id":"src/pages/dashboard/personas/MonthEndChecklist.tsx:127:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/MonthEndChecklist.tsx","data-component-line":"127","data-component-file":"MonthEndChecklist.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22text-%5B11px%5D%20text-yellow-400%20hover%3Atext-yellow-300%20shrink-0%20transition-colors%22%7D",children:"Approve →"})]},D.id))]})}const Ya=e=>
21`₹${Math.abs(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,gn={now:{ring:"border-danger/25 bg-danger/[0.06]",text:"text-danger",label:"Do this now"},soon:{ring:"border-warning-fill/20 bg-warning-fill/[0.06]",text:"text-warning-bright",label:"Worth doing soon"},watch:{ring:"border-white/[0.08] bg-white/[0.03]",text:"text-text-muted",label:"Keep an eye on it"}};function re({lines:e}){return a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:41:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"41","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:e.map(u=>a.jsxs("div",{className:"space-y-0.5","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:43:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"43","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-0.5%22%7D",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:44:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"44","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%22%7D",children:[a.jsxs("span",{className:"text-xs text-text-soft","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:45:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"45","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-soft%22%7D",children:[u.label,u.confidence==="estimate"&&a.jsx("span",{className:"ml-1.5 text-[9px] uppercase tracking-wide text-warning/90","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:49:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"49","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-1.5%20text-%5B9px%5D%20uppercase%20tracking-wide%20text-warning%2F90%22%7D",children:"estimate"})]}),a.jsx("span",{className:"text-xs text-white tabular-nums shrink-0","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:52:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"52","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%20tabular-nums%20shrink-0%22%7D",children:Ya(u.amount)})]}),u.note&&a.jsx("p",{className:"text-[10px] text-text-faint leading-snug","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:54:21","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"54","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20leading-snug%22%7D",children:u.note})]},u.label))})}function bn(){const[e,u]=t.useState(null),[g,p]=t.useState(!0),[l,f]=t.useState(null),s=t.useCallback(async()=>{p(!0),f(null);try{const x=await S("/ledger/tax-position");x.success&&x.data?u(x.data):f((x==null?void 0:x.error)||"Your tax position could not be worked out — refresh to try again.")}catch{f("Your tax position could not be worked out — the request did not get through.")}finally{p(!1)}},[]);t.useEffect(()=>{s()},[s]);const n=e?e.opportunities.reduce((x,o)=>x+(o.amount||0),0):0;return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-4","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:85:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"85","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
21nded-xl%20p-4%20space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:86:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"86","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:87:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"87","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:88:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"88","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Be,{className:"h-4 w-4 text-success","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:89:12","data-matrix-name":"Receipt","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"89","data-component-file":"TaxPositionPanel.tsx","data-component-name":"Receipt","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-success%22%7D"})," Your tax position"]}),a.jsxs("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:91:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"91","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:["Worked out from your own books",e?` · ${e.fy_label}`:"",". Nothing here is fetched from a portal."]})]}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:s,"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:95:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"95","data-component-file":"TaxPositionPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]}),g&&!e&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:98:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"98","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Loading…"}),!g&&!e&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:100:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"100","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:l||"Nothing to show yet."}),e&&a.jsxs(a.Fragment,{children:[n>0&&a.jsxs("div",{className:"rounded-lg border border-success-fill/25 bg-success-fill/[0.07] px-4 py-3","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:107:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"107","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-success-fill%2F25%20bg-success-fill%2F%5B0.07%5D%20px-4%20py-3%22%7D",children:[a.jsx("p",{className:"text-[11px] uppercase tracking-wide text-success-bright/80","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:108:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"108","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20uppercase%20tracking-wide%20text-success-bright%2F80%22%7D",children:"Money you can still claim back"}),a.jsx("p",{className:"text-2xl font-bold text-success-bright tabular-nums mt-0.5","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:109:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"109","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-2xl%20font-bold%20text-success-bright%20tabular-nums%20mt-0.5%22%7D",children:Ya(n)}),a.jsx("p",{className:"text-[11px] text-emerald-200/70 mt-1","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:110:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"110","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-emerald-200%2F70%20mt-1%22%7D",children:"GST credit and TDS already paid in your name. It is y
21ours — it just has not been set against your bill yet."})]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-4","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:116:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"116","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20md%3Agrid-cols-3%20gap-4%22%7D",children:[a.jsxs("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:117:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"117","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:118:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"118","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:"GST"}),a.jsx(re,{lines:e.gst.lines,"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:119:14","data-matrix-name":"Lines","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"119","data-component-file":"TaxPositionPanel.tsx","data-component-name":"Lines","data-component-content":"%7B%22lines%22%3A%22%5BMemberExpression%5D%22%7D"}),a.jsxs("div",{className:"flex items-baseline justify-between gap-3 pt-1.5 border-t border-white/[0.08]","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:120:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"120","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%20pt-1.5%20border-t%20border-white%2F%5B0.08%5D%22%7D",children:[a.jsx("span",{className:"text-xs font-semibold text-text-bright","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:121:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"121","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-text-bright%22%7D",children:e.gst.net_label}),a.jsx("span",{className:"text-sm font-bold text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:122:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"122","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-sm%20font-bold%20text-white%20tabular-nums%22%7D",children:Ya(e.gst.net)})]})]}),a.jsxs("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:126:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"126","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:127:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"127","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:"TDS & advance tax"}),a.jsx(re,{lines:e.tds.lines,"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:128:14","data-matrix-name":"Lines","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"128","data-component-file":"TaxPositionPanel.tsx","data-component-name":"Lines","data-component-content":"%7B%22lines%22%3A%22%5BMemberExpression%5D%22%7D"})]}),a.jsxs("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:131:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"131","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:[a.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:132:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"132","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:["Income tax ",e.income_tax.rate_used!==null&&a.jsxs("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:133:63","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"133","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:["· indicative ",e.income_tax.rate_used,"%"]})]}),a.jsx(re,{lines:e.income_tax.lines,"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:135:14","data-matrix-name":"Lines","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"135","data-component-file":"TaxPositionPanel.tsx","data-component-name":"Lines","data-component-content":"%7B%22lines%22%3A%22%5BMemberExpression%5D%22%7D"})]})]}),e.opportunities.length>0&&a.jsxs("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:140:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"140","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:[a.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:141:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"141","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(Ye,{className:"w-3.5 h-3.5 text-warning","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:142:16","data-matrix-name":"TrendingDown","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"142","data-component-file":"TaxPositionPanel.tsx","data-component-name":"TrendingDown","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-warning%22%7D"})," What is costing you money"]}),e.opportunities.map(x=>{const o=gn[x.urgency];return a.jsxs("div",{className:`rounded-lg border px-3 py-2.5 space-y-1 ${o.ring}`,"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:147:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"147","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:148:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"148","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:149:22","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"149","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:x.title}),x.amount!==null&&a.jsx("p",{className:"text-xs font-bold text-white tabular-nums shrink-0","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:150:44","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"150","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-bold%20text-white%20tabular-nums%20shrink-0%22%7D",children:Ya(x.amount)})]}),a.jsx("p",{className:"text-[11px] text-text-soft leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:152:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"152","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20leading-relaxed%22%7D",children:x.detail}),a.jsxs("p",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:153:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"153","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:[a.jsxs("span",{className:`font-semibold ${o.text}`,"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:154:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"154","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[o.label,":"]}
21)," ",x.action]})]},x.title)})]}),a.jsx("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.08] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:163:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"163","data-component-file":"TaxPositionPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.08%5D%20px-3%20py-2%22%7D",children:a.jsxs("p",{className:"text-[10px] text-text-muted leading-relaxed flex items-start gap-1.5","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:164:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"164","data-component-file":"TaxPositionPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-muted%20leading-relaxed%20flex%20items-start%20gap-1.5%22%7D",children:[a.jsx(Ve,{className:"w-3.5 h-3.5 text-text-subtle shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:165:14","data-matrix-name":"CircleAlert","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"165","data-component-file":"TaxPositionPanel.tsx","data-component-name":"CircleAlert","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-text-subtle%20shrink-0%20mt-0.5%22%7D"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/TaxPositionPanel.tsx:166:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/TaxPositionPanel.tsx","data-component-line":"166","data-component-file":"TaxPositionPanel.tsx","data-component-name":"span",children:e.disclaimer})]})})]})]})}const Fe=e=>`₹${Math.abs(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,ra=e=>e<0?`(${Fe(e)})`:Fe(e);function Ua({s:e}){return a.jsxs("div",{className:"space-y-0.5","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:40:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"40","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-0.5%22%7D",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:41:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"41","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%22%7D",children:[a.jsx("span",{className:"text-xs font-medium text-text-bright","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:42:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"42","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20font-medium%20text-text-bright%22%7D",children:e.label}),a.jsx("span",{className:"text-xs font-semibold text-white tabular-nums shrink-0","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:43:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"43","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20tabular-nums%20shrink-0%22%7D",children:ra(e.total)})]}),e.lines.map(u=>a.jsxs("div",{className:"flex items-baseline justify-between gap-3 pl-3","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:46:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"46","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%20pl-3%22%7D",children:[a.jsxs("span",{className:"text-[11px] text-text-subtle truncate","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:47:10","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"47","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20truncate%22%7D",children:[u.code!=="—"&&a.jsx("span",{className:"text-slate-700 tabular-nums mr-1.5","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:48:31","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"48","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-slate-700%20tabular-nums%20mr-1.5%22%7D",children:u.code}),u.name]}),a.jsx("span",{className:"text-[11px] text-text-muted tabular-nums shrink-0","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:51:10","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"51","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20tabular-nums%20shrink-0%22%7D",children:ra(u.amount)})]},`${u.code}-${u.name}`))]})}function fn(){const[e,u]=t.useState(null),[g,p]=t.useState(!0),[l,f]=t.useState(null),s=t.useCallback(async()=>{p(!0),f(null);try{const o=await S("/ledger/schedule3");o.success&&o.data?u(o.data):f((o==null?void 0:o.error)||"The statements could not be built — refresh to try again.")}catch{f("The statements could not be built — the request did not get through.")}finally{p(!1)}},[]);t.useEffect(()=>{s()},[s]);const n=()=>{document.body.classList.add("printing-sched3"),window.print(),setTimeout(()=>document.body.classList.remove("printing-sched3"),500)},x=e?[...new Set([...e.balance_sheet.unmapped,...e.profit_loss.unmapped])]:[];return a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:86:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"86","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("style",{"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:87:6","data-matrix-name":"style","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"87","data-component-file":"Schedule3Panel.tsx","data-component-name":"style",children:`
22        @media print {
23          body.printing-sched3 > * { visibility: hidden !important; }
24          body.printing-sched3 #sched3-print, body.printing-sched3 #sched3-print * { visibility: visible !important; }
25          body.printing-sched3 #sched3-print { position: absolute !important; left: 0; top: 0; width: 100%; }
26        }
27      `}),a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:95:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"95","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:96:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"96","data-component-file":"Schedule3Panel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:97:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"97","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx($a,{className:"h-4 w-4 text-indigo-400","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:98:12","data-matrix-name":"Scale","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"98","data-component-file":"Schedule3Panel.tsx","data-component-name":"Scale","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-indigo-400%22%7D"})," Statements"]}),a.jsxs("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:100:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"100","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:["Schedule III format — what your CA files and what a bank asks for",e?` · ${e.fy_label}`:"","."]})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:104:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"104","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:We,onClick:n,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:105:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"105","data-component-file":"Schedule3Panel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Print"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:s,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:106:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"106","data-component-file":"Schedule3Panel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]})]}),g&&!e&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:110:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"110","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Loading…"}),!g&&!e&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:112:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"112","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:l||"Nothing to show yet."}),e&&a.jsxs("div",{id:"sched3-print",className:"grid lg:grid-cols-2 gap-4","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:116:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"116","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22sched3-print
27%22%2C%22className%22%3A%22grid%20lg%3Agrid-cols-2%20gap-4%22%7D",children:[a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-4","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:118:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"118","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-4%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:119:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"119","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:["Balance Sheet ",a.jsxs("span",{className:"text-text-faint font-normal","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:119:74","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"119","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%20font-normal%22%7D",children:["as at ",e.balance_sheet.as_of]})]}),a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:121:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"121","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:122:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"122","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:"Equity and liabilities"}),e.balance_sheet.equity_and_liabilities.map(o=>a.jsx(Ua,{s:o,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:123:65","data-matrix-name":"SectionBlock","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"123","data-component-file":"Schedule3Panel.tsx","data-component-name":"SectionBlock","data-component-content":"%7B%22s%22%3A%22%5BIdentifier%5D%22%7D"},o.key)),a.jsxs("div",{className:"flex items-baseline justify-between gap-3 pt-1.5 border-t border-white/[0.1] text-xs font-bold","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:124:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"124","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%20pt-1.5%20border-t%20border-white%2F%5B0.1%5D%20text-xs%20font-bold%22%7D",children:[a.jsx("span",{className:"text-text-bright","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:125:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"125","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-bright%22%7D",children:"Total"}),a.jsx("span",{className:"text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:126:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"126","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%20tabular-nums%22%7D",children:ra(e.balance_sheet.total_equity_and_liabilities)})]})]}),a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:130:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"130","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:131:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"131","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:"Assets"}),e.balance_sheet.assets.map(o=>a.jsx(Ua,{s:o,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:132:49","data-matrix-name":"SectionBlock","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"132","data-component-file":"Schedule3Panel.tsx","data-component-name":"SectionBlock","data-component-content":"%7B%22s%22%3A%22%5BIdentifier%5D%22%7D"},o.key)),a.jsxs("div",{className:"flex items-baseline justify-between gap-3 pt-1.5 border-t border-white/[0.1] text-xs font-bold","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:133:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"133","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%20pt-1.5%20border-t%20border-white%2F%5B0.1%5D%20text-xs%20font-bold%22%7D",children:[a.jsx("span",{className:"text-text-bright","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:134:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"134","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-bright%22%7D",children:"Total"}),a.jsx("span",{className:"text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:135:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"135","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%20tabular-nums%22%7D",children:ra(e.balance_sheet.total_assets)})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:140:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"140","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-2%22%7D",children:[a.jsxs("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:141:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"141","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.06%5D%20px-3%20py-2%22%7D",children:[a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:142:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"142","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Working capital"}),a.jsx("p",{className:`text-sm font-semibold tabular-nums ${e.balance_sheet.working_capital>=0?"text-success-bright":"text-danger"}`,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:143:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"143","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:ra(e.balance_sheet.working_capital)}),a.jsx("p",{className:"text-[10px] text-text-faint mt-0.5","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:146:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"146","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20mt-0.5%22%7D",children:"Short-term assets less short-term dues"})]}),a.jsxs("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:148:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"148","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.06%5D%20px-3%20py-2%22%7D",children:[a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:149:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"149","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Current ratio"}),a.jsx("p",{className:"text-sm font-semibold text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:150:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"150","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-text-bright%20tabular-nums%22%7D",children:e.balance_sheet.current_ratio===null?"—":e.balance_sheet.current_ratio.toFixed(2)}),a.jsx("p",{className:"text-[10px] text-text-faint mt-0.5","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:153:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"153","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20mt-0.5%22%7D",children:e.balance_sheet.current_ratio===null?"Nothing due short-term":"Lenders look for 1.5 or better"})]})]}),e.balance_sheet.balanced?a.jsx("p",{className:"text-[11px] text-success","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:160:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"160","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-success%22%7D",children:"Balanced."}):a.jsxs("p",{className:"text-[11px] text-danger","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:162:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"162","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger%22%7D",children:["Out of balance by ",ra(e.balance_sheet.difference)," — please tell us."]})]}),a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-4","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:167:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"167","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
27nded-xl%20p-4%20space-y-4%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:168:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"168","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:["Statement of Profit and Loss ",a.jsxs("span",{className:"text-text-faint font-normal","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:169:43","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"169","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%20font-normal%22%7D",children:[e.profit_loss.from," to ",e.profit_loss.to]})]}),a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:172:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"172","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:173:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"173","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:"Revenue"}),e.profit_loss.revenue.map(o=>a.jsx(Ua,{s:o,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:174:48","data-matrix-name":"SectionBlock","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"174","data-component-file":"Schedule3Panel.tsx","data-component-name":"SectionBlock","data-component-content":"%7B%22s%22%3A%22%5BIdentifier%5D%22%7D"},o.key)),a.jsxs("div",{className:"flex items-baseline justify-between gap-3 pt-1.5 border-t border-white/[0.1] text-xs font-bold","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:175:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"175","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%20pt-1.5%20border-t%20border-white%2F%5B0.1%5D%20text-xs%20font-bold%22%7D",children:[a.jsx("span",{className:"text-text-bright","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:176:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"176","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-bright%22%7D",children:"Total revenue"}),a.jsx("span",{className:"text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:177:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"177","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%20tabular-nums%22%7D",children:ra(e.profit_loss.total_revenue)})]})]}),a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:181:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"181","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:182:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"182","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:"Expenses"}),e.profit_loss.expenses.map(o=>a.jsx(Ua,{s:o,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:183:49","data-matrix-name":"SectionBlock","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"183","data-component-file":"Schedule3Panel.tsx","data-component-name":"SectionBlock","data-component-content":"%7B%22s%22%3A%22%5BIdentifier%5D%22%7D"},o.key)),a.jsxs("div",{className:"flex items-baseline justify-between gap-3 pt-1.5 border-t border-white/[0.1] text-xs font-bold","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:184:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"184","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%20pt-1.5%20border-t%20border-white%2F%5B0.1%5D%20text-xs%20font-bold%22%7D",children:[a.jsx("span",{className:"text-text-bright","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:185:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"185","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-bright%22%7D",children:"Total expenses"}),a.jsx("span",{className:"text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:186:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"186","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%20tabular-nums%22%7D",children:ra(e.profit_loss.total_expenses)})]})]}),a.jsxs("div",{className:`flex items-baseline justify-between gap-3 rounded-lg px-3 py-2.5 ${e.profit_loss.profit_before_tax>=0?"bg-success-fill/[0.08] border border-success-fill/20":"bg-warning-fill/[0.08] border border-warning-fill/20"}`,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:190:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"190","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("span",{className:`text-xs font-semibold ${e.profit_loss.profit_before_tax>=0?"text-success-bright":"text-warning-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:191:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"191","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:e.profit_loss.profit_before_tax>=0?"Profit before tax":"Loss before tax"}),a.jsx("span",{className:`text-sm font-bold tabular-nums ${e.profit_loss.profit_before_tax>=0?"text-success-bright":"text-warning-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:194:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"194","data-component-file":"Schedule3Panel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:ra(e.profit_loss.profit_before_tax)})]})]})]}),x.length>0&&a.jsx("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.08] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:205:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"205","data-component-file":"Schedule3Panel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.08%5D%20px-3%20py-2%22%7D",children:a.jsxs("p",{className:"text-[10px] text-text-muted flex items-start gap-1.5","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:206:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"206","data-component-file":"Schedule3Panel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-muted%20flex%20items-start%20gap-1.5%22%7D",children:[a.jsx(xa,{
27className:"w-3.5 h-3.5 text-accent-bright shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:207:12","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"207","data-component-file":"Schedule3Panel.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%20shrink-0%20mt-0.5%22%7D"}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:208:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"208","data-component-file":"Schedule3Panel.tsx","data-component-name":"span",children:["These accounts are not part of the standard chart, so they were grouped by their type:",a.jsxs("strong",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/Schedule3Panel.tsx:210:14","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/Schedule3Panel.tsx","data-component-line":"210","data-component-file":"Schedule3Panel.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:[" ",x.join(", ")]}),". Check they sit where your CA expects."]})]})})]})}const J=e=>`₹${Number(e||0).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,Ee=["January","February","March","April","May","June","July","August","September","October","November","December"],ja="bg-surface/60 border border-white/[0.06] rounded-xl p-4",Se="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]";function V({label:e,value:u,strong:g,muted:p}){return a.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-white/[0.04] last:border-0","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:50:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"50","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20py-1.5%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%22%7D",children:[a.jsx("span",{className:`text-[11px] ${p?"text-text-subtle":"text-text-muted"}`,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:51:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"51","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:e}),a.jsx("span",{className:`tabular-nums ${g?"text-sm font-semibold text-white":"text-xs text-text-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:52:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"52","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:u})]})}function Pn(){var r;const e=new Date,u=new Date(e.getFullYear(),e.getMonth()-1,1),[g,p]=t.useState(u.getFullYear()),[l,f]=t.useState(u.getMonth()+1),[s,n]=t.useState(null),[x,o]=t.useState(null),[A,c]=t.useState(!1),[m,v]=t.useState(!1),N=t.useCallback(async()=>{c(!0);try{const h=`?year=${g}&month=${l}`,[B,w]=await Promise.all([S(`/v1/compliance/gst-filings/gstr1${h}`),S(`/v1/compliance/gst-filings/gstr3b${h}`)]);B.success&&B.data?n(B.data):(n(null),k.error(B.error||"Could not build GSTR-1.")),w.success&&w.data?o(w.data):o(null),v(!0)}finally{c(!1)}},[g,l]);t.useEffect(()=>{N()},[N]);const E=[...((s==null?void 0:s.needs_attention)??[]).map(h=>({side:"sales",...h})),...(x==null?void 0:x.needs_attention)??[]].filter((h,B,w)=>w.findIndex(_=>(_.doc_number??_.bill)===(h.doc_number??h.bill)&&_.reason===h.reason)===B),O=[...new Set([...(s==null?void 0:s.warnings)||[],...(x==null?void 0:x.warnings)||[]])],D=x==null?void 0:x.input_tax_credit,Q=()=>{const h=new Blob([JSON.stringify({gstr1:s,gstr3b:x},null,2)],{type:"application/json"}),B=document.createElement("a");B.href=URL.createObjectURL(h),B.download=`gst-${g}-${String(l).padStart(2,"0")}.json`,B.click(),URL.revokeObjectURL(B.href)};return a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:105:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"105","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("div",{className:ja,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:106:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"106","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:107:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"107","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:108:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"108","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:109:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"109","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Qa,{className:"h-4 w-4 text-success","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:110:14","data-matrix-name":"FileText","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"110","data-component-file":"GstReturnsPanel.tsx","data-component-name":"FileText","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-success%22%7D"})," GST returns",a.jsx("span",{className:"text-[10px] font-normal text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:111:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"111","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-normal%20text-text-subtle%22%7D",children:"from your own books"})]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:113:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"113","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Built from the invoices, credit notes and bills in Zapheit — no Tally or Zoho needed. Check it, then file on the GST portal. Nothing here files anything for you."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:118:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"118","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx("select",{value:l,onCh
27ange:h=>f(Number(h.target.value)),className:Se,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:119:12","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"119","data-component-file":"GstReturnsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:Ee.map((h,B)=>a.jsx("option",{value:B+1,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:120:36","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"120","data-component-file":"GstReturnsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BBinaryExpression%5D%22%7D",children:h},h))}),a.jsx("select",{value:g,onChange:h=>p(Number(h.target.value)),className:Se,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:122:12","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"122","data-component-file":"GstReturnsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[e.getFullYear(),e.getFullYear()-1,e.getFullYear()-2].map(h=>a.jsx("option",{value:h,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:123:92","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"123","data-component-file":"GstReturnsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%7D",children:h},h))}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:A,onClick:N,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:125:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"125","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),s&&a.jsx(j,{size:"sm",variant:"ghost",leftIcon:Ne,onClick:Q,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:126:22","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"126","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Export"})]})]})}),E.length>0&&a.jsxs("div",{className:"rounded-xl bg-danger-fill/[0.08] border border-danger-fill/30 p-4 space-y-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:134:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"134","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20bg-danger-fill%2F%5B0.08%5D%20border%20border-danger-fill%2F30%20p-4%20space-y-2%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-danger-pale flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:135:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"135","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-danger-pale%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(W,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:136:12","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"136","data-component-file":"GstReturnsPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"}),E.length," document",E.length===1?"":"s"," could not be included"]}),a.jsx("p",{className:"text-[11px] text-danger-pale/80","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:139:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"139","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-pale%2F80%22%7D",children:"Fix these before filing. Left as they are, this return understates what you actually did."}),a.jsx("div",{className:"space-y-1.5 pt-1","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:142:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"142","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%20pt-1%22%7D",children:E.slice(0,12).map((h,B)=>a.jsxs("div",{className:"rounded-lg bg-black/20 px-2.5 py-1.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:144:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"144","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-black%2F20%20px-2.5%20py-1.5%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-danger-faint","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:145:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"145","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-faint%22%7D",children:[a.jsx("span",{className:"font-medium","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:146:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"146","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-medium%22%7D",children:h.doc_number||h.bill||"No number"}),h.vendor?a.jsxs("span",{className:"text-danger-pale/60","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:147:30","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"147","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-danger-pale%2F60%22%7D",children:[" · ",h.vendor]}):null,h.doc_date?a.jsxs("span",{className:"text-danger-pale/60","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:148:32","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"148","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-danger-pale%2F60%22%7D",children:[" · ",h.doc_date]}):null,h.side?a.jsxs("span",{className:"text-danger-pale/50","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:149:28","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"149","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-danger-pale%2F50%22%7D",children:[" · ",h.side]}):null]}),a.jsx("p",{className:"text-[10px] text-danger-pale/70 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:151:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"151","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-danger-pale%2F70%20mt-0.5%22%7D",children:h.reason})]},B))})]}),O.length>0&&a.jsx("div",{className:"rounded-xl bg-warning-fill/[0.07] border border-warning-fill/25 p-3 space-y-1","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:159:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"159","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20bg-warning-fill%2F%5B0.07%5D%20border%20border-warning-fill%2F25%20p-3%20space-y-1%22%7D",children:O.map((h,B)=>a.jsxs("p",{className:"text-[11px] text-amber-200/90 flex items-start gap-1.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:161:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"161","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%20flex%20items-start%20gap-1.5%22%7D",children:[a.jsx(xa,{
27className:"w-3.5 h-3.5 shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:162:14","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"162","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20shrink-0%20mt-0.5%22%7D"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:162:62","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"162","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span",children:h})]},B))}),m&&!A&&s&&s.documents_read===0&&E.length===0&&a.jsx("div",{className:ja,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:169:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"169","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:170:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"170","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:["No invoices, credit notes or bills for ",Ee[l-1]," ",g,". Nothing to report for this period."]})}),x&&a.jsxs("div",{className:"grid gap-3 md:grid-cols-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:177:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"177","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20gap-3%20md%3Agrid-cols-2%22%7D",children:[a.jsxs("div",{className:ja,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:179:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"179","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:180:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"180","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20mb-2%22%7D",children:"GSTR-3B · what you pay"}),a.jsx(V,{label:"Taxable sales",value:J(x.outward_supplies.taxable_value),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:181:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"181","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22Taxable%20sales%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),a.jsx(V,{label:"GST on sales (your liability)",value:J(x.net_tax.gross_liability),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:182:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"182","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22GST%20on%20sales%20(your%20liability)%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),a.jsx(V,{label:"Input credit on purchases",value:`− ${J(x.net_tax.credit_available)}`,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:183:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"183","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22Input%20credit%20on%20purchases%22%2C%22value%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("div",{className:"mt-2 pt-2 border-t border-white/[0.08]","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:184:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"184","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-2%20pt-2%20border-t%20border-white%2F%5B0.08%5D%22%7D",children:a.jsx(V,{label:"Net GST payable",value:J(x.net_tax.net_payable),strong:!0,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:185:14","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"185","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22Net%20GST%20payable%22%2C%22value%22%3A%22%5BCallExpression%5D%22%2C%22strong%22%3Atrue%7D"})}),a.jsx("p",{className:"text-[10px] text-text-subtle mt-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:187:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"187","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-2%20leading-relaxed%22%7D",children:x.net_tax.note})]}),a.jsxs("div",{className:ja,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:190:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"190","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:191:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"191","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20mb-2%22%7D",children:"Input tax credit"}),a.jsx(V,{label:`Claimed (${(D==null?void 0:D.eligible.count)??0} bill${(D==null?void 0:D.eligible.count)===1?"":"s"})`,value:J((D==null?void 0:D.eligible.total)??0),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:192:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"192","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),((D==null?void 0:D.reverse_charge.count)??0)>
270&&a.jsx(V,{label:`Reverse charge (${D==null?void 0:D.reverse_charge.count})`,value:J((D==null?void 0:D.reverse_charge.total)??0),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:194:14","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"194","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),((D==null?void 0:D.unverified.count)??0)>0&&a.jsx(V,{label:`Held back — tax not confirmed (${D==null?void 0:D.unverified.count})`,value:J((D==null?void 0:D.unverified.total)??0),muted:!0,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:198:14","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"198","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%2C%22muted%22%3Atrue%7D"}),((D==null?void 0:D.blocked.count)??0)>0&&a.jsx(V,{label:`Not claimable (${D==null?void 0:D.blocked.count})`,value:J((D==null?void 0:D.blocked.total)??0),muted:!0,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:201:14","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"201","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%2C%22muted%22%3Atrue%7D"}),a.jsx("div",{className:"mt-2 pt-2 border-t border-white/[0.08]","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:203:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"203","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-2%20pt-2%20border-t%20border-white%2F%5B0.08%5D%22%7D",children:a.jsx(V,{label:"Total credit claimed",value:J((D==null?void 0:D.net_claimable)??0),strong:!0,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:204:14","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"204","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22Total%20credit%20claimed%22%2C%22value%22%3A%22%5BCallExpression%5D%22%2C%22strong%22%3Atrue%7D"})}),(((r=D==null?void 0:D.blocked.reasons)==null?void 0:r.length)??0)>0&&a.jsx("div",{className:"mt-2 space-y-0.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:207:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"207","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-2%20space-y-0.5%22%7D",children:D.blocked.reasons.slice(0,4).map((h,B)=>a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:209:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"209","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[h.reason," — ",J(h.amount)]},B))})]})]}),s&&s.documents_read>0&&a.jsxs("div",{className:ja,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:218:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"218","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:219:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"219","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20mb-2%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:220:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"220","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:"GSTR-1 · what you sold"}),a.jsxs("span",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:221:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"221","data-component-file":"GstReturnsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[s.gstin?`GSTIN ${s.gstin} · `:"","period ",s.period]})]}),a.jsx(V,{label:`B2B — registered customers (${s.b2b.count})`,value:J(s.b2b.taxable_value),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:225:10","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"225","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),a.jsx(V,{label:`B2C large — over ₹2.5 lakh, other states (${s.b2cl.count})`,value:J(s.b2cl.taxable_value),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:226:10","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"226","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),a.jsx(V,{label:`B2C small — summarised by state (${s.b2cs.count})`,value:J(s.b2cs.taxable_value),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:227:10","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"227","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),a.jsx(V,{label:`Credit notes (${s.cdnr.count})`,value:`− ${J(s.cdnr.taxable_value)}`,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:228:10","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"228","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx(V,{label:`HSN summary lines (${s.hsn.count})`,value:J(s.hsn.taxable_value),muted:!0,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:229:10","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"229","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BCallExpression%5D%22%2C%22muted%22%3Atrue%7D"}),a.jsxs("div",{className:"mt-2 pt-2 border-t border-white/[0.08] space-y-0.5","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:230:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"230","data-component-file":"GstReturnsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-2%20pt-2%20border-t%20border-white%2F%5B0.08%5D%20space-y-0.5%22%7D",children:[a.jsx(V,{label:"Total taxable value",value:J(s.totals.taxable_value),strong:!0,"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:231:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"231","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22Total%20taxable%20value%22%2C%22value%22%3A%22%5BCallExpression%5D%22%2C%22strong%22%3Atrue%7D"}),a.jsx(V,{label:"CGST",value:J(s.totals.cgst),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:232:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"232","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22CGST%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),a.jsx(V,{label:"SGST",value:J(s.totals.sgst),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:233:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"233","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22SGST%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"}),a.jsx(V,{label:"IGST",value:J(s.totals.igst),"data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:234:12","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"234","data-component-file":"GstReturnsPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22label%22%3A%22IGST%22%2C%22value%22%3A%22%5BCallExpression%5D%22%7D"})]}),a.jsx("p",{className:"text-[10px] text-text-subtle mt-2","data-matrix-id":"src/pages/dashboard/personas/GstReturnsPanel.tsx:236:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/GstReturnsPanel.tsx","data-component-line":"236","data-component-file":"GstReturnsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-2%22%7D",children:"Credit notes are subtracted, so these totals are what you actually supplied in the peri
27od."})]})]})}const ea=e=>`₹${Number(e||0).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,Ia=e=>Number(e||0).toLocaleString("en-IN",{maximumFractionDigits:3}),Ra="bg-surface/60 border border-white/[0.06] rounded-xl p-4",La="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]",vn={opening:"Opening stock",purchase:"Bought",sale:"Sold",adjustment:"Adjusted",return_in:"Returned to you",return_out:"Returned by you"};function Bn(){const[e,u]=t.useState(null),[g,p]=t.useState(!0),[l,f]=t.useState(null),[s,n]=t.useState({}),[x,o]=t.useState(null),[A,c]=t.useState(""),[m,v]=t.useState(""),[N,E]=t.useState(!1),O=t.useCallback(async()=>{p(!0);try{const r=await S("/ledger/stock");r.success&&r.data?u(r.data):k.error(r.error||"Could not load stock")}catch{k.error("Could not load stock")}finally{p(!1)}},[]);t.useEffect(()=>{O()},[O]);const D=async r=>{if(l===r){f(null);return}if(f(r),!s[r])try{const h=await S(`/ledger/stock/${r}/movements`);h.success&&h.data&&n(B=>({...B,[r]:h.data.movements}))}catch{k.error("Could not load the history")}},Q=async()=>{var h,B;if(!x)return;if(!m.trim()){k.error("Say what the adjustment is for — it is the only record of why.");return}const r=Number(A);if(!Number.isFinite(r)||r<0){k.error("Enter the quantity you counted.");return}E(!0);try{const w=await S("/ledger/stock/adjust",{method:"POST",body:JSON.stringify({item_id:x.item_id,as_of:new Date().toISOString().slice(0,10),counted_quantity:r,reason:m.trim()})});w.success?(k.success(((h=w.data)==null?void 0:h.adjusted)===!1?"The count already matches the books.":`Adjusted by ${Ia(w.data.difference)}.`),(B=w.data)!=null&&B.note&&k.error(w.data.note),o(null),c(""),v(""),n(_=>{const i={..._};return delete i[x.item_id],i}),await O()):k.error(w.error||"Could not adjust")}catch{k.error("Could not adjust")}finally{E(!1)}};return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:114:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"114","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:115:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"115","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:116:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"116","data-component-file":"StockPanel.tsx","data-component-name":"div",children:[a.jsxs("h3",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:117:10","data-matrix-name":"h3","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"117","data-component-file":"StockPanel.tsx","data-component-name":"h3","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Xe,{className:"w-4 h-4 text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:118:12","data-matrix-name":"Boxes","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"118","data-component-file":"StockPanel.tsx","data-component-name":"Boxes","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-accent-bright%22%7D"})," Stock"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:120:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"120","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"What you hold, what it cost, and how it got there"})]}),a.jsx(j,{variant:"ghost",size:"sm",onClick:()=>void O(),disabled:g,"aria-label":"Refresh",title:"Refresh","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:122:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"122","data-component-file":"StockPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%2C%22title%22%3A%22Refresh%22%7D",children:a.jsx(H,{className:`w-3.5 h-3.5 ${g?"animate-spin":""}`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:123:10","data-matrix-name":"RefreshCw","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"123","data-component-file":"StockPanel.tsx","data-component-name":"RefreshCw","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})})]}),e&&e.tracked_items>0&&(()=>{const r=e.reconciles&&e.negative_items===0&&e.out_of_order_items.length===0;return a.jsx("div",{className:`${Ra} ${e.reconciles?r?"":"border-warning-fill/25":"border-danger-fill/25"}`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:135:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"135","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:a.jsxs("div",{className:"flex items-start gap-3","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:136:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"136","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-3%22%7D",children:[r?a.jsx(Z,{className:"w-4 h-4 text-success mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:138:16","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"138","data-component-file":"StockPanel.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-success%20mt-0.5%20shrink-0%22%7D"}):a.jsx(W,{className:`w-4 h-4 mt-0.5 shrink-0 ${e.reconciles?"text-warning":"text-danger"}`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:139:16","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"139","data-component-file":"StockPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsxs("div",{className:"flex-1 min-w-0","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:140:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"140","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-1%20min-w-0%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:141:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"141","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:e.reconciles?r?"Your stock records match your books":"The totals agree, but some items are wrong":"Your stock records disagree with your books"}),a.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1 mt-2 text-[11px] tabular-nums","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:148:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"148","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20gap-x-6%20gap-y-1%20mt-2%20text-%5B11px%5D%20tabular-nums%22%7D",children:[a.jsxs("span",{className:"text-text-muted","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:149:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"149","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-muted%22%7D",children:["Stock movements ",a.jsx("span",{className:"text-white ml-1","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:149:66","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"149","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%20ml-1%22%7D",children:ea(e.total_value)})]}),a.jsxs("span",{className:"text-text-muted","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:150:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"150","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-muted%22%7D",children:["Inventory account ",a.jsx("span",{className:"text-white ml-1","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:150:68","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"150","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%20ml-1%22%7D",children:ea(e.account_value)})]})]}),!e.reconciles&&a.jsxs("p",{className:"text-[11px] text-danger-bright mt-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:153:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"153","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-bright%20mt-2%20leading-relaxed%22%7D",children:["They differ by ",ea(Math.abs(e.total_value-e.account_value)),". One of them is wrong, so both your balance sheet and your gross profit are wrong until it is settled."]}),e.reconciles&&!r&&a.jsx("p",{className:"text-[11px] text-warning-bright/90 mt-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:159:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"159","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-warning-bright%2F90%20mt-2%20leading-relaxed%22%7D",children:"The two totals match, but that is not the same as being right: goods sold before their purchase was entered cost nothing, so both sides agree at a figure that is too low."})]})]})})})(),e&&e.out_of_order_items.length>0&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-warning-fill/[0.07] border border-warning-fill/20","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:174:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"174","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20px-3%20py-2.5%20rounded-lg%20bg-warning-fill%2F%5B0.07%5D%20border%20border-warning-fill%2F20%22%7D",children:[a.jsx(W,{className:"w-3.5 h-3.5 text-warning mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:175:10","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"175","data-component-file":"StockPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-warning%20mt-0.5%20shrink-0%22%7D"}),a.jsxs("div",{className:"text-[11px] text-amber-100/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:176:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"176","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-100%2F80%20leading-relaxed%22%7D",children:[a.jsxs("p",{"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:177:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"177","data-component-file":"StockPanel.tsx","data-component-name":"p",children:[e.out_of_order_items.length===1?"One item was":`${e.out_of_order_items.length} items were`," bought after ",e.out_of_order_items.length===1?"it was":"they were"," sold, so the cost charged on those sales is lower than what the goods really cost. Your books are not broken — but that profit is flattering."]}),a.jsx("ul",{className:"mt-1.5 space-y-0.5","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:182:12","data-matrix-name":"ul","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"182","data-component-file":"StockPanel.tsx","data-component-name":"ul","data-component-content":"%7B%22className%22%3A%22mt-1.5%20space-y-0.5%22%7D",children:e.out_of_order_items.map(r=>a.jsxs("li",{className:"tabular-nums","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:184:16","data-matrix-name":"li","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"184","data-component-file":"StockPanel.tsx","data-component-name":"li","data-component-content":"%7B%22className%22%3A%22tabular-nums%22%7D",children:[r.name,": booked at ",ea(r.posted),", actually worth ",ea(r.restated)]},r.name))}),a.jsx("p",{className:"mt-1.5 text-amber-200/60","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:189:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"189","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-1.5%20text-amber-200%2F60%22%7D",children:"Post a correcting entry under Account balances if it matters."})]})]}),e&&e.negative_items>0&&a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-danger-fill/[0.07] border border-danger-fill/20","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:195:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"195","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20px-3%20py-2.5%20rounded-lg%20bg-danger-fill%2F%5B0.07%5D%20border%20border-danger-fill%2F20%22%7D",children:[a.jsx(W,{className:"w-3.5 h-3.5 text-danger mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:196:10","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"196","data-component-file":"StockPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-danger%20mt-0.5%20shrink-0%22%7D"}),a.jsxs("p",{className:"text-[11px] text-danger-faint/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:197:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"197","data-component-file":"StockPanel.tsx","data-component-nam
27e":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-faint%2F80%20leading-relaxed%22%7D",children:[e.negative_items===1?"One item shows":`${e.negative_items} items show`," less stock than zero. More has gone out than ever came in, which always means a purchase has not been entered — until it is, those sales cost nothing and your profit is overstated."]})]}),!g&&e&&e.tracked_items===0&&a.jsxs("div",{className:`${Ra} text-center`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:207:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"207","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("p",{className:"text-xs text-text-soft","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:208:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"208","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-soft%22%7D",children:"You are not tracking stock for anything yet."}),a.jsxs("p",{className:"text-[11px] text-text-subtle mt-1.5 leading-relaxed max-w-lg mx-auto","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:209:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"209","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-1.5%20leading-relaxed%20max-w-lg%20mx-auto%22%7D",children:["Turn on ",a.jsx("span",{className:"text-text-soft","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:210:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"210","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%22%7D",children:"Track stock"})," for an item under Customers & items. Goods you buy then become an asset until you sell them, instead of an expense the day they arrive — which is what makes your profit right in the month you stocked up."]})]}),e&&e.items.length>0&&a.jsxs("div",{className:Ra,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:219:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"219","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"hidden sm:grid grid-cols-12 gap-2 pb-2 mb-1 border-b border-white/[0.06] text-[10px] uppercase tracking-wide text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:220:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"220","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22hidden%20sm%3Agrid%20grid-cols-12%20gap-2%20pb-2%20mb-1%20border-b%20border-white%2F%5B0.06%5D%20text-%5B10px%5D%20uppercase%20tracking-wide%20text-text-subtle%22%7D",children:[a.jsx("div",{className:"col-span-4","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:221:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"221","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-4%22%7D",children:"Item"}),a.jsx("div",{className:"col-span-2 text-right","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:222:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"222","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-2%20text-right%22%7D",children:"On hand"}),a.jsx("div",{className:"col-span-2 text-right","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:223:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"223","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-2%20text-right%22%7D",children:"Average cost"}),a.jsx("div",{className:"col-span-2 text-right","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:224:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"224","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-2%20text-right%22%7D",children:"Value"}),a.jsx("div",{className:"col-span-2","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:225:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"225","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-2%22%7D"})]}),e.items.map(r=>{var h,B;return a.jsxs("div",{className:"border-b border-white/[0.04] last:border-0 py-2.5","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:229:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"229","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%20py-2.5%22%7D",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 items-center","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:230:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"230","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-1%20sm%3Agrid-cols-12%20gap-2%20items-center%22%7D",children:[a.jsxs("div",{className:"sm:col-span-4 min-w-0","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:231:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"231","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-4%20min-w-0%22%7D",children:[a.jsx("p",{className:"text-xs text-white truncate","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:232:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"232","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%20truncate%22%7D",children:r.name}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:233:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"233","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[r.hsn_sac?`HSN ${r.hsn_sac} · `:"",r.movements," movement",r.movements===1?"":"s",!r.active&&" · inactive"]})]}),a.jsxs("div",{className:`sm:col-span-2 sm:text-right text-xs tabular-nums ${r.negative?"text-danger-bright font-semibold":"text-text-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:238:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"238","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[Ia(r.quantity)," ",a.jsx("span",{className:"text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:239:37","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"239","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%22%7D",children:r.unit})]}),a.jsx("div",{className:"sm:col-span-2 sm:text-right text-xs tabular-nums text-text-muted","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:241:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"241","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-2%20sm%3Atext-right%20text-xs%20tabular-nums%20text-text-muted%22%7D",children:r.quantity>0&&!r.out_of_order?ea(r.average_cost):a.jsx("span",{className:"text-text-faint","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:248:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"248","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%22%7D",children:"—"})}),a.jsx("div",{className:"sm:col-span-2 sm:text-right text-xs tabular-nums text-white","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:250:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"250","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-2%20sm%3Atext-right%20text-xs%20tabular-nums%20text-white%22%7D",children:ea(r.value)}),a.jsxs("div",{className:"sm:col-span-2 flex sm:justify-end gap-1.5","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:251:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"251","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-2%20flex%20sm%3Ajustify-end%20gap-1.5%22%7D",children:[a.jsxs(j,{size:"sm",variant:"ghost",onClick:()=>void D(r.item_id),"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:252:18","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"252","data-component-file":"StockPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(bt,{className:"w-3 h-3 sm:mr-0 mr-1","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:253:20","data-matrix-name":"History","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"253","data-component-file":"StockPanel.tsx","data-component-name":"History","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20sm%3Amr-0%20mr-1%22%7D"}),a.jsx("span",{className:"sm:hidden","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:253:64","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"253","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22sm%3Ahidden%22%7D",children:"History"})]}),a.jsxs(j,{size:"sm",variant:"ghost",onClick:()=>{o(r),c(String(r.quantity)),v("")},"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:255:18","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"255","data-component-file":"StockPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx($a,{className:"w-3 h-3 sm:mr-0 mr-1","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:256:20","data-matrix-name":"Scale","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"256","data-component-file":"StockPanel.tsx","data-component-name":"Scale","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20sm%3Amr-0%20mr-1%22%7D"}),a.jsx("span",{className:"sm:hidden","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:256:62","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"256","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22sm%3Ahidden%22%7D",children:"Adjust"})]})]})]}),r.negative&&a.jsxs("p",{className:"text-[10px] text-danger-bright/90 mt-1.5","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:262:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"262","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-danger-bright%2F90%20mt-1.5%22%7D",children:["Sold more than was ever received. Enter the missing purchase — until then these sales show no cost at all.",r.value!==0&&` Your books still carry ${ea(r.value)} against it, which cannot be right when the count is below zero.`]}),l===r.item_id&&a.jsxs("div",{className:"mt-3 pl-2 border-l-2 border-white/[0.08] space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:270:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"270","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20pl-2%20border-l-2%20border-white%2F%5B0.08%5D%20space-y-1.5%22%7D",children:[!s[r.item_id]&&a.jsx("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:271:43","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"271","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:"Loading…"}),((h=s[r.item_id])==null?void 0:h.length)===0&&a.jsx("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:272:56","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"272","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:"Nothing has moved yet."}),(B=s[r.item_id])==null?void 0:B.map(w=>a.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-0.5 text-[11px]","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:274:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"274","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-baseline%20gap-x-3%20gap-y-0.5%20text-%5B11px%5D%22%7D",children:[a.jsx("span",{className:"text-text-subtle tabular-nums w-[76px] shrink-0","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:275:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"275","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20tabular-nums%20w-%5B76px%5D%20shrink-0%22%7D",children:w.date}),a.jsxs("span",{className:w.direction==="in"?"text-success-bright":"text-warning-bright","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:276:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"276","data-component-file":"StockPane
27l.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:[w.direction==="in"?"+":"−",Ia(w.quantity)]}),a.jsx("span",{className:"text-text-muted","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:279:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"279","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-muted%22%7D",children:vn[w.source]||w.source}),a.jsx("span",{className:"text-text-soft tabular-nums","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:280:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"280","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-soft%20tabular-nums%22%7D",children:ea(w.value)}),a.jsxs("span",{className:"text-text-faint tabular-nums","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:281:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"281","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%20tabular-nums%22%7D",children:["→ ",Ia(w.balance_quantity)," ",r.unit," worth ",ea(w.balance_value)]}),w.went_negative&&a.jsx("span",{className:"text-danger-bright","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:284:42","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"284","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-danger-bright%22%7D",children:"sold from stock that was not there"}),w.narration&&a.jsx("span",{className:"text-text-faint truncate max-w-[240px]","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:285:38","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"285","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-faint%20truncate%20max-w-%5B240px%5D%22%7D",children:w.narration})]},w.id))]})]},r.item_id)}),a.jsxs("div",{className:"flex items-center justify-between pt-3 mt-1 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:293:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"293","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20pt-3%20mt-1%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsx("span",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:294:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"294","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:"Total stock value"}),a.jsx("span",{className:"text-sm font-semibold text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:295:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"295","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20tabular-nums%22%7D",children:ea(e.total_value)})]})]}),x&&a.jsxs("div",{className:`${Ra} border-warning-fill/25`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:302:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"302","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:303:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"303","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:["Adjust ",x.name]}),a.jsxs("p",{className:"text-[11px] text-text-muted mt-1 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:304:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"304","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mt-1%20leading-relaxed%22%7D",children:["The books say ",a.jsxs("span",{className:"text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:305:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"305","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%20tabular-nums%22%7D",children:[Ia(x.quantity)," ",x.unit]}),". Enter what you actually counted — the difference is recorded as a new movement and posted to your books. Nothing is edited or deleted, so the history stays readable."]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 mt-3","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:309:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"309","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-1%20sm%3Agrid-cols-3%20gap-2%20mt-3%22%7D",children:[a.jsxs("label",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:310:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"310","data-component-file":"StockPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:["Counted",a.jsx("input",{value:A,onChange:r=>c(r.target.value),inputMode:"decimal",className:`${La} w-full mt-1`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:312:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"312","data-component-file":"StockPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[11px] text-text-muted sm:col-span-2","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:314:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"314","data-component-file":"StockPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20sm%3Acol-span-2%22%7D",children:["Why",a.jsx("input",{value:m,onChange:r=>v(r.target.value),placeholder:"Stock count, breakage, damaged in transit…",className:`${La} w-full mt-1`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:316:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"316","data-component-file":"StockPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Stock%20count%2C%20breakage%2C%20damaged%20in%20transit%E2%80%A6%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-3","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:319:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"319","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20mt-3%22%7D",children:[a.jsx(j,{size:"sm",onClick:()=>void Q(),disabled:N,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:320:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"320","data-component-file":"StockPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:N?"Recording…":"Record the count"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>o(null),"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:321:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"321","data-component-file":"StockPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]})]}),e&&e.tracked_items>0&&e.items.every(r=>r.movements===0)&&a.jsx(An,{items:e.items.map(r=>({id:r.item_id,name:r.name,unit:r.unit,purchase_rate:r.purchase_rate})),onDone:()=>void O(),"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:330:8","data-matrix-name":"OpeningStockPanel","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"330","data-component-file":"StockPanel.tsx","data-component-name":"OpeningStockPanel","data-component-content":"%7B%22items%22%3A%22%5BCallExpression%5D%22%2C%22onDone%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-accent/[0.07] border border-accent/20","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:333:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"333","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20px-3%20py-2.5%20rounded-lg%20bg-accent%2F%5B0.07%5D%20border%20border-accent%2F20%22%7D",children:[a.jsx(xa,{
27className:"w-3.5 h-3.5 text-accent-bright mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:334:8","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"334","data-component-file":"StockPanel.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%20mt-0.5%20shrink-0%22%7D"}),a.jsx("p",{className:"text-[11px] text-accent-faint/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:335:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"335","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-accent-faint%2F80%20leading-relaxed%22%7D",children:"Stock is valued at weighted average cost, the same basis Tally uses by default. Every quantity and value here is worked out from the movements themselves rather than stored — so what you see can always be traced back to the bill or invoice that caused it."})]})]})}function An({items:e,onDone:u}){const[g,p]=t.useState({}),[l,f]=t.useState(new Date().toISOString().slice(0,10)),[s,n]=t.useState(!1),[x,o]=t.useState(null),A=async()=>{const c=Object.entries(g).map(([m,v])=>({item_id:m,quantity:Number(v.qty),unit_cost:Number(v.cost)})).filter(m=>Number.isFinite(m.quantity)&&m.quantity>0&&Number.isFinite(m.unit_cost)&&m.unit_cost>=0);if(c.length===0){k.error("Enter a quantity and a cost for at least one item.");return}n(!0);try{const m=await S("/ledger/opening-stock",{method:"POST",body:JSON.stringify({as_of:l,items:c})});m.success?(o(`Recorded ${m.data.items} item${m.data.items===1?"":"s"} worth ${ea(m.data.total_value)}.`),k.success("Opening stock recorded."),u()):k.error(m.error||"Could not record opening stock")}catch{k.error("Could not record opening stock")}finally{n(!1)}};return e.length===0?null:a.jsxs("div",{className:Ra,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:380:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"380","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:381:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"381","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(X,{className:"w-3.5 h-3.5 text-text-muted","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:381:78","data-matrix-name":"Plus","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"381","data-component-file":"StockPanel.tsx","data-component-name":"Plus","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-text-muted%22%7D"})," Stock you already own"]}),a.jsx("p",{className:"text-[11px] text-text-muted mt-1 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:384:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"384","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mt-1%20leading-relaxed%22%7D",children:"If you were already trading before using Zapheit, enter what you were holding and what it cost you. Without it your first sale of each item is costed against nothing, and your profit is wrong from day one. This is entered once."}),x?a.jsx("p",{className:"text-[11px] text-success-bright mt-3","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:390:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"390","data-component-file":"StockPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-success-bright%20mt-3%22%7D",children:x}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-[11px] text-text-muted mt-3","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:393:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"393","data-component-file":"StockPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B11px%5D%20text-text-muted%20mt-3%22%7D",children:["As at",a.jsx("input",{type:"date",value:l,onCh
27ange:c=>f(c.target.value),className:`${La} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:395:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"395","data-component-file":"StockPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsx("div",{className:"mt-3 space-y-2","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:397:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"397","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20space-y-2%22%7D",children:e.map(c=>{var m,v;return a.jsxs("div",{className:"grid grid-cols-12 gap-2 items-center","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:399:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"399","data-component-file":"StockPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-12%20gap-2%20items-center%22%7D",children:[a.jsx("span",{className:"col-span-5 text-[11px] text-text-soft truncate","data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:400:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"400","data-component-file":"StockPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22col-span-5%20text-%5B11px%5D%20text-text-soft%20truncate%22%7D",children:c.name}),a.jsx("input",{className:`${La} col-span-3`,inputMode:"decimal",placeholder:`Qty (${c.unit})`,value:((m=g[c.id])==null?void 0:m.qty)||"",onChange:N=>p(E=>{var O;return{...E,[c.id]:{qty:N.target.value,cost:((O=E[c.id])==null?void 0:O.cost)||""}}}),"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:401:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"401","data-component-file":"StockPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BLogicalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx("input",{className:`${La} col-span-4`,inputMode:"decimal",placeholder:c.purchase_rate!=null?`Cost each (usually ₹${c.purchase_rate})`:"Cost each",value:((v=g[c.id])==null?void 0:v.cost)||"",onChange:N=>p(E=>{var O;return{...E,[c.id]:{qty:((O=E[c.id])==null?void 0:O.qty)||"",cost:N.target.value}}}),"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:403:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"403","data-component-file":"StockPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22%5BConditionalExpression%5D%22%2C%22value%22%3A%22%5BLogicalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"})]},c.id)})}),a.jsx(j,{size:"sm",className:"mt-3",onClick:()=>void A(),disabled:s,"data-matrix-id":"src/pages/dashboard/personas/StockPanel.tsx:409:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/StockPanel.tsx","data-component-line":"409","data-component-file":"StockPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22className%22%3A%22mt-3%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:s?"Recording…":"Record opening stock"})]})]})}const ka=e=>`₹${Number(e||0).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,ce="bg-surface/60 border border-white/[0.06] rounded-xl p-4",Fa="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]";function Nn(){const[e,u]=t.useState([]),[g,p]=t.useState([]),[l,f]=t.useState([]),[s,n]=t.useState({}),[x,o]=t.useState("generic"),[A,c]=t.useState(new Date().toISOString().slice(0,10)),[m,v]=t.useState(""),[N,E]=t.useState(null),[O,D]=t.useState(!0),[Q,r]=t.useState(!1),[h,B]=t.useState(""),[w,_]=t.useState(null),i=t.useCallback(async()=>{D(!0);try{const[I,L,R]=await Promise.all([S("/hubs/finance/invoices?limit=200"),S("/payment-runs?limit=25"),S("/payment-runs/formats")]);I.success&&I.data&&u(I.data.filter($=>$.status==="approved")),L.success&&L.data&&p(L.data),R.success&&R.data&&f(R.data)}catch{k.error("Could not load supplier bills")}finally{D(!1)}},[]);t.useEffect(()=>{i()},[i]);const d=e.filter(I=>s[I.id]),P=d.reduce((I,L)=>I+Number(L.amount||0),0),C=async()=>
27{if(d.length===0){k.error("Choose at least one bill.");return}r(!0);try{const I=await S("/payment-runs",{method:"POST",body:JSON.stringify({bill_ids:d.map(L=>L.id),payment_date:A,bank_format:x,debit_account:m.trim()||void 0})});I.success&&I.data?(E(I.data),n({}),await i()):k.error(I.error||"Could not prepare the run.")}catch{k.error("Could not prepare the run.")}finally{r(!1)}},y=(I,L)=>{const R=new Blob([L],{type:"text/csv"}),$=URL.createObjectURL(R),G=document.createElement("a");G.href=$,G.download=I,document.body.appendChild(G),G.click(),G.remove(),URL.revokeObjectURL($)},b=async I=>{r(!0);try{const L=await S(`/payment-runs/${I}/confirm`,{method:"POST",body:JSON.stringify({reference:h.trim()||void 0})});L.success?(k.success(`${L.data.paid} bill${L.data.paid===1?"":"s"} marked paid.`),L.warning&&k.error(L.warning),_(null),B(""),E(null),await i()):k.error(L.error||"Could not confirm.")}catch{k.error("Could not confirm.")}finally{r(!1)}},F=async I=>{const L=window.prompt("Why is this run being cancelled? It is the only record of why those suppliers were not paid.");if(!(!L||L.trim().length<3)){r(!0);try{const R=await S(`/payment-runs/${I}/cancel`,{method:"POST",body:JSON.stringify({reason:L.trim()})});R.success?(k.success("Run cancelled — those bills are free for a later run."),E(null),await i()):k.error(R.error||"Could not cancel.")}catch{k.error("Could not cancel.")}finally{r(!1)}}};return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:129:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"129","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:130:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"130","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:131:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"131","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div",children:[a.jsxs("h3",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:132:10","data-matrix-name":"h3","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"132","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"h3","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(qe,{className:"w-4 h-4 text-success","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:133:12","data-matrix-name":"Banknote","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"133","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Banknote","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-success%22%7D"})," Paying suppliers"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:135:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"135","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Pick the bills, get a bank file, upload it yourself"})]}),a.jsx(j,{variant:"ghost",size:"sm",onClick:()=>void i(),disabled:O,"aria-label":"Refresh",title:"Refresh","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:137:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"137","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%2C%22title%22%3A%22Refresh%22%7D",children:a.jsx(H,{className:`w-3.5 h-3.5 ${O?"animate-spin":""}`,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:138:10","data-matrix-name":"RefreshCw","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"138","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"RefreshCw","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})})]}),a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-accent/[0.07] border border-accent/20","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:143:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"143","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20px-3%20py-2.5%20rounded-lg%20bg-accent%2F%5B0.07%5D%20border%20border-accent%2F20%22%7D",children:[a.jsx(xa,{
27className:"w-3.5 h-3.5 text-accent-bright mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:144:8","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"144","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%20mt-0.5%20shrink-0%22%7D"}),a.jsxs("p",{className:"text-[11px] text-accent-faint/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:145:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"145","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-accent-faint%2F80%20leading-relaxed%22%7D",children:["Zapheit prepares the file. ",a.jsx("span",{className:"font-semibold","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:146:37","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"146","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-semibold%22%7D",children:"You"})," upload it to your bank and authorise it with your own login — Zapheit never moves money. Nothing is marked paid until you come back and confirm it went out."]})]}),!N&&a.jsx("div",{className:ce,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:153:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"153","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:e.length===0?a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:155:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"155","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"No approved bills waiting to be paid."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"max-h-64 overflow-y-auto space-y-1","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:158:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"158","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22max-h-64%20overflow-y-auto%20space-y-1%22%7D",children:e.map(I=>a.jsxs("label",{className:"flex items-center gap-2.5 py-1.5 px-2 rounded-lg hover:bg-white/[0.02] cursor-pointer","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:160:18","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"160","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2.5%20py-1.5%20px-2%20rounded-lg%20hover%3Abg-white%2F%5B0.02%5D%20cursor-pointer%22%7D",children:[a.jsx("input",{type:"checkbox",checked:!!s[I.id],onChange:L=>n(R=>({...R,[I.id]:L.target.checked})),className:"accent-success-fill","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:161:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"161","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BUnaryExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22accent-success-fill%22%7D"}),a.jsxs("span",{className:"flex-1 min-w-0","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:164:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"164","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22flex-1%20min-w-0%22%7D",children:[a.jsx("span",{className:"text-xs text-white","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:165:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"165","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%22%7D",children:I.vendor_name}),a.jsxs("span",{className:"text-[10px] text-text-subtle ml-2","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:166:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"166","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20ml-2%22%7D",children:[I.invoice_number||"no number",I.due_date?` · due ${I.due_date}`:""]})]}),a.jsx("span",{className:"text-xs text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:168:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"168","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%20tabular-nums%22%7D",children:ka(Number(I.amount))})]},I.id))}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 mt-3 pt-3 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:173:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"173","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-1%20sm%3Agrid-cols-3%20gap-2%20mt-3%20pt-3%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:174:16","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"174","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Payment date",a.jsx("input",{type:"date",value:A,onChange:I=>c(I.target.value),className:`${Fa} w-full mt-1`,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:176:18","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"176","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:178:16","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"178","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Bank file format",a.jsx("select",{value:x,onChange:I=>o(I.target.value),className:`${Fa} w-full mt-1`,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:180:18","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"180","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:l.map(I=>a.jsx("option",{value:I.id,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:181:40","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"181","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:I.label},I.id))})]}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:184:16","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"184","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Your account to debit (optional)",a.jsx("input",{value:m,onChange:I=>v(I.target.value),placeholder:"Account number",className:`${Fa} w-full mt-1`,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:186:18","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"186","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Account%20number%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]})]}),a.jsxs("div",{className:"flex items-center justify-between mt-3","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:190:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"190","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20mt-3%22%7D",children:[a.jsxs("span",{className:"text-[11px] text-text-muted tabular-nums","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:191:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"191","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20tabular-nums%22%7D",children:[d.length," selected · ",ka(P)]}),a.jsx(j,{size:"sm",onClick:()=>void C(),disabled:Q||d.length===0,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:194:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"194","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BLogicalExpression%5D%22%7D",children:Q?"Preparing…":"Prepare the bank file"})]})]})}),N&&a.jsxs("div",{className:`${ce} border-success-fill/20`,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:205:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"205","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:206:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"206","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:["Ready to upload — ",N.payable.count," payment",N.payable.count===1?"":"s",", ",ka(N.payable.total)]}),a.jsx("p",{className:"text-[11px] text-text-muted mt-1","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:209:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"209","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mt-1%22%7D",children:N.bank_format_label}),N.warnings.map((I,L)=>a.jsx("p",{className:"text-[11px] text-warning-bright/90 mt-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:212:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"212","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-warning-bright%2F90%20mt-2%20leading-relaxed%22%7D",children:I},L)),N.blocked.count>0&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg bg-danger-fill/[0.07] border border-danger-fill/20","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:217:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"217","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-2%20px-3%20py-2%20rounded-lg%20bg-danger-fill%2F%5B0.07%5D%20border%20border-danger-fill%2F20%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-danger-faint/80 font-semibold","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:218:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"218","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-faint%2F80%20font-semibold%22%7D",children:["Not included (",ka(N.blocked.total),")"]}),a.jsx("ul",{className:"mt-1 space-y-0.5","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:219:14","data-matrix-name":"ul","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"219","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"ul","data-component-content":"%7B%22className%22%3A%22mt-1%20space-y-0.5%22%7D",children:N.blocked.vendors.map((I,L)=>a.jsxs("li",{className:"text-[11px] text-danger-faint/70","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:221:18","data-matrix-name":"li","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"221","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"li","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-faint%2F70%22%7D",children:[I.name," — ",I.reason]},L))})]}),a.jsx("p",{className:"text-[10px] text-text-subtle mt-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:227:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"227","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-2%20leading-relaxed%22%7D",children:N.verify_note}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-3","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:229:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"229","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-2%20mt-3%22%7D",children:[a.jsxs(j,{size:"sm",onClick:()=>y(N.
27file_name,N.file_content),"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:230:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"230","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(Ne,{className:"w-3 h-3 mr-1","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:231:14","data-matrix-name":"Download","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"231","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Download","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mr-1%22%7D"})," Download the bank file"]}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>_(N.batch_id),"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:233:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"233","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"I have paid these"}),a.jsxs(j,{size:"sm",variant:"ghost",onClick:()=>void F(N.batch_id),"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:236:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"236","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(Za,{className:"w-3 h-3 mr-1","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:237:14","data-matrix-name":"Ban","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"237","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Ban","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mr-1%22%7D"})," Cancel this run"]})]}),w===N.batch_id&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:242:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"242","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20pt-3%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:245:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"245","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%22%7D",children:["Confirm only after your bank has actually processed the file. This marks all ",N.payable.count," bills paid and posts the entries — it does not send any money."]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:249:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"249","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-2%20mt-2%22%7D",children:[a.jsx("input",{value:h,onChange:I=>B(I.target.value),placeholder:"Bank reference / UTR (optional)",className:`${Fa} flex-1 min-w-[200px]`,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:250:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"250","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Bank%20reference%20%2F%20UTR%20(optional)%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"destructive",onClick:()=>void b(N.batch_id),disabled:Q,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:253:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"253","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22destructive%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:Q?"Recording…":"Yes, the money has left"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>_(null),"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:256:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"256","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Not yet"})]})]})]}),g.length>0&&a.jsxs("div",{className:ce,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:265:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"265","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-subtle mb-2","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:266:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"266","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-subtle%20mb-2%22%7D",children:"Recent runs"}),g.map(I=>a.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-white/[0.04] last:border-0","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:268:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"268","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20py-1.5%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:269:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"269","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-xs text-white","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:270:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"270","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%22%7D",children:[I.payment_date," · ",I.bill_count," bill",I.bill_count===1?"":"s"," · ",ka(Number(I.total_amount))]}),a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:273:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"273","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:I.status==="confirmed"?a.jsxs("span",{className:"text-success","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:275:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"275","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-success%22%7D",children:["paid",I.payment_reference?` · ${I.payment_reference}`:""]}):I.status==="cancelled"?a.jsxs("span",{className:"text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:277:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"277","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%22%7D",children:["cancelled — ",I.cancel_reason]}):a.jsx("span",{className:"text-warning","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:278:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"278","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-warning%22%7D",children:"prepared, not yet paid"})})]}),I.status==="prepared"&&a.jsxs("div",{className:"flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:282:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"282","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>_(I.id),"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:283:18","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"283","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"I have paid these"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>void F(I.id),"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:284:18","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"284","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]}),I.status==="confirmed"&&a.jsx(Z,{className:"w-3.5 h-3.5 text-success shrink-0","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:287:43","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"287","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-success%20shrink-0%22%7D"})]},I.id)),w&&!N&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:293:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"293","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20pt-3%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-soft flex items-start gap-1.5","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:294:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"294","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20flex%20items-start%20gap-1.5%22%7D",children:[a.jsx(W,{className:"w-3.5 h-3.5 text-warning mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:295:16","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"295","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-warning%20mt-0.5%20shrink-0%22%7D"}),"Confirm only after your bank has processed the file. This marks the bills paid and posts the entries."]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2","data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:298:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"298","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-2%20mt-2%22%7D",children:[a.jsx("input",{value:h,onChange:I=>B(I.target.value),placeholder:"Bank reference / UTR (optional)",className:`${Fa} flex-1 min-w-[200px]`,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:299:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"299","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Bank%20reference%20%2F%20UTR%20(optional)%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"destructive",onClick:()=>void b(w),disabled:Q,"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:301:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"301","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22destructive%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:"Yes, the money has left"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>_(null),"data-matrix-id":"src/pages/dashboard/personas/PaymentRunsPanel.tsx:304:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PaymentRunsPanel.tsx","data-component-line":"304","data-component-file":"PaymentRunsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Not yet"})]})]})]})]})}const Re=e=>
27`₹${Number(e||0).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,ie=e=>Number(e||0).toLocaleString("en-IN",{maximumFractionDigits:3}),pe="bg-surface/60 border border-white/[0.06] rounded-xl p-4",pa="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]",me=()=>({item_id:"",description:"",quantity:"1",rate:"",gst_rate:"18"});function Dn(){const[e,u]=t.useState([]),[g,p]=t.useState([]),[l,f]=t.useState({}),[s,n]=t.useState(null),[x,o]=t.useState(!0),[A,c]=t.useState(!1),[m,v]=t.useState(!1),[N,E]=t.useState({vendor_name:"",po_number:"",expected_date:"",lines:[me()]}),[O,D]=t.useState({}),Q=t.useCallback(async()=>{o(!0);try{const[d,P]=await Promise.all([S("/purchase-orders?limit=50"),S("/finance-items?limit=200")]);d.success&&d.data&&u(d.data),P.success&&P.data&&p(P.data)}catch{k.error("Could not load purchase orders")}finally{o(!1)}},[]);t.useEffect(()=>{Q()},[Q]);const r=async d=>{if(s===d){n(null);return}if(n(d),l[d])return;const P=await S(`/purchase-orders/${d}`);P.success&&P.data&&f(C=>({...C,[d]:P.data}))},h=(d,P)=>E(C=>({...C,lines:C.lines.map((y,b)=>b===d?{...y,...P}:y)})),B=(d,P)=>{const C=g.find(y=>y.id===P);if(!C){h(d,{item_id:""});return}h(d,{item_id:P,description:C.name,rate:C.purchase_rate!=null?String(C.purchase_rate):"",gst_rate:String(C.gst_rate)})},w=N.lines.reduce((d,P)=>d+(Number(P.quantity)||0)*(Number(P.rate)||0),0),_=async()=>{const d=N.lines.filter(P=>P.description.trim()&&Number(P.quantity)>0);if(!N.vendor_name.trim()||!N.po_number.trim()||d.length===0){k.error("A supplier, an order number and at least one line are needed.");return}v(!0);try{const P=await S("/purchase-orders",{method:"POST",body:JSON.stringify({vendor_name:N.vendor_name.trim(),po_number:N.po_number.trim(),expected_date:N.expected_date||void 0,line_items:d.map(C=>({description:C.description.trim(),item_id:C.item_id||void 0,quantity:Number(C.quantity),rate:Number(C.rate)||0,gst_rate:Number(C.gst_rate)||0}))})});P.success?(k.success("Purchase order raised."),c(!1),E({vendor_name:"",po_number:"",expected_date:"",lines:[me()]}),await Q()):k.error(P.error||"Could not raise the order.")}catch{k.error("Could not raise the order.")}finally{v(!1)}},i=async d=>{const P=(d.line_items||[]).map(C=>({po_line_id:C.id,quantity:Number(O[C.id])})).filter(C=>Number.isFinite(C.quantity)&&C.quantity>0);if(P.length===0){k.error("Enter how much arrived.");return}v(!0);try{const C=await S(`/purchase-orders/${d.id}/receive`,{method:"POST",body:JSON.stringify({lines:P})});C.success?(k.success("Recorded what arrived."),D({}),f(y=>{const b={...y};return delete b[d.id],b}),n(null),await r(d.id)):k.error(C.error||"Could not record it.")}catch{k.error("Could not record it.")}finally{v(!1)}};return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:134:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"134","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:135:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"135","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:136:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"136","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div",children:[a.jsxs("h3",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:137:10","data-matrix-name":"h3","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"137","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"h3","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(ft,{className:"w-4 h-4 text-violet-400","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:138:12","data-matrix-name":"ClipboardList","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"138","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"ClipboardList","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-violet-400%22%7D"})," Purchase orders"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:140:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"140","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"What you ordered, what arrived, and whether the bill agrees"})]}),a.jsxs("div",{className:"flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:142:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"142","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%22%7D",children:[a.jsxs(j,{size:"sm",variant:"secondary",onClick:()=>c(d=>!d),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:143:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"143","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(X,{className:"w-3 h-3 mr-1","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:144:12","data-matrix-name":"Plus","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"144","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"Plus","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mr-1%22%7D"})," Raise an order"]}),a.jsx(j,{variant:"ghost",size:"sm",onClick:()=>void Q(),disabled:x,"aria-label":"Refresh",title:"Refresh","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:146:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"146","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%2C%22title%22%3A%22Refresh%22%7D",children:a.jsx(H,{className:`w-3.5 h-3.5 ${x?"animate-spin":""}`,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:147:12","data-matrix-name":"RefreshCw","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"147","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"RefreshCw","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})})]})]}),a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-accent/[0.07] border border-accent/20","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:152:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"152","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20px-3%20py-2.5%20rounded-lg%20bg-accent%2F%5B0.07%5D%20border%20border-accent%2F20%22%7D",children:[a.jsx(xa,{
27className:"w-3.5 h-3.5 text-accent-bright mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:153:8","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"153","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%20mt-0.5%20shrink-0%22%7D"}),a.jsxs("p",{className:"text-[11px] text-accent-faint/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:154:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"154","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-accent-faint%2F80%20leading-relaxed%22%7D",children:["Orders are optional — most bills do not need one. Raise one when it matters, and any bill that names it gets checked against what you ordered and what arrived ",a.jsx("span",{className:"font-semibold","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:156:60","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"156","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-semibold%22%7D",children:"before"})," it can be approved."]})]}),A&&a.jsxs("div",{className:pe,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:161:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"161","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:162:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"162","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-1%20sm%3Agrid-cols-3%20gap-2%22%7D",children:[a.jsx("input",{className:pa,placeholder:"Supplier",value:N.vendor_name,onChange:d=>E(P=>({...P,vendor_name:d.target.value})),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:163:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"163","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%2C%22placeholder%22%3A%22Supplier%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx("input",{className:pa,placeholder:"Order number, e.g. PO-2026-011",value:N.po_number,onChange:d=>E(P=>({...P,po_number:d.target.value})),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:164:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"164","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%2C%22placeholder%22%3A%22Order%20number%2C%20e.g.%20PO-2026-011%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsxs("label",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:165:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"165","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:["Expected",a.jsx("input",{type:"date",className:`${pa} w-full mt-0.5`,value:N.expected_date,onChange:d=>E(P=>({...P,expected_date:d.target.value})),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:167:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"167","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"})]})]}),a.jsxs("div",{className:"mt-3 space-y-2","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:171:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"171","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20space-y-2%22%7D",children:[N.lines.map((d,P)=>a.jsxs("div",{className:"grid grid-cols-12 gap-1.5","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:173:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"173","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-12%20gap-1.5%22%7D",children:[a.jsxs("select",{className:`${pa} col-span-4`,value:d.item_id,onChange:C=>B(P,C.target.value),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:174:16","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"174","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"select","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:175:18","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"175","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Type below, or pick an item…"}),g.map(C=>a.jsx("option",{value:C.id,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:176:37","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"176","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:C.name},C.id))]}),a.jsx("input",{className:`${pa} col-span-4`,placeholder:"What are you ordering?",value:d.description,onChange:C=>h(P,{description:C.target.value}),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:178:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"178","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22placeholder%22%3A%22What%20are%20you%20ordering%3F%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx("input",{className:`${pa} col-span-1`,inputMode:"decimal",placeholder:"Qty",value:d.quantity,onChange:C=>h(P,{quantity:C.target.value}),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:179:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"179","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Qty%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx("input",{className:`${pa} col-span-2`,inputMode:"decimal",placeholder:"Rate",value:d.rate,onChange:C=>h(P,{rate:C.target.value}),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:180:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"180","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Rate%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx("button",{onClick:()=>E(C=>({...C,lines:C.lines.length>1?C.lines.filter((y,b)=>b!==P):C.lines})),className:"col-span-1 text-text-faint hover:text-danger text-xs","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:181:16","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"181","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22col-span-1%20text-text-faint%20hover%3Atext-danger%20text-xs%22%7D",children:"×"})]},P)),a.jsx("button",{onClick:()=>E(d=>({...d,lines:[...d.lines,me()]})),className:"text-[11px] text-text-muted hover:text-white","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:185:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"185","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20hover%3Atext-white%22%7D",children:"+ Another line"})]}),a.jsxs("div",{className:"flex items-center justify-between mt-3","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:188:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"188","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20mt-3%22%7D",children:[a.jsxs("span",{className:"text-[11px] text-text-muted tabular-nums","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:189:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"189","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20tabular-nums%22%7D",children:["Order value ",Re(w)," before tax"]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:190:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"190","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",onClick:()=>void _(),disabled:m,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:191:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"191","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:m?"Raising…":"Raise the order"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>c(!1),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:192:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"192","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]})]})]}),!x&&e.length===0&&!A&&a.jsxs("div",{className:`${pe} text-center`,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:199:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"199","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:200:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"200","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"No purchase orders yet."}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-1","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:201:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"201","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-1%22%7D",children:"Raise one when an order is big enough that you would want the bill checked against it."})]}),e.map(d=>{const P=l[d.id];return a.jsxs("div",{className:pe,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:208:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"208","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("button",{onClick:()=>void r(d.id),className:"w-full flex items-center justify-between text-left","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:209:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"209","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22w-full%2
270flex%20items-center%20justify-between%20text-left%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:210:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"210","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-xs text-white","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:211:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"211","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-white%22%7D",children:[d.po_number," · ",d.vendor_name]}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:212:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"212","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[d.order_date,d.expected_date?` · expected ${d.expected_date}`:""," · ",d.status]})]}),a.jsx("span",{className:"text-xs text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:216:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"216","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%20tabular-nums%22%7D",children:Re(Number(d.total_amount))})]}),s===d.id&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:220:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"220","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20pt-3%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[!P&&a.jsx("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:221:28","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"221","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:"Loading…"}),P&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"hidden sm:grid grid-cols-12 gap-2 text-[10px] uppercase tracking-wide text-text-subtle pb-1","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:224:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"224","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22hidden%20sm%3Agrid%20grid-cols-12%20gap-2%20text-%5B10px%5D%20uppercase%20tracking-wide%20text-text-subtle%20pb-1%22%7D",children:[a.jsx("div",{className:"col-span-5","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:225:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"225","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-5%22%7D",children:"Line"}),a.jsx("div",{className:"col-span-2 text-right","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:226:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"226","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-2%20text-right%22%7D",children:"Ordered"}),a.jsx("div",{className:"col-span-2 text-right","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:227:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"227","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-2%20text-right%22%7D",children:"Arrived"}),a.jsx("div",{className:"col-span-3 text-right","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:228:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"228","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-3%20text-right%22%7D",children:"Still to come"})]}),(P.line_items||[]).map(C=>a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 py-1.5 border-b border-white/[0.04] last:border-0 items-center","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:231:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"231","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-1%20sm%3Agrid-cols-12%20gap-2%20py-1.5%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%20items-center%22%7D",children:[a.jsx("div",{className:"sm:col-span-5 text-xs text-text-bright truncate","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:232:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"232","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-5%20text-xs%20text-text-bright%20truncate%22%7D",children:C.description}),a.jsx("div",{className:"sm:col-span-2 sm:text-right text-xs tabular-nums text-text-muted","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:233:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"233","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-2%20sm%3Atext-right%20text-xs%20tabular-nums%20text-text-muted%22%7D",children:ie(Number(C.quantity))}),a.jsx("div",{className:"sm:col-span-2 sm:text-right text-xs tabular-nums text-text-soft","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:234:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"234","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-2%20sm%3Atext-right%20text-xs%20tabular-nums%20text-text-soft%22%7D",children:ie(C.received_quantity||0)}),a.jsxs("div",{className:"sm:col-span-3 sm:text-right flex sm:justify-end items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:235:24","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"235","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22sm%3Acol-span-3%20sm%3Atext-right%20flex%20sm%3Ajustify-end%20items-center%20gap-2%22%7D",children:[a.jsx("span",{className:`text-xs tabular-nums ${(C.outstanding_quantity||0)>0?"text-warning-bright":"text-success"}`,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:236:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"236","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:ie(C.outstanding_quantity||0)}
27),d.status!=="cancelled"&&a.jsx("input",{className:`${pa} w-20`,inputMode:"decimal",placeholder:"Arrived",value:O[C.id]||"",onChange:y=>D(b=>({...b,[C.id]:y.target.value})),"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:240:28","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"240","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%22Arrived%22%2C%22value%22%3A%22%5BLogicalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"})]})]},C.id)),d.status!=="cancelled"&&a.jsxs("div",{className:"flex items-center gap-2 mt-3","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:248:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"248","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20mt-3%22%7D",children:[a.jsxs(j,{size:"sm",variant:"secondary",onClick:()=>void i(P),disabled:m,"data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:249:24","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"249","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22secondary%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx(Pt,{className:"w-3 h-3 mr-1","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:250:26","data-matrix-name":"PackageCheck","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"250","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"PackageCheck","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mr-1%22%7D"})," Record what arrived"]}),a.jsx("span",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx:253:24","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/PurchaseOrdersPanel.tsx","data-component-line":"253","data-component-file":"PurchaseOrdersPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:"Recorded separately from the bill, so a short delivery can be seen."})]})]})]})]},d.id)})]})}const Aa=e=>`₹${Number(e||0).toLocaleString("en-IN",{maximumFractionDigits:0})}`,le="bg-surface/60 border border-white/[0.06] rounded-xl p-4",Ea="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]";function wn(){const e=new Date,u=e.getMonth()>=3?e.getFullYear():e.getFullYear()-1;return Array.from({length:5},(g,p)=>{const l=u-p;return`${l}-${String((l+1)%100).padStart(2,"0")}`})}function Cn(){const[e,u]=t.useState(null),[g,p]=t.useState([]),[l,f]=t.useState(!0),[s,n]=t.useState(null),[x,o]=t.useState({}),[A,c]=t.useState(!1),[m,v]=t.useState({}),[N,E]=t.useState(!1),[O,D]=t.useState(null),[Q,r]=t.useState({irn:"",ack_no:"",ack_date:"",signed_qr:""}),[h,B]=t.useState(!1),w=t.useCallback(async()=>{f(!0);try{const[y,b]=await Promise.all([S("/ar-invoices/einvoice/applicability"),S("/ar-invoices?limit=100")]);y.success&&y.data&&u(y.data),b.success&&b.data&&p(b.data.filter(F=>F.status!=="draft"))}catch{k.error("Could not load e-invoicing status")}finally{f(!1)}},[]);t.useEffect(()=>{w()},[w]);const _=async y=>{n(y);try{const b=await S(`/ar-invoices/${y}/einvoice`);b.success&&b.data?o(F=>({...F,[y]:b.data})):k.error(b.error||"Could not check this invoice")}catch{k.error("Could not check this invoice")}finally{n(null)}},i=async(y,b=!1)=>{n(y);try{const F=await S(`/ar-invoices/${y}/einvoice/prepare`,{method:"POST"});return F.success?(b||k.success(F.code==="not_required"?"Recorded — this is a B2C sale and needs no IRN":"Ready to register on the portal"),await w(),!0):(k.error(F.error||"This invoice is not ready"),await _(y),!1)}catch{return k.error("Could not prepare this invoice"),!1}finally{n(null)}},d=async(y,b)=>{if(!await i(y.id,!0))return;const F=new Blob([JSON.stringify(b.payload,null,2)],{type:"application/json"}),I=URL.createObjectURL(F),L=document.createElement("a");L.href=I,L.download=`einvoice-${y.invoice_number||y.id}.json`,document.body.appendChild(L),L.click(),L.remove(),URL.revokeObjectURL(I)},P=async()=>{E(!0);try{const y={};for(const[F,I]of Object.entries(m)){const L=Number(String(I).replace(/[^0-9.]/g,""));Number.isFinite(L)&&L>0&&(y[F]=L)}const b=await S("/ar-invoices/einvoice/turnover",{method:"PUT",body:JSON.stringify({turnover_by_fy:y})});b.success&&b.data?(u(b.data),c(!1),k.success("Turnover saved")):k.error(b.error||"Could not save")}catch{k.error("Could not save")}finally{E(!1)}},C=async y=>{B(!0);try{const b=await S(`/ar-invoices/${y}/einvoice/irn`,{method:"POST",body:JSON.stringify({irn:Q.irn.trim(),ack_no:Q.ack_no.trim()||void 0,ack_date:Q.ack_date.trim()||void 0,signed_qr:Q.signed_qr.trim()||void 0})});b.success?(k.success(b.note||"IRN recorded"),D(null),r({irn:"",ack_no:"",ack_date:"",signed_qr:""}),await w(),await _(y)):k.error(b.error||"Could not record the IRN")}catch{k.error("Could not record the IRN")}finally{B(!1)}};return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:195:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"195","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:196:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"196","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:197:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"197","data-component-file":"EinvoicePanel.tsx","data-component-name":"div",children:[a.jsxs("h3",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:198:10","data-matrix-name":"h3","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"198","data-component-file":"EinvoicePanel.tsx","data-component-name":"h3","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(vt,{className:"w-4 h-4 text-warning","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:199:12","data-matrix-name":"QrCode","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"199","data-component-file":"EinvoicePanel.tsx","data-component-name":"QrCode","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning%22%7D"})," e-Invoicing"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:201:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"201","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"IRN and the signed QR, from the invoices you already issued"})]}),a.jsx(j,{variant:"ghost",size:"sm",onClick:()=>void w(),disabled:l,"aria-label":"Refresh",title:"Refresh","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:203:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"203","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%2C%22title%22%3A%22Refresh%22%7D",children:a.jsx(H,{className:`w-3.5 h-3.5 ${l?"animate-spin":""}`,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:204:10","data-matrix-name":"RefreshCw","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"204","data-component-file":"EinvoicePanel.tsx","data-component-name":"RefreshCw","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})})]}),e&&a.jsxs("div",{className:`${le} ${e.applies?"border-warning-fill/25":""}`,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:210:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"210","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsxs("div",{className:"flex items-start gap-3","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:211:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"211","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-3%22%7D",children:[e.applies?a.jsx(W,{className:"w-4 h-4 text-warning mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:213:16","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"213","data-component-file":"EinvoicePanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning%20mt-0.5%20shrink-0%22%7D"}):a.jsx(Z,{className:"w-4 h-4 text-success mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:214:16","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"214","data-component-file":"EinvoicePanel.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-success%20mt-0.5%20shrink-0%22%7D"}),a.jsxs("div",{className:"flex-1 min-w-0","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:215:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"215","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-1%20min-w-0%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:216:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"216","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:e.applies?"E-invoicing is mandatory for you":"E-invoicing is not mandatory for you yet"}),a.jsx("p",{className:"text-[11px] text-text-muted mt-1 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:219:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"219","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mt-1%20leading-relaxed%22%7D",children:e.reason}),e.warnings.map((y,b)=>a.jsx("p",{className:"text-[11px] text-warning-bright/90 mt-1.5 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:221:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"221","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-warning-bright%2F90%20mt-1.5%20leading-relaxed%22%7D",children:y},b)),a.jsx("button",{onClick:()=>{c(y=>!y)},className:"text-[11px] text-text-soft underline underline-offset-2 mt
27-2 hover:text-white","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:223:14","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"223","data-component-file":"EinvoicePanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20underline%20underline-offset-2%20mt-2%20hover%3Atext-white%22%7D",children:e.declared_fys.length?"Edit your turnover history":"Enter your turnover history"})]})]}),A&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:233:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"233","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20pt-3%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-muted mb-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:236:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"236","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mb-2%20leading-relaxed%22%7D",children:["Aggregate turnover for each year, including years before you used Zapheit. Crossing the threshold in ",a.jsx("span",{className:"text-white","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:238:29","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"238","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%22%7D",children:"any"})," year since 2017-18 makes e-invoicing mandatory permanently — so the older years matter as much as this one."]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:241:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"241","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20sm%3Agrid-cols-3%20gap-2%22%7D",children:wn().map(y=>a.jsxs("label",{className:"block","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:243:18","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"243","data-component-file":"EinvoicePanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%22%7D",children:[a.jsx("span",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:244:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"244","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:y}),a.jsx("input",{className:`${Ea} w-full mt-0.5`,inputMode:"numeric",placeholder:"₹",value:m[y]??"",onChange:b=>v(F=>({...F,[y]:b.target.value})),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:245:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"245","data-component-file":"EinvoicePanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22inputMode%22%3A%22numeric%22%2C%22placeholder%22%3A%22%E2%82%B9%22%2C%22value%22%3A%22%5BLogicalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"})]},y))}),a.jsxs("div",{className:"flex gap-2 mt-3","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:253:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"253","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20gap-2%20mt-3%22%7D",children:[a.jsx(j,{size:"sm",onClick:()=>void P(),disabled:N,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:254:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"254","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:N?"Saving…":"Save"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>c(!1),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:257:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"257","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]})]})]}),a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-accent/[0.07] border border-accent/20","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:265:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"265","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20px-3%20py-2.5%20rounded-lg%20bg-accent%2F%5B0.07%5D%20border%20border-accent%2F20%22%7D",children:[a.jsx(xa,{
27className:"w-3.5 h-3.5 text-accent-bright mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:266:8","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"266","data-component-file":"EinvoicePanel.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%20mt-0.5%20shrink-0%22%7D"}),a.jsxs("p",{className:"text-[11px] text-accent-faint/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:267:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"267","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-accent-faint%2F80%20leading-relaxed%22%7D",children:["Zapheit builds and checks the e-invoice but ",a.jsx("span",{className:"font-semibold","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:268:54","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"268","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-semibold%22%7D",children:"cannot register it"})," — that needs a GST portal or GSP login issued to your business. Download the checked payload, register it, then record the IRN and QR here so they print on your invoice."]})]}),!l&&g.length===0&&a.jsx("div",{className:`${le} text-center`,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:276:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"276","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:277:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"277","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"No issued invoices yet. E-invoicing applies to invoices you have sent."})}),a.jsx("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:281:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"281","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:g.map(y=>{var L;const b=x[y.id],F=y.irp_status==="not_required"||((L=b==null?void 0:b.eligibility)==null?void 0:L.status)==="not_required",I=!!y.irn;return a.jsxs("div",{className:le,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:287:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"287","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:288:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"288","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:289:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"289","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white truncate","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:290:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"290","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20truncate%22%7D",children:[y.invoice_number||"No number"," ",a.jsxs("span",{className:"text-text-muted font-normal","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:291:56","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"291","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-muted%20font-normal%22%7D",children:["· ",y.customer_name]})]}),a.jsxs("p",{className:"text-[11px] text-text-subtle mt-0.5 tabular-nums","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:293:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"293","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%20tabular-nums%22%7D",children:[y.issue_date," · ",Aa(y.total_amount)]})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:295:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"295","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[I&&a.jsx("span",{className:"text-[10px] px-2 py-1 rounded-md bg-success-fill/15 text-success-bright border border-success-fill/25","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:297:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"297","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20px-2%20py-1%20rounded-md%20bg-success-fill%2F15%20text-success-bright%20border%20border-success-fill%2F25%22%7D",children:"Registered"}),!I&&F&&a.jsx("span",{className:"text-[10px] px-2 py-1 rounded-md bg-white/[0.05] text-text-muted border border-white/[0.08]","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:301:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"301","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20px-2%20py-1%20rounded-md%20bg-white%2F%5B0.05%5D%20text-text-muted%20border%20border-white%2F%5B0.08%5D%22%7D",children:"B2C — no IRN needed"}),!I&&!F&&a.jsx(j,{size:"sm",onClick:()=>void _(y.id),disabled:s===y.id,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:304:20","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"304","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%7D",children:s===y.id?"Checking…":b?"Check again":"Check"}),!I&&!F&&a.jsxs(j,{size:"sm",variant:"ghost",onClick:()=>D(O===y.id?null:y.id),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:309:20","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"309","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(X,{className:"w-3 h-3 mr-1","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:310:22","data-matrix-name":"Plus","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"310","data-component-file":"EinvoicePanel.tsx","data-component-name":"Plus","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mr-1%22%7D"})," I have the IRN"]})]})]}),I&&a.jsxs("p",{className:"text-[10px] text-text-subtle mt-2 font-mono break-all","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:317:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"317","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-2%20font-mono%20break-all%22%7D",children:["IRN ",y.irn]}),b&&!I&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06] space-y-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:321:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"321","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20pt-3%20border-t%20border-white%2F%5B0.06%5D%20space-y-2%22%7D",children:[b.blockers.map((R,$)=>a.jsxs("p",{className:"text-[11px] text-danger-bright leading-relaxed flex gap-1.5","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:325:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"325","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-bright%20leading-relaxed%20flex%20gap-1.5%22%7D",children:[a.jsx(W,{className:"w-3 h-3 mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:326:22","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"326","data-component-file":"EinvoicePanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mt-0.5%20shrink-0%22%7D"}),R]},`b${$}`)),b.mismatches.map((R,$)=>a.jsxs("p",{className:"text-[11px] text-danger-bright leading-relaxed flex gap-1.5","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:330:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"330","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-bright%20leading-relaxed%20flex%20gap-1.5%22%7D",children:[a.jsx(W,{className:"w-3 h-3 mt-0.5 shrink-0","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:331:22","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"331","data-component-file":"EinvoicePanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mt-0.5%20shrink-0%22%7D"}),R]},`m${$}`)),b.warnings.map((R,$)=>a.jsx("p",{className:"text-[11px] text-warning-bright/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:335:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"335","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-warning-bright%2F80%20leading-relaxed%22%7D",children:R},`w${$}`)),b.eligibility.status==="not_required"&&a.jsx("p",{className:"text-[11px] text-text-muted leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:338:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"338","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20leading-relaxed%22%7D",children:b.eligibility.reason}),b.summary&&a.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-text-muted tabular-nums pt-1","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:341:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"341","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20gap-x-4%20gap-y-1%20text-%5B11px%5D%20text-text-muted%20tabular-nums%20pt-1%22%7D",children:[a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:342:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"342","data-component-file":"EinvoicePanel.tsx","data-component-name":"span",children:b.summary.supply==="intra_state"?"Intra-state":"Inter-state"}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:343:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"343","data-component-file":"EinvoicePanel.tsx","data-component-name":"span",children:["Taxable ",Aa(b.summary.assessable_value)]}),b.summary.igst>0?a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:345:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"345","data-component-file":"EinvoicePanel.tsx","data-component-name":"span",children:["IGST ",Aa(b.summary.igst)]}):a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:346:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"346","data-component-file":"EinvoicePanel.tsx","data-component-name":"span",children:["CGST ",Aa(b.summary.cgst)," · SGST ",Aa(b.summary.sgst)]}),a.jsxs("span",{className:"text-white","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:347:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"347","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-white%22%7D",children:["Total ",Aa(b.summary.total_invoice_value)]})]}),b.can_submit&&b.payload&&a.jsxs("div",{className:"flex items-center gap-2 pt-1","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:351:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"351","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20pt-1%22%7D",children:[a.jsxs(j,{size:"sm",onClick:()=>void d(y,b),disabled:s===y.id,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:352:22","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"352","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%7D",children:[a.jsx(Ne,{className:"w-3 h-3 mr-1","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:353:24","data-matrix-name":"Download","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"353","data-component-file":"EinvoicePanel.tsx","data-component-name":"Download","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20mr-1%22%7D"})," Download for the portal"]}),a.jsx("span",{className:"text-[10px] text-success-bright","data-m
27atrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:355:22","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"355","data-component-file":"EinvoicePanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-success-bright%22%7D",children:"Ready to register"})]}),b.eligibility.status==="not_required"&&a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>void i(y.id),disabled:s===y.id,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:361:20","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"361","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%7D",children:"Mark as B2C — no IRN needed"})]}),O===y.id&&!I&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.06] space-y-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:369:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"369","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20pt-3%20border-t%20border-white%2F%5B0.06%5D%20space-y-2%22%7D",children:[a.jsx("p",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:370:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"370","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:"Paste what the portal returned."}),a.jsx("input",{className:`${Ea} w-full font-mono`,placeholder:"IRN (64 characters)",value:Q.irn,onChange:R=>r($=>({...$,irn:R.target.value})),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:371:18","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"371","data-component-file":"EinvoicePanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22placeholder%22%3A%22IRN%20(64%20characters)%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:373:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"373","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{className:Ea,placeholder:"Ack No.",value:Q.ack_no,onChange:R=>r($=>({...$,ack_no:R.target.value})),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:374:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"374","data-component-file":"EinvoicePanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%2C%22placeholder%22%3A%22Ack%20No.%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx("input",{className:Ea,placeholder:"Ack Date",value:Q.ack_date,onChange:R=>r($=>({...$,ack_date:R.target.value})),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:376:20","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"376","data-component-file":"EinvoicePanel.tsx","data-component-name":"input","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%2C%22placeholder%22%3A%22Ack%20Date%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"})]}),a.jsx("textarea",{className:`${Ea} w-full font-mono h-16`,placeholder:"Signed QR (the long string from the portal)",value:Q.signed_qr,onChange:R=>r($=>({...$,signed_qr:R.target.value})),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:379:18","data-matrix-name":"textarea","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"379","data-component-file":"EinvoicePanel.tsx","data-component-name":"textarea","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%2C%22placeholder%22%3A%22Signed%20QR%20(the%20long%20string%20from%20the%20portal)%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx("p",{className:"text-[10px] text-warning-bright/80 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:383:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"383","data-component-file":"EinvoicePanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-warning-bright%2F80%20leading-relaxed%22%7D",children:"The signed QR is legally required to be printed on the invoice. Without it the PDF is not compliant even though the IRN is valid."}),a.jsxs("div",{className:"flex gap-2","data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:387:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"387","data-component-file":"EinvoicePanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",onClick:()=>void C(y.id),disabled:h||Q.irn.trim().length<20,"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:388:20","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"388","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BLogicalExpression%5D%22%7D",children:h?"Saving…":"Record IRN"}),a.jsx(j,{size:"sm",variant:"ghost",onClick:()=>D(null),"data-matrix-id":"src/pages/dashboard/personas/EinvoicePanel.tsx:391:20","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/EinvoicePanel.tsx","data-component-line":"391","data-component-file":"EinvoicePanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]})]})]},y.id)})})]})}const Pe=e=>{const u=Math.abs(e)/100;return`${e<0?"−":""}
27₹${u.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`},_a="bg-surface/60 border border-white/[0.06] rounded-xl p-4",xe="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]";function _e({title:e,items:u}){return u.length?a.jsxs("div",{className:_a,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:36:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"36","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white mb-1.5","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:37:6","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"37","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20mb-1.5%22%7D",children:[e," ",a.jsxs("span",{className:"text-text-subtle font-normal","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:37:69","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"37","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20font-normal%22%7D",children:["(",u.length,")"]})]}),a.jsx("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:38:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"38","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:u.map(g=>a.jsxs("div",{className:"flex items-start justify-between gap-3 py-1 border-b border-white/[0.04] last:border-0","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:40:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"40","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%20py-1%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:41:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"41","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-bright truncate","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:42:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"42","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-bright%20truncate%22%7D",children:[a.jsx("span",{className:"text-text-subtle tabular-nums mr-2","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:43:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"43","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20tabular-nums%20mr-2%22%7D",children:g.date}),g.description]}),a.jsx("p",{className:"text-[10px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:45:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"45","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-0.5%22%7D",children:g.reason})]}),a.jsx("span",{className:`text-xs tabular-nums shrink-0 ${g.amount_paise<0?"text-text-soft":"text-success-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:47:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"47","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:Pe(g.amount_paise)})]},g.reference))})]}):null}function yn(){const[e,u]=t.useState([]),[g,p]=t.useState(""),[l,f]=t.useState(()=>{const h=new Date;return h.setDate(0),h.toISOString().slice(0,10)}),[s,n]=t.useState(""),[x,o]=t.useState(null),[A,c]=t.useState(!1),[m,v]=t.useState(!1),[N,E]=t.useState(!1);t.useEffect(()=>{(async()=>{const h=await S("/ledger/accounts");if(h.success&&Array.isArray(h.data)){const B=h.data.filter(i=>i.account_type==="asset"),w=B.filter(i=>["1000","1010"].includes(i.code)||/bank|cash/i.test(i.name)),_=w.length?w:B;u(_),_[0]&&!g&&p(_[0].id)}E(!0)})()},[]);const O=t.useCallback(async()=>
27{if(g){c(!0);try{const h=s.trim()===""?"":`&statement_balance=${Number(s)}`,B=await S(`/bank-reconciliation?account_id=${g}&as_of=${l}${h}`);B.success&&B.data?o(B.data):(o(null),k.error(B.error||"Could not reconcile that account."))}finally{c(!1)}}},[g,l,s]);t.useEffect(()=>{O()},[g,l]);const D=async()=>{v(!0);try{const h=await S("/bank-reconciliation/complete",{method:"POST",body:JSON.stringify({account_id:g,as_of:l,statement_balance:Number(s)})});h.success?(k.success("Reconciled and signed off."),O()):k.error(h.error||"Could not sign that off.")}finally{v(!1)}},Q=s.trim()!=="",r=((x==null?void 0:x.in_books_not_on_statement.length)??0)+((x==null?void 0:x.on_statement_not_in_books.length)??0);return a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:124:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"124","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsxs("div",{className:_a,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:125:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"125","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:126:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"126","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:127:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"127","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:128:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"128","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx($a,{className:"h-4 w-4 text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:129:14","data-matrix-name":"Scale","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"129","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"Scale","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-accent-bright%22%7D"})," Bank reconciliation"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:131:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"131","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Compare what your books say against what the bank says, and account for every rupee of the difference."})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:135:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"135","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20flex-wrap%22%7D",children:[e.length>0&&a.jsx("select",{value:g,onChange:h=>p(h.target.value),className:xe,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:137:14","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"137","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:e.map(h=>a.jsxs("option",{value:h.id,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:138:37","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"138","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[h.code," — ",h.name]},h.id))}
27),a.jsx("input",{type:"date",value:l,onChange:h=>f(h.target.value),className:xe,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:141:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"141","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:A,onClick:O,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:142:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"142","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]})]}),a.jsxs("div",{className:"mt-3 flex items-end gap-2 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:146:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"146","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20flex%20items-end%20gap-2%20flex-wrap%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:147:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"147","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:148:12","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"148","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"Closing balance on your bank statement"}),a.jsx("input",{value:s,onChange:h=>n(h.target.value),onBlur:O,placeholder:"e.g. 154320.75",inputMode:"decimal",className:`${xe} w-48`,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:149:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"149","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22onBlur%22%3A%22%5BIdentifier%5D%22%2C%22placeholder%22%3A%22e.g.%20154320.75%22%2C%22inputMode%22%3A%22decimal%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsx("p",{className:"text-[10px] text-text-subtle pb-2 max-w-md","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:154:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"154","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20pb-2%20max-w-md%22%7D",children:"Type this from your statement. We hold the transactions the bank listed, not the bank's own closing figure — comparing our copy against itself would always agree."})]})]}),N&&e.length===0&&a.jsx("div",{className:_a,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:162:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"162","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsx("p",{className:"text-xs text-amber-200/90","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:163:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"163","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-amber-200%2F90%22%7D",children:"No bank or cash account was found in your chart of accounts, so there is nothing to re
27concile yet. Add one under Books → Account balances, then come back."})}),(x==null?void 0:x.already_signed)&&a.jsx("div",{className:"rounded-xl bg-success-fill/[0.08] border border-success-fill/25 px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:171:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"171","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20bg-success-fill%2F%5B0.08%5D%20border%20border-success-fill%2F25%20px-3%20py-2%22%7D",children:a.jsxs("p",{className:"text-[11px] text-emerald-200 flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:172:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"172","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-emerald-200%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(Bt,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:173:12","data-matrix-name":"Lock","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"173","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"Lock","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"}),"Already reconciled and signed off for ",x.already_signed.as_of_date,"."]})}),x&&!Q&&a.jsx("div",{className:_a,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:180:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"180","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:181:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"181","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:["Enter your statement's closing balance above to see whether the two sides agree.",r>0&&` ${r===1?"1 item is":`${r} items are`} outstanding on one side or the other.`]})}),x&&Q&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:x.reconciles?"rounded-xl bg-success-fill/[0.08] border border-success-fill/25 p-4":"rounded-xl bg-danger-fill/[0.08] border border-danger-fill/30 p-4","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:190:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"190","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:a.jsxs("div",{className:"flex items-start justify-between gap-3","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:193:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"193","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:194:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"194","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:`text-sm font-semibold flex items-center gap-1.5 ${x.reconciles?"text-emerald-200":"text-danger-pale"}`,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:195:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"195","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[x.reconciles?a.jsx(Z,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:196:38","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"196","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"}):a.jsx(W,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:196:77","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"196","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"}),x.reconciles?"Every rupee accounted for":`${Pe(Math.abs(x.difference_paise))} unaccounted for`]}),a.jsx("p",{className:`text-[11px] mt-0.5 ${x.reconciles?"text-emerald-200/80":"text-danger-pale/80"}`,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:199:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"199","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:x.reconciles?`${x.matched_count} transaction${x.matched_count===1?"":"s"} matched, ${r} outstanding and explained.`:"Something is on the statement or in the books that this could not explain. Do not sign it off until this is zero."})]}),!x.already_signed&&a.jsx(j,{size:"sm",variant:x.reconciles?"primary":"ghost",disabled:!x.reconciles,loading:m,onClick:D,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:206:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"206","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22%5BConditionalExpression%5D%22%2C%22disabled%22%3A%22%5BUnaryExpression%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Sign it off"})]})}),a.jsx(_e,{title:"In your books, the bank has not shown it yet",items:x.in_books_not_on_statement,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:217:10","data-matrix-name":"ItemList","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"217","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"ItemList","data-component-content":"%7B%22title%22%3A%22In%20your%20books%2C%20the%20bank%20has%20not%20shown%20it%20yet%22%2C%22items%22%3A%22%5BMemberExpression%5D%22%7D"}),a.jsx(_e,{title:"On the statement, not in your books yet",items:x.on_statement_not_in_books,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:218:10","data-matrix-name":"ItemList","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"218","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"ItemList","data-component-content":"%7B%22title%22%3A%22On%20the%20statement%2C%20not%20in%20your%20books%20yet%22%2C%22items%22%3A%22%5BMemberExpression%5D%22%7D"}),a.jsxs("div",{className:_a,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:220:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"220","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-2","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:221:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"221","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20mb-2%22%7D",children:"The reconciliation"}),x.statement.map((h,B)=>a.jsxs("div",{className:`flex items-center justify-between py-1.5 ${h.kind==="total"?"border-t border-white/[0.08] mt-1 pt-2":"border-b border-white/[0.04]"}`,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:223:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"223","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("span",{className:`text-[11px] ${h.label==="UNEXPLAINED DIFFERENCE"?"text-danger-bright font-semibold":h.kind==="total"?"text-white font-medium":"text-text-muted"}`,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:224:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"224","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:h.label}),a.jsx("span",{className:`tabular-nums ${h.kind==="total"?"text-sm font-semibold text-white":"text-xs text-text-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:227:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"227","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:Pe(h.amount_paise)})]},B))]}),x.warnings.length>0&&a.jsx("div",{className:"rounded-xl bg-warning-fill/[0.07] border border-warning-fill/25 p-3 space-y-1","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:235:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"235","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20bg-warning-fill%2F%5B0.07%5D%20border%20border-warning-fill%2F25%20p-3%20space-y-1%22%7D",children:x.warnings.map((h,B)=>a.jsx("p",{className:"text-[11px] text-amber-200/90","data-matrix-id":"src/pages/dashboard/personas/BankReconciliationPanel.tsx:237:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BankReconciliationPanel.tsx","data-component-line":"237","data-component-file":"BankReconciliationPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%22%7D",children:h},B))})]})]})}const ba=e=>
27`₹${Number(e||0).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,Wa="bg-surface/60 border border-white/[0.06] rounded-xl p-4",aa="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-[11px] text-white placeholder:text-text-faint outline-none focus:border-white/[0.16]",he=["January","February","March","April","May","June","July","August","September","October","November","December"];function jn(){const[e,u]=t.useState(null),[g,p]=t.useState([]),[l,f]=t.useState([]),[s,n]=t.useState(!0),[x,o]=t.useState(!1),[A,c]=t.useState(!1),[m,v]=t.useState(!1),N=new Date;N.setDate(0);const[E,O]=t.useState(N.getFullYear()),[D,Q]=t.useState(N.getMonth()+1),[r,h]=t.useState({name:"",category:"",purchase_date:"",cost:"",useful_life_years:"",method:"slm",it_block:"",source:"bank",accumulated_depreciation:"",salvage_value:""}),B=t.useCallback(async()=>{n(!0);try{const[d,P,C]=await Promise.all([S("/fixed-assets"),S("/fixed-assets/depreciation/runs"),S("/fixed-assets/blocks")]);d.success&&d.data&&u(d.data),P.success&&Array.isArray(P.data)&&p(P.data),C.success&&Array.isArray(C.data)&&f(C.data)}finally{n(!1)}},[]);t.useEffect(()=>{B()},[B]);const w=async()=>{var C;const d=Number(r.cost),P=Number(r.useful_life_years);if(!r.name.trim()||!r.purchase_date||!(d>0)||!(P>0)){k.error("Name, purchase date, cost and useful life are all needed.");return}c(!0);try{const y={name:r.name.trim(),purchase_date:r.purchase_date,cost:d,useful_life_years:P,method:r.method,source:r.source};r.category.trim()&&(y.category=r.category.trim()),r.it_block&&(y.it_block=r.it_block),r.salvage_value!==""&&(y.salvage_value=Number(r.salvage_value)),r.accumulated_depreciation!==""&&(y.accumulated_depreciation=Number(r.accumulated_depreciation));const b=await S("/fixed-assets",{method:"POST",body:JSON.stringify(y)});b.success?(k.success("Asset recorded and posted to your books."),o(!1),h({name:"",category:"",purchase_date:"",cost:"",useful_life_years:"",method:"slm",it_block:"",source:"bank",accumulated_depreciation:"",salvage_value:""}),B()):k.error(((C=b.errors)==null?void 0:C[0])||b.error||"Could not record that asset.")}finally{c(!1)}},_=async()=>{v(!0);try{const d=await S("/fixed-assets/depreciation/run",{method:"POST",body:JSON.stringify({year:E,month:D})});if(d.success){const P=d.data;P!=null&&P.posted?k.success(`Charged ${ba(P.total)} of depreciation for ${he[D-1]} ${E}.`):k.info((P==null?void 0:P.message)||"Nothing to charge for that month."),B()}else k.error(d.error||"Could not charge depreciation.")}finally{v(!1)}},i=g.some(d=>d.period===`${E}-${String(D).padStart(2,"0")}`);return a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:114:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"114","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsxs("div",{className:Wa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:115:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"115","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:116:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"116","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:117:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"117","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:118:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"118","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Xe,{className:"h-4 w-4 text-violet-400","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:119:14","data-matrix-name":"Boxes","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"119","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"Boxes","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-violet-400%22%7D"})," Fixed assets"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:121:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"121","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Things the business owns and uses for years — laptops, vehicles, machinery. Their cost is spread over their life instead of hitting one month's profit."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:126:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"126","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:s,onClick:B,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:127:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"127","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:x?oa:X,onClick:()=>o(d=>!d),"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:128:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"128","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BConditionalExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:x?"Cancel":"Add an asset"})]})]}),e&&e.summary.count>0&&a.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-3","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:135:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"135","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-3%20gap-3%20mt-3%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:137:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"137","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:137:17","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"137","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"What they cost"}),a.jsx("p",{className:"text-sm text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:137:79","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"137","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20text-white%20tabular-nums%22%7D",children:ba(e.summary.gross_block)})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:138:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"138","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:138:17","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"138","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Written off so far"}),a.jsxs("p",{className:"text-sm text-text-soft tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:138:83","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"138","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20text-text-soft%20tabular-nums%22%7D",children:["− ",ba(e.summary.accumulated_depreciation)]})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:139:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"139","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:139:17","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"139","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Worth in your books"}),a.jsx("p",{className:"text-sm font-semibold text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:139:84","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"139","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20tabular-nums%22%7D",children:ba(e.summary.net_block)})]})]})]}),!s&&e&&e.summary.count===0&&!x&&a.jsxs("div",{className:"rounded-xl bg-warning-fill/[0.07] border border-warning-fill/25 p-4","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:146:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"146","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20bg-warning-fill%2F%5B0.07%5D%20border%20border-warning-fill%2F25%20p-4%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-amber-200","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:147:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"147","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-amber-200%22%7D",children:"Nothing here yet — and that probably isn't right."}),a.jsxs("p",{className:"text-[11px] text-amber-200/80 mt-1 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:148:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"148","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F80%20mt-1%20leading-relaxed%22%7D",children:["Anything you already own — laptops, furniture, vehicles — is currently sitting in y
27our books as an expense from the month you bought it. Add each one here with"," ",a.jsx("span",{className:"font-medium","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:151:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"151","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-medium%22%7D",children:"“Already owned”"})," as the source: it brings the asset onto your balance sheet without touching any month you have already reported."]})]}),e&&e.missing_it_block.length>0&&a.jsx("div",{className:"rounded-xl bg-warning-fill/[0.07] border border-warning-fill/25 px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:158:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"158","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20bg-warning-fill%2F%5B0.07%5D%20border%20border-warning-fill%2F25%20px-3%20py-2%22%7D",children:a.jsxs("p",{className:"text-[11px] text-amber-200/90","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:159:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"159","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%22%7D",children:[a.jsx("span",{className:"font-medium","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:160:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"160","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22font-medium%22%7D",children:e.missing_it_block.length===1?"1 asset has":`${e.missing_it_block.length} assets have`})," ","no Income Tax block set, so ",e.missing_it_block.length===1?"it is":"they are"," left out of your tax depreciation until one is chosen:"," ",e.missing_it_block.slice(0,5).join(", "),e.missing_it_block.length>5?"…":""]})}),x&&a.jsxs("div",{className:Wa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:170:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"170","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:171:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"171","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20gap-2%22%7D",children:[a.jsx("input",{value:r.name,onChange:d=>h({...r,name:d.target.value}),placeholder:"What is it? e.g. Dell laptop",className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:172:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"172","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22What%20is%20it%3F%20e.g.%20Dell%20laptop%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{value:r.category,onChange:d=>h({...r,category:d.target.value}),placeholder:"Category (optional)",className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:173:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"173","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Category%20(optional)%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:174:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"174","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:175:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"175","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"Bought on"}),a.jsx("input",{type:"date",value:r.purchase_date,onChange:d=>h({...r,purchase_date:d.target.value}),className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:176:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"176","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:178:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"178","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:179:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"179","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"What it cost (₹)"}),a.jsx("input",{value:r.cost,onChange:d=>h({...r,cost:d.target.value}),inputMode:"decimal",placeholder:"80000",className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:180:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"180","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%2280000%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:182:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"182","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:183:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"183","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"How many years will it last?"}),a.jsx("input",{value:r.useful_life_years,onChange:d=>h({...r,useful_life_years:d.target.value}),inputMode:"decimal",placeholder:"3",className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:184:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"184","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%223%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:186:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"186","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:187:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"187","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"Worth at the end (₹) — 5% if left blank"}),a.jsx("input",{value:r.salvage_value,onChange:d=>h({...r,salvage_value:d.target.value}),inputMode:"decimal",placeholder:"4000",className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:188:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"188","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%224000%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:190:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"190","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:191:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"191","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"How to spread the cost"}),a.jsxs("select",{value:r.method,onChange:d=>h({...r,method:d.target.value}),className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:192:14","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"192","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("option",{value:"slm","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:193:16","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"193","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22slm%22%7D",children:"Evenly each year (straight line)"}),a.jsx("option",{value:"wdv","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:194:16","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"194","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22wdv%22%7D",children:"More in early years (written-down value)"})]})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:197:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"197","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:198:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"198","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"Income Tax block"}
27),a.jsxs("select",{value:r.it_block,onChange:d=>h({...r,it_block:d.target.value}),className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:199:14","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"199","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:200:16","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"200","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Not decided yet"}),l.map(d=>a.jsxs("option",{value:d.id,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:201:35","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"201","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[d.label," — ",d.rate,"%"]},d.id))]})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:204:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"204","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:205:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"205","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"How was it paid for?"}),a.jsxs("select",{value:r.source,onChange:d=>h({...r,source:d.target.value}),className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:206:14","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"206","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("option",{value:"bank","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:207:16","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"207","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22bank%22%7D",children:"Paid from the bank"}),a.jsx("option",{value:"creditors","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:208:16","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"208","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22creditors%22%7D",children:"Bought on credit"}),a.jsx("option",{value:"opening","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:209:16","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"209","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22opening%22%7D",children:"Already owned before using Zapheit"})]})]}),r.source==="opening"&&a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:213:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"213","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div",children:[a.jsx("label",{className:"block text-[10px] text-text-subtle mb-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:214:16","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"214","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20mb-1%22%7D",children:"Depreciation already charged (₹)"}),a.jsx("input",{value:r.accumulated_depreciation,onChange:d=>h({...r,accumulated_depreciation:d.target.value}),inputMode:"decimal",placeholder:"20000",className:aa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:215:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"215","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%2220000%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"})]})]}
27),r.source==="opening"&&a.jsx("p",{className:"text-[10px] text-text-subtle mt-2 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:220:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"220","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-2%20leading-relaxed%22%7D",children:"This records the asset against your opening balances rather than as a payment — you did not buy it from the bank this year, and pretending you did would invent a payment in a month you may already have filed."}),a.jsx("div",{className:"mt-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:226:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"226","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-2%22%7D",children:a.jsx(j,{size:"sm",variant:"primary",loading:A,onClick:w,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:227:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"227","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Record it"})})]}),e&&e.assets.length>0&&a.jsxs("div",{className:Wa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:233:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"233","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:234:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"234","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20mb-2%22%7D",children:"The register"}),a.jsx("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:235:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"235","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:e.assets.map(d=>{const P=Number(d.cost)-Number(d.accumulated_depreciation);return a.jsxs("div",{className:"flex items-center justify-between gap-3 py-1.5 border-b border-white/[0.04] last:border-0","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:239:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"239","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20gap-3%20py-1.5%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:240:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"240","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-bright truncate","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:241:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"241","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-bright%20truncate%22%7D",children:[d.name,d.status!=="active"&&a.jsxs("span",{className:"text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:243:48","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"243","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%22%7D",children:[" · ",d.status]})]}),a.jsxs("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:245:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"245","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:[d.purchase_date," · ",d.useful_life_years," yr · ",d.method==="slm"?"straight line":"written-down value",!d.it_block&&a.jsx("span",{className:"text-warning/80","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:247:38","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"247","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-warning%2F80%22%7D",children:" · no tax block"})]})]}),a.jsxs("div",{className:"text-right shrink-0","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:250:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"250","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22text-right%20shrink-0%22%7D",children:[a.jsx("p",{className:"text-[11px] text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:251:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"251","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-white%20tabular-nums%22%7D",children:ba(P)}),a.jsxs("p",{className:"text-[10px] text-text-subtle tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:252:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"252","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20tabular-nums%22%7D",children:["of ",ba(d.c
27ost)]})]})]},d.id)})})]}),a.jsxs("div",{className:Wa,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:261:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"261","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("p",{className:"text-xs font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:262:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"262","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(At,{className:"w-3.5 h-3.5 text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:263:10","data-matrix-name":"CalendarClock","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"263","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"CalendarClock","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%22%7D"})," Charge depreciation"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:265:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"265","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Spreads a month's share of every asset's cost into your books. Each month is charged once."}),a.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:268:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"268","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20mt-2%20flex-wrap%22%7D",children:[a.jsx("select",{value:D,onChange:d=>Q(Number(d.target.value)),className:`${aa} w-auto`,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:269:10","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"269","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:he.map((d,P)=>a.jsx("option",{value:P+1,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:270:34","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"270","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BBinaryExpression%5D%22%7D",children:d},d))}),a.jsx("select",{value:E,onChange:d=>O(Number(d.target.value)),className:`${aa} w-auto`,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:272:10","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"272","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[N.getFullYear(),N.getFullYear()-1,N.getFullYear()-2].map(d=>a.jsx("option",{value:d,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:273:93","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"273","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%7D",children:d},d))}),a.jsx(j,{size:"sm",variant:i?"ghost":"primary",disabled:i,loading:m,onClick:_,"data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:275:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"275","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22%5BConditionalExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:i?"Already charged":`Charge ${he[D-1]} ${E}`})]}),i&&a.jsxs("p",{className:"text-[10px] text-text-subtle mt-1.5 flex items-center gap-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:280:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"280","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-1.5%20flex%20items-center%20gap-1%22%7D",children:[a.jsx(W,{className:"w-3 h-3 text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:281:12","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"281","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20text-text-subtle%22%7D"}),"Charging a month twice would double the expense and halve every asset, so it is only done once."]}),g.length>0&&a.jsx("div",{className:"mt-3 space-y-1","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:287:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"287","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20space-y-1%22%7D",children:g.slice(0,6).map(d=>a.jsxs("div",{className:"flex items-center justify-between py-1 border-b border-white/[0.04] last:border-0","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:289:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"289","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20py-1%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%22%7D",children:[a.jsxs("span",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:290:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"290","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:[d.peri
27od," · ",d.asset_count," asset",d.asset_count===1?"":"s"]}),a.jsx("span",{className:"text-[11px] text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FixedAssetsPanel.tsx:291:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FixedAssetsPanel.tsx","data-component-line":"291","data-component-file":"FixedAssetsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-bright%20tabular-nums%22%7D",children:ba(d.total_amount)})]},d.id))})]})]})}const Pa=e=>{const u=Math.abs(e)/100;return`${e<0?"−":""}₹${u.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`},Va="bg-surface/60 border border-white/[0.06] rounded-xl p-4",Oe="bg-white/[0.04] border border-white/[0.08] rounded-lg px-2.5 py-1.5 text-xs text-white outline-none focus:border-white/[0.16]";function ue({title:e,section:u}){return a.jsxs("div",{className:Va,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:33:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"33","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1.5","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:34:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"34","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20mb-1.5%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:35:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"35","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-white%22%7D",children:e}),a.jsx("span",{className:`text-xs font-semibold tabular-nums ${u.total_paise<0?"text-text-soft":"text-success-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:36:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"36","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:Pa(u.total_paise)})]}),u.lines.length===0?a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:41:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"41","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"Nothing in this period."}):u.lines.map((g,p)=>a.jsxs("div",{className:"flex items-start justify-between gap-3 py-1 border-b border-white/[0.04] last:border-0","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:43:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"43","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%20py-1%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:44:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"44","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsx("p",{className:"text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:45:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"45","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%22%7D",children:g.label}),g.hint&&a.jsx("p",{className:"text-[10px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:46:25","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"46","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-0.5%22%7D",children:g.hint})]}),a.jsx("span",{className:`text-[11px] tabular-nums shrink-0 ${g.amount_paise<0?"text-text-muted":"text-success-bright/90"}`,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:48:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"48","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:Pa(g.amount_paise)})]},p))]})}function In(){const e=new Date,[u,g]=t.useState(`${e.getFullYear()}-04-01`),[p,l]=t.useState(e.toISOString().slice(0,10)),[f,s]=t.useState(null),[n,x]=t.useState(!1),[o,A]=t.useState(null),c=t.useCallback(async()=>{x(!0),A(null);try{const m=await S(`/ledger/cash-flow?from=${u}&to=${p}`);m.success&&m.data?s(m.data):(s(null),A(m.error||"Could not build the cash flow statement."))}finally{x(!1)}},[u,p]);return t.useEffect(()=>{c()},[c]),a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:76:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"76","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("div",{className:Va,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:77:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"77","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:78:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"78","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:79:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"79","data-component-file":"CashFlowPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:80:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"80","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Nt,{className:"h-4 w-4 text-info","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:81:14","data-matrix-name":"Waves","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"81","data-component-file":"CashFlowPanel.tsx","data-component-name":"Waves","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-info%22%7D"})," Where the money went"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:83:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"83","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Profit is not cash. This shows what actually moved through your bank, and why it differs from what you earned."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:88:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"88","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx("input",{type:"date",value:u,onChange:m=>g(m.target.value),className:Oe,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:89:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"89","data-component-file":"CashFlowPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx("input",{type:"date",value:p,onChange:m=>l(m.target.value),className:Oe,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:90:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"90","data-component-file":"CashFlowPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BIdentifier%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:n,onClick:c,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:91:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"91","data-component-file":"CashFlowPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]})]})}),o&&a.jsx("div",{className:Va,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:97:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"97","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:a.jsx("p",{className:"text-xs text-amber-200/90","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:97:30","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"97","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-amber-200%2F90%22%7D",children:o})}),f&&a.jsx("div",{className:f.reconciles?"rounded-xl bg-success-fill/[0.08] border border-success-fill/25 px-3 py-2":"rounded-xl bg-danger-fill/[0.08] border border-danger-fill/30 p-3","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:102:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"102","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:f.reconciles?a.jsxs("p",{className:"text-[11px] text-emerald-200 flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:106:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"106","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-emerald-200%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:107:14","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"107","data-component-file":"CashFlowPanel.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"}),"This ties back exactly to the cash in your books."]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-xs font-semibold text-danger-pale flex items-center gap-1.5","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:112:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"112","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-danger-pale%20flex%20items-center%20gap-1.5%22%7D",children:[a.jsx(W,{className:"w-4 h-4","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:113:16","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"113","data-component-file":"CashFlowPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%22%7D"})," ",Pa(Math.abs(f.unexplained_paise))," cannot be explained"]}),f.warnings.map((m,v)=>a.jsx("p",{className:"text-[11px] text-danger-pale/80 mt-1 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:116:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"116","data-component-file":"CashFlowPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-pale%2F80%20mt-1%20leading-relaxed%22%7D",children:m},v))]})}),f&&a.jsxs(a.Fragment,{children:[a.jsx(ue,{title:"From trading",section:f.operating,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:125:10","data-matrix-name":"Block","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"125","data-component-file":"CashFlowPanel.tsx","data-component-name":"Block","data-component-content":"%7B%22title%22%3A%22From%20trading%22%2C%22section%22%3A%22%5BMemberExpression%5D%22%7D"}),a.jsx(ue,{title:"Buying and selling long-term things",section:f.investing,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:126:10","data-matrix-name":"Block","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"126","data-component-file":"CashFlowPanel.tsx","data-component-name":"Block","data-component-content":"%7B%22title%22%3A%22Buying%20and%20selling%20long-term%20things%22%2C%22section%22%3A%22%5BMemberExpression%5D%22%7D"}),a.jsx(ue,{title:"Money from owners and lenders",section:f.financing,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:127:10","data-matrix-name":"Block","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"127","data-component-file":"CashFlowPanel.tsx","data-component-name":"Block","data-component-content":"%7B%22title%22%3A%22Money%20from%20owners%20and%20lenders%22%2C%22section%22%3A%22%5BMemberExpression%5D%22%7D"}),a.jsxs("div",{className:Va,"data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:129:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"129","data-component-file":"CashFlowPanel.tsx","data-component-name":
27"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between py-1 border-b border-white/[0.04]","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:130:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"130","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20py-1%20border-b%20border-white%2F%5B0.04%5D%22%7D",children:[a.jsx("span",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:131:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"131","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:"Cash at the start"}),a.jsx("span",{className:"text-xs text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:132:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"132","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%20tabular-nums%22%7D",children:Pa(f.opening_cash_paise)})]}),a.jsxs("div",{className:"flex items-center justify-between py-1 border-b border-white/[0.04]","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:134:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"134","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20py-1%20border-b%20border-white%2F%5B0.04%5D%22%7D",children:[a.jsx("span",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:135:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"135","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:"Change over the period"}),a.jsx("span",{className:"text-xs text-text-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:136:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"136","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%20tabular-nums%22%7D",children:Pa(f.net_change_paise)})]}),a.jsxs("div",{className:"flex items-center justify-between pt-2 mt-1 border-t border-white/[0.08]","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:138:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"138","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20pt-2%20mt-1%20border-t%20border-white%2F%5B0.08%5D%22%7D",children:[a.jsx("span",{className:"text-[11px] font-medium text-white","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:139:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"139","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20font-medium%20text-white%22%7D",children:"Cash at the end"}),a.jsx("span",{className:"text-sm font-semibold text-white tabular-nums","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:140:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"140","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20tabular-nums%22%7D",children:Pa(f.closing_c
27ash_paise)})]}),!f.reconciles&&a.jsxs("div",{className:"flex items-center justify-between pt-1","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:143:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"143","data-component-file":"CashFlowPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20pt-1%22%7D",children:[a.jsx("span",{className:"text-[11px] text-danger-bright","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:144:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"144","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-bright%22%7D",children:"Your books actually say"}),a.jsx("span",{className:"text-xs text-danger-bright tabular-nums","data-matrix-id":"src/pages/dashboard/personas/CashFlowPanel.tsx:145:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/CashFlowPanel.tsx","data-component-line":"145","data-component-file":"CashFlowPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger-bright%20tabular-nums%22%7D",children:Pa(f.actual_closing_cash_paise)})]})]})]})]})}const Le="bg-surface/60 border border-white/[0.06] rounded-xl p-4",kn=e=>`₹${Number(e||0).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,Fn={broken:{row:"bg-danger-fill/[0.07] border-danger-fill/25",icon:a.jsx(W,{className:"w-4 h-4 text-danger-bright shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:35:10","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"35","data-component-file":"BooksHealthPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-danger-bright%20shrink-0%20mt-0.5%22%7D"}),label:"text-danger-faint"},attention:{row:"bg-warning-fill/[0.06] border-warning-fill/20",icon:a.jsx(W,{className:"w-4 h-4 text-warning-bright shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:40:10","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"40","data-component-file":"BooksHealthPanel.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-warning-bright%20shrink-0%20mt-0.5%22%7D"}),label:"text-amber-100"},ok:{row:"bg-white/[0.02] border-white/[0.05]",icon:a.jsx(Z,{className:"w-4 h-4 text-success/70 shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:45:10","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"45","data-component-file":"BooksHealthPanel.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-success%2F70%20shrink-0%20mt-0.5%22%7D"}),label:"text-text-soft"}};function En(){const[e,u]=t.useState(null),[g,p]=t.useState(!0),[l,f]=t.useState(null),[s,n]=t.useState(!1),x=t.useCallback(async()=>{p(!0),f(null);try{const c=await S("/books-health");c.success&&c.data?u(c.data):(u(null),f(c.error||"Could not check your books."))}finally{p(!1)}},[]);t.useEffect(()=>{x()},[x]);const o=((e==null?void 0:e.checks)||[]).filter(c=>c.status!=="ok"),A=((e==null?void 0:e.checks)||[]).filter(c=>c.status==="ok");return a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:70:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"70","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsxs("div",{className:e!=null&&e.trustworthy?"rounded-xl bg-success-fill/[0.08] border border-success-fill/25 p-4":e&&e.broken>0?"rounded-xl bg-danger-fill/[0.08] border border-danger-fill/30 p-4":Le,"data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:71:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"71","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:76:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"76","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:77:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"77","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:78:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"78","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[e!=null&&e.trustworthy?a.jsx(Ze,{className:"h-4 w-4 text-success","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:80:18","data-matrix-name":"ShieldCheck","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"80","data-component-file":"BooksHealthPanel.tsx","data-component-name":"ShieldCheck","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-success%22%7D"}):a.jsx(Dt,{className:"h-4 w-4 text-danger","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:81:18","data-matrix-name":"ShieldAlert","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"81","data-component-file":"BooksHealthPanel.tsx","data-component-name":"ShieldAlert","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-danger%22%7D"}),"Are your books right?"]}),a.jsx("p",{className:`text-[11px] mt-1 leading-relaxed max-w-2xl ${e!=null&&e.trustworthy?"text-emerald-200/90":e&&e.broken>0?"text-danger-pale/90":"text-text-muted"}`,"data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:84:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"84","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:g?"Checking…":l||(e==null?void 0:e.summary)}),e&&!g&&a.jsxs("p",{className:"text-[10px] text-text-subtle mt-1","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:89:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"89","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-1%22%7D",children:["Checked ",e.period.from," to ",e.period.to,e.gst_month?` · GST for period ${e.gst_month}`:""]})]}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:g,onClick:x,"data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:95:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"95","data-component-file":"BooksHealthPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Check again"})]}),e&&!g&&a.jsx("p",{className:"text-[10px] text-text-subtle mt-3 leading-relaxed max-w-2xl","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:99:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"99","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-3%20leading-relaxed%20max-w-2xl%22%7D",children:"Your ledger, your GST returns, your cash flow statement and your asset register are different views of the same entries. If they disagree, one of them is wrong — this compares them so you find out before your accountant or the department does."})]}),o.map(c=>{const m=Fn[c.status];return a.jsx("div",{className:`rounded-xl border p-3 ${m.row}`,"data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:111:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"111","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:a.jsxs("div",{className:"flex items-start gap-2","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:112:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"112","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%22%7D",children:[m.icon,a.jsxs("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:114:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"114","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:115:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"115","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-baseline%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsx("p",{className:`text-xs font-semibold ${m.label}`,"data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:116:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"116","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:c.title}),c.amount!==void 0&&c.amount>0&&a.jsx("span",{className:"text-xs tabular-nums text-text-soft shrink-0","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:118:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"118","data-component-file":"BooksHealthPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20tabular-nums%20text-text-soft%20shrink-0%22%7D",children:kn(c.amount)})]}),a.jsx("p",{className:"text-[11px] text-text-muted mt-0.5 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:121:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"121","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mt-0.5%20leading-relaxed%22%7D",children:c.detail}),c.fix&&a.jsxs("p",{className:"text-[10px] text-text-subtle mt-1 flex items-center gap-1","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:123:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"123","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-1%20flex%20items-center%20gap-1%22%7D",children:[a.jsx(Ke,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:124:20","data-matrix-name":"ArrowRight","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"124","data-component-file":"BooksHealthPanel.tsx","data-component-name":"ArrowRight","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})," ",c.fix]})]})]})},c.id)}),A.length>0&&a.jsxs("div",{className:Le,"data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:135:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"135","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsxs("button",{onClick:()=>n(c=>!c),className:"w-full flex items-center justify-between text-left","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:136:10","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"136","data-component-file":"BooksHealthPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22w-full%2
270flex%20items-center%20justify-between%20text-left%22%7D",children:[a.jsxs("span",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:140:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"140","data-component-file":"BooksHealthPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:[A.length," check",A.length===1?"":"s"," passed"]}),a.jsx("span",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:143:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"143","data-component-file":"BooksHealthPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:s?"Hide":"Show"})]}),s&&a.jsx("div",{className:"mt-2 space-y-1","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:146:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"146","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-2%20space-y-1%22%7D",children:A.map(c=>a.jsxs("div",{className:"flex items-start gap-2 py-1 border-b border-white/[0.04] last:border-0","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:148:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"148","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-2%20py-1%20border-b%20border-white%2F%5B0.04%5D%20last%3Aborder-0%22%7D",children:[a.jsx(Z,{className:"w-3.5 h-3.5 text-success/70 shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:149:18","data-matrix-name":"CheckCircle2","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"149","data-component-file":"BooksHealthPanel.tsx","data-component-name":"CheckCircle2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-success%2F70%20shrink-0%20mt-0.5%22%7D"}),a.jsxs("div",{className:"min-w-0","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:150:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"150","data-component-file":"BooksHealthPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%22%7D",children:[a.jsx("p",{className:"text-[11px] text-text-soft","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:151:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"151","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%22%7D",children:c.title}),a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BooksHealthPanel.tsx:152:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BooksHealthPanel.tsx","data-component-line":"152","data-component-file":"BooksHealthPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:c.detail})]})]},c.id))})]})]})}const nt=[{title:"Start here — you can look these up today",rows:[{code:"1010",label:"Money in your bank account",hint:"Closing balance on the statement for that date. Overdrawn? Enter it under Bank / Term Loan instead."},{code:"1000",label:"Cash in hand",hint:"Physical cash the business held"},{code:"1100",label:"Money customers owed you",hint:"Add up invoices sent but not yet paid"},{code:"2000",label:"Money you owed suppliers",hint:"Bills received but not yet paid"}]},{title:"What the business owns",rows:[{code:"1500",label:"Equipment, vehicles, property",hint:"Written-down value after depreciation — not what you paid for it"},{code:"1400",label:"Stock / inventory",hint:"Value of goods held, at cost"},{code:"1050",label:"Fixed deposits",hint:"FDs and similar"}]},{title:"Often forgotten — and each one silently distorts your equity",note:"The
27se are the lines a first attempt usually misses. Skip any that do not apply.",rows:[{code:"1310",label:"Deposits you have paid",hint:"Office rent deposit, electricity deposit — still owed back to you"},{code:"1300",label:"Expenses paid in advance",hint:"Insurance, AMC, rent paid ahead of the period it covers"},{code:"1150",label:"Advances paid to suppliers",hint:"Money paid before the goods or service arrived"},{code:"2010",label:"Advances received from customers",hint:"Money taken before the work was done. This is owed, not earned."},{code:"1210",label:"TDS deducted by your customers",hint:"From Form 26AS on the income-tax portal — this is your money"},{code:"1220",label:"Advance tax you paid",hint:"Also on Form 26AS"},{code:"1200",label:"GST input credit unused",hint:"Electronic credit ledger balance on the GST portal"},{code:"2100",label:"GST you owed the government",hint:"From the March GSTR-3B, if unpaid at that date"}]},{title:"What the business owed",rows:[{code:"2200",label:"Salaries owed to staff",hint:"March salary paid in April belongs here"},{code:"2120",label:"PF owed",hint:"March PF, paid in April"},{code:"2130",label:"ESI owed",hint:"March ESI, paid in April"},{code:"2140",label:"Professional tax owed",hint:"March PT, paid in April"},{code:"2110",label:"TDS you deducted but had not deposited",hint:"On vendor bills or salaries"},{code:"2250",label:"Bills you had not received yet",hint:"March electricity, phone, CA fees — billed to you in April"},{code:"2400",label:"Bank or term loan outstanding",hint:"Principal still owed. Also use this for an overdrawn bank account."},{code:"2410",label:"Money the directors lent the business",hint:"Very commonly missed — the owner thinks of it as their own money"},{code:"2500",label:"Income tax provision",hint:"Tax expected on last year’s profit, not yet paid"}]},{title:"What the owners put in",rows:[{code:"3010",label:"Share capital",hint:"For a Pvt Ltd or LLP — from the MoA or your MCA filings"},{code:"3000",label:"Owner’s money put in",hint:"For a proprietorship or partnership"}]}],Sn=nt.flatMap(e=>e.rows),Ja="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-3 py-2 text-xs text-white placeholder:text-text-faint outline-none focus:border-white/[0.16] tabular-nums",Rn=e=>`₹${Math.abs(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;function _n(){const e=new Date,u=e.getFullYear();return`${e.getMonth()<3?u-1:u}-04-01`}function On(){var _;const[e,u]=t.useState([]),[g,p]=t.useState({}),[l,f]=t.useState(""),[s,n]=t.useState(""),[x,o]=t.useState(_n),[A,c]=t.useState(null),[m,v]=t.useState(!0),[N,E]=t.useState(!1),[O,D]=t.useState(null),Q=t.useCallback(async()=>{v(!0);try{const[i,d]=await Promise.all([S("/ledger/accounts"),S("/ledger/opening-balances")]);i.success&&Array.isArray(i.data)&&u(i.data),d.success&&d.data&&c(d.data)}finally{v(!1)}},[]);t.useEffect(()=>{Q()},[Q]);const r=t.useMemo(()=>new Map(e.map(i=>[i.code,i])),[e]),h=t.useMemo(()=>{let i=0;for(const[C,y]of Object.entries(g)){const b=Number(y);if(!b)continue;const F=r.get(C);F&&(i+=F.normal_side==="debit"?b:-b)}const d=e.find(C=>C.id===l),P=Number(s)||0;return d&&P&&(i+=d.normal_side==="debit"?P:-P),Math.round(i*100)/100},[g,r,e,l,s]),B=t.useMemo(()=>{const i=Object.entries(g).map(([C,y])=>({acc:r.get(C),amount:Number(y)})).filter(C=>C.acc&&C.amount),d=e.find(C=>C.id===l),P=Number(s)||0;return d&&P&&i.push({acc:d,amount:P}),i},[g,r,e,l,s]),w=async()=>{var i;if(B.length===0){D("Enter at least one figure.");return}if(B.some(d=>d.amount<0)){D("Enter positive figures — the side is worked out from the account.");return}E(!0),D(null);try{const d=await S("/ledger/opening-balances",{method:"POST",body:JSON.stringify({as_of:x,balances:B.map(P=>({account_id:P.acc.id,amount:P.amount}))})});d.success?(k.success("Opening balances posted — your statements now start from here."),Q()):D(d.error||((i=d.errors)==null?void 0:i[0])||"Could not save.")}catch{D("Could not save.")}finally{E(!1)}};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:175:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"175","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
27nded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:176:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"176","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:177:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"177","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:178:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"178","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(wt,{className:"h-4 w-4 text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:179:12","data-matrix-name":"Landmark","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"179","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"Landmark","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-accent-bright%22%7D"})," Where your books start"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:181:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"181","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"What the business already owned and owed on the day you started using Zapheit. Without this, your profit and balance sheet only describe what has happened since."})]}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:m,onClick:Q,"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:186:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"186","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"})]}),A!=null&&A.exists?a.jsx("div",{className:"rounded-lg bg-success-fill/[0.06] border border-success-fill/20 px-3 py-2.5","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:190:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"190","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-success-fill%2F%5B0.06%5D%20border%20border-success-fill%2F20%20px-3%20py-2.5%22%7D",children:a.jsxs("p",{className:"text-[11px] text-emerald-200/90","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:191:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"191","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-emerald-200%2F90%22%7D",children:["Already entered, dated ",a.jsx("strong",{"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:192:35","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"192","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"strong",children:(_=A.journals[0])==null?void 0:_.journal_date}),". Entering them again would double every figure, so it is blocked. To correct them, cancel that entry under",a.jsx("strong",{"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:194:12","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"194","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"strong",children:" Books → Recent entries"})," and enter them again."]})}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-[10px] text-text-subtle max-w-xs","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:199:10","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"199","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22block%20text-%5B10px%5D%20text-text-subtle%20max-w-xs%22%7D",children:["As at — the day before you started using Zapheit",a.jsx("input",{type:"date",value:x,onChange:i=>o(i.target.value),className:`${Ja} mt-1`,"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:201:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"201","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsx("div",{className:"space-y-5","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:204:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"204","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-5%22%7D",children:nt.map(i=>{const d=i.rows.filter(P=>r.has(P.code));return d.length===0?null:a.jsxs("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:209:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"209","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:210:18","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"210","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-text-muted","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:211:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"211","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20font-semibold%20uppercase%20tracking-wide%20text-text-muted%22%7D",children:i.title}),i.note&&a.jsx("p",{className:"text-[10px] text-text-faint mt-0.5","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:212:31","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"212","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%20mt-0.5%22%7D",children:i.note})]}),d.map(P=>a.jsxs("div",{className:"grid grid-cols-12 gap-2 items-center","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:215:20","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"215","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-12%20gap-2%20items-center%22%7D",children:[a.jsxs("div",{className:"col-span-7","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:216:22","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"216","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22col-span-7%22%7D",children:[a.jsx("p",{className:"text-xs text-text-bright","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:217:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"217","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%22%7D",children:P.label}),a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:218:24","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"218","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:P.hint})]}),a.jsx("input",{value:g[P.code]||"",onChange:C=>p(y=>({...y,[P.code]:C.target.value})),inputMode:"decimal",placeholder:"0.00",className:`col-span-5 ${Ja}`,"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:220:22","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"220","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BLogicalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%220.00%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]},P.code))]},i.title)})}),a.jsxs("div",{className:"grid grid-cols-12 gap-2 items-center pt-1 border-t border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:233:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"233","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-12%20gap-2%20items-center%20pt-1%20border-t%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsxs("select",{value:l,onCh
27ange:i=>f(i.target.value),className:`col-span-7 ${Ja}`,"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:234:12","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"234","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:235:14","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"235","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Something else…"}),e.filter(i=>i.account_type!=="income"&&i.account_type!=="expense"&&!Sn.some(d=>d.code===i.code)&&i.code!=="3100").sort((i,d)=>i.code.localeCompare(d.code)).map(i=>a.jsxs("option",{value:i.id,"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:239:28","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"239","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[i.code," — ",i.name]},i.id))]}),a.jsx("input",{value:s,onChange:i=>n(i.target.value),inputMode:"decimal",placeholder:"0.00",className:`col-span-5 ${Ja}`,"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:241:12","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"241","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22inputMode%22%3A%22decimal%22%2C%22placeholder%22%3A%220.00%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"})]}),a.jsx("p",{className:"text-[10px] text-text-faint","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:243:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"243","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-faint%22%7D",children:"Income and expense accounts are deliberately not listed — opening balances describe a position, not past trading. Past profit belongs in the figure below."}),B.length>0&&a.jsxs("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.08] px-3 py-2.5 space-y-1","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:250:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"250","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.08%5D%20px-3%20py-2.5%20space-y-1%22%7D",children:[a.jsxs("p",{className:"text-[11px] text-text-soft flex items-start gap-1.5","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:251:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"251","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20flex%20items-start%20gap-1.5%22%7D",children:[a.jsx(xa,{className:"w-3.5 h-3.5 text-accent-bright shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:252:16","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"252","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%20shrink-0%20mt-0.5%22%7D"}),a.jsxs("span",{"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:253:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"253","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"span",children:["Everything you have entered leaves ",a.jsx("strong",{"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:254:53","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"254","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"strong",children:Rn(h)}),h>=0?" of accumulated worth":" of accumulated shortfall",", which goes to “Opening Balance Equity”."]})]}),a.jsx("p",{className:"text-[10px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:259:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"259","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%22%7D",children:"That figure is 
27what the business has built up (or lost) before today. If it looks wrong, something above is missing or mistyped — this always balances mechanically, so a wrong number here is the only signal you get."})]}),O&&a.jsx("p",{className:"text-xs text-danger","data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:267:20","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"267","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-danger%22%7D",children:O}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:Ta,loading:N,disabled:B.length===0,onClick:w,"data-matrix-id":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx:268:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/OpeningBalancesPanel.tsx","data-component-line":"268","data-component-file":"OpeningBalancesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Post opening balances"})]})]})}const Ln=".csv,.tsv,.xlsx,.xls",fa=e=>`₹${Number(e||0).toLocaleString("en-IN",{maximumFractionDigits:2})}`;async function Qe(e,u,g={}){const l=(await ve()).Authorization,f=new FormData;f.append("file",u);for(const[n,x]of Object.entries(g))f.append(n,x);const s=await fetch(`${Ka}${e}`,{method:"POST",headers:l?{Authorization:l}:void 0,body:f});return{ok:s.ok,body:await s.json().catch(()=>({}))}}const Qn={chart:{title:"Step 1 — your chart of accounts",blurb:"Upload the ledger list from your previous system. Accounts you already have are left untouched; only the missing ones are added. Do this before the balances, because a balance cannot post to an account that does not exist.",verb:"Add accounts"},opening:{title:"Step 2 — opening balances",blurb:"Upload the closing trial balance from your previous system. Without it the ledger starts at zero — no cash you actually hold, nothing owed to you, nothing you owe — and every report built on it is arithmetically correct and completely wrong.",verb:"Post opening balances"}};function Tn(){const[e,u]=t.useState("chart"),[g,p]=t.useState(null),[l,f]=t.useState(null),[s,n]=t.useState(!1),[x,o]=t.useState(null),[A,c]=t.useState(null),[m,v]=t.useState(""),N=t.useRef(null),E=Qn[e],O=()=>{p(null),f(null),o(null),c(null)};async function D(r){p(r),f(null),o(null),c(null),n(!0);const{ok:h,body:B}=await Qe(`/finance-import/${e}/preview`,r);if(n(!1),!h){o((B==null?void 0:B.error)||"Could not read that file");return}f(B)}async function Q(){if(!g)return;if(e==="opening"&&!m){o("Give the date these balances are as at.");return}n(!0),o(null);const{ok:r,body:h}=await Qe(`/finance-import/${e}/commit`,g,e==="opening"?{journal_date:m}:{});if(n(!1),!r){o((h==null?void 0:h.error)||"Import failed");return}c(e==="chart"?`${h.created} accounts added${h.already_existed?`, ${h.already_existed} already existed`:""}.`:`Opening balances posted as at ${h.journal_date} — ${h.accounts} accounts, ${fa(h.total_debit)} each side${h.plugged?`, including ${fa(h.plugged)} to Opening Balance Equity`:""}.`),f(null),p(null)}return A?a.jsx("div",{className:"rounded-xl border border-emerald-500/30 bg-emerald-500/5 p-6","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:112:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"112","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-emerald-500%2F30%20bg-emerald-500%2F5%20p-6%22%7D",children:a.jsxs("div",{className:"flex items-start gap-3","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:113:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"113","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-3%22%7D",children:[a.jsx(De,{className:"h-5 w-5 shrink-0 text-emerald-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:114:10","data-matrix-name":"Check","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"114","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Check","data-component-content":"%7B%22className%22%3A%22h-5%20w-5%20shrink-0%20text-emerald-400%22%7D"}),a.jsxs("div",{className:"space-y-3","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:115:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"115","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-3%22%7D",children:[a.jsx("h3",{className:"text-base font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:116:12","data-matrix-name":"h3","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"116","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"h3","data-component-content":"%7B%22className%22%3A%22text-base%20font-semibold%20text-white%22%7D",children:A}),a.jsx("p",{className:"text-sm text-slate-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:117:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"117","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20text-slate-400%22%7D",children:e==="chart"?"Now upload the closing trial balance from your old 
27system.":"Open the Trial Balance report and check it against the closing trial balance from your old system before recording anything new."}),a.jsxs("div",{className:"flex gap-2","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:122:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"122","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20gap-2%22%7D",children:[e==="chart"&&a.jsx(j,{onClick:()=>{u("opening"),O()},"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:123:35","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"123","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Continue to balances →"}),a.jsx(j,{variant:"secondary",onClick:O,"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:124:14","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"124","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22secondary%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Upload another file"})]})]})]})}):a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:133:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"133","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/40 p-5","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:134:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"134","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-slate-800%20bg-slate-900%2F40%20p-5%22%7D",children:[a.jsx("div",{className:"flex flex-wrap items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:135:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"135","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-2%22%7D",children:["chart","opening"].map(r=>a.jsx("button",{onClick:()=>{u(r),O()},className:`rounded-lg px-3 py-1.5 text-sm ${e===r?"bg-slate-700 text-white":"text-slate-400 hover:text-slate-200"}`,"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:137:12","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"137","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:r==="chart"?"1. Chart of accounts":"2. Opening balances"},r))}),a.jsx("h3",{className:"mt-4 text-base font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:147:8","data-matrix-name":"h3","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"147","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"h3","data-component-content":"%7B%22className%22%3A%22mt-4%20text-base%20font-semibold%20text-white%22%7D",children:E.title}),a.jsx("p",{className:"mt-1 max-w-3xl text-sm text-slate-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:148:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"148","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-1%20max-w-3xl%20text-sm%20text-slate-400%22%7D",children:E.blurb}),a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:150:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"150","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-4%20flex%20flex-wrap%20items-center%20gap-3%22%7D",children:[a.jsx("input",{ref:N,type:"file",accept:Ln,className:"hidden",onChange:r=>{var B;const h=(B=r.target.files)==null?void 0:B[0];
27h&&D(h),r.target.value=""},"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:151:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"151","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22file%22%2C%22accept%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22hidden%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsxs(j,{onClick:()=>{var r;return(r=N.current)==null?void 0:r.click()},disabled:s,"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:155:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"155","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx(at,{className:"mr-2 h-4 w-4","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:156:12","data-matrix-name":"Upload","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"156","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Upload","data-component-content":"%7B%22className%22%3A%22mr-2%20h-4%20w-4%22%7D"}),s&&!l?"Reading…":"Choose a file"]}),g&&a.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-slate-300","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:159:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"159","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22inline-flex%20items-center%20gap-2%20text-sm%20text-slate-300%22%7D",children:[a.jsx(et,{className:"h-4 w-4 text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:160:14","data-matrix-name":"FileSpreadsheet","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"160","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"FileSpreadsheet","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-slate-500%22%7D"}),g.name,a.jsx("button",{onClick:O,className:"text-slate-500 hover:text-slate-300","aria-label":"Clear","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:161:14","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"161","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22className%22%3A%22text-slate-500%20hover%3Atext-slate-300%22%7D",children:a.jsx(oa,{className:"h-4 w-4","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:161:105","data-matrix-name":"X","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"161","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"X","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%22%7D"})})]})]}),a.jsx("p",{className:"mt-3 text-xs text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:165:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"165","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-3%20text-xs%20text-slate-500%22%7D",children:e==="chart"?'Needs a Code and a Name column, plus a Type or Group column — Tally wording like "Sundry Debtors" or "Indirect Expenses" is understood.':"Needs an account Code (or Name), and either Debit and Credit columns or a single Balance column."})]}),x&&a.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-red-500/30 bg-red-500/5 p-4","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:173:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"173","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-3%20rounded-xl%20border%20border-red-500%2F30%20bg-red-500%2F5%20p-4%22%7D",children:[a.jsx(W,{className:"h-5 w-5 shrink-0 text-red-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:174:10","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"174","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22h-5%20w-5%20shrink-0%20text-red-400%22%7D"}),a.jsx("p",{className:"text-sm text-red-200","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:175:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"175","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20text-red-200%22%7D",children:x})]}),l&&a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:180:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"180","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[l.errors.length>0&&a.jsxs("div",{className:"rounded-xl border border-red-500/30 bg-red-500/5 p-5","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:182:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"182","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-red-500%2F30%20bg-red-500%2F5%20p-5%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:183:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"183","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(W,{className:"h-5 w-5 text-red-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:184:16","data-matrix-name":"AlertTriangle","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"184","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"AlertTriangle","data-component-content":"%7B%22className%22%3A%22h-5%20w-5%20text-red-400%22%7D"}),a.jsxs("h4",{className:"font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:185:16","data-matrix-name":"h4","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"185","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"h4","data-component-content":"%7B%22className%22%3A%22font-semibold%20text-white%22%7D",children:[l.errors.length," thing",l.errors.length===1?"":"s"," to fix first"]})]}),a.jsxs("ul",{className:"mt-3 space-y-1.5 text-sm text-red-200","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:187:14","data-matrix-name":"ul","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"187","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"ul","data-component-content":"%7B%22className%22%3A%22mt-3%20space-y-1.5%20text-sm%20text-red-200%22%7D",children:[l.errors.slice(0,25).map((r,h)=>a.jsxs("li",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:189:18","data-matrix-name":"li","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"189","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"li",children:[r.row>0&&a.jsxs("span",{className:"text-red-400/70","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:189:44","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"189","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-red-400%2F70%22%7D",children:["Line ",r.row,": "]}),r.message]},h)),l.errors.length>25&&a.jsxs("li",{className:"text-slate-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:191:47","data-matrix-name":"li","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"191","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"li","data-component-content":"%7B%22className%22%3A%22text-slate-400%22%7D",children:["…and ",l.errors.length-25," more"]})]}),l.unknown_codes&&l.unknown_codes.length>0&&a.jsxs("p",{className:"mt-3 text-sm text-slate-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:194:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"194","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-3%20text-sm%20text-slate-400%22%7D",children:["Missing accounts: ",l.unknown_codes.slice(0,12).join(", "),". Add them in step 1 first."]})]}),e==="opening"&&l.difference!==void 0&&a.jsxs("div",{className:`rounded-xl border p-5 ${l.plug?"border-orange-500/30 bg-
27orange-500/5":"border-slate-800 bg-slate-900/40"}`,"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:204:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"204","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:205:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"205","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx($a,{className:`h-5 w-5 ${l.plug?"text-orange-400":"text-emerald-400"}`,"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:206:16","data-matrix-name":"Scale","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"206","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Scale","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D"}),a.jsx("h4",{className:"font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:207:16","data-matrix-name":"h4","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"207","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"h4","data-component-content":"%7B%22className%22%3A%22font-semibold%20text-white%22%7D",children:l.plug?"This trial balance does not balance":"Balanced"})]}),a.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-4 text-sm tabular-nums","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:211:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"211","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20grid%20grid-cols-3%20gap-4%20text-sm%20tabular-nums%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:212:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"212","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:212:21","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"212","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-slate-500%22%7D",children:"Debits"}),a.jsx("p",{className:"text-slate-200","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:212:61","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"212","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-slate-200%22%7D",children:fa(l.total_debit??0)})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:213:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"213","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:213:21","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"213","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-slate-500%22%7D",children:"Credits"}),a.jsx("p",{className:"text-slate-200","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:213:62","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"213","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-slate-200%22%7D",children:fa(l.total_credit??0)})]}),a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:214:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"214","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:215:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"215","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-slate-500%22%7D",children:"Difference"}),a.jsx("p",{className:l.plug?"text-orange-300":"text-emerald-300","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:216:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"216","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BConditionalExpression%5D%22%7D",children:fa(Math.abs(l.difference??0))})]})]}),l.plug&&a.jsxs("p",{className:"mt-3 text-sm text-orange-100/90","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:220:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"220","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22mt-3%20text-sm%20text-orange-100%2F90%22%7D",children:["A journal cannot post unless it balances, so this difference will go to"," ",a.jsxs("strong",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:222:23","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"222","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"strong",children:[l.plug.account_code," Opening Balance Equity"]}),". A real trial balance balances — if yours does not, something is missing from the file, and this is where it will hide."]})]}),l.warnings.filter(r=>!/does not balance/.test(r.message)).length>0&&a.jsxs("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/5 p-5","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:230:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"230","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-amber-500%2F30%20bg-amber-500%2F5%20p-5%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:231:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"231","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx(xa,{
27className:"h-5 w-5 text-amber-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:232:16","data-matrix-name":"Info","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"232","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Info","data-component-content":"%7B%22className%22%3A%22h-5%20w-5%20text-amber-400%22%7D"}),a.jsx("h4",{className:"font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:233:16","data-matrix-name":"h4","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"233","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"h4","data-component-content":"%7B%22className%22%3A%22font-semibold%20text-white%22%7D",children:"Worth a look"})]}),a.jsx("ul",{className:"mt-3 space-y-1.5 text-sm text-amber-100/90","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:235:14","data-matrix-name":"ul","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"235","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"ul","data-component-content":"%7B%22className%22%3A%22mt-3%20space-y-1.5%20text-sm%20text-amber-100%2F90%22%7D",children:l.warnings.filter(r=>!/does not balance/.test(r.message)).slice(0,15).map((r,h)=>a.jsxs("li",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:237:18","data-matrix-name":"li","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"237","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"li",children:[r.row>0&&a.jsxs("span",{className:"text-amber-400/70","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:237:44","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"237","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-amber-400%2F70%22%7D",children:["Line ",r.row,": "]}),r.message]},h))})]}),e==="chart"&&l.create&&a.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/40 p-5","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:244:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"244","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-slate-800%20bg-slate-900%2F40%20p-5%22%7D",children:[a.jsxs("h4",{className:"font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:245:14","data-matrix-name":"h4","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"245","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"h4","data-component-content":"%7B%22className%22%3A%22font-semibold%20text-white%22%7D",children:[l.create.length," new account",l.create.length===1?"":"s",l.existing&&l.existing.length>0&&a.jsxs("span",{className:"ml-2 text-sm font-normal text-slate-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:248:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"248","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-2%20text-sm%20font-normal%20text-slate-400%22%7D",children:["· ",l.existing.length," already exist and are untouched"]})]}),a.jsx("div",{className:"mt-3 max-h-72 overflow-auto","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:251:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"251","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20max-h-72%20overflow-auto%22%7D",children:a.jsx("table",{className:"w-full text-sm","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:252:16","data-matrix-name":"table","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"252","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"table","data-component-content":"%7B%22className%22%3A%22w-full%2
270text-sm%22%7D",children:a.jsx("tbody",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:253:18","data-matrix-name":"tbody","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"253","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"tbody",children:l.create.map(r=>a.jsxs("tr",{className:"border-b border-slate-800/60","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:255:22","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"255","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22border-b%20border-slate-800%2F60%22%7D",children:[a.jsx("td",{className:"py-2 pr-4 tabular-nums text-slate-400","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:256:24","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"256","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-2%20pr-4%20tabular-nums%20text-slate-400%22%7D",children:r.code}),a.jsx("td",{className:"py-2 pr-4 text-slate-200","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:257:24","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"257","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-2%20pr-4%20text-slate-200%22%7D",children:r.name}),a.jsx("td",{className:"py-2 text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:258:24","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"258","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-2%20text-slate-500%22%7D",children:r.account_type})]},r.code))})})})]}),e==="opening"&&l.lines&&l.lines.length>0&&a.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/40 p-5","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:268:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"268","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-slate-800%20bg-slate-900%2F40%20p-5%22%7D",children:[a.jsxs("h4",{className:"font-semibold text-white","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:269:14","data-matrix-name":"h4","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"269","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"h4","data-component-content":"%7B%22className%22%3A%22font-semibold%20text-white%22%7D",children:[l.lines.length," accounts"]}),a.jsx("div",{className:"mt-3 max-h-72 overflow-auto","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:270:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"270","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22mt-3%20max-h-72%20overflow-auto%22%7D",children:a.jsxs("table",{className:"w-full text-sm tabular-nums","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:271:16","data-matrix-name":"table","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"271","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"table","data-component-content":"%7B%22className%22%3A%22w-full%2
270text-sm%20tabular-nums%22%7D",children:[a.jsx("thead",{className:"sticky top-0 bg-slate-900","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:272:18","data-matrix-name":"thead","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"272","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"thead","data-component-content":"%7B%22className%22%3A%22sticky%20top-0%20bg-slate-900%22%7D",children:a.jsxs("tr",{className:"border-b border-slate-800 text-left text-xs uppercase tracking-wide text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:273:20","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"273","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22border-b%20border-slate-800%20text-left%20text-xs%20uppercase%20tracking-wide%20text-slate-500%22%7D",children:[a.jsx("th",{className:"py-2 pr-4 font-medium","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:274:22","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"274","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22py-2%20pr-4%20font-medium%22%7D",children:"Account"}),a.jsx("th",{className:"py-2 pr-4 text-right font-medium","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:275:22","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"275","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22py-2%20pr-4%20text-right%20font-medium%22%7D",children:"Debit"}),a.jsx("th",{className:"py-2 text-right font-medium","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:276:22","data-matrix-name":"th","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"276","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"th","data-component-content":"%7B%22className%22%3A%22py-2%20text-right%20font-medium%22%7D",children:"Credit"})]})}),a.jsx("tbody",{"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:279:18","data-matrix-name":"tbody","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"279","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"tbody",children:l.lines.map((r,h)=>a.jsxs("tr",{className:"border-b border-slate-800/60","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:281:22","data-matrix-name":"tr","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"281","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"tr","data-component-content":"%7B%22className%22%3A%22border-b%20border-slate-800%2F60%22%7D",children:[a.jsxs("td",{className:"py-2 pr-4 text-slate-200","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:282:24","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"282","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-2%20pr-4%20text-slate-200%22%7D",children:[a.jsx("span",{className:"text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:283:26","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"283","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-slate-500%22%7D",children:r.account_code})," ",r.account_name]}),a.jsx("td",{className:"py-2 pr-4 text-right text-slate-300","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:285:24","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"285","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-2%20pr-4%20text-right%20text-slate-300%22%7D",children:r.debit?fa(r.debit):"—"}),a.jsx("td",{className:"py-2 text-right text-slate-300","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:286:24","data-matrix-name":"td","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"286","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"td","data-component-content":"%7B%22className%22%3A%22py-2%20text-right%20text-slate-300%22%7D",children:r.credit?fa(r.credit):"—"})]},h))})]})})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:295:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"295","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20flex-wrap%20items-center%20gap-3%22%7D",children:[e==="opening"&&a.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-300","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:297:14","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"297","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20text-sm%20text-slate-300%22%7D",children:["As at",a.jsx("input",{type:"date",value:m,onChange:r=>v(r.target.value),className:"rounded-lg border border-slate-700 bg-slate-900 px-3 py-2 text-sm text-slate-100","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:299:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"299","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22date%22%2C%22value%22%3A%22%5BIdentifier%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22rounded-lg%20border%20border-slate-700%20bg-slate-900%20px-3%20py-2%20text-sm%20text-slate-100%22%7D"}),a.jsx("span",{className:"text-xs text-slate-500","data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:303:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"303","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-slate-500%22%7D",children:"usually the day before you started here"})]}),a.jsx(j,{onClick:()=>void Q(),disabled:!l.committable||s,"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:306:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"306","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BLogicalExpression%5D%22%7D",children:s?"Working…":E.verb}),a.jsx(j,{variant:"secondary",onClick:O,disabled:s,"data-matrix-id":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx:309:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/finance/OpeningBalancesImport.tsx","data-component-line":"309","data-component-file":"OpeningBalancesImport.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22secondary%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:"Cancel"})]})]})]})}const $n=e=>
27`₹${Number(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`,Mn="w-full bg-white/[0.04] border border-white/[0.08] rounded-lg px-2 py-1.5 text-[11px] text-white outline-none focus:border-white/[0.16]";function zn(e){return e>=.9?{label:"Confident",cls:"bg-success-fill/15 text-success-bright"}:e>=.6?{label:"Likely",cls:"bg-accent/15 text-accent-faint"}:e>=.35?{label:"Unsure",cls:"bg-warning-fill/15 text-warning-bright"}:{label:"Just a guess",cls:"bg-slate-500/15 text-text-muted"}}function Gn(){const[e,u]=t.useState([]),[g,p]=t.useState([]),[l,f]=t.useState({}),[s,n]=t.useState(!0),[x,o]=t.useState(!1),[A,c]=t.useState(null),[m,v]=t.useState(null),[N,E]=t.useState(!1),[O,D]=t.useState(!1),[Q,r]=t.useState(!1),h=t.useRef(null),B=t.useCallback(async()=>{n(!0);try{const[P,C]=await Promise.all([S("/proposed-entries?status=pending&limit=200"),S("/ledger/accounts")]);P.success&&Array.isArray(P.data)&&u(P.data),C.success&&Array.isArray(C.data)&&p(C.data)}finally{n(!1)}},[]);t.useEffect(()=>{B()},[B]);const w=async P=>{o(!0),v(null),E(!1),D(!1),r(!1);try{const C=new FormData;C.append("file",P);const y=await fetch(`${Ka}/proposed-entries/bank-statement`,{method:"POST",headers:await lt(),body:C}),b=await y.json();if(!y.ok||!b.success){v(b.error||"Could not read that statement."),k.error(b.error||"Could not read that statement.");return}const F=b.data;E(F.extracted_by==="ai"),D(!!F.ai_gap),r(!!F.ai_unverified),v(`${F.proposed} transaction${F.proposed===1?"":"s"} read, ${F.matched} matched to an invoice or bill`+(F.duplicates?` · ${F.duplicates} already imported, skipped`:"")+(F.ai_dropped?` · ${F.ai_dropped} unreadable line${F.ai_dropped===1?"":"s"} left out`:"")+(F.ai_corrected?` · ${F.ai_corrected} corrected from the running balance`:"")),k.success("Statement read — review the suggestions below."),B()}catch{v("Could not upload that file.")}finally{o(!1),h.current&&(h.current.value="")}},_=async P=>{c(P.id);try{const C=l[P.id]||P.suggested_account_id;if(!C){k.error("Choose which account this belongs to first.");return}const y=await S(`/proposed-entries/${P.id}/approve`,{method:"POST",body:JSON.stringify({account_id:C})});if(y.success){const b=y.settled;k.success(b==="invoice"?"Added to your books, and the invoice is now marked paid.":b==="bill"?"Added to your books, and the supplier bill is now marked paid.":"Added to your books."),u(F=>F.filter(I=>I.id!==P.id))}else k.error(y.error||"Could not add it.")}finally{c(null)}},i=async P=>{c(P.id);try{const C=await S(`/proposed-entries/${P.id}/reject`,{method:"POST"});C.success?u(y=>y.filter(b=>b.id!==P.id)):k.error(C.error||"Could not dismiss it.")}finally{c(null)}},d=g.filter(P=>P.account_type!=="equity").sort((P,C)=>P.code.localeCompare(C.code));return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:142:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"142","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:143:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"143","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20flex-wrap%20gap-2%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:144:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"144","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-white flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:145:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"145","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-white%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Na,{className:"h-4 w-4 text-violet-400","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:146:12","data-matrix-name":"Sparkles","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"146","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"Sparkles","data-component-content":"%7B%22className%22%3A%22h-4%20w-4%20text-violet-400%22%7D"})," Let your books fill themselves"]}),a.jsx("p",{className:"text-[11px] text-text-subtle mt-0.5","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:148:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"148","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20mt-0.5%22%7D",children:"Upload a bank statement and we work out what each line is. You approve — nothing reaches your books on its own."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:152:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"152","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsx("input",{ref:h,type:"file",accept:".csv,.tsv,.xlsx,.xls,.pdf",className:"hidden",onChange:P=>{var y;const C=(y=P.target.files)==null?void 0:y[0];C&&w(C)},"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:153:10","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"153","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22file%22%2C%22accept%22%3A%22.csv%2C.tsv%2C.xlsx%2C.xls%2C.pdf%22%2C%22className%22%3A%22hidden%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:H,loading:s,onClick:B,"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:157:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"157","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:"Refresh"}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:at,loading:x,onClick:()=>{var P;return(P=h.current)==null?void 0:P.click()},"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:158:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"158","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BIdentifier%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Upload bank statement"})]})]}),m&&a.jsx("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.08] px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:165:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"165","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-white%2F%5B0.03%5D%20border%20border-white%2F%5B0.08%5D%20px-3%20py-2%22%7D",children:a.jsxs("p",{className:"text-[11px] text-text-soft flex items-start gap-1.5","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:166:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"166","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-soft%20flex%20items-start%20gap-1.5%22%7D",children:[a.jsx(et,{className:"w-3.5 h-3.5 text-accent-bright shrink-0 mt-0.5","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:167:12","data-matrix-name":"FileSpreadsheet","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"167","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"FileSpreadsheet","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%20shrink-0%20mt-0.5%22%7D"}),a.jsx("span",{"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:168:12","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"168","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"span",children:m})]})}),N&&a.jsx("div",{className:"rounded-lg bg-warning-fill/[0.08] border border-warning-fill/25 px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:174:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"174","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-warning-fill%2F%5B0.08%5D%20border%20border-warning-fill%2F25%20px-3%20py-2%22%7D",children:a.jsx("p",{className:"text-[11px] text-amber-200/90","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:175:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"175","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%22%7D",children:"That PDF had no readable table, so the transactions were read by AI. Check each date and amount against your statement before adding them to your books — a CSV or Excel export from your bank is always read exactly."})}),O&&a.jsx("div",{className:"rounded-lg bg-danger-fill/[0.1] border border-danger-fill/30 px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:184:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"184","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-danger-fill%2F%5B0.1%5D%20border%20border-danger-fill%2F30%20px-3%20py-2%22%7D",children:a.jsxs("p",{className:"text-[11px] text-danger-pale","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:185:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"185","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-danger-pale%22%7D",children:[a.jsx("strong",{className:"font-semibold","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:186:12","data-matrix-name":"strong","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"186","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"strong","data-component-content":"%7B%22className%22%3A%22font-semibold%22%7D",children:"At least one transaction is missing."})," The running balances on this statement don't join up, so something between two lines wasn't read. Check it against your passbook before approving anything here."]})}),Q&&!O&&a.jsx("div",{className:"rounded-lg bg-warning-fill/[0.08] border border-warning-fill/25 px-3 py-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:194:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"194","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20bg-warning-fill%2F%5B0.08%5D%20border%20border-warning-fill%2F25%20px-3%20py-2%22%7D",children:a.jsx("p",{className:"text-[11px] text-amber-200/90","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:195:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"195","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-amber-200%2F90%22%7D",children:"This statement showed no running balance, so nothing could confirm which way each amount went. Check every money-in and money-out against your statement before approving."})}),!s&&e.length===0&&a.jsx("p",{className:"text-xs text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:203:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"203","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-subtle%22%7D",children:"Nothing waiting. Upload a CSV, Excel or PDF statement from your bank and every transaction will appear here with a suggestion."}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:209:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"209","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:e.map(P=>{const C=zn(P.confidence),y=P.matched_invoice_id||P.matched_bill_id;return a.jsxs("div",{className:"rounded-lg border border-white/[0.05] bg-white/[0.02] px-3 py-2.5 space-y-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:214:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"214","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.05%5D%20bg-white%2F%5B0.02%5D%20px-3%20py-2.5%20sp
27ace-y-2%22%7D",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:215:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"215","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsxs("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:216:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"216","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:[a.jsxs("p",{className:"text-xs text-text-bright truncate","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:217:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"217","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-bright%20truncate%22%7D",children:[a.jsx("span",{className:"text-text-subtle tabular-nums mr-2","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:218:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"218","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20tabular-nums%20mr-2%22%7D",children:P.txn_date}),P.description]}),P.reasoning&&a.jsx("p",{className:"text-[10px] text-text-subtle mt-0.5 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:221:34","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"221","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20text-text-subtle%20mt-0.5%20leading-relaxed%22%7D",children:P.reasoning})]}),a.jsxs("div",{className:"text-right shrink-0","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:223:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"223","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22text-right%20shrink-0%22%7D",children:[a.jsxs("p",{className:`text-sm font-semibold tabular-nums ${P.direction==="in"?"text-success-bright":"text-text-bright"}`,"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:224:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"224","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[P.direction==="in"?"+":"−",$n(P.amount)]}),a.jsx("span",{className:`inline-flex rounded-md px-1.5 py-0.5 text-[9px] font-medium mt-0.5 ${C.cls}`,"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:227:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"227","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:C.label})]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:231:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"231","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20flex-wrap%22%7D",children:[y?a.jsxs("span",{className:"text-[11px] text-success-bright flex-1","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:235:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"235","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-success-bright%20flex-1%22%7D",children:["Settles ",P.matched_invoice_id?"a customer invoice":"a supplier bill",P.suggested_party_name?` — ${P.suggested_party_name}`:""]}):a.jsxs("select",{value:l[P.id]||P.suggested_account_id||"",onChange:b=>f(F=>({...F,[P.id]:b.target.value})),className:`${Mn} flex-1 min-w-[180px]`,"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:240:18","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"240","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BLogicalExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:245:20","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"245","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Choose an account…"}),d.map(b=>a.jsxs("option",{value:b.id,"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:246:41","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"246","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[b.code," — ",b.name]},b.id))]}),a.jsx(j,{size:"sm",variant:"primary",leftIcon:De,loading:A===P.id,onClick:()=>_(P),"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:249:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"249","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22primary%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Add to books"}),a.jsx(j,{size:"sm",variant:"ghost",leftIcon:oa,loading:A===P.id,onClick:()=>i(P),"data-matrix-id":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx:252:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ProposedEntriesPanel.tsx","data-component-line":"252","data-component-file":"ProposedEntriesPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22variant%22%3A%22ghost%22%2C%22leftIcon%22%3A%22%5BIdentifier%5D%22%2C%22loading%22%3A%22%5BBinaryExpression%5D%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Not needed"})]})]},P.id)})})]})}function Hn(){const e=rt(),u=ee(),[g,p]=t.useState(null),[l,f]=t.useState(null),s=t.useCallback(async()=>{try{const o=await S("/finance-settings/setup");p(o!=null&&o.success&&o.data?o.data:null)}catch{p(null)}},[]);if(t.useEffect(()=>{s()},[s]),t.useEffect(()=>{const o=()=>void s();return window.addEventListener("focus",o),()=>window.removeEventListener("focus",o)},[s]),!g||g.complete)return null;const n=o=>
27{if(o.href){u(o.href);return}if(o.tab){e(o.tab,o.panel_id);return}},x=async o=>{f(o.id);try{await S("/finance-settings/setup/ack",{method:"POST",body:JSON.stringify({step_id:o.id})}),await s()}finally{f(null)}};return a.jsxs("div",{className:"rounded-xl border border-accent/25 bg-accent-tint/[0.35] p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:91:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"91","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-xl%20border%20border-accent%2F25%20bg-accent-tint%2F%5B0.35%5D%20p-4%20space-y-3%22%7D",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:92:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"92","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:93:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"93","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-sm font-semibold text-text","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:94:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"94","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-text%22%7D",children:"Start here — set up your books"}),a.jsx("p",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:95:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"95","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:"Six steps, in the order they depend on each other. You only do this once."})]}),a.jsxs("span",{className:"text-[11px] text-text-muted tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:99:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"99","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20tabular-nums%22%7D",children:[g.done_count," of ",g.total," done"]})]}),a.jsx("div",{className:"space-y-1.5","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:104:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"104","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1.5%22%7D",children:g.steps.map(o=>{const A=o.id===g.next_step_id;return a.jsxs("div",{className:`flex items-start gap-3 rounded-lg px-3 py-2.5 border ${A?"border-accent/30 bg-e1":"border-transparent"}`,"data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:108:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"108","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsx("span",{className:`grid place-items-center w-5 h-5 rounded-full flex-none mt-0.5 text-[10px] font-semibold ${o.done?"bg-success-fill/20 text-success":"bg-e2 text-text-subtle border border-hairline"}`,"data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:114:14","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"114","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:o.done?a.jsx(De,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:119:26","data-matrix-name":"Check","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"119","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"Check","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"}):o.n}),a.jsxs("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:122:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"122","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:[a.jsxs("p",{className:`text-xs font-medium ${o.done?"text-text-muted line-through":"text-text"}`,"data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:123:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"123","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[o.title,o.done&&o.source==="acknowledged"&&a.jsx("span",{className:"ml-1.5 text-[10px] text-text-subtle no-underline","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:128:20","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"128","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-1.5%20text-%5B10px%5D%20text-text-subtle%20no-underline%22%7D",children:"(skipped)"})]}),!o.done&&a.jsx("p",{className:"text-[11px] text-text-muted leading-relaxed mt-0.5","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:131:28","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"131","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20leading-relaxed%20mt-0.5%22%7D",children:o.hint})]}),!o.done&&a.jsxs("div",{className:"flex-none flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:135:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"135","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex-none%20flex%20items-center%20gap-2%22%7D",children:[o.skippable&&a.jsx("button",{onClick:()=>void x(o),disabled:l===o.id,className:"text-[11px] text-text-subtle hover:text-text-muted transition-colors disabled:opacity-50","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:137:20","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"137","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BBinaryExpression%5D%22%2C%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20hover%3Atext-text-muted%20transition-colors%20disabled%3Aopacity-50%22%7D",children:l===o.id?a.jsx(Ct,{className:"w-3 h-3 animate-spin","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:142:43","data-matrix-name":"Loader2","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"142","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"Loader2","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%20animate-spin%22%7D"}):o.skip_label}),a.jsxs("button",{onClick:()=>n(o),className:`inline-flex items-center gap-1 text-[11px] rounded-lg px-2.5 py-1 transition-colors ${A?"bg-accent text-white hover:opacity-90":"text-text-muted hover:text-text"}`,"data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:145:18","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"145","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[o.cta," ",a.jsx(Ke,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx:151:28","data-matrix-name":"ArrowRight","data-component-path":"src/pages/dashboard/personas/FinanceSetupChecklist.tsx","data-component-line":"151","data-component-file":"FinanceSetupChecklist.tsx","data-component-name":"ArrowRight","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"})]})]})]},o.id)})})]})}const Oa=e=>
27`₹${Math.round(Math.abs(e)).toLocaleString("en-IN")}`,Te=e=>`${e<0?"−":"+"}${Oa(e)}`;function qn(){const[e,u]=t.useState(null),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState([]),[x,o]=t.useState([]),[A,c]=t.useState([]),[m,v]=t.useState(!1),N=t.useCallback(async()=>{p(!0);try{const B=await S("/budgets/report");u(B!=null&&B.success&&B.data?B.data:null)}catch{u(null)}finally{p(!1)}},[]);t.useEffect(()=>{N()},[N]);const E=async()=>{try{const B=await S("/budgets");if(!(B!=null&&B.success)){k.error("Could not load your budget");return}n(B.data.budgetable_accounts||[]),c(B.data.months||[]),o((B.data.entries||[]).map(w=>({id:w.id,account_id:w.account_id,period_key:w.period_key,amount:Number(w.amount),code:w.code,name:w.name}))),f(!0)}catch{k.error("Could not load your budget")}},O=async()=>{const B=x.filter(w=>w.account_id&&w.period_key&&w.amount>=0);if(!B.length){k.error("Add at least one figure first.");return}v(!0);try{const w=await S("/budgets",{method:"PUT",body:JSON.stringify({entries:B.map(_=>({account_id:_.account_id,period_key:_.period_key,amount:_.amount}))})});if(!(w!=null&&w.success)){k.error((w==null?void 0:w.error)||"Could not save the budget");return}k.success(`Saved ${w.data.saved} budget ${w.data.saved===1?"figure":"figures"}`),f(!1),await N()}finally{v(!1)}},D=()=>o(B=>{var w;return[...B,{account_id:((w=s[0])==null?void 0:w.id)||"",period_key:A[0]||"",amount:0}]}),Q=async B=>{const w=x[B];w.id&&await S(`/budgets/${w.id}`,{method:"DELETE"}).catch(()=>{}),o(_=>_.filter((i,d)=>d!==B))},r=({l:B})=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-white/[0.03]","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:108:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"108","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-3%20px-3%20py-2%20rounded-lg%20hover%3Abg-white%2F%5B0.03%5D%22%7D",children:[a.jsx("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:109:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"109","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:a.jsxs("p",{className:"text-xs text-text truncate","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:110:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"110","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text%20truncate%22%7D",children:[a.jsx("span",{className:"text-text-subtle tabular-nums mr-1.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:111:10","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"111","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-text-subtle%20tabular-nums%20mr-1.5%22%7D",children:B.code}),B.name,B.unbudgeted&&a.jsx("span",{className:"ml-1.5 text-[10px] text-warning","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:112:27","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"112","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-1.5%20text-%5B10px%5D%20text-warning%22%7D",children:"no budget set"})]})}),a.jsx("span",{className:"text-xs text-text-muted tabular-nums w-24 text-right","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:115:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"115","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%20tabular-nums%20w-24%20text-right%22%7D",children:B.budget?Oa(B.budget):"—"}),a.jsx("span",{className:"text-xs text-text tabular-nums w-24 text-right","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:116:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"116","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text%20tabular-nums%20w-24%20text-right%22%7D",children:Oa(B.actual)}),a.jsx("span",{className:`text-xs tabular-nums w-24 text-right ${B.favourable?"text-success":"text-danger"}`,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:117:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"117","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:B.budget?Te(B.variance):"—"}),a.jsx("span",{className:"text-[11px] text-text-subtle tabular-nums w-14 text-right","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:120:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"120","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%20tabular-nums%20w-14%20text-right%22%7D",children:B.used_pct===null?"—":`${Math.round(B.used_pct)}%`})]}),h=()=>a.jsxs("div",{className:"flex items-center gap-3 px-3 pb-1.5 border-b border-white/[0.06]","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:127:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"127","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-3%20px-3%20pb-1.5%20border-b%20border-white%2F%5B0.06%5D%22%7D",children:[a.jsx("span",{className:"flex-1 text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:128:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"128","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22flex-1%20text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Account"}),a.jsx("span",{className:"w-24 text-right text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:129:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"129","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22w-24%20text-right%20text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Planned"}),a.jsx("span",{className:"w-24 text-right text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:130:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"130","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22w-24%20text-right%20text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Actual"}),a.jsx("span",{className:"w-24 text-right text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:131:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"131","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22w-24%20text-right%20text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Difference"}),a.jsx("span",{className:"w-14 text-right text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:132:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"132","data-component-file":"BudgetPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22w-14%20text-right%20text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Used"})]});return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-4","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:137:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"137","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
27nded-xl%20p-4%20space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:138:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"138","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:139:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"139","data-component-file":"BudgetPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-text flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:140:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"140","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-text%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(be,{className:"w-4 h-4 text-info","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:141:12","data-matrix-name":"Target","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"141","data-component-file":"BudgetPanel.tsx","data-component-name":"Target","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-info%22%7D"})," Budget vs actual"]}),a.jsxs("p",{className:"text-xs text-text-muted mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:143:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"143","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%20mt-0.5%22%7D",children:["What you planned to earn and spend, against what your books actually say",e?` — ${e.fy_label} to date.`:"."]})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:148:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"148","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsxs(j,{variant:"ghost",size:"sm",onClick:()=>void N(),"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:149:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"149","data-component-file":"BudgetPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(H,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:150:12","data-matrix-name":"RefreshCw","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"150","data-component-file":"BudgetPanel.tsx","data-component-name":"RefreshCw","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Refresh"]}),a.jsxs(j,{size:"sm",onClick:()=>void E(),"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:152:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"152","data-component-file":"BudgetPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(be,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:153:12","data-matrix-name":"Target","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"153","data-component-file":"BudgetPanel.tsx","data-component-name":"Target","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," ",e!=null&&e.no_budget?"Set a budget":"Edit budget"]})]})]}),g&&a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:158:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"158","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"Reading your books…"}),!g&&(e==null?void 0:e.no_budget)&&!l&&a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] p-4","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:161:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"161","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%20p-4%22%7D",children:[a.jsx("p",{className:"text-xs text-text font-medium","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:162:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"162","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text%20font-medium%22%7D",children:"You have not set a budget yet."}),a.jsx("p",{className:"text-[11px] text-text-muted mt-1 leading-relaxed","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:163:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"163","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20mt-1%20leading-relaxed%22%7D",children:"A budget turns your books from a record into a plan. Set what you expect to earn and spend each month, and Zapheit will tell you where you are drifting — while there is still a month left to do something about it. Your actuals are already here; this is the only number missing."})]}),!g&&e&&!e.no_budget&&!l&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:175:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"175","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-1%20sm%3Agrid-cols-3%20gap-3%22%7D",children:[a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] p-3","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:176:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"176","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%20p-3%22%7D",children:[a.jsx("p",{className:"text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:177:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"177","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Planned profit"}),a.jsx("p",{className:"text-lg font-semibold text-text tabular-nums mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:178:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"178","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-lg%20font-semibold%20text-text%20tabular-nums%20mt-0.5%22%7D",children:Oa(e.planned_profit)})]}),a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] p-3","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:180:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"180","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%20p-3%22%7D",children:[a.jsx("p",{className:"text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:181:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"181","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Actual profit"}),a.jsx("p",{className:"text-lg font-semibold text-text tabular-nums mt-0.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:182:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"182","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-lg%20font-semibold%20text-text%20tabular-nums%20mt-0.5%22%7D",children:Oa(e.actual_profit)})]}),a.jsxs("div",{className:`rounded-lg border p-3 ${e.profit_favourable?"border-success-fill/25 bg-success-fill/[0.06]":"border-danger-fill/25 bg-danger-fill/[0.06]"}`,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:184:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"184","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[a.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-text-subtle flex items-center gap-1","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:185:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"185","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%20flex%20items-center%20gap-1%22%7D",children:[e.profit_favourable?a.jsx(Xa,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:186:44","data-matrix-name":"TrendingUp","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"186","data-component-file":"BudgetPanel.tsx","data-component-name":"TrendingUp","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"}):a.jsx(Ye,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:186:81","data-matrix-name":"TrendingDown","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"186","data-component-file":"BudgetPanel.tsx","data-component-name":"TrendingDown","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"}),e.profit_favourable?"Ahead of plan":"Behind plan"]}),a.jsx("p",{className:`text-lg font-semibold tabular-nums mt-0.5 ${e.profit_favourable?"text-success":"text-danger"}`,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:189:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"189","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:Te(e.profit_variance)})]})]}),e.income.lines.length>0&&a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:196:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"196","data-component-file":"BudgetPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[11px] font-semibold text-text-muted uppercase tracking-wide mb-1.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:197:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"197","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20font-semibold%20text-text-muted%20uppercase%20tracking-wide%20mb-1.5%22%7D",children:"Money coming in"}),a.jsx(h,{"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:198:14","data-matrix-name":"Header","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"198","data-component-file":"BudgetPanel.tsx","data-component-name":"Header"}),e.income.lines.map(B=>a.jsx(r,{l:B,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:199:44","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"199","data-component-file":"BudgetPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22l%22%3A%22%5BIdentifier%5D%22%7D"},B.account_id))]}),e.expense.lines.length>0&&a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:204:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"204","data-component-file":"BudgetPanel.tsx","data-component-name":"div",children:[a.jsx("p",{className:"text-[11px] font-semibold text-text-muted uppercase tracking-wide mb-1.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:205:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"205","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20font-semibold%20text-text-muted%20uppercase%20tracking-wide%20mb-1.5%22%7D",children:"Money going out"}),a.jsx(h,{"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:206:14","data-matrix-name":"Header","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"206","data-component-file":"BudgetPanel.tsx","data-component-name":"Header"}),e.expense.lines.map(B=>a.jsx(r,{l:B,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:207:45","data-matrix-name":"Row","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"207","data-component-file":"BudgetPanel.tsx","data-component-name":"Row","data-component-content":"%7B%22l%22%3A%22%5BIdentifier%5D%22%7D"},B.account_id))]}),e.unbudgeted_count>0&&a.jsxs("p",{className:"text-[11px] text-warning/90","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:212:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"212","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-warning%2F90%22%7D",children:[e.unbudgeted_count," account",e.unbudgeted_count===1?" has":"s have"," activity with no budget set. Those are the ones nobody is watching."]})]}),l&&a.jsxs("div",{className:"space-y-2","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:221:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"221","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-2%22%7D",children:[a.jsx("p",{className:"text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:222:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/BudgetPanel.
27tsx","data-component-line":"222","data-component-file":"BudgetPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%22%7D",children:"One figure per account per month. Re-saving a month replaces its figure rather than adding to it."}),x.map((B,w)=>a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:226:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"226","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsxs("select",{value:B.account_id,onChange:_=>o(i=>i.map((d,P)=>P===w?{...d,account_id:_.target.value}:d)),className:"input-field text-xs flex-1","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:227:14","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"227","data-component-file":"BudgetPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22input-field%20text-xs%20flex-1%22%7D",children:[a.jsx("option",{value:"","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:232:16","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"232","data-component-file":"BudgetPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%22%7D",children:"Choose an account…"}),s.map(_=>a.jsxs("option",{value:_.id,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:233:35","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"233","data-component-file":"BudgetPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:[_.code," ",_.name]},_.id))]}),a.jsx("select",{value:B.period_key,onChange:_=>o(i=>i.map((d,P)=>P===w?{...d,period_key:_.target.value}:d)),className:"input-field text-xs w-32","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:235:14","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"235","data-component-file":"BudgetPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22input-field%20text-xs%20w-32%22%7D",children:A.map(_=>a.jsx("option",{value:_,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:240:33","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"240","data-component-file":"BudgetPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%7D",children:_},_))}),a.jsx("input",{type:"number",min:0,step:"0.01",value:B.amount,onChange:_=>o(i=>i.map((d,P)=>P===w?{...d,amount:Number(_.target.value)}:d)),className:"input-field text-xs w-32 tabular-nums",placeholder:"0.00","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:242:14","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"242","data-component-file":"BudgetPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22number%22%2C%22min%22%3A0%2C%22step%22%3A%220.01%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22input-field%20text-xs%20w-32%20tabular-nums%22%2C%22placeholder%22%3A%220.00%22%7D"}),a.jsx("button",{onClick:()=>void Q(w),className:"text-text-subtle hover:text-danger p-1","aria-label":"Delete",title:"Delete","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:247:14","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"247","data-component-file":"BudgetPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22text-text-subtle%20hover%3Atext-danger%20p-1%22%2C%22title%22%3A%22Delete%22%7D",children:a.jsx(la,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:248:16","data-matrix-name":"Trash2","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"248","data-component-file":"BudgetPanel.tsx","data-component-name":"Trash2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})})]},w)),a.jsxs("div",{className:"flex items-center gap-2 pt-1","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:252:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"252","data-component-file":"BudgetPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20pt-1%22%7D",children:[a.jsxs(j,{variant:"ghost",size:"sm",onClick:D,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:253:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"253","data-component-file":"BudgetPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx(X,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:253:63","data-matrix-name":"Plus","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"253","data-component-file":"BudgetPanel.tsx","data-component-name":"Plus","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Add a line"]}),a.jsxs(j,{size:"sm",onClick:()=>void O(),disabled:m,"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:254:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"254","data-component-file":"BudgetPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BIdentifier%5D%22%7D",children:[a.jsx(Ta,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:255:14","data-matrix-name":"Save","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"255","data-component-file":"BudgetPanel.tsx","data-component-name":"Save","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," ",m?"Saving…":"Save budget"]}),a.jsx(j,{variant:"ghost",size:"sm",onClick:()=>{f(!1),N()},"data-matrix-id":"src/pages/dashboard/personas/BudgetPanel.tsx:257:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/BudgetPanel.tsx","data-component-line":"257","data-component-file":"BudgetPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:"Cancel"})]})]})]})}const Un=e=>
27`₹${Math.round(Math.abs(e)).toLocaleString("en-IN")}`,Wn={good:"text-success",watch:"text-warning",bad:"text-danger"};function Jn(){const[e,u]=t.useState(null),[g,p]=t.useState(!0),l=t.useCallback(async()=>{p(!0);try{const f=await S("/budgets/ratios");u(f!=null&&f.success&&f.data?f.data:null)}catch{u(null)}finally{p(!1)}},[]);return t.useEffect(()=>{l()},[l]),a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-4","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:61:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"61","data-component-file":"RatiosPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:62:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"62","data-component-file":"RatiosPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:63:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"63","data-component-file":"RatiosPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-text flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:64:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"64","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-text%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(yt,{className:"w-4 h-4 text-info","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:65:12","data-matrix-name":"Gauge","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"65","data-component-file":"RatiosPanel.tsx","data-component-name":"Gauge","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-info%22%7D"})," How the business is doing"]}),a.jsxs("p",{className:"text-xs text-text-muted mt-0.5","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:67:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"67","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%20mt-0.5%22%7D",children:["The figures a bank or an investor asks for, worked out from your own books",e?` — ${e.fy_label} to date.`:"."]})]}),a.jsxs(j,{variant:"ghost",size:"sm",onClick:()=>void l(),"data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:72:8","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"72","data-component-file":"RatiosPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(H,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:73:10","data-matrix-name":"RefreshCw","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"73","data-component-file":"RatiosPanel.tsx","data-component-name":"RefreshCw","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Refresh"]})]}),g&&a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:77:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"77","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"Reading your books…"}),!g&&!e&&a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:80:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"80","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"These need a ledger with some activity in it. Once you have posted invoices, bills or expenses, the figures appear here on their own."}),!g&&e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:88:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"88","data-component-file":"RatiosPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22grid%20grid-cols-2%20sm%3Agrid-cols-4%20gap-3%22%7D",children:[{k:"Cash",v:e.cash},{k:"Owed to you",v:e.receivables},{k:"You owe",v:e.payables},{k:"Working capital",v:e.working_capital}].map(f=>a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] p-3","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:95:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"95","data-component-file":"RatiosPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%20p-3%22%7D",children:[a.jsx("p",{className:"text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:96:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"96","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:f.k}),a.jsxs("p",{className:`text-base font-semibold tabular-nums mt-0.5 ${f.v<0?"text-danger":"text-text"}`,"data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:97:16","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"97","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:[f.v<0?"−":"",Un(f.v)]})]},f.k))}),a.jsx("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:104:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"104","data-component-file":"RatiosPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:e.readings.map(f=>a.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5 rounded-lg hover:bg-white/[0.03]","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:106:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"106","data-component-file":"RatiosPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20gap-3%20px-3%20py-2.5%20rounded-lg%20hover%3Abg-white%2F%5B0.03%5D%22%7D",children:[a.jsxs("div",{className:"min-w-0 flex-1","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:107:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"107","data-component-file":"RatiosPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22min-w-0%20flex-1%22%7D",children:[a.jsx("p",{className:"text-xs font-medium text-text","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:108:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"108","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-medium%20text-text%22%7D",children:f.label}),a.jsx("p",{className:"text-[11px] text-text-muted leading-relaxed mt-0.5","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:109:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"109","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-muted%20leading-relaxed%20mt-0.5%22%7D",children:f.plain})]}),a.jsx("span",{className:`text-sm font-semibold tabular-nums flex-none ${f.verdict?Wn[f.verdict]:"text-text"}`,"data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:111:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"111","data-component-file":"RatiosPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22%5BTemplateLiteral%5D%22%7D",children:f.display})]},f.id))}),a.jsxs("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/RatiosPanel.tsx:118:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/RatiosPanel.tsx","data-component-line":"118","data-component-file":"RatiosPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:["Worked out over ",e.window_days," days. A dash means the figure cannot be worked out yet — the line above it says what is missing."]})]})]})}const $e=e=>
27`₹${Math.round(e).toLocaleString("en-IN")}`,Me={viewer:"Viewer",manager:"Manager",admin:"Admin",super_admin:"Owner"};function Yn(){const[e,u]=t.useState(null),[g,p]=t.useState(!0),[l,f]=t.useState(!1),[s,n]=t.useState({scope:"role",target:"manager",amount:"",unlimited:!1}),x=t.useCallback(async()=>{p(!0);try{const m=await S("/approval-limits");u(m!=null&&m.success&&m.data?m.data:null)}catch{u(null)}finally{p(!1)}},[]);t.useEffect(()=>{x()},[x]);const o=async()=>{const m={scope:s.scope,max_amount:s.unlimited?null:Number(s.amount||0)};s.scope==="role"?m.role=s.target:m.user_id=s.target;const v=await S("/approval-limits",{method:"PUT",body:JSON.stringify(m)});if(!(v!=null&&v.success)){k.error((v==null?void 0:v.error)||"Could not save that limit");return}k.success("Limit saved"),f(!1),n({scope:"role",target:"manager",amount:"",unlimited:!1}),await x()},A=async m=>{const v=await S(`/approval-limits/${m}`,{method:"DELETE"});if(!(v!=null&&v.success)){k.error((v==null?void 0:v.error)||"Could not remove that limit");return}await x()},c=m=>{if(m.scope==="role")return Me[m.role||""]||m.role;const v=e==null?void 0:e.people.find(N=>N.id===m.user_id);return v?v.name||v.email:"A team member"};return a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-4","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:82:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"82","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rounded-xl%20p-4%20space-y-4%22%7D",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:83:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"83","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-start%20justify-between%20gap-3%20flex-wrap%22%7D",children:[a.jsxs("div",{"data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:84:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"84","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div",children:[a.jsxs("p",{className:"text-sm font-semibold text-text flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:85:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"85","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-sm%20font-semibold%20text-text%20flex%20items-center%20gap-2%22%7D",children:[a.jsx(Ze,{className:"w-4 h-4 text-info","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:86:12","data-matrix-name":"ShieldCheck","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"86","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"ShieldCheck","data-component-content":"%7B%22className%22%3A%22w-4%20h-4%20text-info%22%7D"})," Who can approve how much"]}),a.jsx("p",{className:"text-xs text-text-muted mt-0.5","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:88:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"88","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%20mt-0.5%22%7D",children:"A role decides who may approve. A limit decides how much they are trusted with. Someone named here overrides their role, up or down."})]}),a.jsxs("div",{className:"flex items-center gap-2","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:93:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"93","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%22%7D",children:[a.jsxs(j,{variant:"ghost",size:"sm",onClick:()=>void x(),"data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:94:10","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"94","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22variant%22%3A%22ghost%22%2C%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(H,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:95:12","data-matrix-name":"RefreshCw","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"95","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"RefreshCw","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Refresh"]}),(e==null?void 0:e.can_edit)&&a.jsxs(j,{size:"sm",onClick:()=>f(m=>!m),"data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:98:12","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"98","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(X,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:99:14","data-matrix-name":"Plus","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"99","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"Plus","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Set a limit"]})]})]}),g&&a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:105:18","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"105","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"Loading…"}),!g&&e&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.02] p-3","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:111:10","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"111","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-white%2F%5B0.06%5D%20bg-white%2F%5B0.02%5D%20p-3%22%7D",children:[a.jsx("p",{className:"text-[10px] uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:112:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"112","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"You can approve up to"}),a.jsxs("p",{className:"text-base font-semibold text-text mt-0.5","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:113:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"113","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-base%20font-semibold%20text-text%20mt-0.5%22%7D",children:[e.my_limit===null?e.my_limit_source==="none"?"Any amount — no limit has been set":"Any amount":$e(e.my_limit),e.my_limit_source==="user"&&a.jsx("span",{className:"ml-2 text-[11px] font-normal text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:118:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"118","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-2%20text-%5B11px%5D%20font-normal%20text-text-muted%22%7D",children:"set for you personally"}),e.my_limit_source==="role"&&a.jsx("span",{className:"ml-2 text-[11px] font-normal text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:121:16","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"121","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22ml-2%20text-%5B11px%5D%20font-normal%20text-text-muted%22%7D",children:"from your role"})]})]}),l&&e.can_edit&&a.jsxs("div",{className:"rounded-lg border border-accent/25 bg-accent-tint/[0.25] p-3 space-y-2","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:127:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"127","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22rounded-lg%20border%20border-accent%2F25%20bg-accent-tint%2F%5B0.25%5D%20p-3%20space-y-2%22%7D",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:128:14","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"128","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20flex-wrap%22%7D",children:[a.jsxs("select",{value:s.scope,onCh
27ange:m=>n(v=>{var N;return{...v,scope:m.target.value,target:m.target.value==="role"?"manager":((N=e.people[0])==null?void 0:N.id)||""}}),className:"input-field text-xs w-36","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:129:16","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"129","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22input-field%20text-xs%20w-36%22%7D",children:[a.jsx("option",{value:"role","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:137:18","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"137","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22role%22%7D",children:"Everyone with a role"}),a.jsx("option",{value:"user","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:138:18","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"138","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22user%22%7D",children:"One person"})]}),a.jsx("select",{value:s.target,onChange:m=>n(v=>({...v,target:m.target.value})),className:"input-field text-xs flex-1 min-w-[10rem]","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:140:16","data-matrix-name":"select","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"140","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"select","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22input-field%20text-xs%20flex-1%20min-w-%5B10rem%5D%22%7D",children:s.scope==="role"?e.roles.map(m=>a.jsx("option",{value:m,"data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:146:42","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"146","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BIdentifier%5D%22%7D",children:Me[m]||m},m)):e.people.map(m=>a.jsx("option",{value:m.id,"data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:147:43","data-matrix-name":"option","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"147","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"option","data-component-content":"%7B%22value%22%3A%22%5BMemberExpression%5D%22%7D",children:m.name||m.email},m.id))}),a.jsx("input",{type:"number",min:0,step:"1",disabled:s.unlimited,value:s.amount,onChange:m=>n(v=>({...v,amount:m.target.value})),placeholder:"Maximum ₹",className:"input-field text-xs w-40 tabular-nums disabled:opacity-40","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:149:16","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"149","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22number%22%2C%22min%22%3A0%2C%22step%22%3A%221%22%2C%22disabled%22%3A%22%5BMemberExpression%5D%22%2C%22value%22%3A%22%5BMemberExpression%5D%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22placeholder%22%3A%22Maximum%20%E2%82%B9%22%2C%22className%22%3A%22input-field%20text-xs%20w-40%20tabular-nums%20disabled%3Aopacity-40%22%7D"}),a.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:155:16","data-matrix-name":"label","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"155","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"label","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-1.5%20text-%5B11px%5D%20text-text-muted%22%7D",children:[a.jsx("input",{type:"checkbox",checked:s.unlimited,className:"accent-accent",onChange:m=>n(v=>({...v,unlimited:m.target.checked})),"data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:156:18","data-matrix-name":"input","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"156","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"input","data-component-content":"%7B%22type%22%3A%22checkbox%22%2C%22checked%22%3A%22%5BMemberExpression%5D%22%2C%22className%22%3A%22accent-accent%22%2C%22onChange%22%3A%22%5BArrowFunctionExpression%5D%22%7D"}),"No limit"]}),a.jsxs(j,{size:"sm",onClick:()=>void o(),"data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:160:16","data-matrix-name":"Button","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"160","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"Button","data-component-content":"%7B%22size%22%3A%22sm%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D",children:[a.jsx(Ta,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:160:62","data-matrix-name":"Save","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"160","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"Save","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})," Save"]})]}),a.jsx("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:162:14","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"162","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:"“No limit” records a deliberate decision. Setting ₹0 means that person approves nothing."})]}),e.limits.length===0?a.jsx("p",{className:"text-xs text-text-muted","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:169:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"169","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%22%7D",children:"No limits set, so anyone who can a
27pprove can approve any amount. That is fine for a small team — set one the moment more than one person signs things off."}):a.jsx("div",{className:"space-y-1","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:174:12","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"174","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-1%22%7D",children:e.limits.map(m=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-white/[0.03]","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:176:16","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"176","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-3%20px-3%20py-2%20rounded-lg%20hover%3Abg-white%2F%5B0.03%5D%22%7D",children:[a.jsx("span",{className:"text-[10px] uppercase tracking-wider text-text-subtle w-16 flex-none","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:177:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"177","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B10px%5D%20uppercase%20tracking-wider%20text-text-subtle%20w-16%20flex-none%22%7D",children:m.scope==="role"?"Role":"Person"}),a.jsx("span",{className:"text-xs text-text flex-1 truncate","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:180:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"180","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text%20flex-1%20truncate%22%7D",children:c(m)}),a.jsx("span",{className:"text-xs font-semibold text-text tabular-nums","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:181:18","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"181","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-text%20tabular-nums%22%7D",children:m.max_amount===null?"No limit":$e(m.max_amount)}),e.can_edit&&a.jsx("button",{onClick:()=>void A(m.id),className:"text-text-subtle hover:text-danger p-1","aria-label":"Delete",title:"Delete","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:185:20","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"185","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22className%22%3A%22text-text-subtle%20hover%3Atext-danger%20p-1%22%2C%22title%22%3A%22Delete%22%7D",children:a.jsx(la,{className:"w-3.5 h-3.5","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:186:22","data-matrix-name":"Trash2","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"186","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"Trash2","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%22%7D"})})]},m.id))}),!e.can_edit&&a.jsx("p",{className:"text-[11px] text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx:195:12","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/ApprovalLimitsPanel.tsx","data-component-line":"195","data-component-file":"ApprovalLimitsPanel.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-text-subtle%22%7D",children:"Only an admin can change these — otherwise anyone could raise the
27ir own ceiling."})]})]})}const Vn=Math.floor(new Date(new Date().getFullYear(),new Date().getMonth(),1).getTime()/1e3),Xn=[{connectorId:"quickbooks",appName:"QuickBooks",icon:a.jsx(Ft,{className:"w-3.5 h-3.5 text-success","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:51:10","data-matrix-name":"DollarIcon","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"51","data-component-file":"FinancePersonaPage.tsx","data-component-name":"DollarIcon","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-success%22%7D"}),workspacePath:"/dashboard/apps/quickbooks/workspace",brandBg:"bg-green-500/20",metrics:[{label:"Unpaid Invoices",action:"list_invoices",params:{limit:100},transform:e=>Array.isArray(e)?e.filter(u=>Number(u.Balance)>0).length:"—"},{label:"Revenue Total",action:"list_invoices",params:{limit:100},transform:e=>{if(!Array.isArray(e))return"—";const u=e.reduce((g,p)=>g+Number(p.TotalAmt||0),0);return u>=1e7?`₹${(u/1e7).toFixed(1)}Cr`:u>=1e5?`₹${(u/1e5).toFixed(1)}L`:`₹${u.toLocaleString("en-IN")}`}}]},{connectorId:"razorpay",appName:"Razorpay",icon:a.jsx(fe,{className:"w-3.5 h-3.5 text-accent-bright","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:78:10","data-matrix-name":"CreditCard","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"78","data-component-file":"FinancePersonaPage.tsx","data-component-name":"CreditCard","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-bright%22%7D"}),workspacePath:"/dashboard/apps/razorpay/workspace",brandBg:"bg-accent/20",metrics:[{label:"Payments This Month",action:"list_payments",params:{from:Vn,count:100},transform:e=>{const g=(Array.isArray(e==null?void 0:e.payments)?e.payments:[]).reduce((p,l)=>p+Number(l.amount||0),0)/100;return g>=1e7?`₹${(g/1e7).toFixed(1)}Cr`:g>=1e5?`₹${(g/1e5).toFixed(1)}L`:`₹${g.toLocaleString("en-IN")}`}}]},{connectorId:"tally",appName:"Tally",icon:a.jsx(Ae,{className:"w-3.5 h-3.5 text-orange-400","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:99:10","data-matrix-name":"BookOpen","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"99","data-component-file":"FinancePersonaPage.tsx","data-component-name":"BookOpen","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-orange-400%22%7D"}),workspacePath:"/dashboard/apps/tally/workspace",brandBg:"bg-orange-500/20",metrics:[{label:"Ledger Accounts",action:"list_ledgers",params:{limit:200},transform:e=>{const u=(e==null?void 0:e.ledgers)??e;return Array.isArray(u)?u.length:"—"}}]},{connectorId:"dynamics365",appName:"Dynamics 365",icon:a.jsx(Qa,{className:"w-3.5 h-3.5 text-accent-faint","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:117:10","data-matrix-name":"FileText","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"117","data-component-file":"FinancePersonaPage.tsx","data-component-name":"FileText","data-component-content":"%7B%22className%22%3A%22w-3.5%20h-3.5%20text-accent-faint%22%7D"}),workspacePath:"/dashboard/apps/dynamics365/workspace",brandBg:"bg-accent/20",metrics:[{label:"GL Accounts",action:"list_accounts",params:{limit:200},transform:e=>Array.isArray(e)?e.length:"—"},{label:"Vendors",action:"list_vendors",params:{limit:200},transform:e=>Array.isArray(e)?e.length:"—"}]}];function Zn({invoiceId:e,vendorName:u,amount:g}){const[p,l]=t.useState(null),[f,s]=t.useState(null);async function n(x){l(x),s(null);try{const o=await S(`/hubs/finance/invoices/${e}/${x}`,{method:"POST"});o.success?s(x==="remind"?"Reminder sent":x==="dispute"?"Flagged as dispute":"Queued for approval"):s(`Error: ${o.error??"Failed"}`)}catch{s("Request failed")}finally{l(null)}}return a.jsxs("div",{className:"flex items-center gap-2 flex-wrap","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:158:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"158","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22flex%20items-center%20gap-2%20flex-wrap%22%7D",children:[a.jsx("span",{className:"text-xs text-text-muted truncate max-w-[120px]","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:159:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"159","data-component-file":"FinancePersonaPage.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20text-text-muted%20truncate%20max-w-%5B120px%5D%22%7D",children:u}),a.jsxs("span",{className:"text-xs font-semibold text-text tabular-nums","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:160:6","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"160","data-component-file":"FinancePersonaPage.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-text%20tabular-nums%22%7D",children:["₹",g.toLocaleStr
27ing("en-IN")]}),f?a.jsx("span",{className:"text-[11px] text-success","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:162:8","data-matrix-name":"span","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"162","data-component-file":"FinancePersonaPage.tsx","data-component-name":"span","data-component-content":"%7B%22className%22%3A%22text-%5B11px%5D%20text-success%22%7D",children:f}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>n("remind"),disabled:!!p,className:"flex items-center gap-1 text-[11px] text-accent-bright hover:text-accent-faint disabled:opacity-50 transition-colors","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:165:10","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"165","data-component-file":"FinancePersonaPage.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BUnaryExpression%5D%22%2C%22className%22%3A%22flex%20items-center%20gap-1%20text-%5B11px%5D%20text-accent-bright%20hover%3Atext-accent-faint%20disabled%3Aopacity-50%20transition-colors%22%7D",children:[a.jsx(kt,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:166:12","data-matrix-name":"Bell","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"166","data-component-file":"FinancePersonaPage.tsx","data-component-name":"Bell","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"}),p==="remind"?"…":"Remind"]}),a.jsxs("button",{onClick:()=>n("dispute"),disabled:!!p,className:"flex items-center gap-1 text-[11px] text-yellow-400 hover:text-yellow-300 disabled:opacity-50 transition-colors","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:168:10","data-matrix-name":"button","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"168","data-component-file":"FinancePersonaPage.tsx","data-component-name":"button","data-component-content":"%7B%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%2C%22disabled%22%3A%22%5BUnaryExpression%5D%22%2C%22className%22%3A%22flex%20items-center%20gap-1%20text-%5B11px%5D%20text-yellow-400%20hover%3Atext-yellow-300%20disabled%3Aopacity-50%20transition-colors%22%7D",children:[a.jsx(Ve,{className:"w-3 h-3","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:169:12","data-matrix-name":"AlertCircle","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"169","data-component-file":"FinancePersonaPage.tsx","data-component-name":"AlertCircle","data-component-content":"%7B%22className%22%3A%22w-3%20h-3%22%7D"}),p==="dispute"?"…":"Dispute"]})]})]})}function Kn(){const e=ee(),[u,g]=t.useState([]);return t.useEffect(()=>{let p=!1;return S("/hubs/finance/invoices?status=pending&limit=10").then(l=>{!p&&l.success&&Array.isArray(l.data)&&g(l.data)}).catch(()=>{}),()=>{p=!0}},[]),a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:193:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"193","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsx(Hn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:200:6","data-matrix-name":"FinanceSetupChecklist","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"200","data-component-file":"FinancePersonaPage.tsx","data-component-name":"FinanceSetupChecklist"}),u.length>0&&a.jsxs("div",{className:"bg-surface/60 border border-white/[0.06] rounded-xl p-4 space-y-3","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:205:8","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"205","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22bg-surface%2F60%20border%20border-white%2F%5B0.06%5D%20rou
27nded-xl%20p-4%20space-y-3%22%7D",children:[a.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-text-subtle","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:206:10","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"206","data-component-file":"FinancePersonaPage.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-medium%20uppercase%20tracking-wider%20text-text-subtle%22%7D",children:"Supplier bills awaiting you"}),u.map(p=>a.jsx(Zn,{invoiceId:p.id,vendorName:p.vendor_name,amount:p.amount,"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:208:12","data-matrix-name":"InvoiceActions","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"208","data-component-file":"FinancePersonaPage.tsx","data-component-name":"InvoiceActions","data-component-content":"%7B%22invoiceId%22%3A%22%5BMemberExpression%5D%22%2C%22vendorName%22%3A%22%5BMemberExpression%5D%22%2C%22amount%22%3A%22%5BMemberExpression%5D%22%7D"},p.id))]}),a.jsx("div",{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:216:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"216","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div",children:a.jsx(it,{configs:Xn,emptyContent:a.jsx(ze,{type:"no-data",title:"Your books are kept here",description:"Zapheit keeps your own books — invoices, bills, expenses and accounts — so you do not need another accounting system. If you already use QuickBooks, Zoho Books or Tally, you can connect it to bring past data across.",action:{label:"Connect an existing tool",onClick:()=>e("/dashboard/getting-started")},secondaryAction:{label:"Browse all Finance apps",onClick:()=>e("/dashboard/apps")},"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:220:12","data-matrix-name":"EmptyState","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"220","data-component-file":"FinancePersonaPage.tsx","data-component-name":"EmptyState","data-component-content":"%7B%22type%22%3A%22no-data%22%2C%22title%22%3A%22Your%20books%20are%20kept%20here%22%2C%22description%22%3A%22Zapheit%20keeps%20your%20own%20books%20%E2%80%94%20invoices%2C%20bills%2C%20expenses%20and%20accounts%20%E2%80%94%20so%20you%20do%20not%20need%20another%20accounting%20system.%20If%20you%20already%20use%20QuickBooks%2C%20Zoho%20Books%20or%20Tally%2C%20you%20can%20connect%20it%20to%20bring%20past%20data%20across.%22%2C%22action%22%3A%7B%22label%22%3A%22Connect%20an%20existing%20tool%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D%2C%22secondaryAction%22%3A%7B%22label%22%3A%22Browse%20all%20Finance%20apps%22%2C%22onClick%22%3A%22%5BArrowFunctionExpression%5D%22%7D%7D"}),"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:217:8","data-matrix-name":"HubLiveMetrics","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"217","data-component-file":"FinancePersonaPage.tsx","data-component-name":"HubLiveMetrics","data-component-content":"%7B%22configs%22%3A%22%5BIdentifier%5D%22%2C%22emptyContent%22%3A%22%5BJSXElement%5D%22%7D"})})]})}function as(){return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:240:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"240","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsx("div",{id:"finance-ar-invoices","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:241:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"241","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-ar-invoices%22%7D",children:a.jsx(Vt,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:241:36","data-matrix-name":"ArInvoicesPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"241","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ArInvoicesPanel"})}),a.jsx("div",{id:"finance-credit-notes","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:242:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"242","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-credit-notes%22%7D",children:a.jsx(dn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:242:37","data-matrix-name":"CreditNotesPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"242","data-component-file":"FinancePersonaPage.tsx","data-component-name":"CreditNotesPanel"})}),a.jsx("div",{id:"finance-receivables","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:243:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"243","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-receivables%22%7D",children:a.jsx(Qt,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:243:36","data-matrix-name":"ReceivablesQueue","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"243","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ReceivablesQueue"})}),a.jsx("div",{id:"finance-customers","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:246:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"246","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-customers%22%7D",children:a.jsx(Ht,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:246:34","data-matrix-name":"CustomersPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"246","data-component-file":"FinancePersonaPage.tsx","data-component-name":"CustomersPanel"})}),a.jsx("div",{id:"finance-items","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:247:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"247","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-items%22%7D",children:a.jsx(en,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:247:30","data-matrix-name":"ItemsPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"247","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ItemsPanel"})}),a.jsx("div",{id:"finance-payment-details","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:248:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"248","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-payment-details%22%7D",children:a.jsx(tn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:248:40","data-matrix-name":"PaymentDetailsPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"248","data-component-file":"FinancePersonaPage.tsx","data-component-name":"PaymentDetailsPanel"})})]})}function es(){return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:255:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"255","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsx("div",{id:"finance-purchase-orders","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:257:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"257","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-purchase-orders%22%7D",children:a.jsx(Dn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:257:40","data-matrix-name":"PurchaseOrdersPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"257","data-component-file":"FinancePersonaPage.tsx","data-component-name":"PurchaseOrdersPanel"})}),a.jsx("div",{id:"finance-payment-runs","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:259:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"259","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-payment-runs%22%7D",children:a.jsx(Nn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:259:37","data-matrix-name":"PaymentRunsPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"259","data-component-file":"FinancePersonaPage.tsx","data-component-name":"PaymentRunsPanel"})}),a.jsx("div",{id:"finance-invoices","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:260:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"260","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-invoices%22%7D",children:a.jsx(Mt,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:260:33","data-matrix-name":"InvoicesQueue","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"260","data-component-file":"FinancePersonaPage.tsx","data-component-name":"InvoicesQueue"})})]})}function ts(){return a.jsx("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:267:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"267","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:a.jsx("div",{id:"finance-expenses","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:268:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"268","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-expenses%22%7D",children:a.jsx(Ot,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:268:33","data-matrix-name":"ExpensesQueue","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"268","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ExpensesQueue"})})})}function ns(){return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:275:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"275","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsx("div",{id:"finance-proposed","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:277:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"277","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-proposed%22%7D",children:a.jsx(Gn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:277:33","data-matrix-name":"ProposedEntriesPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"277","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ProposedEntriesPanel"})}),a.jsx("div",{id:"finance-bank-recon","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:280:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"280","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-bank-recon%22%7D",children:a.jsx(yn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:280:35","data-matrix-name":"BankReconciliationPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"280","data-component-file":"FinancePersonaPage.tsx","data-component-name":"BankReconciliationPanel"})}),a.jsx("div",{id:"finance-stock","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:283:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"283","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-stock%22%7D",children:a.jsx(Bn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:283:30","data-matrix-name":"StockPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"283","data-component-file":"FinancePersonaPage.tsx","data-component-name":"StockPanel"})}),a.jsx("div",{id:"finance-assets","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:284:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"284","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-assets%22%7D",children:a.jsx(jn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:284:31","data-matrix-name":"FixedAssetsPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"284","data-component-file":"FinancePersonaPage.tsx","data-component-name":"FixedAssetsPanel"})}),a.jsx("div",{id:"finance-opening-balances","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:285:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"285","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-opening-balances%22%7D",children:a.jsx(On,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:285:4
271","data-matrix-name":"OpeningBalancesPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"285","data-component-file":"FinancePersonaPage.tsx","data-component-name":"OpeningBalancesPanel"})}),a.jsx("div",{id:"finance-opening-import","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:289:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"289","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-opening-import%22%7D",children:a.jsx(Tn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:289:39","data-matrix-name":"OpeningBalancesImport","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"289","data-component-file":"FinancePersonaPage.tsx","data-component-name":"OpeningBalancesImport"})}),a.jsx("div",{id:"finance-approval-limits","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:292:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"292","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-approval-limits%22%7D",children:a.jsx(Yn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:292:40","data-matrix-name":"ApprovalLimitsPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"292","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ApprovalLimitsPanel"})}),a.jsx(rn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:293:6","data-matrix-name":"LedgerPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"293","data-component-file":"FinancePersonaPage.tsx","data-component-name":"LedgerPanel"})]})}function ss(){return a.jsxs("div",{className:"space-y-4","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:302:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"302","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-4%22%7D",children:[a.jsx("div",{id:"finance-budget","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:303:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"303","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-budget%22%7D",children:a.jsx(qn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:303:31","data-matrix-name":"BudgetPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"303","data-component-file":"FinancePersonaPage.tsx","data-component-name":"BudgetPanel"})}),a.jsx("div",{id:"finance-ratios","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:306:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"306","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-ratios%22%7D",children:a.jsx(Jn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:306:31","data-matrix-name":"RatiosPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"306","data-component-file":"FinancePersonaPage.tsx","data-component-name":"RatiosPanel"})}),a.jsx("div",{id:"finance-cashflow","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:309:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"309","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-cashflow%22%7D",children:a.jsx(Rt,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:309:33","data-matrix-name":"CashflowForecast","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"309","data-component-file":"FinancePersonaPage.tsx","data-component-name":"CashflowForecast"})})]})}function os(){return a.jsxs("div",{className:"space-y-5","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:316:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"316","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-5%22%7D",children:[a.jsx("div",{id:"finance-books-health","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:321:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"321","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-books-health%22%7D",children:a.jsx(En,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:321:37","data-matrix-name":"BooksHealthPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"321","data-component-file":"FinancePersonaPage.tsx","data-component-name":"BooksHealthPanel"})}),a.jsx("div",{id:"finance-tax","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:322:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"322","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-tax%22%7D",children:a.jsx(bn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:322:28","data-matrix-name":"TaxPositionPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"322","data-component-file":"FinancePersonaPage.tsx","data-component-name":"TaxPositionPanel"})}),a.jsx("div",{id:"finance-gst","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:324:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"324","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-gst%22%7D",children:a.jsx(Pn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:324:28","data-matrix-name":"GstReturnsPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"324","data-component-file":"FinancePersonaPage.tsx","data-component-name":"GstReturnsPanel"})}),a.jsx("div",{id:"finance-einvoice","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:327:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"327","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-einvoice%22%7D",children:a.jsx(Cn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:327:33","data-matrix-name":"EinvoicePanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"327","data-component-file":"FinancePersonaPage.tsx","data-component-name":"EinvoicePanel"})}),a.jsx("div",{id:"finance-statements","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:328:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"328","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-statements%22%7D",children:a.jsx(fn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:328:35","data-matrix-name":"Schedule3Panel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"328","data-component-file":"FinancePersonaPage.tsx","data-component-name":"Schedule3Panel"})}),a.jsx("div",{id:"finance-cash-flow","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:329:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"329","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-cash-flow%22%7D",children:a.jsx(In,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:329:34","data-matrix-name":"CashFlowPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"329","data-component-file":"FinancePersonaPage.tsx","data-component-name":"CashFlowPanel"})}),a.jsx("div",{id:"finance-aging","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:330:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"330","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-aging%22%7D",children:a.jsx(Zt,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:330:30","data-matrix-name":"AgingReport","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"330","data-component-file":"FinancePersonaPage.tsx","data-component-name":"AgingReport"})}),a.jsxs("div",{id:"finance-close","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:331:6","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"331","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22id%22%3A%22finance-close%22%7D",children:[a.jsx("p",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide mb-3","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:332:8","data-matrix-name":"p","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"332","data-component-file":"FinancePersonaPage.tsx","data-component-name":"p","data-component-content":"%7B%22className%22%3A%22text-xs%20font-semibold%20text-text-muted%20uppercase%20tracking-wide%20mb-3%22%7D",children:"Closing the month"}),a.jsx(un,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:333:8","data-matrix-name":"MonthEndChecklist","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"333","data-component-file":"FinancePersonaPage.tsx","data-component-name":"MonthEndChecklist"})]})]})}const ds={id:"finance",name:"Finance & Accounting",description:"Your books, end to end — sales, purchases, expenses, and the month-end close.",icon:Be,isLive:!0,connectedAppIds:["quickbooks","zoho-books","tally","dynamics365"],quickActions:[{label:"Bill a customer",description:"Create and send an invoice",icon:Qa,tab:"sales",scrollTo:"finance-ar-invoices"},{label:"Record a supplier bill",description:"Enter a bill you have received",icon:fe,tab:"purchases",scrollTo:"finance-invoices"},{label:"Cash forecast",description:"What is coming in and going out",icon:Xa,tab:"plan",scrollTo:"finance-cashflow"},{label:"New finance agent",description:"Create a specialised finance agent",icon:X,href:"/dashboard/agents"}],overviewContent:a.jsxs("div",{className:"space-y-6","data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:384:4","data-matrix-name":"div","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"384","data-component-file":"FinancePersonaPage.tsx","data-component-name":"div","data-component-content":"%7B%22className%22%3A%22space-y-6%22%7D",children:[a.jsx(Kn,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:385:6","data-matrix-name":"FinanceOverview","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"385","data-component-file":"FinancePersonaPage.tsx","data-component-name":"FinanceOverview"}),a.jsx(pt,{allowedWorkflows:["gst_3b_filing","pf_challan","voucher_entry"],"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:386:6","data-matrix-name":"BrowserTasksPanel","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"386","data-component-file":"FinancePersonaPage.tsx","data-component-name":"BrowserTasksPanel","data-component-content":"%7B%22allowedWorkflows%22%3A%5B%22gst_3b_filing%22%2C%22pf_challan%22%2C%22voucher_entry%22%5D%7D"})]}),extraTabs:[{id:"sales",label:"Sales",icon:Xa,group:"work",content:a.jsx(as,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:393:87","data-matrix-name":"SalesTab","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"393","data-component-file":"FinancePersonaPage.tsx","data-component-name":"SalesTab"})},{id:"purchases",label:"Purchases",icon:jt,group:"work",content:a.jsx(es,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:394:87","data-matrix-name":"PurchasesTab","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"394","data-component-file":"FinancePersonaPage.tsx","data-component-name":"PurchasesTab"})},{id:"expenses",label:"Expenses",icon:fe,group:"work",content:a.jsx(ts,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:395:87","data-matrix-name":"ExpensesTab","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"395","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ExpensesTab"})},{id:"plan",label:"Plan",icon:be,group:"knowledge",content:a.jsx(ss,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:396:92","data-matrix-name":"PlanTab","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"396","data-component-file":"FinancePersonaPage.tsx","data-component-name":"PlanTab"})},{id:"reports",label:"Reports",icon:It,group:"trail",content:a.jsx(os,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:397:88","data-matrix-name":"ReportsTab","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"397","data-component-file":"FinancePersonaPage.tsx","data-component-name":"ReportsTab"})},{id:"books",label:"Books",icon:Ae,group:"trail",content:a.jsx(ns,{"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:398:88","data-matrix-name":"BooksTab","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"398","data-component-file":"FinancePersonaPage.tsx","data-component-name":"BooksTab"})}]};function Os(){return a.jsx(ct,{persona:ds,"data-matrix-id":"src/pages/dashboard/personas/FinancePersonaPage.tsx:403:9","data-matrix-name":"DomainWorkspace","data-component-path":"src/pages/dashboard/personas/FinancePersonaPage.tsx","data-component-line":"403","data-component-file":"FinancePersonaPage.tsx","data-component-name":"DomainWorkspace","data-component-content":"%7B%22persona%22%3A%22%5BIdentifier%5D%22%7D"})}export{Os 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.