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-def636a4.js";import{T as _}from"./TopComponent-7f7c384d.js";import{T,t as c,a as j}from"./TableRow-2c544f58.js";import{T as R}from"./TableContainer-5944247b.js";import{T as k,a as I,b as O}from"./TableHead-f0476938.js";import{u as S}from"./index-f48c8aa0.js";import{C as U}from"./CardContent-c8b2d0af.js";import{T as D}from"./TablePagination-7d3b42e9.js";import"./yup-c8535458.js";import"./index.esm-7d9d1491.js";import"./componentStyles-41382c67.js";import"./floating-ui.dom-e7d69f3b.js";import"./OutlinedInput-ddb8bb3f.js";import"./useFormControl-880b2f7b.js";import"./List-17cd485b.js";import"./InputAdornment-196a5386.js";import"./InputLabel-e2e73b27.js";/* empty css                   */import"./PageBreadCrumb-816019c3.js";import"./PageMetaData-0f9457e5.js";import"./ScrollableList-a550bc32.js";import"./Loader-16c57fae.js";import"./index.esm-eec4f448.js";import"./TextField-2ba95a45.js";import"./FormControl-1f811046.js";import"./Select-2cfb5afd.js";import"./Menu-af49d134.js";import"./Grow-85576dd3.js";import"./useControlled-bd643819.js";import"./createSvgIcon-ff487f53.js";import"./FilterFilled-08c5b5a7.js";import"./AntdIcon-34324527.js";import"./objectSpread2-a4d0f5f6.js";import"./presets-dbb0f3bf.js";import"./FilterOutlined-03ee9578.js";import"./useMediaQuery-4304fb25.js";import"./MenuItem-8fdd2340.js";import"./dividerClasses-2b953c2a.js";import"./listItemTextClasses-063fcacf.js";import"./KeyboardArrowRight-bfb3d848.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};
