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,kH as v,b as B,kI as p}from"./index-83d9c1e2.js";import{T as E}from"./TopComponent-63d5a830.js";import{T,t as c,a as b}from"./TableRow-1c35ea2a.js";import{T as R}from"./TableContainer-98997305.js";import{T as _,a as z,b as U}from"./TableHead-95baa189.js";import{E as D}from"./ExpandLess-ea07f706.js";import{E as O}from"./ExpandMore-c522de8d.js";import{C as F}from"./CardContent-fb0d7247.js";import{T as I}from"./TablePagination-81b30c1b.js";import"./yup-dfe9f223.js";import"./index.esm-82874186.js";import"./GenericThumbnailView-ceecb14e.js";import"./index-1ceef347.js";import"./popper-f3391c26.js";import"./Select-1505055e.js";import"./index-e5978b8b.js";import"./Grow-6cc6748b.js";import"./InputAdornment-4b0a9854.js";import"./TextField-39c52322.js";import"./isMuiElement-5c2699ea.js";import"./ScrollableList-2bb71a63.js";import"./CircularProgress-3ce9da74.js";import"./componentStyles-7858e543.js";import"./PageBreadCrumb-6e858b55.js";import"./PageMetaData-1fb92714.js";import"./TextArea-7d949f4d.js";import"./Grid2-78565a55.js";import"./FilterFilled-eb3492a9.js";import"./AntdIcon-f9724de9.js";import"./objectSpread2-e5f2d908.js";import"./FilterOutlined-d00fec62.js";import"./KeyboardArrowRight-b7bab219.js";import"./Toolbar-25a41873.js";import"./MenuItem-26e66f0f.js";import"./dividerClasses-f18f0f93.js";import"./listItemTextClasses-fcd068d2.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"}})),$=({data:r,pageParams:i})=>{const[d,x]=C.useState(null),a=o=>{x(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,g)=>{var l;const m=(i.page-1)*i.page_size+(g+1);return e.jsxs(e.Fragment,{children:[e.jsxs(b,{children:[e.jsx(s,{children:m}),e.jsx(s,{children:o.record_code}),e.jsx(s,{children:o.type_name}),e.jsx(s,{children:o.tablename}),e.jsx(s,{children:(l=o==null?void 0:o.user)==null?void 0:l.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 Se(){const r=A(),i=L(),{manageUser:{userAuditCount:d,userAuditList:x,userAuditParams:a,auditLoading:n},system:{userAccessList:o}}=k(t=>({manageUser:v(t),system:B(t)})),g=({search:t})=>{r(p({...a,search:t||"",page:1,page_size:10}))},m=(t,u)=>{r(p({...a,page:u+1}))},l=t=>{r(p({...a,page:1,page_size:parseInt(t.target.value)}))};return C.useEffect(()=>{r(p({...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:g,filteredData:a}),e.jsx($,{data:x,pageParams:a}),e.jsx(I,{rowsPerPageOptions:[10,20,50,100,{label:"All",value:-1}],component:"div",count:d,rowsPerPage:a.page_size,page:a.page-1,onPageChange:m,onRowsPerPageChange:l})]})}export{Se as default};
