import{r as l,j as e}from"./login-aN2dRsX6.js";import{f as N}from"./api_laporan-C-kpoJQw.js";import{B as g}from"./button_submit-wN0ayemz.js";import{S as f}from"./Select-B6FG_hRH.js";import{S}from"./SelectProdukTabungan-2_58_DnQ.js";import{a as v,b as p,f as w}from"./index-26bvdVY4.js";import{M as d}from"./Modal-Dn58D0E5.js";import"./ThemeProvider-Cx_yflmw.js";import"./defineProperty-DRmM3rRU.js";import"./typeof-QjJsDpFa.js";import"./setPrototypeOf-B4fUID9J.js";import"./index-Ci65TyJp.js";import"./app-gmlkJjeD.js";import"./floating-ui.dom-C5vApqfE.js";import"./query-c3dDncii.js";const j=[{label:"1 : Aktif",value:"1"},{label:"3 : Tutup",value:"3"}];function $(){const[a,r]=l.useState({}),t=k(),i=l.useCallback(async()=>{const o=await(await N(a)).json();console.log(o),t.open(o,a)},[a,t]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsx("div",{className:"container",style:{width:640},children:e.jsxs("div",{className:"card rounded-4 shadow-lg",children:[e.jsx("div",{className:"card-header py-3 bg-transparent",children:e.jsx("h5",{className:"m-0",children:"Laporan Tabungan"})}),e.jsxs("div",{className:"card-body",children:[e.jsxs("div",{className:"row mb-2",children:[e.jsx("label",{className:"col-form-label col-md-4",children:"Produk"}),e.jsx("div",{className:"col-md-8",children:e.jsx(S,{value:a.produk??"",onChange:n=>{r(n?{...a,produk:n}:{...a,produk:void 0})}})})]}),e.jsxs("div",{className:"row mb-2",children:[e.jsx("label",{className:"col-form-label col-md-4",children:"Status"}),e.jsx("div",{className:"col-md-8",children:e.jsx(f,{options:j,placeholder:"Pilih Status",value:j.find(n=>n.value===String(a.status)),onChange:n=>{r(n?{...a,status:Number(n.value)}:{...a,status:void 0})}})})]})]}),e.jsx("div",{className:"card-footer py-3 justify-content-end d-flex bg-transparent",children:e.jsx(g,{className:"btn btn-primary",onClick:async()=>i(),children:"Sumbit"})})]})})}),t.modal]})}const k=()=>{const[a,r]=l.useState(!1),[t,i]=l.useState([]),[n,o]=l.useState(),b=(s,c)=>{o(c),i(s),r(!0)},m=()=>r(!1);return{modal:l.useMemo(()=>e.jsxs(d,{show:a,onHide:m,fullscreen:!0,children:[e.jsx(d.Header,{closeButton:!0,children:e.jsx("h6",{className:"m-0",children:"Laporan Tabungan"})}),e.jsx(d.Body,{className:"bg-secondary",children:e.jsxs("div",{className:"bg-white p-3 container",style:{width:1024},children:[e.jsxs("div",{className:"text-center mb-3",children:[e.jsx("h6",{className:"fw-bold",children:"Laporan Nominatif Tabungan"}),e.jsxs("h6",{children:["Periode ",v(new Date().toDateString())]})]}),e.jsxs("table",{className:"table-bordered table-sm table",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-light",children:[e.jsx("th",{className:"text-center",children:"Rekening"}),e.jsx("th",{className:"text-center",children:"Produk"}),e.jsx("th",{className:"text-center",children:"Anggota"}),e.jsx("th",{className:"text-center",children:"Saldo"}),e.jsx("th",{className:"text-center",children:"Tgl Buka"})]})}),e.jsx("tbody",{children:t==null?void 0:t.map((s,c)=>{var h,x,u;return e.jsxs("tr",{children:[e.jsx("td",{width:120,className:"text-center",children:s.rekening}),e.jsx("td",{width:200,className:"text-center",children:`${(h=s.produk)==null?void 0:h.id} : ${(x=s.produk)==null?void 0:x.nama}`}),e.jsx("td",{children:(u=s.anggota)==null?void 0:u.nama_lengkap}),e.jsx("td",{width:120,className:"text-end",children:p(s.saldo)}),e.jsx("td",{width:120,className:"text-center",children:w(s.tgl_buka)})]},s.rekening||c)})}),e.jsx("tfoot",{children:e.jsxs("tr",{className:"bg-light",children:[e.jsx("td",{colSpan:3,className:"text-end fw-bold",children:"Total"}),e.jsx("td",{className:"text-end fw-bold",children:p(t.reduce((s,c)=>s+(c.saldo??0),0))}),e.jsx("td",{})]})})]})]})}),e.jsx(d.Footer,{})]}),[t,a]),open:b,close:m}};export{$ as default};
