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,b6 as L,a as v,lo as B,b as E,lp as l}from"./index-e972fa8e.js";import{T as R}from"./TopComponent-f908b1e2.js";import{T,t as c,a as b}from"./TableRow-c60adf0a.js";import{T as _}from"./TableContainer-ad9de4b5.js";import{T as k,a as z,b as U}from"./TableHead-11d85aea.js";import{E as D}from"./ExpandLess-bb8b5e45.js";import{E as O}from"./ExpandMore-fafca872.js";import{C as F}from"./CardContent-4b9f1338.js";import{T as $}from"./TablePagination-63dde5fc.js";import"./yup-b3178c01.js";import"./index.esm-b3c20f6d.js";import"./GenericThumbnailView-38007944.js";import"./index-44db81fe.js";import"./createClass-8ffbea6f.js";import"./popper-f3391c26.js";import"./Select-a2938be0.js";import"./index-e5978b8b.js";import"./Grow-0b3a9797.js";import"./InputAdornment-acd34c72.js";import"./TextField-77f9d647.js";import"./isMuiElement-fab695f8.js";import"./ScrollableList-4768c2b7.js";import"./CircularProgress-58819244.js";import"./componentStyles-7142291f.js";import"./PageBreadCrumb-bc440201.js";import"./PageMetaData-c3c9cb80.js";import"./TextArea-6c7f39e1.js";import"./Grid2-936c64bd.js";import"./Badge-ea57b795.js";import"./FilterFilled-61dd8e74.js";import"./AntdIcon-c86cb7c3.js";import"./objectSpread2-5ffd54f7.js";import"./FilterOutlined-aeeaa696.js";import"./KeyboardArrowRight-4b11e6b9.js";import"./LastPage-69d51b6f.js";import"./Toolbar-fca75f8a.js";import"./MenuItem-fab52ff5.js";import"./dividerClasses-b771f620.js";import"./listItemTextClasses-f7cdafa8.js";import"./listItemIconClasses-bcb38dc7.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,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(_,{component:w,sx:{borderRadius:0,overflow:"hidden",boxShadow:0},children:e.jsxs(k,{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 Le(){const r=A(),i=L(),{manageUser:{userAuditCount:d,userAuditList:m,userAuditParams:a,auditLoading:n},system:{userAccessList:o}}=v(t=>({manageUser:B(t),system:E(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(R,{permissionPreFix:"System",permissionPostFix:"user",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:x,filteredData:a}),e.jsx(I,{data:m,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:p})]})}export{Le as default};
