import{r as t,c as f,b as e,a as b}from"./app-DTeOhhdM.js";import{A as j}from"./AuthenticatedLayout-DNj-hWy1.js";import{T as w}from"./toast.esm-CLj0hUIX.js";import{C as d}from"./calendar.esm-DqUk2xOX.js";import{a as N}from"./helper-Gzy5oJm-.js";import"./createLucideIcon-0QtVMxKe.js";import"./defualtLogo-C0dU5cUD.js";import"./index.esm-xhUioO7y.js";import"./index.esm-DydXoyuW.js";import"./index.esm-BlFJNgmX.js";import"./inputtext.esm-DvYkLvTo.js";import"./asyncToGenerator-BfWTt6ZC.js";function V({auth:i}){const{permission:c,warehouseList:v}=t.useContext(f),[a,p]=t.useState(),[r,m]=t.useState(),[y,u]=t.useState([]),x=t.useRef(null),[n,o]=t.useState(!1);t.useEffect(()=>{c.includes("report_super_admin_access")||u(i.user.shop_id)},[]);const h=async()=>{o(!0);let s=new FormData;return s.append("start",a),s.append("end",r),(await b.post("supplier-opening-search-report",s)).data},g=async()=>{const s=await h(),l=await window.generatePDFView(s,window.reportModes.supplierOpening,!1,"Supplier Account Opening",a,r);N(l,"SupplierOpening.pdf"),o(!1)};return e.jsxs(j,{user:i.user,header:e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-skin-header font-medium ",children:"Supplier Account Opening"})," ",e.jsxs("p",{className:"text-skin-sub-header font-semibold text-xs",children:[" ","Home - SupplierAccountOpening"]})]}),headerButton:e.jsx(e.Fragment,{}),children:[e.jsx(w,{ref:x}),e.jsx("div",{className:"card p-5",children:e.jsx("div",{className:"min-h-screen  bg-gray-100  py-12 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-5xl mx-auto bg-white rounded-2xl shadow-lg p-10 border border-gray-200",children:[e.jsx("h2",{className:"text-3xl font-bold text-center text-gray-800 mb-10 tracking-tight",children:"Filter Report Criteria"}),e.jsxs("div",{className:"grid  grid-cols-12  gap-6",children:[e.jsxs("div",{className:"col-span-12 md:col-span-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Starting Date"}),e.jsx(d,{value:a,onChange:s=>{p(s.value)},className:"w-full rounded-lg shadow-sm focus:ring-2 focus:ring-blue-300"})]}),e.jsxs("div",{className:"col-span-12 md:col-span-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"End Date"}),e.jsx(d,{value:r,onChange:s=>{m(s.value)},className:"w-full rounded-lg shadow-sm focus:ring-2 focus:ring-blue-300"})]})]}),e.jsx("div",{className:"mt-10 flex justify-center",children:e.jsx("button",{type:"button",onClick:g,disabled:n,className:`px-6 py-3 rounded-xl font-semibold text-sm min-w-[160px] flex items-center justify-center gap-2 transition duration-200
                    ${n?"bg-blue-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}
                    text-white shadow-md`,children:n?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium",children:"Generating..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"img","aria-label":"View Report",children:"🔍"}),"View Report"]})})})]})})})]})}export{V as default};
