PageSourceSearch

https://dealer-setup-wizard.emergent.host/static/js/273.4bead675.chunk.js

js dealer-setup-wizard.emergent.host collected 2026-10-03 03:22:10 UTC 32,409 bytes, 3 lines download raw bytes

1/*! For license information please see 273.4bead675.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[273],{273(e,a,t){t.r(a),t.d(a,{default:()=>Z});var s=t(9379),l=t(5544),r=t(5043),d=t(8975),c=t(9591),n=t(4980),o=t(3390),i=t(1140),m=t(2264),x=t(925),p=t(6328),u=t(6930),h=t(8384),b=t(2382),g=t(9493),j=t(5727),f=t(8646),N=t(8773),v=t(7784);const _=(0,v.A)("flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]),y=(0,v.A)("file-chart-column-increasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);var w=t(6245),k=t(7719),A=t(6833),S=t(7104),C=t(5692),I=t(579);const T=e=>null==e?"-":"\u20b9".concat(Number(e).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})),M=()=>(new Date).toISOString().slice(0,10);function Z(){var e;const a=(0,u.Bd)().t,t=(0,d.Zp)(),s=(0,c.S)(),n=s.ca,i=s.pumps,m=s.loading,x=s.logout,p=(0,r.useState)(null),v=(0,l.A)(p,2),w=v[0],k=v[1],A=(0,r.useState)("dashboard"),S=(0,l.A)(A,2),C=S[0],T=S[1];(0,r.useEffect)(()=>{m||n||t("/ca/login",{replace:!0})},[n,m,t]),(0,r.useEffect)(()=>{i.length&&!w&&k(i[0].pump_id)},[i,w]);const M=(0,r.useMemo)(()=>i.find(e=>e.pump_id===w),[i,w]);return m?(0,I.jsx)("div",{className:"flex min-h-screen items-center justify-center text-muted-foreground",children:a("ca.caportal.loading")}):n?(0,I.jsxs)("div",{className:"min-h-screen bg-slate-50 dark:bg-slate-950",children:[(0,I.jsx)("header",{className:"sticky top-0 z-20 border-b border-border bg-white/90 backdrop-blur dark:bg-slate-900/90",children:(0,I.jsxs)("div",{className:"mx-auto flex max-w-7xl items-center justify-between gap-3 px-4 py-3 md:px-6",children:[(0,I.jsxs)("div",{className:"flex items-center gap-3",children:[(0,I.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-amber-500 text-white shadow",children:(0,I.jsx)(h.A,{className:"h-4 w-4"})}),(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"font-bold",children:[a("ca.caportal.hisabx")," ",(0,I.jsx)("span",{className:"text-amber-500",children:"CA"})]}),(0,I.jsxs)("div",{className:"text-[11px] text-muted-foreground",children:[n.name," \xb7 ",n.firm_name||"Independent"]})]})]}),(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[i.length>1&&(0,I.jsxs)("div",{className:"relative",children:[(0,I.jsx)("select",{value:w||"",onChange:e=>k(e.target.value),className:"h-9 rounded-md border border-border bg-card pr-8 pl-3 text-sm font-semibold focus:outline-none focus:ring-2 focus:ring-amber-500","data-testid":"ca-workspace-switcher",children:i.map(e=>(0,I.jsx)("option",{value:e.pump_id,children:e.pump_name},e.pump_id))}),(0,I.jsx)(b.A,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2"})]}),1===i.length&&(0,I.jsx)("div",{className:"rounded-md border border-border bg-card px-3 py-1.5 text-xs font-semibold","data-testid":"ca-single-pump",children:null===(e=i[0])||void 0===e?void 0:e.pump_name}),(0,I.jsxs)(o.$,{variant:"ghost",size:"sm",onClick:async()=>{window.confirm("Sign out?")&&(await x(),t("/ca/login"))},"data-testid":"ca-logout",children:[(0,I.jsx)(g.A,{className:"h-4 w-4"})," ",(0,I.jsx)("span",{className:"hidden md:inline",children:a("common.logout")})]})]})]})}),M?M.ca_module_enabled?(0,I.jsxs)("main",{className:"mx-auto max-w-7xl px-4 py-5 md:px-6 md:py-6",children:[(0,I.jsx)("div",{className:"mb-4 rounded-xl border-2 border-amber-500/40 bg-amber-50 p-3 dark:bg-amber-950/20","data-testid":"ca-pump-header",children:(0,I.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:"text-xs font-semibold uppercase tracking-widest text-amber-700",children:a("ca.caportal.auditing")}),(0,I.jsx)("div",{className:"text-lg font-bold text-slate-900 dark:text-white",children:M.pump_name}),(0,I.jsxs)("div",{className:"text-xs text-muted-foreground",children:[M.omc||"\u2014"," \xb7 ",M.pump_address||"No address"]})]}),(0,I.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:["Access:",(M.permissions||[]).map(e=>(0,I.jsx)("span",{className:"rounded-full bg-white px-2 py-0.5 font-semibold text-slate-700 dark:bg-slate-800 dark:text-slate-300",children:e},e))]})]})}),(0,I.jsx)("div",{className:"mb-4 flex gap-1 overflow-x-auto border-b border-border",children:[{key:"dashboard",label:"Dashboard",icon:f.A},{key:"audit",label:"Audit trail",icon:N.A},{key:"flags",label:"Flags",icon:_},{key:"reports",label:"Reports",icon:y},{key:"form3cd",label:"Form 3CD",icon:y}].map(e=>{const a=e.icon;return(0,I.jsxs)("button",{onClick:()=>T(e.key),className:"flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm font-semibold transition "+(C===e.ke
2y?"border-amber-500 text-amber-700 dark:text-amber-300":"border-transparent text-muted-foreground hover:text-foreground"),"data-testid":"ca-tab-".concat(e.key),children:[(0,I.jsx)(a,{className:"h-3.5 w-3.5"})," ",e.label]},e.key)})}),"dashboard"===C&&(0,I.jsx)(B,{pumpId:M.pump_id}),"audit"===C&&(0,I.jsx)(L,{pumpId:M.pump_id}),"flags"===C&&(0,I.jsx)(W,{pumpId:M.pump_id}),"reports"===C&&(0,I.jsx)(D,{pumpId:M.pump_id,tallyEnabled:M.tally_export_enabled}),"form3cd"===C&&(0,I.jsx)(F,{pumpId:M.pump_id})]}):(0,I.jsxs)("div",{className:"mx-auto max-w-2xl px-4 py-16 text-center",children:[(0,I.jsx)(j.A,{className:"mx-auto mb-4 h-12 w-12 text-muted-foreground/50"}),(0,I.jsxs)("h2",{className:"text-lg font-bold",children:["CA module is disabled for ",M.pump_name]}),(0,I.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Ask the dealer to enable the CA add-on from their Settings \u2192 CA Add-on page."})]}):(0,I.jsxs)("div",{className:"mx-auto max-w-2xl px-4 py-16 text-center",children:[(0,I.jsx)(h.A,{className:"mx-auto mb-4 h-12 w-12 text-muted-foreground/50"}),(0,I.jsx)("h2",{className:"text-lg font-bold",children:a("ca.caportal.no_pumps_assigned_yet")}),(0,I.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Ask any of your dealer clients to invite you from their HisabX dashboard."})]})]}):null}function B(e){let a=e.pumpId;const t=(0,u.Bd)().t,s=(0,r.useState)([]),d=(0,l.A)(s,2),c=d[0],o=d[1],m=(0,r.useState)(null),x=(0,l.A)(m,2),p=x[0],h=x[1],b=(0,r.useState)([]),g=(0,l.A)(b,2),j=g[0],N=g[1];return(0,r.useEffect)(()=>{n.api.get("/ca/reports/compliance-calendar?pump_id=".concat(a)).then(e=>o(e.data.items||[])).catch(()=>{}),n.api.get("/ca/audit-trail/verify?pump_id=".concat(a)).then(e=>h(e.data)).catch(()=>{}),n.api.get("/ca/flags?pump_id=".concat(a,"&status=open")).then(e=>N(e.data.flags||[])).catch(()=>{})},[a]),(0,I.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,I.jsx)(i.Zp,{className:"border-border","data-testid":"ca-calendar-card",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,I.jsx)(f.A,{className:"h-4 w-4 text-amber-500"}),(0,I.jsx)("h3",{className:"text-sm font-bold uppercase tracking-widest",children:t("ca.caportal.compliance_calendar")})]}),(0,I.jsx)("div",{className:"space-y-2",children:c.map(e=>{const a="red"===e.status?w.A:"amber"===e.status?k.A:A.A,t="red"===e.status?"text-red-600":"amber"===e.status?"text-amber-600":"text-emerald-600";return(0,I.jsxs)("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-border bg-card p-3","data-testid":"cal-".concat(e.code),children:[(0,I.jsxs)("div",{className:"min-w-0",children:[(0,I.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,I.jsx)(a,{className:"h-4 w-4 ".concat(t)}),(0,I.jsx)("span",{className:"font-semibold",children:e.label})]}),(0,I.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.desc})]}),(0,I.jsxs)("div",{className:"shrink-0 text-right",children:[(0,I.jsx)("div",{className:"text-xs font-mono",children:e.due_date}),(0,I.jsx)("div",{className:"text-[10px] font-bold uppercase ".concat(t),children:e.days_until>=0?"".concat(e.days_until,"d left"):"".concat(Math.abs(e.days_until),"d overdue")})]})]},e.code)})})]})}),(0,I.jsxs)("div",{className:"space-y-4",children:[(0,I.jsx)(i.Zp,{className:"border-border","data-testid":"ca-integrity-card",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsx)("h3",{className:"mb-3 text-sm font-bold uppercase tracking-widest",children:t("ca.caportal.audit_chain_integrity")}),p?(0,I.jsxs)("div",{className:"rounded-lg p-3 "+(p.ok?"bg-emerald-50 dark:bg-emerald-950/20":"bg-red-50 dark:bg-red-950/20"),children:[(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[p.ok?(0,I.jsx)(A.A,{className:"h-5 w-5 text-emerald-600"}):(0,I.jsx)(w.A,{className:"h-5 w-5 text-red-600"}),(0,I.jsx)("span",{className:"font-bold",children:p.message})]}),(0,I.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:[p.total," events on record. SHA-256 hash chain verified."]})]}):(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:"Checking\u2026"})]})}),(0,I.jsx)(i.Zp,{className:"border-border","data-testid":"ca-flags-summary",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,I.jsx)("h3",{className:"text-sm font-bold uppercase tracking-widest",children:t("ca.caportal.open_flags")}),(0,I.jsx)("span",{className:"rounded-full bg-amber-500 px-2 py-0.5 text-xs font-black text-white",children:j.length})]}),0===j.length?(0,I.jsx)("div",{className:"rounded-lg bg-emerald-50 p-3 text-sm text-emerald-800 dark:bg-emerald-950/20",children:"Nothing to flag. Books look clean \ud83d\udc4d"}):(0,I.jsx)("div",{className:"space-y-1.5",children:j.slice(0,5).map(e=>(0,I.jsxs)("div",{className:"rounded-md border border-border bg-card p-2 text-xs",children:[(0,I.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,I.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-bold uppercase "+("critical"===e.severity?"bg-red-100 text-red-700":"warn"===e.severity?"bg-amber-100 text-amber-800":"bg-slate-100 text-slate-700"),
2children:e.severity}),(0,I.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.target_type,":",e.target_id.slice(0,12)]})]}),(0,I.jsx)("p",{className:"mt-1 text-foreground/90",children:e.note})]},e.id))})]})})]})]})}function L(e){let a=e.pumpId;const t=(0,u.Bd)().t,s=(0,r.useState)([]),d=(0,l.A)(s,2),c=d[0],o=d[1],m=(0,r.useState)(!0),x=(0,l.A)(m,2),p=x[0],h=x[1];return(0,r.useEffect)(()=>{h(!0),n.api.get("/ca/audit-trail?pump_id=".concat(a,"&limit=200")).then(e=>o(e.data.trail||[])).catch(()=>{}).finally(()=>h(!1))},[a]),(0,I.jsx)(i.Zp,{className:"border-border",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,I.jsxs)("h3",{className:"text-sm font-bold uppercase tracking-widest",children:["Immutable audit log (",c.length,")"]}),(0,I.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"SHA-256 hash chained \xb7 append-only"})]}),p?(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:t("common.loading")}):0===c.length?(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:t("ca.caportal.no_activity_yet")}):(0,I.jsx)("div",{className:"overflow-x-auto",children:(0,I.jsxs)("table",{className:"w-full text-xs",children:[(0,I.jsx)("thead",{className:"border-b text-left uppercase tracking-widest text-muted-foreground",children:(0,I.jsxs)("tr",{children:[(0,I.jsx)("th",{className:"py-2",children:t("ca.caportal.when")}),(0,I.jsx)("th",{children:t("ca.caportal.actor")}),(0,I.jsx)("th",{children:t("ca.caportal.action")}),(0,I.jsx)("th",{children:t("ca.caportal.entity")}),(0,I.jsx)("th",{children:t("ca.caportal.hash")})]})}),(0,I.jsx)("tbody",{children:c.map(e=>{var a,t;return(0,I.jsxs)("tr",{className:"border-b border-border/60","data-testid":"audit-row-".concat(e.id),children:[(0,I.jsx)("td",{className:"py-2 font-mono text-[10px]",children:null===(a=e.ts)||void 0===a?void 0:a.slice(0,19).replace("T"," ")}),(0,I.jsxs)("td",{children:[e.actor_role," \xb7 ",(0,I.jsx)("span",{className:"font-mono text-[10px]",children:(e.actor_id||"").slice(0,12)})]}),(0,I.jsx)("td",{children:(0,I.jsx)("span",{className:"rounded bg-secondary px-1.5 py-0.5 text-[10px] font-bold",children:e.action})}),(0,I.jsxs)("td",{className:"text-muted-foreground",children:[e.entity_type," \xb7 ",(0,I.jsx)("span",{className:"font-mono text-[10px]",children:(e.entity_id||"").slice(0,12)})]}),(0,I.jsxs)("td",{className:"font-mono text-[10px] text-muted-foreground",children:[null===(t=e.hash)||void 0===t?void 0:t.slice(0,12),"..."]})]},e.id)})})]})})]})})}function W(e){let a=e.pumpId;const t=(0,u.Bd)().t,d=(0,r.useState)([]),c=(0,l.A)(d,2),x=c[0],h=c[1],b=(0,r.useState)({target_type:"HISAB",target_id:"",severity:"warn",note:""}),g=(0,l.A)(b,2),j=g[0],f=g[1],N=(0,r.useState)(!1),v=(0,l.A)(N,2),_=v[0],y=v[1],w=()=>n.api.get("/ca/flags?pump_id=".concat(a)).then(e=>h(e.data.flags||[])).catch(()=>{});(0,r.useEffect)(()=>{w()},[a]);return(0,I.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[1fr_400px]",children:[(0,I.jsx)(i.Zp,{className:"border-border",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsxs)("h3",{className:"mb-3 text-sm font-bold uppercase tracking-widest",children:["Flags (",x.length,")"]}),0===x.length?(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:t("ca.caportal.no_flags_yet")}):(0,I.jsx)("div",{className:"space-y-2",children:x.map(e=>{var a;return(0,I.jsx)("div",{className:"rounded-lg border border-border bg-card p-3","data-testid":"flag-".concat(e.id),children:(0,I.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,I.jsxs)("div",{className:"min-w-0",children:[(0,I.jsxs)("div",{className:"flex items-center gap-2",children:[(0,I.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-bold uppercase "+("critical"===e.severity?"bg-red-100 text-red-700":"warn"===e.severity?"bg-amber-100 text-amber-800":"bg-slate-100 text-slate-700"),children:e.severity}),(0,I.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-bold uppercase "+("open"===e.status?"bg-orange-100 text-orange-800":"resolved"===e.status?"bg-emerald-100 text-emerald-800":"bg-slate-100 text-slate-500"),children:e.status}),(0,I.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.target_type,":",e.target_id]})]}),(0,I.jsx)("p",{className:"mt-1.5 text-sm",children:e.note})]}),(0,I.jsx)("div",{className:"shrink-0 text-right text-[10px] text-muted-foreground",children:null===(a=e.created_at)||void 0===a?void 0:a.slice(0,10)})]})},e.id)})})]})}),(0,I.jsx)(i.Zp,{className:"border-border h-fit",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsx)("h3",{className:"mb-3 text-sm font-bold uppercase tracking-widest",children:t("ca.caportal.post_a_new_flag")}),(0,I.jsxs)("div",{className:"space-y-3",children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold",children:t("ca.caportal.target_type")}
2),(0,I.jsxs)("select",{value:j.target_type,onChange:e=>f((0,s.A)((0,s.A)({},j),{},{target_type:e.target.value})),className:"mt-1 h-9 w-full rounded-md border border-border bg-card px-2 text-sm","data-testid":"flag-target-type",children:[(0,I.jsx)("option",{children:t("ca.caportal.hisab")}),(0,I.jsx)("option",{children:t("ca.caportal.cashbook")}),(0,I.jsx)("option",{children:t("ca.caportal.expense")}),(0,I.jsx)("option",{children:t("ca.caportal.credit")}),(0,I.jsx)("option",{children:t("ca.caportal.other")})]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold",children:t("ca.caportal.target_id")}),(0,I.jsx)(m.p,{value:j.target_id,onChange:e=>f((0,s.A)((0,s.A)({},j),{},{target_id:e.target.value})),className:"h-9 text-sm font-mono",placeholder:"e.g. hi-abc123","data-testid":"flag-target-id"})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold",children:t("ca.caportal.severity")}),(0,I.jsxs)("select",{value:j.severity,onChange:e=>f((0,s.A)((0,s.A)({},j),{},{severity:e.target.value})),className:"mt-1 h-9 w-full rounded-md border border-border bg-card px-2 text-sm","data-testid":"flag-severity",children:[(0,I.jsx)("option",{value:"info",children:t("ca.caportal.info")}),(0,I.jsx)("option",{value:"warn",children:t("ca.caportal.warn")}),(0,I.jsx)("option",{value:"critical",children:t("ca.caportal.critical")})]})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold",children:t("csa.note")}),(0,I.jsx)("textarea",{value:j.note,onChange:e=>f((0,s.A)((0,s.A)({},j),{},{note:e.target.value})),className:"mt-1 min-h-[80px] w-full rounded-md border border-border bg-card p-2 text-sm","data-testid":"flag-note"})]}),(0,I.jsx)(o.$,{onClick:async()=>{if(!j.target_id.trim()||!j.note.trim())return p.oR.error(t("ca.caportal.enter_target_id_and_note"));y(!0);try{await n.api.post("/ca/flags?pump_id=".concat(a),j),p.oR.success(t("ca.caportal.flag_posted")),f({target_type:"HISAB",target_id:"",severity:"warn",note:""}),w()}catch(e){p.oR.error((0,n.KI)(e))}finally{y(!1)}},disabled:_,className:"w-full bg-amber-500 hover:bg-amber-600","data-testid":"flag-submit",children:_?"Posting\u2026":"Post flag"})]})]})})]})}function D(e){var a,t,d,c,o;let h=e.pumpId,b=e.tallyEnabled;const g=(0,u.Bd)().t,j=M().slice(0,7),f=(0,r.useState)({from:M().slice(0,8)+"01",to:M()}),N=(0,l.A)(f,2),v=N[0],_=N[1],y=(0,r.useState)(j),w=(0,l.A)(y,2),k=w[0],A=w[1],Z=(0,r.useState)(null),B=(0,l.A)(Z,2),L=B[0],W=B[1],D=(0,r.useState)(null),F=(0,l.A)(D,2),H=F[0],R=F[1],q=(0,r.useState)(null),O=(0,l.A)(q,2),z=O[0],G=O[1];(0,r.useEffect)(()=>{(async()=>{try{const e=await Promise.all([n.api.get("/ca/reports/sales-daybook?pump_id=".concat(h,"&date_from=").concat(v.from,"&date_to=").concat(v.to)),n.api.get("/ca/reports/gst-split?pump_id=".concat(h,"&month=").concat(k)),n.api.get("/ca/reports/cash-payments-large?pump_id=".concat(h,"&date_from=").concat(v.from,"&date_to=").concat(v.to))]),a=(0,l.A)(e,3),t=a[0],s=a[1],r=a[2];W(t.data),R(s.data),G(r.data)}catch(e){p.oR.error((0,n.KI)(e))}})()},[h,v.from,v.to,k]);const K="".concat("https://hisabx.in","/api/ca/tally/sales-xml?pump_id=").concat(h,"&date_from=").concat(v.from,"&date_to=").concat(v.to);return(0,I.jsxs)("div",{className:"space-y-4",children:[(0,I.jsx)(i.Zp,{className:"border-border",children:(0,I.jsxs)(i.Wu,{className:"flex flex-wrap items-end gap-3 p-4",children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:g("manager.from")}),(0,I.jsx)(x.A,{value:v.from,onChange:e=>_((0,s.A)((0,s.A)({},v),{},{from:e})),className:"h-9 w-52",testId:"rpt-date-from",ariaLabel:"From date"})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"To"}),(0,I.jsx)(x.A,{value:v.to,onChange:e=>_((0,s.A)((0,s.A)({},v),{},{to:e})),className:"h-9 w-52",testId:"rpt-date-to",ariaLabel:"To date",min:v.from})]}),(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:g("ca.caportal.gst_month")}),(0,I.jsx)(m.p,{type:"month",value:k,onChange:e=>A(e.target.value),className:"h-9 w-40","data-testid":"rpt-month"})]}),b?(0,I.jsxs)("a",{href:K,className:"ml-auto inline-flex items-center gap-1.5 rounded-md bg-slate-900 px-3 py-2 text-xs font-bold text-white hover:bg-slate-800 dark:bg-slate-100 dar
2k:text-slate-900","data-testid":"tally-download",children:[(0,I.jsx)(S.A,{className:"h-3.5 w-3.5"})," Tally XML (Sales) ",(0,I.jsx)(C.A,{className:"h-3 w-3"})]}):(0,I.jsx)("div",{className:"ml-auto text-[10px] text-muted-foreground","data-testid":"tally-disabled-hint",children:"\ud83d\udca1 Ask the dealer to enable Tally export in their CA Add-on settings"})]})}),(0,I.jsx)(i.Zp,{className:"border-border","data-testid":"report-sales-daybook",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsxs)("h3",{className:"mb-3 text-sm font-bold uppercase tracking-widest",children:["Sales Day-Book \xb7 ",v.from," \u2192 ",v.to]}),L?(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"mb-3 flex flex-wrap gap-4 text-sm",children:[(0,I.jsx)(E,{label:g("ca.caportal.total_sales"),value:T(null===(a=L.grand_totals)||void 0===a?void 0:a.sales)}),(0,I.jsx)(E,{label:g("csa.litres"),value:((null===(t=L.grand_totals)||void 0===t?void 0:t.litres)||0).toLocaleString("en-IN",{maximumFractionDigits:2})}),(0,I.jsx)(E,{label:g("csa.csaportal.cash"),value:T(null===(d=L.grand_totals)||void 0===d?void 0:d.cash)}),(0,I.jsx)(E,{label:g("setup.online"),value:T(null===(c=L.grand_totals)||void 0===c?void 0:c.online)}),(0,I.jsx)(E,{label:g("manager.kpi_credit"),value:T(null===(o=L.grand_totals)||void 0===o?void 0:o.credit)})]}),(0,I.jsx)("div",{className:"max-h-96 overflow-y-auto",children:(0,I.jsxs)("table",{className:"w-full text-xs",children:[(0,I.jsx)("thead",{className:"sticky top-0 bg-card",children:(0,I.jsxs)("tr",{className:"border-b text-left uppercase text-muted-foreground",children:[(0,I.jsx)("th",{className:"py-2",children:g("manager.date")}),(0,I.jsx)("th",{children:g("csa.shift")}),(0,I.jsx)("th",{children:g("ca.caportal.salesman")}),(0,I.jsx)("th",{className:"text-right",children:g("csa.sales")}),(0,I.jsx)("th",{className:"text-right",children:g("csa.csaportal.cash")}),(0,I.jsx)("th",{className:"text-right",children:g("setup.online")}),(0,I.jsx)("th",{className:"text-right",children:g("manager.kpi_credit")})]})}),(0,I.jsx)("tbody",{children:(L.days||[]).flatMap(e=>(e.shifts||[]).map(a=>(0,I.jsxs)("tr",{className:"border-b border-border/50",children:[(0,I.jsx)("td",{className:"py-2 font-mono",children:e.date}),(0,I.jsx)("td",{children:a.shift}),(0,I.jsx)("td",{children:a.csa_name}),(0,I.jsx)("td",{className:"text-right font-mono",children:T(a.sales)}),(0,I.jsx)("td",{className:"text-right font-mono",children:T(a.cash)}),(0,I.jsx)("td",{className:"text-right font-mono",children:T(a.online)}),(0,I.jsx)("td",{className:"text-right font-mono",children:T(a.credit)})]},a.hisab_id)))})]})})]}):(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:g("common.loading")})]})}),(0,I.jsx)(i.Zp,{className:"border-border","data-testid":"report-gst-split",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsxs)("h3",{className:"mb-3 text-sm font-bold uppercase tracking-widest",children:["GST Split \xb7 ",k]}),H?(0,I.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,I.jsxs)("div",{className:"rounded-lg border-2 border-slate-400/40 bg-slate-50 p-3 dark:bg-slate-900/60",children:[(0,I.jsxs)("div",{className:"text-xs font-bold uppercase text-slate-500",children:["Non-GST \xb7 ",H.non_gst_supplies.gstr1_table]}),(0,I.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:["HSN ",H.non_gst_supplies.hsn]}),(0,I.jsxs)("div",{className:"mt-2 space-y-1 text-sm",children:[(0,I.jsxs)("div",{className:"flex justify-between",children:[(0,I.jsx)("span",{children:g("ca.caportal.petrol")}),(0,I.jsx)("span",{className:"font-mono",children:T(H.non_gst_supplies.petrol.amount)})]}),(0,I.jsxs)("div",{className:"flex justify-between",children:[(0,I.jsx)("span",{children:g("ca.caportal.diesel")}),(0,I.jsx)("span",{className:"font-mono",children:T(H.non_gst_supplies.diesel.amount)})]}),(0,I.jsxs)("div",{className:"flex justify-between border-t pt-1 font-bold",children:[(0,I.jsx)("span",{children:g("csa.csaleaves.total")}),(0,I.jsx)("span",{className:"font-mono",children:T(H.non_gst_supplies.total)})]})]})]}),(0,I.jsxs)("div",{className:"rounded-lg border-2 border-amber-400/40 bg-amber-50 p-3 dark:bg-amber-950/20",children:[(0,I.jsx)("div",{className:"text-xs font-bold uppercase text-amber-700",children:"Taxable (18% GST)"}),(0,I.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:["HSN ",H.taxable_supplies.hsn]}),(0,I.jsxs)("div",{className:"mt-2 space-y-1 text-sm",children:[(0,I.jsxs)("div",{className:"flex justify-between",children:[(0,I.jsxs)("span",{children:["Lubricants (",H.taxable_supplies.lubricants.count,")"]}),(0,I.jsx)("span",{className:"font-mono",children:T(H.taxable_supplies.lubricants.amount)})]}),(0,I.jsxs)("div",{className:"flex justify-between border-t pt-1 font-bold",children:[(0,I.jsx)("span",{children:g("csa.csaleaves.total")}),(0,I.jsx)("span",{className:"font-mono",children:T(H.taxable_supplies.total)})]})]})]})]}):(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:g("common.loading")})]})}),(0,I.jsx)(i.Zp,{className:"border-border","data-testid":"report-cash-payments",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsx)("h3",{className:"mb-1 text-sm font-bold uppercase tracking-widest",children:"Form 3CD Clause 21 \xb7 Section 269ST"}),(0,I.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Cash payments > \u20b910,000 (Section 40A(3)) and cash receipts > \u20b92,00,000 in a single day."}),z?(0,I.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"text-xs font-semibold text-red-700",children:["Cash payments > \u20b910K (",z.clause_21_count,")"]}),(z.clause_21_cash_payments_over_10k||[]).map(e=>(0,I.jsxs)("div",{className:"mt-1 rounded border border-border bg-card p-2 text-xs",children:[(0,I.jsxs)("div",{className:"font-mono",children:[e.date," \xb7 ",(0,I.jsx)("b",{children:T(e.amount)})]}),(0,I.jsxs)("div",{className:"text-muted-foreground",children:[e.type," \xb7 ",e.note]})]},e.id)),0===z.clause_21_count&&(0,I.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:g("ca.caportal.none_clean")})]}),(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{className:"text-xs font-semibold text-red-700",children:["Cash receipts > \u20b92L (",z.section_269st_count,")"]}
2),(z.section_269st_large_cash_receipts||[]).map(e=>(0,I.jsxs)("div",{className:"mt-1 rounded border border-red-300 bg-red-50 p-2 text-xs dark:bg-red-950/20",children:[(0,I.jsxs)("div",{className:"font-mono",children:[e.date," \xb7 ",(0,I.jsx)("b",{children:T(e.amount)})]}),(0,I.jsxs)("div",{className:"text-muted-foreground",children:[e.type," \xb7 ",e.note]}),(0,I.jsx)("div",{className:"mt-0.5 text-[10px] font-bold text-red-700",children:"\u26a0 Section 269ST \u2014 100% penalty risk"})]},e.id)),0===z.section_269st_count&&(0,I.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:g("ca.caportal.none_clean")})]})]}):(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:g("common.loading")})]})})]})}function E(e){let a=e.label,t=e.value;return(0,I.jsxs)("div",{children:[(0,I.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:a}),(0,I.jsx)("div",{className:"font-mono text-lg font-bold",children:t})]})}function F(e){var a,t,s,d,c,x,p;let h=e.pumpId;const b=(0,u.Bd)().t,g=(0,r.useState)(()=>{const e=new Date,a=e.getFullYear(),t=e.getMonth()<3?a-1:a;return"".concat(t,"-").concat(String((t+1)%100).padStart(2,"0"))}),j=(0,l.A)(g,2),f=j[0],N=j[1],v=(0,r.useState)(null),_=(0,l.A)(v,2),y=_[0],w=_[1],k=(0,r.useState)(null),A=(0,l.A)(k,2),C=A[0],M=A[1],Z=()=>{w(null),M(null),n.api.get("/ca/reports/form-3cd?pump_id=".concat(h,"&fy=").concat(f)).then(e=>w(e.data)).catch(e=>M((0,n.KI)(e)))};(0,r.useEffect)(()=>{Z()},[h,f]);return(0,I.jsxs)("div",{className:"space-y-4",children:[(0,I.jsx)(i.Zp,{className:"border-border",children:(0,I.jsxs)(i.Wu,{className:"p-4 flex flex-wrap items-end gap-3",children:[(0,I.jsxs)("div",{children:[(0,I.jsx)("label",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:b("ca.caportal.financial_year")}),(0,I.jsx)(m.p,{value:f,onChange:e=>N(e.target.value),className:"h-9 w-32 font-mono",placeholder:"2025-26","data-testid":"fy-input"})]}),(0,I.jsx)(o.$,{onClick:Z,className:"h-9","data-testid":"fy-load",children:b("ca.caportal.regenerate")}),(0,I.jsxs)(o.$,{variant:"outline",onClick:()=>{if(!y)return;const e=new Blob([JSON.stringify(y,null,2)],{type:"application/json"}),a=URL.createObjectURL(e),t=document.createElement("a");t.href=a,t.download="form-3cd-".concat(h,"-").concat(f,".json"),t.click(),URL.revokeObjectURL(a)},disabled:!y,className:"ml-auto h-9","data-testid":"fy-download",children:[(0,I.jsx)(S.A,{className:"h-3.5 w-3.5"})," Download JSON"]})]})}),C&&(0,I.jsx)("div",{className:"rounded border border-red-300 bg-red-50 p-3 text-sm text-red-800",children:C}),!y&&!C&&(0,I.jsx)("div",{className:"text-sm text-muted-foreground",children:b("common.loading")}),y&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i.Zp,{className:"border-border",children:(0,I.jsxs)(i.Wu,{className:"p-5",children:[(0,I.jsxs)("h3",{className:"mb-3 text-sm font-bold uppercase tracking-widest",children:["Turnover summary \xb7 ",null===(a=y.period)||void 0===a?void 0:a.from," \u2192 ",null===(t=y.period)||void 0===t?void 0:t.to]}),(0,I.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[(0,I.jsx)(E,{label:b("ca.caportal.total_sales"),value:T(null===(s=y.turnover_summary)||void 0===s?void 0:s.total_sales)}),(0,I.jsx)(E,{label:b("ca.caportal.non_gst_petrol_diesel"),value:T(null===(d=y.turnover_summary)||void 0===d?void 0:d.non_gst_sales_petrol_diesel)}),(0,I.jsx)(E,{label:b("ca.caportal.taxable_lubes_etc"),value:T(null===(c=y.turnover_summary)||void 0===c?void 0:c.taxable_sales_lubes_etc)}),(0,I.jsx)(E,{label:b("ca.caportal.audit_required"),value:null!==(x=y.turnover_summary)&&void 0!==x&&x.tax_audit_required?"YES":"no"})]}),(null===(p=y.turnover_summary)||void 0===p?void 0:p.tax_audit_required)&&(0,I.jsx)("div",{className:"mt-3 rounded-md bg-red-50 p-2 text-xs text-red-800 dark:bg-red-950/20",children:"\u26a0 Turnover crossed \u20b91 Cr threshold \u2014 Section 44AB tax audit required. Deadline 30 Sep."})]})}),[["clause_11_books_of_account","Clause 11 \u2014 Books of account"],["clause_14_stock_valuation","Clause 14 \u2014 Stock valuation"],["clause_17_method_of_accounting","Clause 17 \u2014 Method of accounting"],["clause_20_non_deductible","Clause 20 \u2014 Non-deductible amounts"],["clause_21_cash_payments_over_10k","Clause 21 \u2014 Cash payments > \u20b910,000 (Section 40A(3))"],["clause_34_tds_compliance","Clause 34 \u2014 TDS compliance"],["clause_36_related_party","Clause 36 \u2014 Related-party transactions"],["clause_44_gst_breakup","Clause 44 \u2014 GST breakup (Non-GST vs Taxable)"],["section_269st_large_cash_receipts","Section 269ST \u2014 Cash receipts > \u20b92 L"]].map(e=>{let a=(0,l.A)(e,2),t=a[0],s=a[1];return(0,I.jsx)(H,{title:s,data:y[t],testid:"3cd-".concat(t)},t)})]})]})}function H(e){let a=e.title,t=e.data,s=e.testid;const r=(0,u.Bd)().t,d=t&&"object"===typeof t?Object.entries(t):[];return(0,I.jsx)(i.Zp,{className:"border-border","data-testid":s,children:(0,I.jsxs)(i.Wu,{className:"p-4",children:[(0,I.jsx)("h4",{className:"mb-2 text-xs font-bold uppercase tracking-widest text-amber-600",children:a}),0===d.length?(0,I.jsx)("div",{className:"text-xs text-muted-foreground",children:r("ca.c
2aportal.no_data")}):(0,I.jsx)("div",{className:"space-y-1 text-xs",children:d.map(e=>{let a=(0,l.A)(e,2),t=a[0],s=a[1];return(0,I.jsxs)("div",{className:"grid grid-cols-[minmax(140px,240px)_1fr] gap-2 border-b border-border/40 py-1",children:[(0,I.jsx)("span",{className:"font-semibold text-muted-foreground",children:t}),(0,I.jsx)("span",{className:"font-mono",children:R(s)})]},t)})})]})})}function R(e){return null==e?"\u2014":Array.isArray(e)?0===e.length?"\u2014":"".concat(e.length," item").concat(e.length>1?"s":""):"object"===typeof e?JSON.stringify(e).slice(0,200):"boolean"===typeof e?e?"yes":"no":"number"===typeof e?e.toLocaleString("en-IN"):String(e)}},8773(e,a,t){t.d(a,{A:()=>s});const s=(0,t(7784).A)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]])}}]);
3//# sourceMappingURL=273.4bead675.chunk.js.map

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.