PageSourceSearch

https://app.transactpay.ai/assets/balance-history-DATZu_L5.js

js transactpay.ai collected 2026-10-05 02:53:36 UTC 5,002 bytes, 1 lines download raw bytes

1import{h as E,u as H,r,a as I,j as t,b as N,a0 as d,B as D,a4 as K,V as O,a5 as z,Q as B}from"./index-BiwlBLjf.js";import{D as A}from"./index-Cz-2r8Tk.js";import{F as V}from"./filter-header-BbsrRMkg.js";import{S as $}from"./status-badge-CfP1lEp8.js";import{C as q}from"./card-BPqi3BI-.js";import"./select-CQTcdMSk.js";import"./index-lfcKBI-N.js";import"./index-BvvUz0nn.js";import"./export-button-BthmD-p-.js";import"./exportToExcel-CfVF9nni.js";import"./chevron-left-D9oNKs06.js";import"./chevron-right-BKZhVBu-.js";const se=()=>{var C;const{setHeader:F}=E(),n=H(e=>e==null?void 0:e.selectedCurrency),[v,u]=r.useState(!1),[m,L]=r.useState(null),[y,g]=r.useState(1),[l,k]=r.useState(10),[i,h]=r.useState(""),[c,p]=r.useState(""),[f,x]=r.useState(""),[j,S]=r.useState(""),{data:a}=I({queryKey:["BALANCE_HISTORY",y,l,n,f,j,i,c],queryFn:async()=>{const e=await N.get(`/subsidiary/dashboard/fetch/wallet/history?direction=${f}&reference=${j}&currency=${n}&page=${y}&limit=${l}&fromdate=${i?d(i,0,0,0):""}&todate=${c?d(c,23,59,59):""}`);return e==null?void 0:e.data}});r.useEffect(()=>{F("Balance-history",a==null?void 0:a.totalItems)},[a]);const R=[{accessorKey:"dateCreated",header:"Due Date",cell:({getValue:e})=>B(e(),"dd-MM-yyyy")||"-"},{accessorKey:"amount",header:"Amount",cell:({row:e})=>{const s=e.original.amount;return s!=null?t.jsxs(t.Fragment,{children:[" ",n," ",s.toLocaleString()]}):"-"}},{accessorKey:"balance",header:"Balance",cell:({row:e})=>{const s=e.original.balance;return s!=null?t.jsxs(t.Fragment,{children:[n," ",s.toLocaleString()]}):"-"}},{accessorKey:"direction",header:"Direction",cell:({row:e})=>{const s=e.original.direction;return s?t.jsx($,{status:s}):"-"}},{accessorKey:"remarks",header:"Details",cell:({getValue:e})=>e()||"-"}],M=e=>{const s=new Date,o=new Date;o.setDate(s.getDate()-e),h(o.toISOString().split("T")[0]),p(s.toISOString().split("T")[0])},P=()=>{h(""),p(""),S(""),x("")},T=[{name:"date",type:"date",value:"Date",options:[{label:"Last 7 days",value:"7"},{label:"Last 30 days",value:"30"},{label:"Last 90 days",value:"90"},{label:"Last 1 year",value:"365"}],onChange:e=>{if(typeof e=="string"){const s=parseInt(e,10);isNaN(s)||M(s)}else h(e.from),p(e.to)}},{name:"direction",type:"select",placeholder:"Direction",options:[{label:"Credit",value:"C"},{label:"Debit",value:"D"}],onChange:e=>{typeof e=="string"&&x(e)}},{name:"Reference",type:"text",placeholder:"Reference",onChange:e=>{typeof e=="string"&&S(e)}}],b=[{label:"Date",key:"dateCreated"},{label:"Amount",key:"amount"},{label:"Direction",key:"direction"},{label:"Balance",key:"balance"},{label:"Details",key:"remarks"},{label:"Reference",key:"reference"}];return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-b",children:t.jsx(V,{filters:T,customButton:t.jsx(D,{onClick:P,children:"Reset Filters"}),exportButton:{fileName:"balance-history",exportType:"xlsx",disabled:!1,fetchFullData:async()=>{var s;const e=await N.get(`/subsidiary/dashboard/fetch/wallet/history?direction=${f}&currency=${n}&page=${y}&limit=${l}&fromdate=${i?d(i,0,0,0):""}&todate=${c?d(c,23,59,59):""}&download=true`);return(s=e==null?void 0:e.data)==null?void 0:s.items}}})}),t.jsx("div",{className:"p-4",children:a&&((C=a==null?void 0:a.items)==null?void 0:C.length)>0?t.jsxs(t.Fragment,{children:[t.jsx(A,{columns:R,data:a==null?void 0:a.items,paginationMeta:{total:(a==null?void 0:a.totalItems)??0,size:(a==null?void 0:a.pageSize)??l,totalPage:(a==null?void 0:a.totalPages)??0,currentPage:(a==null?void 0:a.currentPage)??0},onPageChange:e=>g(e),onPageSizeChange:e=>{k(e),g(1)},onRowClick:e=>{L(e),u(!0)}}),t.jsxs(K,{open:v,onOpenChange:u,title:"Balance Details",children:[t.jsx(O,{children:t.jsx(z,{children:"Balance History"})}),t.jsx("p",{className:"text-muted-foreground mb-4 text-sm",children:"See Full Balance Details"}),t.jsx("div",{className:"space-y-4",children:b&&b.map(({label:e,key:s})=>
1{const o=m==null?void 0:m[s],w=s==="dateCreated"?B(o,"dd-MM-yyyy"):s==="balance"||s==="amount"?`${n} ${Number(o).toLocaleString()}`:o??"-";return t.jsxs("div",{className:"flex justify-between pb-1 text-sm",children:[t.jsx("span",{className:"font-medium",children:e}),e.toLowerCase()==="direction"?t.jsx($,{status:String(w).toLowerCase()}):t.jsx("span",{className:"max-w-1/2 break-words text-right text-gray-700",children:w})]},e)})}),t.jsx("div",{className:"mt-auto flex justify-end",children:t.jsx(D,{className:"border-primary text-primary w-full max-w-none",variant:"outline",onClick:()=>u(!1),children:"Close"})})]})]}):t.jsxs(q,{className:"flex min-h-60 flex-col items-center justify-center rounded-none shadow-none",children:[t.jsx("div",{className:"border-primary flex h-10 w-10 items-center justify-center rounded-lg border bg-[#FBE9EF99] p-1",children:t.jsx("img",{src:"/assets/icons/wallet.svg",alt:"icon",className:"h-7 w-7"})}),t.jsx("h4",{children:"You do not have any Balance-history"}),t.jsx("p",{children:"No balance history has been processed on your account yet."})]})})]})};export{se 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.