import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{s as r}from"./index-Dg6GjGgP.js";import{n as i,t as a}from"./AuditReportFilterBar-NfHzYNkm.js";var o=e(t(),1),s=e(n(),1),c=[{key:`date_from`,label:`From Date`,type:`date`},{key:`date_to`,label:`To Date`,type:`date`},{key:`username`,label:`Username`,type:`user_select`}];function l(){let{data:e,loading:t,error:n,applyFilters:l}=i(r.getUserActivity,[]);return(0,o.useEffect)(()=>{l({})},[]),(0,s.jsxs)(`div`,{className:`flex flex-col h-full p-4 gap-2`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-1 text-sm border-b pb-2 mb-2`,children:[(0,s.jsx)(`span`,{className:`text-muted-foreground`,children:`Audit`}),(0,s.jsx)(`span`,{className:`text-muted-foreground mx-1`,children:`/`}),(0,s.jsx)(`span`,{className:`font-semibold`,children:`User Activity Summary`}),e.length>0&&(0,s.jsxs)(`span`,{className:`ml-auto text-muted-foreground text-xs`,children:[e.length,` users`]})]}),(0,s.jsx)(a,{filters:c,onApply:l,loading:t}),n&&(0,s.jsx)(`div`,{className:`text-sm text-destructive bg-destructive/10 rounded p-3`,children:n}),(0,s.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,s.jsxs)(`table`,{className:`w-full text-xs border-collapse`,children:[(0,s.jsx)(`thead`,{className:`sticky top-0 z-10 bg-slate-700 text-white`,children:(0,s.jsx)(`tr`,{children:[`Username`,`Total`,`Creates`,`Updates`,`Deletes`,`Posts`,`Approvals`,`Last Action`].map(e=>(0,s.jsx)(`th`,{className:`px-3 py-2 text-left border border-slate-600 whitespace-nowrap font-medium`,children:e},e))})}),(0,s.jsxs)(`tbody`,{children:[e.length===0&&!t&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:8,className:`text-center py-8 text-muted-foreground`,children:`No data found`})}),e.map((e,t)=>(0,s.jsxs)(`tr`,{className:t%2==0?`bg-white hover:bg-slate-50`:`bg-slate-50 hover:bg-slate-100`,children:[(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 font-medium`,children:e.username}),(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 text-center font-semibold`,children:e.total_actions}),(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 text-center text-emerald-700`,children:e.creates}),(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 text-center text-amber-700`,children:e.updates}),(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 text-center text-rose-700`,children:e.deletes}),(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 text-center`,children:e.posts}),(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 text-center text-blue-700`,children:e.approvals}),(0,s.jsx)(`td`,{className:`px-3 py-1.5 border border-slate-200 whitespace-nowrap text-muted-foreground`,children:e.last_action?.slice(0,19).replace(`T`,` `)||`—`})]},e.username))]})]})})]})}export{l as default};