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-43bf7a1c.js";import{T as _}from"./TopComponent-6b8acdbd.js";import{T,t as c,a as j}from"./TableRow-86264944.js";import{T as R}from"./TableContainer-b977c6cc.js";import{T as k,a as I,b as O}from"./TableHead-fb4972c5.js";import{u as S}from"./index-913b2dc6.js";import{C as U}from"./CardContent-69a98a60.js";import{T as D}from"./TablePagination-9147f93d.js";import"./yup-3b80ed10.js";import"./index.esm-0548c843.js";import"./componentStyles-4624000e.js";import"./floating-ui.dom-e7d69f3b.js";import"./OutlinedInput-6bcf3cf8.js";import"./useFormControl-2c5d60c2.js";import"./List-6fcc4821.js";import"./InputAdornment-b1a1aa58.js";import"./InputLabel-6c7474f0.js";/* empty css                   */import"./PageBreadCrumb-9a31a3c1.js";import"./PageMetaData-7350980e.js";import"./ScrollableList-e19132c3.js";import"./Loader-aabe9ed3.js";import"./index.esm-f9e0a906.js";import"./TextField-4da97115.js";import"./FormControl-8d011aab.js";import"./Select-44fd3147.js";import"./Menu-362130d3.js";import"./Grow-ca573f65.js";import"./useControlled-ab567149.js";import"./createSvgIcon-f118be02.js";import"./FilterFilled-ccc86e02.js";import"./AntdIcon-634507e8.js";import"./objectSpread2-c31b885b.js";import"./presets-bb9bdfd8.js";import"./FilterOutlined-908c8e25.js";import"./useMediaQuery-d6627623.js";import"./MenuItem-58b8887e.js";import"./dividerClasses-497df10c.js";import"./listItemTextClasses-0ea25cee.js";import"./KeyboardArrowRight-8bd7c13f.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};
