import{r as s,c as j,b as e,a as v}from"./app-DTeOhhdM.js";import{A as w,a as i,B as y}from"./AuthenticatedLayout-DNj-hWy1.js";import{T as N}from"./toast.esm-CLj0hUIX.js";import{C as c}from"./calendar.esm-DqUk2xOX.js";import{a as S}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 J({auth:m,users:d}){const{permission:C,warehouseList:D}=s.useContext(j),[a,u]=s.useState(),[r,x]=s.useState(),[l,p]=s.useState([]),[U,k]=s.useState([]),[o,h]=s.useState([]),[A,F]=s.useState(null),b=s.useRef(null),[H,L]=s.useState({customer:""}),f=async()=>{let t=new FormData;return t.append("start",a),t.append("end",r),t.append("status",l),t.append("userId",o),(await v.post("user-activity-report-filter",t)).data},g=async()=>{const t=await f(),n=await window.generatePDFView(t,window.reportModes.activityLogColumns,!1,"User Activity History",a,r);S(n,"UserActivityHistory.pdf")};return e.jsxs(w,{user:m.user,header:e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-skin-header font-medium ",children:"User Activity History"})," ",e.jsxs("p",{className:"text-skin-sub-header font-semibold text-xs",children:[" ","Home - Report - User Activity History"]})]}),headerButton:e.jsx(e.Fragment,{}),children:[e.jsx(N,{ref:b}),e.jsx("div",{className:"card min-h-screen",children:e.jsx("div",{className:"bg-gray-100  flex items-center justify-center py-12 px-2 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"w-full max-w-5xl bg-white rounded-2xl shadow-lg border border-gray-200 p-4 sm:p-8 md:p-10",children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-center text-gray-800 mb-8 md: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 sm:col-span-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Starting Date"}),e.jsx(c,{value:a,onChange:t=>u(t.value),className:"w-full h-[41px] text-[14px] rounded-lg shadow-sm"})]}),e.jsxs("div",{className:"col-span-12 sm:col-span-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"End Date"}),e.jsx(c,{value:r,onChange:t=>x(t.value),className:"w-full h-[41px] text-[14px] rounded-lg shadow-sm"})]}),e.jsxs("div",{className:"col-span-12 sm:col-span-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Select User"}),e.jsx(i,{value:o,onChange:t=>{h(t.value)},options:d,optionLabel:"name",optionValue:"id",placeholder:"Select a User",className:"w-full h-11",filter:!0,showClear:!0})]}),e.jsxs("div",{className:"col-span-12 sm:col-span-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Select Status"}),e.jsx(i,{value:l,onChange:t=>{p(t.value)},options:[{label:"All",value:"all"},{label:"Only Login",value:"login"}],showClear:!0,optionLabel:"label",optionValue:"value",placeholder:"Select a Status",className:"w-full h-11",filter:!0})]})]}),e.jsx("div",{className:"mt-10 flex justify-center",children:e.jsx(y,{type:"button",label:"🔍 View Report",onClick:g,className:"px-6 py-3 rounded-xl bg-blue-600 text-white font-semibold shadow hover:bg-blue-700 transition duration-200 text-sm"})})]})})})]})}export{J as default};
