import{f,r as C,j as e,P as w,I as S,C as y,a2 as P,T as h,B as j,d as A,b4 as L,a as k,kM as v,b as B,kN as l}from"./index-858224db.js";import{T as E}from"./TopComponent-e6610146.js";import{T,t as c,a as b}from"./TableRow-ef998644.js";import{T as R}from"./TableContainer-0664e137.js";import{T as _,a as z,b as U}from"./TableHead-cf76ecee.js";import{E as D}from"./ExpandLess-47b3950d.js";import{E as O}from"./ExpandMore-ec77ed9d.js";import{C as F}from"./CardContent-0d2efdc7.js";import{T as M}from"./TablePagination-4cf72ac4.js";import"./yup-9213c3af.js";import"./index.esm-241dec99.js";import"./GenericThumbnailView-2d7b7363.js";import"./index-9223140c.js";import"./createClass-042c577b.js";import"./popper-f3391c26.js";import"./Select-8b602eed.js";import"./index-e5978b8b.js";import"./Grow-b7b43b3f.js";import"./InputAdornment-583927e5.js";import"./TextField-bbb2480f.js";import"./isMuiElement-ec705bc2.js";import"./ScrollableList-bf78e54b.js";import"./CircularProgress-5bd54bd6.js";import"./componentStyles-107bd37e.js";import"./PageBreadCrumb-57332081.js";import"./PageMetaData-69741ff8.js";import"./TextArea-78cda1eb.js";import"./Grid2-274bb638.js";import"./FilterFilled-4ddeca5a.js";import"./AntdIcon-8f3bee6f.js";import"./objectSpread2-cfd43bb2.js";import"./FilterOutlined-c1046d9f.js";import"./KeyboardArrowRight-b25c72ab.js";import"./LastPage-c7260b25.js";import"./Toolbar-9be5abc1.js";import"./MenuItem-bf5218a0.js";import"./dividerClasses-3bf2d765.js";import"./listItemTextClasses-ac0d77df.js";import"./listItemIconClasses-5ed9cb9d.js";const s=f(T)(({theme:r})=>({[`&.${c.head}`]:{backgroundColor:r.palette.background.paper,fontSize:"14px",textAlign:"start"},[`&.${c.body}`]:{textAlign:"start",fontSize:"14px",BorderBottom:"0.8px solid #0000004D"}})),N=({data:r,pageParams:i})=>{const[d,m]=C.useState(null),a=o=>{m(d===o?null:o)},n=["S.No","Code","Type","Table","User Name","Created On","More"];return e.jsx(R,{component:w,sx:{borderRadius:0,overflow:"hidden",boxShadow:0},children:e.jsxs(_,{children:[e.jsx(z,{children:e.jsx(b,{sx:{backgroundColor:"#f5f5f5"},children:n==null?void 0:n.map(o=>e.jsx(s,{children:o}))})}),e.jsx(U,{children:r.map((o,x)=>{var p;const g=(i.page-1)*i.page_size+(x+1);return e.jsxs(e.Fragment,{children:[e.jsxs(b,{children:[e.jsx(s,{children:g}),e.jsx(s,{children:o.record_code}),e.jsx(s,{children:o.type_name}),e.jsx(s,{children:o.tablename}),e.jsx(s,{children:(p=o==null?void 0:o.user)==null?void 0:p.username}),e.jsx(s,{children:new Date(o.created_on).toLocaleString()}),e.jsx(s,{children:e.jsx(S,{onClick:()=>a(o.id),children:d===o.id?e.jsx(D,{}):e.jsx(O,{})})})]},o.id),e.jsx(b,{children:e.jsx(s,{colSpan:n==null?void 0:n.length,sx:{padding:0},children:e.jsx(y,{in:d===o.id,timeout:"auto",unmountOnExit:!0,children:e.jsx(P,{variant:"outlined",sx:{margin:2,padding:3,backgroundColor:"#f9fafb",borderLeft:"5px solid #1976d2",boxShadow:2},children:e.jsxs(F,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"#1976d2",fontWeight:"bold"},children:"Log Data"}),e.jsx(j,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:2},children:Object.entries(o.log_data).map(([t,u])=>e.jsxs(j,{sx:{padding:1,backgroundColor:"white",borderRadius:1,boxShadow:1},children:[e.jsxs(h,{variant:"body2",sx:{fontWeight:"bold",color:"#555"},children:[t,":"]}),e.jsx(h,{variant:"body2",sx:{color:"#333",wordWrap:"break-word"},children:String(u)})]},t))})]})})})})})]})})})]})})};f(T)(({theme:r})=>({[`&.${c.head}`]:{backgroundColor:r.palette.grey[100],color:r.palette.primary},[`&.${c.body}`]:{fontSize:14}}));function Ae(){const r=A(),i=L(),{manageUser:{userAuditCount:d,userAuditList:m,userAuditParams:a,auditLoading:n},system:{userAccessList:o}}=k(t=>({manageUser:v(t),system:B(t)})),x=({search:t})=>{r(l({...a,search:t||"",page:1,page_size:10}))},g=(t,u)=>{r(l({...a,page:u+1}))},p=t=>{r(l({...a,page:1,page_size:parseInt(t.target.value)}))};return C.useEffect(()=>{r(l({...a,search:"",page:1,page_size:10})),i.setTitle("Audit"),i.setSubtitle("Settings")},[]),e.jsxs(j,{children:[e.jsx(E,{permissionPreFix:"System",permissionPostFix:"user",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:x,filteredData:a}),e.jsx(N,{data:m,pageParams:a}),e.jsx(M,{rowsPerPageOptions:[10,20,50,100,{label:"All",value:-1}],component:"div",count:d,rowsPerPage:a.page_size,page:a.page-1,onPageChange:g,onRowsPerPageChange:p})]})}export{Ae as default};
