import{_ as F}from"./Input.7105798b.js";import E from"./Icon.1464d3c9.js";import{_ as R}from"./Button.c35f3c05.js";import{_ as G}from"./Table.e164c81e.js";import{_ as H}from"./Pagination.967f26ab.js";import{bE as D,bF as S,aL as m,bq as f,o as T,c as A,b as o,w as x,d as M,t as P,ba as u,ah as N,F as $,_ as z,u as j,bG as J,bu as K,a as h,bz as O,bD as Q}from"./entry.816e6e91.js";import{_ as W}from"./card.924cd882.js";import"./Button.8c8352d3.js";import"./nuxt-link.0e2876ca.js";import"./index.84e04faa.js";const X={__name:"List",props:{pending:{type:Boolean},transactions:{type:Array,default:()=>[]},page:{type:Number,default:1},total:{type:Number,default:1}},setup(c){const s=D(),n=S(),p=c,r=[{key:"id",label:"ID",sortable:!0},{key:"username",label:"Username",sortable:!0},{key:"payment_account_id",label:"Payment Account",sortable:!0},{key:"amount",label:"Amount",sortable:!0},{key:"type",label:"Type",sortable:!0},{key:"status",label:"Status",sortable:!0},{key:"created_at",label:"Create at",sortable:!0}];let e=m();e.value=p.page;let d=m("");return f(()=>n.query,()=>{d.value=n.query.search,e.value=+n.query.page||p.page},{immediate:!0}),f(e,()=>{s.push({query:{page:e.value,search:d.value}})}),(b,l)=>{const y=G,t=H;return T(),A($,null,[o(y,{columns:r,rows:c.transactions,loading:c.pending,"loading-state":{label:"Loading..."}},{"created_at-data":x(({row:a})=>[M(P(new Date(a.created_at).getHours()+":"+new Date(a.created_at).getMinutes()+", "+new Date(a.created_at).toDateString()),1)]),_:1},8,["rows","loading","loading-state"]),o(t,{modelValue:u(e),"onUpdate:modelValue":l[0]||(l[0]=a=>N(e)?e.value=a:e=a),"page-count":10,total:c.total},null,8,["modelValue","total"])],64)}}};const Y={class:"row mx-0"},Z={class:"mb-4"},ee=["onSubmit"],te={class:"col-lg-12"},ae={__name:"index",async setup(c){var v;let s,n;j({title:"Transactions list"});const p=J();p.pageName="Transactions List";const r=S(),e=D();let d=m(""),b=m();const{data:l,pending:y}=([s,n]=K(()=>Q({url:"wallets/trasnactions/all/7",method:"GET"},{immediate:!1,query:{page:b}})),s=await s,n(),s);f(()=>r.query,()=>{var g,_;d.value=((g=r.query)==null?void 0:g.search)||"",b.value=((_=r.query)==null?void 0:_.page)||1},{immediate:!0});let t=m("");t.value=(v=r.query)==null?void 0:v.search;const a=()=>{e.push({query:{page:1,search:t.value}})};return(g,_)=>{const I=F,L=E,U=R,B=X,C=W;return T(),A("div",Y,[h("div",Z,[h("form",{onSubmit:O(a,["prevent"]),class:"d-flex mt-4 mt-md-0"},[o(I,{class:"search__input me-2",placeholder:"Search by trasnactiion ID, wallet ID, username or amount",modelValue:u(t),"onUpdate:modelValue":_[0]||(_[0]=i=>N(t)?t.value=i:t=i)},null,8,["modelValue"]),o(U,{color:"dark",type:"submit"},{default:x(()=>[o(L,{name:"material-symbols:search"})]),_:1})],40,ee)]),h("div",te,[o(C,{bodyClasses:"mt-2"},{body:x(()=>{var i,w,q,V,k;return[o(B,{pending:u(y),transactions:(i=u(l))==null?void 0:i.data,page:(q=(w=u(l))==null?void 0:w.meta)==null?void 0:q.current_page,total:(k=(V=u(l))==null?void 0:V.meta)==null?void 0:k.total},null,8,["pending","transactions","page","total"])]}),_:1})])])}}},pe=z(ae,[["__scopeId","data-v-3112cd44"]]);export{pe as default};
