import{r as n,j as e}from"./login-aN2dRsX6.js";import{c as f}from"./api_laporan-C-kpoJQw.js";import{B as b}from"./button_submit-wN0ayemz.js";import{S as g}from"./Select-B6FG_hRH.js";import{S as w}from"./SelectProdukDeposito-Ct3_Prbe.js";import{a as v,b as p,f as j}from"./index-26bvdVY4.js";import{M as i}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 u=[{label:"1 : Aktif",value:"1"},{label:"3 : Tutup",value:"3"}];function I(){const[s,r]=n.useState({status:1}),a=y(),d=n.useCallback(async()=>{const o=await(await f(s)).json();console.log(o),a.open(o,s)},[s,a]);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 Deposito"})}),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:"Jangka Waktu"}),e.jsx("div",{className:"col-md-8",children:e.jsx(w,{value:s.produk??"",onChange:l=>{r(l?{...s,produk:l}:{...s,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(g,{options:u,placeholder:"Pilih Status",value:u.find(l=>l.value===String(s.status)),onChange:l=>{r(l?{...s,status:Number(l.value)}:{...s,status:void 0})}})})]})]}),e.jsx("div",{className:"card-footer py-3 justify-content-end d-flex bg-transparent",children:e.jsx(b,{className:"btn btn-primary",onClick:async()=>d(),children:"Sumbit"})})]})})}),a.modal]})}const y=()=>{const[s,r]=n.useState(!1),[a,d]=n.useState([]),[l,o]=n.useState(),N=(t,c)=>{o(c),d(t),r(!0)},h=()=>r(!1);return{modal:n.useMemo(()=>e.jsxs(i,{show:s,onHide:h,fullscreen:!0,children:[e.jsx(i.Header,{closeButton:!0,children:e.jsx("h6",{className:"m-0",children:"Laporan Deposito"})}),e.jsx(i.Body,{className:"bg-secondary",children:e.jsxs("div",{className:"bg-white p-3 container",style:{width:1024},children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h6",{className:"fw-bold",children:"Laporan Nominatif Deposito"}),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",style:{width:120},children:"Rekening"}),e.jsx("th",{className:"text-center",style:{width:150},children:"Produk"}),e.jsx("th",{className:"text-center",children:"Anggota"}),e.jsx("th",{className:"text-center",style:{width:120},children:"Nilai Valuta"}),e.jsx("th",{className:"text-center",style:{width:120},children:"Tgl Valuta"}),e.jsx("th",{className:"text-center",style:{width:80},children:"Jkw"}),e.jsx("th",{className:"text-center",style:{width:120},children:"Tgl Jth Tempo"})]})}),e.jsx("tbody",{children:a==null?void 0:a.map((t,c)=>{var m,x;return e.jsxs("tr",{children:[e.jsx("td",{width:120,className:"text-center",children:t.rekening}),e.jsx("td",{width:150,className:"text-center",children:(m=t.produk)==null?void 0:m.nama}),e.jsx("td",{children:(x=t.anggota)==null?void 0:x.nama_lengkap}),e.jsx("td",{width:120,className:"text-end",children:p(t.nilai_valuta)}),e.jsx("td",{width:120,className:"text-center",children:j(t.tgl_valuta)}),e.jsx("td",{width:80,className:"text-center",children:t.jkw}),e.jsx("td",{width:120,className:"text-center",children:j(t.tgl_jatuh_tempo)})]},t.rekening||c)})}),e.jsx("tfoot",{children:e.jsxs("tr",{className:"bg-light",children:[e.jsx("td",{colSpan:3,className:"fw-bold text-end",children:"Total"}),e.jsx("td",{className:"fw-bold text-end",children:p(a.reduce((t,c)=>t+(c.nilai_valuta??0),0))}),e.jsx("td",{}),e.jsx("td",{}),e.jsx("td",{})]})})]})]})}),e.jsx(i.Footer,{})]}),[a,s]),open:N,close:h}};export{I as default};
