PageSourceSearch

https://app.snapto.ai/assets/Transaction-t3lowlRg.js

js snapto.ai collected 2026-10-05 15:08:17 UTC 5,688 bytes, 1 lines download raw bytes

1import{q,r as l,fn as v,bs as F,y as z,p as r,L as d,T as R,v as T,B as u,aZ as j,ag as G,S as J}from"./index-C9IH3k-2.js";import{g as K,T as Q,ab as U,aa as H}from"./TemplateUtil-D1DzmWLm.js";import{r as V}from"./AuditConstant-C6syQHOu.js";import{D as X,B as Y}from"./HelperMethods-C-ewwU_x.js";import{W as ee}from"./WalletPointsFilter-D06q_Gh8.js";import{F as te}from"./Table-isZ0WXp4.js";import{R as ae}from"./ArrowUpOutlined-BhfGhE4E.js";import{R as re}from"./ArrowDownOutlined-Lx40NDq8.js";import{D as se}from"./index-CmSVNJzc.js";import"./Wrapper-ChjuDa3w.js";import"./index-BOwvFOZJ.js";import"./Pagination-D1z-xPUv.js";import"./HolderOutlined-YOHjCGKZ.js";import"./index-Bv3SRNsl.js";import"./CalendarOutlined-DyzsKNdO.js";import"./ClockCircleOutlined-Cym7vptW.js";const{Text:oe}=R,we=E=>{const{customerId:p,tableSize:O="default",preFilledColumns:L=[],phoneNumberId:g}=E,x=q(t=>t.jwtTokenDecodedData),[h,C]=l.useState(v),[S,w]=l.useState([]),[D,A]=l.useState([]),[b,P]=l.useState(!1),$=l.useRef(null),{roleType:I}=x||{};l.useEffect(()=>{const t={...h},e={current:t?.pagination?.current??1,pageSize:t?.pagination?.pageSize??F};t.pagination=e,t.search=[],p&&t.search.push({fieldName:"customerId",value:[p]}),g&&t.search.push({fieldName:"phoneNumberId",value:[g]}),N(t)},[p,g]);const B=(t,e,a)=>{const s={current:t?.current??1,pageSize:t?.pageSize??F},n=a.order?[{fieldName:a.columnKey,dir:a.order==="descend"?"desc":"asc"}]:v.order,o=["walletPoints"],c=Object.entries(e??{}).filter(([i])=>!o.includes(i)).map(([i,m])=>({fieldName:i,value:m!==null?i!=="creationTime"?m:m.map(H):null})).filter(({value:i})=>i);c.push(...Y(e,o)),p&&c.push({fieldName:"customerId",value:[p]}),C({...h,pagination:s,search:c,order:n}),N({pagination:s,search:c,order:n})},_=(t,e)=>({filterDropdown:({setSelectedKeys:a,selectedKeys:s,confirm:n,clearFilters:o,close:c})=>r.jsxs(d,{gap:"small",vertical:!0,style:{padding:8},onKeyDown:i=>i.stopPropagation(),children:[r.jsx(se.RangePicker,{presets:[...V],showTime:!0,format:U,onChange:(i,m)=>{a([m[0],m[1]])}}),r.jsxs(T,{children:[r.jsx(u,{type:"primary",onClick:()=>f(s,n,t),icon:r.jsx(j,{}),size:"small",style:{width:90},children:"Search"}),r.jsx(u,{type:"link",size:"small",onClick:()=>c(),children:"Close"})]})]})}),k=(t,e)=>({filterDropdown:({setSelectedKeys:a,selectedKeys:s,confirm:n,clearFilters:o,close:c})=>r.jsxs(d,{gap:"small",vertical:!0,style:{padding:8},onKeyDown:i=>i.stopPropagation(),children:[r.jsx(G,{ref:$,placeholder:`Search ${e}`,value:s[0],onChange:i=>a(i.target.value?[i.target.value]:[]),onPressEnter:()=>f(s,n,t)}),r.jsxs(T,{children:[r.jsx(u,{type:"primary",onClick:()=>f(s,n,t),icon:r.jsx(j,{}),size:"small",children:"Search"}),r.jsx(u,{type:"link",onClick:()=>c(),size:"small",children:"Close"})]})]})}),N=async t=>{let e="/api/v1/admin/transactions";x&&x.roleType==="RESELLER"&&(e="/api/v1/reseller/transactions");const a=await z(e,t);a&&a.status===200&&(w(a.data.results||[]),C({...h,pagination:{...t.pagination,total:a.data.total},search:t.search,order:t.order}))},f=(t,e,a)=>{e();const s=S.filter(n=>n?.wabaTokens?.some(o=>o.phoneNumberId.includes(t[0])));w(s),C(n=>({...n,search:[...n.search.filter(o=>o.fieldName!==a),{fieldName:a,value:t[0]}]}))},y=l.useCallback(async(t="")=>{P(!0);try{const e=await z("/api/v1/reseller/customers/search",{username:t},!1);if(e?.status===200){const a=e.data?.results||e.data||[];A(a.map(s=>({label:s.username,value:s.id})))}}catch(e){console.error(e)}finally{P(!1)}},[]),M=l.useMemo(()=>X(t=>{y(t)},400),[y]),W=t=>({filterDropdown:({setSelectedKeys:e,selectedKeys:a,confirm:s,close:n})=>r.jsxs(d,{gap:"small",vertical:!0,style:{padding:8},onKeyDown:o=>o.stopPropagation(),children:[r.jsx(J,{showSearch:!0,allowClear:!0,style:{width:220},placeholder:"Search customer",loading:b,options:D,value:a[0]??null,onFocus:()=>y(""),onChange:o=>e(o!=null?[o]:[]),onSearch:o=>M(o),filterOption:!1,placement:"topRight"}),r.jsxs(T,{children:[r.jsx(u,{type:"primary",onClick:()=>f(a,s,t),icon:r.jsx(j,{}),size:"small",children:"Search"}),r.jsx(u,{type:"link",size:"small",onClick:()=>n(),children:"Close"})]})]})}),Z=l.useMemo(()=>{const t=[{title:"Creation Time",dataIndex:"creationTime",key:"creationTime",..._("creationTime"),render:(e,a)=>K(a.creationTime),sorter:(e,a)=>e.creationTime-a.creationTime},{title:"Phone Number ID",dataIndex:"phoneNumberId",key:"phoneNumberId",...k("displayPhoneNumber","Display Phone Number")},{title:"Related Customer",dataIndex:["relatedCustomer","username"],key:"relatedCustomerId",...W("relatedCustomerId"),sorter:(e,a)=>(e.relatedCustomer?.username??"").localeCompare(a.relatedCustomer?.username??"")},{title:"Wallet Points",dataIndex:"walletPoints",key:"walletPoints",filterDropdown:e=>r.jsx(ee,{...e}),sorter:(e,a)=>e.walletPoints-a.walletPoints},{title:"Type",key:"type",dataIndex:"type",render:e=>r.jsxs(Q,{color:e==="ADD"?"success":"error",children:[e==="ADD"?r.jsx(ae,{}):r.jsx(re,{})," ",e]})},{title:"Comment",dataIndex:"comment",key:"comment",render:e=>r.jsx(oe,{style:{whiteSpace:"pre-wrap"},children:e})}];return I==="ADMIN"&&t.unshift({title:"Customer",dataIndex:"customer",key:"customer",...k("customer","Customer"),sorter:(e,a)=>e.username-a.username,render:(e,a)=>a?.customer?.username}),t},[I,D,b]).filter(t=>!L.includes(t.key));return r.jsxs(d,{vertical:!0,gap:"large",children:[r.jsx(d,{justify:"space-between",children:r.jsx(R.Title,{level:4,style:{margin:0},children:"Transactions List"})}),r.jsx("div",{children:r.jsx(te,{rowKey:t=>t.id,columns:Z,dataSource:S,onChange:B,size:O,scroll:{x:1600},pagination:{...h.pagination,showQuickJumper:!0,showSizeChanger:!0,showTotal:(t,e)=>`${e[0]} - ${e[1]} of ${t} records`}})})]})};export{we 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.