import{r as l,j as a}from"./login-aN2dRsX6.js";import{p as k,v as f}from"./query-c3dDncii.js";import{D as v}from"./DataTable-D2rA17vR.js";import{S as w}from"./SelectProdukTabungan-2_58_DnQ.js";import{M as u}from"./Modal-Dn58D0E5.js";const C=({onSelected:r})=>{const[c,g]=l.useState(!1),[t,x]=l.useState(),m=k(),b=()=>{g(!0)},s=()=>{g(!1)},p=l.useMemo(()=>[{label:a.jsx("center",{children:"Rekening"}),width:120,align:"center",value:e=>e.rekening},{label:a.jsx("center",{children:"Produk"}),align:"center",width:200,value:e=>{var n;return(n=e.produk)==null?void 0:n.nama}},{label:"Nama Anggota",value:e=>{var n;return(n=e.anggota)==null?void 0:n.nama_lengkap}},{label:"Alamat",value:e=>{var n;return(n=e.anggota)==null?void 0:n.alamat}},{label:a.jsx("center",{}),width:80,align:"center",value:e=>a.jsx("span",{className:"badge text-bg-primary c-pointer",onClick:()=>{s(),r==null||r(e)},children:"Pilih"})}],[r]),o=f();return{modal:l.useMemo(()=>{var e,n;return a.jsxs(u,{show:c,onHide:s,size:"xl",children:[a.jsx(u.Header,{closeButton:!0,children:a.jsx("h5",{className:"m-0",children:"Daftar Tabungan"})}),a.jsx(u.Body,{children:a.jsx(v,{data:((e=o.data)==null?void 0:e.filter(d=>{var i;return t?((i=d.produk)==null?void 0:i.id)==t.id:!0}))??[],column:p,search:!0,pagination:!0,item_per_page:10,loading:o.isLoading,buttons:a.jsx("div",{style:{width:300},children:a.jsx(w,{value:(n=t==null?void 0:t.id)==null?void 0:n.toString(),onChange:d=>{var h;const i=(h=m.data)==null?void 0:h.find(j=>j.id==parseInt(d));x(i)}})})})}),a.jsx(u.Footer,{children:a.jsx("button",{className:"btn btn-primary",onClick:s,children:"Tutup"})})]})},[c,o.data,o.isLoading,p,t,m.data]),open:b,close:s}};export{C as u};
