import{j as e,d as f,r as C,W as w,I as y,fI as P,_ as A,T as h,B as b,b as L,e8 as v,a as z,sN as B,h as E,sO as l}from"./index-60a3c753.js";import{T as _}from"./TopComponent-69eda74c.js";import{T,t as c,a as j}from"./TableRow-0b33776c.js";import{T as R}from"./TableContainer-414c12e0.js";import{T as k,a as I,b as O}from"./TableHead-f864c753.js";import{u as S}from"./index-900fa817.js";import{C as U}from"./CardContent-faee3650.js";import{T as D}from"./TablePagination-218dde38.js";import"./yup-92678dde.js";import"./index.esm-c494934a.js";import"./componentStyles-7753bbb9.js";import"./floating-ui.dom-e7d69f3b.js";import"./OutlinedInput-3a884178.js";import"./useFormControl-e13b5747.js";import"./List-f567f8e4.js";import"./InputAdornment-96c40dce.js";import"./InputLabel-71dfc9d4.js";/* empty css                   */import"./PageBreadCrumb-fcf1e00a.js";import"./PageMetaData-198e143e.js";import"./ScrollableList-1962b023.js";import"./Loader-466ccb5e.js";import"./index.esm-62d6b2f7.js";import"./TextField-32b29087.js";import"./FormControl-d13d2693.js";import"./Select-99fc0d84.js";import"./Menu-d1b7e1c3.js";import"./Grow-68442588.js";import"./useControlled-194ef007.js";import"./createSvgIcon-de433e5f.js";import"./FilterFilled-cdde02db.js";import"./AntdIcon-bed41c21.js";import"./objectSpread2-85813881.js";import"./presets-06d13753.js";import"./FilterOutlined-c131dc67.js";import"./useMediaQuery-dba48e3b.js";import"./MenuItem-2f410bd2.js";import"./dividerClasses-3fa67596.js";import"./listItemTextClasses-36afdb92.js";import"./KeyboardArrowRight-b2645aed.js";const M=S.createSvgIcon(e.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),F=S.createSvgIcon(e.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),a=f(T)(({theme:t})=>({[`&.${c.head}`]:{backgroundColor:t.palette.background.paper,fontSize:"14px",textAlign:"start"},[`&.${c.body}`]:{textAlign:"start",fontSize:"14px",BorderBottom:"0.8px solid #0000004D"}})),N=({data:t,pageParams:i})=>{const[d,x]=C.useState(null),s=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(k,{children:[e.jsx(I,{children:e.jsx(j,{sx:{backgroundColor:"#f5f5f5"},children:n==null?void 0:n.map(o=>e.jsx(a,{children:o}))})}),e.jsx(O,{children:t.map((o,m)=>{var p;const g=(i.page-1)*i.page_size+(m+1);return e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx(a,{children:g}),e.jsx(a,{children:o.record_code}),e.jsx(a,{children:o.type_name}),e.jsx(a,{children:o.tablename}),e.jsx(a,{children:(p=o==null?void 0:o.user)==null?void 0:p.username}),e.jsx(a,{children:new Date(o.created_on).toLocaleString()}),e.jsx(a,{children:e.jsx(y,{onClick:()=>s(o.id),children:d===o.id?e.jsx(M,{}):e.jsx(F,{})})})]},o.id),e.jsx(j,{children:e.jsx(a,{colSpan:n==null?void 0:n.length,sx:{padding:0},children:e.jsx(P,{in:d===o.id,timeout:"auto",unmountOnExit:!0,children:e.jsx(A,{variant:"outlined",sx:{margin:2,padding:3,backgroundColor:"#f9fafb",borderLeft:"5px solid #1976d2",boxShadow:2},children:e.jsxs(U,{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(([r,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:[r,":"]}),e.jsx(h,{variant:"body2",sx:{color:"#333",wordWrap:"break-word"},children:String(u)})]},r))})]})})})})})]})})})]})})};f(T)(({theme:t})=>({[`&.${c.head}`]:{backgroundColor:t.palette.grey[100],color:t.palette.primary},[`&.${c.body}`]:{fontSize:14}}));function ve(){const t=L(),i=v(),{manageUser:{userAuditCount:d,userAuditList:x,userAuditParams:s,auditLoading:n},system:{userAccessList:o}}=z(r=>({manageUser:B(r),system:E(r)})),m=({search:r})=>{t(l({...s,search:r||"",page:1,page_size:10}))},g=(r,u)=>{t(l({...s,page:u+1}))},p=r=>{t(l({...s,page:1,page_size:parseInt(r.target.value)}))};return C.useEffect(()=>{t(l({...s,search:"",page:1,page_size:10})),i.setTitle("Audit"),i.setSubtitle("Settings")},[]),e.jsxs(b,{children:[e.jsx(_,{permissionPreFix:"System",permissionPostFix:"user",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:m,filteredData:s}),e.jsx(N,{data:x,pageParams:s}),e.jsx(D,{rowsPerPageOptions:[10,20,50,100,{label:"All",value:-1}],component:"div",count:d,rowsPerPage:s.page_size,page:s.page-1,onPageChange:g,onRowsPerPageChange:p})]})}export{ve as default};
