import{f,r as C,j as e,P as w,I as S,C as y,R as P,T as h,B as b,d as A,aV as L,a as k,ko as v,b as B,kp as p}from"./index-4dfc510b.js";import{T as R}from"./TopComponent-df931c7e.js";import{T,t as c,a as j}from"./TableRow-bee40746.js";import{T as E}from"./TableContainer-3d0f0f18.js";import{T as _,a as z,b as U}from"./TableHead-c19aff48.js";import{E as D}from"./ExpandLess-1693b0a8.js";import{E as O}from"./ExpandMore-546aeead.js";import{C as F}from"./CardContent-afcdca5e.js";import{T as $}from"./TablePagination-faf46d98.js";import"./yup-80def618.js";import"./index.esm-0a454763.js";import"./GenericThumbnailView-6256cad7.js";import"./index-9a385720.js";import"./popper-f3391c26.js";import"./Select-c8503f85.js";import"./index-e5978b8b.js";import"./Menu-0f556e12.js";import"./Grow-a7315f12.js";import"./InputAdornment-ccd6e8ff.js";import"./TextField-c0d4022e.js";import"./isMuiElement-7be61a21.js";import"./ScrollableList-bef4a518.js";import"./CircularProgress-d36b5e75.js";import"./componentStyles-df94248d.js";import"./PageBreadCrumb-59ca32fd.js";import"./PageMetaData-9d85e469.js";import"./TextArea-a0cc14f3.js";import"./Grid2-713975b3.js";import"./FilterFilled-dc66781c.js";import"./AntdIcon-90a37458.js";import"./objectSpread2-66550f90.js";import"./FilterOutlined-6c52d192.js";import"./KeyboardArrowRight-605c8352.js";import"./Toolbar-1cf142b4.js";import"./MenuItem-9737e3d9.js";import"./dividerClasses-26c2a6d6.js";import"./listItemTextClasses-e85f7ff0.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"}})),I=({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(E,{component:w,sx:{borderRadius:0,overflow:"hidden",boxShadow:0},children:e.jsxs(_,{children:[e.jsx(z,{children:e.jsx(j,{sx:{backgroundColor:"#f5f5f5"},children:n==null?void 0:n.map(o=>e.jsx(s,{children:o}))})}),e.jsx(U,{children:r.map((o,m)=>{var l;const g=(i.page-1)*i.page_size+(m+1);return e.jsxs(e.Fragment,{children:[e.jsxs(j,{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:(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(j,{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(b,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:2},children:Object.entries(o.log_data).map(([t,u])=>e.jsxs(b,{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 ye(){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)})),m=({search:t})=>{r(p({...a,search:t||"",page:1,page_size:10}))},g=(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(b,{children:[e.jsx(R,{permissionPreFix:"System",permissionPostFix:"user",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:m,filteredData:a}),e.jsx(I,{data:x,pageParams:a}),e.jsx($,{rowsPerPageOptions:[10,20,50,100,{label:"All",value:-1}],component:"div",count:d,rowsPerPage:a.page_size,page:a.page-1,onPageChange:g,onRowsPerPageChange:l})]})}export{ye as default};
