import{r as n,j as a}from"./login-aN2dRsX6.js";import{b as h,a as x}from"./api_laporan-C-kpoJQw.js";import{B as f}from"./button_submit-wN0ayemz.js";import{S as N}from"./Select-B6FG_hRH.js";import{f as g}from"./index-26bvdVY4.js";import{M as t}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";const u=[{label:"1 : Neraca",value:"1"},{label:"2 : Laba Rugi",value:"2"}];function E(){const[e,r]=n.useState({tanggal:g(new Date)}),l=b(),c=L(),d=n.useCallback(async()=>{if(e.jenis=="1"){const o=await(await h(e)).json();console.log(o),l.open(o,e)}if(e.jenis=="2"){const o=await(await x(e)).json();console.log(o),c.open(o,e)}},[e,c,l]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{children:a.jsx("div",{className:"container",style:{width:640},children:a.jsxs("div",{className:"card rounded-4 shadow-lg",children:[a.jsx("div",{className:"card-header py-3 bg-transparent",children:a.jsx("h5",{className:"m-0",children:"Laporan Akuntansi"})}),a.jsxs("div",{className:"card-body",children:[a.jsxs("div",{className:"row mb-2",children:[a.jsx("label",{className:"col-form-label col-md-4",children:"Jenis Laporan"}),a.jsx("div",{className:"col-md-8",children:a.jsx(N,{options:u,placeholder:"Pilih Jenis Laporan",value:u.find(s=>s.value==String(e.jenis)),onChange:s=>{r(s?{...e,jenis:s.value}:{...e,jenis:void 0})}})})]}),a.jsxs("div",{className:"row",children:[a.jsx("label",{className:"col-form-label col-md-4",children:"Periode"}),a.jsx("div",{className:"col-md-5",children:a.jsx("div",{className:"input-group",children:a.jsx("input",{className:"form-control text-center",type:"date",value:e.tanggal??"",onChange:s=>{r({...e,tanggal:s.target.value})}})})})]})]}),a.jsx("div",{className:"card-footer py-3 justify-content-end d-flex bg-transparent",children:a.jsx(f,{className:"btn btn-primary",onClick:async()=>d(),children:"Sumbit"})})]})})}),l.modal,c.modal]})}const b=()=>{const[e,r]=n.useState(!1),[l,c]=n.useState([]),[d,s]=n.useState(),o=(m,p)=>{s(p),c(m),r(!0)},i=()=>r(!1);return{modal:n.useMemo(()=>a.jsxs(t,{show:e,onHide:i,fullscreen:!0,children:[a.jsx(t.Header,{closeButton:!0,children:a.jsx("h6",{className:"m-0",children:"Laporan Neraca"})}),a.jsx(t.Body,{className:"bg-secondary"}),a.jsx(t.Footer,{})]}),[l,e]),open:o,close:i}},L=()=>{const[e,r]=n.useState(!1),[l,c]=n.useState([]),[d,s]=n.useState(),o=(m,p)=>{s(p),c(m),r(!0)},i=()=>r(!1);return{modal:n.useMemo(()=>a.jsxs(t,{show:e,onHide:i,fullscreen:!0,children:[a.jsx(t.Header,{closeButton:!0,children:a.jsx("h6",{className:"m-0",children:"Laporan Laba Rugi"})}),a.jsx(t.Body,{className:"bg-secondary"}),a.jsx(t.Footer,{})]}),[l,e]),open:o,close:i}};export{E as default};
