PageSourceSearch

https://thola.ai/app/assets/ProformasPage-fKPld-qz.js

js thola.ai collected 2026-10-05 14:14:54 UTC 4,953 bytes, 1 lines download raw bytes

1import{u as P,r as s,j as e,b$ as f,a8 as C,R as E,b2 as R,k as b,i as w}from"./app-CL7tOXJE.js";import{P as _}from"./PosNav-CEFfbMYz.js";import{a as v}from"./posDocuments-CNhzjWwS.js";import{a as F,f as j}from"./posMoney-7punZdm6.js";import{P as L,R as A,K as g,c as M,L as $,E as q,a as z,d as I}from"./PosParityUi-DkVpifdg.js";import{P as O,f as N}from"./format-CLS6-q4d.js";import"./scan-line-D86jCgAS.js";import"./chart-column-CDiJHygD.js";import"./taskForm-BVmr8e1b.js";import"./refresh-cw-CfyLWpqZ.js";const T=[{value:"",label:"All"},{value:"draft",label:"Draft"},{value:"accepted",label:"Accepted"},{value:"converted",label:"Converted"},{value:"cancelled",label:"Cancelled"},{value:"expired",label:"Expired"}],B=20;function X(){const y=P(),[c,m]=s.useState([]),[u,k]=s.useState(!1),[a,o]=s.useState(1),[l,S]=s.useState(""),[i,x]=s.useState(!0),[n,p]=s.useState(null),[d,h]=s.useState(null),r=s.useCallback(async()=>{x(!0),p(null);try{const t=await v.list({status:l||void 0,page:a,page_size:B});m(t.items),k(t.has_more)}catch(t){p(F(t,"Couldn't load proforma invoices.")),m([])}finally{x(!1)}},[l,a]);return s.useEffect(()=>{r()},[r]),s.useEffect(()=>{v.conversionSummary("proforma").then(h).catch(()=>h(null))},[]),e.jsxs("div",{className:"max-w-6xl mx-auto p-6 space-y-4",children:[e.jsx(_,{}),e.jsx(L,{icon:f,title:"Proforma invoices",subtitle:"Advance invoices sent before a sale. Create one from a quotation; it is marked converted when billed at the till.",actions:e.jsxs(e.Fragment,{children:[e.jsx(A,{onClick:()=>void r(),loading:i}),e.jsx(C,{to:"/pos/quotations",className:"inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-blue-600 text-white text-sm font-medium hover:bg-blue-700",children:"From a quotation"})]})}),d&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(g,{label:"Bills from proformas",value:String(d.bills_count),icon:E}),e.jsx(g,{label:"Revenue from proformas",value:j(d.revenue_minor),icon:R})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:T.map(t=>e.jsx("button",{type:"button",onClick:()=>{S(t.value),o(1)},className:`px-3 py-1.5 rounded-xl text-sm font-medium border ${l===t.value?"bg-blue-600 text-white border-blue-600":"border-slate-300 dark:border-neutral-600 text-slate-600 dark:text-neutral-300 hover:bg-slate-50 dark:hover:bg-neutral-800"}`,children:t.label},t.value||"all"))}),e.jsx("div",{className:`${M} overflow-hidden`,children:i?e.jsx($,{}):n?e.jsx(q,{message:n,onRetry:()=>void r()}):c.length===0?e.jsx(z,{icon:f,title:l?`No ${l} proforma invoices.`:"No proforma invoices yet.",hint:"Open a quotation and choose “Create proforma invoice”."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-slate-50 dark:bg-neutral-800/60 text-left text-[11px] uppercase tracking-wide text-slate-500 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-5 py-3 font-medium",children:"Number"}),e.jsx("th",{className:"px-5 py-3 font-medium",children:"Customer"}),e.jsx("th",{className:"px-5 py-3 font-medium",children:"Status"}),e.jsx("th",{className:"px-5 py-3 font-medium",children:"Issued"}),e.jsx("th",{className:"px-5 py-3 font-medium",children:"Valid until"}),e.jsx("th",{className:"px-5 py-3 font-medium text-right",children:"Total"}),e.jsx("th",{className:"px-5 py-3"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100 dark:divide-neutral-800",children:c.map(t=>e.jsxs("tr",{onClick:()=>y(`/pos/proformas/${t.id}`),className:"cursor-pointer hover:bg-slate-50 dark:hover:bg-neutral-800/50",children:[e.jsx("td",{className:"px-5 py-3 font-medium text-slate-800 dark:text-neutral-100",children:t.document_number||t.id.slice(0,8)}),e.jsx("td",{className:"px-5 py-3 text-slate-600 dark:text-neutral-300",children:t.customer_name}),e.jsx("td",{className:"px-5 py-3",children:e.jsx(I,{tone:O[t.status],children:t.status})}),e.jsx("td",{className:"px-5 py-3 text-slate-500",children:N(t.issued_at??t.created_at)}),e.jsx("td",{className:"px-5 py-3 text-slate-500",children:N(t.valid_until)}),e.jsx("td",{className:"px-5 py-3 text-right font-semibold tabular-nums",children:j(t.total_paise)}),e.jsx("td",{className:"px-5 py-3 text-slate-300",children:e.jsx(b,{size:16})})]},t.id))})]})})}),!i&&!n&&(a>1||u)&&e.jsxs("div",{className:"flex items-center justify-end gap-2 text-sm",children:[e.jsxs("button",{type:"button",disabled:a<=1,onClick:()=>o(t=>t-1),className:"inline-flex items-center gap-1 px-3 py-1.5 rounded-xl border border-slate-300 dark:border-neutral-600 disabled:opacity-40",children:[e.jsx(w,{size:14})," Previous"]}),e.jsxs("span",{className:"text-slate-500",children:["Page ",a]}),e.jsxs("button",{type:"button",disabled:!u,onClick:()=>o(t=>t+1),className:"inline-flex items-center gap-1 px-3 py-1.5 rounded-xl border border-slate-300 dark:border-neutral-600 disabled:opacity-40",children:["Next ",e.jsx(b,{size:14})]})]})]})}export{X 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.