import{j as e,d as f,r as C,W as w,I as y,fy as P,_ as A,T as h,B as b,b as L,e8 as v,a as z,sI as B,h as E,sJ as l}from"./index-76d4793e.js";import{T as _}from"./TopComponent-82b1f250.js";import{T,t as c,a as j}from"./TableRow-736f36bd.js";import{T as R}from"./TableContainer-4147c2f3.js";import{T as k,a as I,b as U}from"./TableHead-c6031541.js";import{u as S}from"./index-ecea5cfc.js";import{C as D}from"./CardContent-2f10f9e9.js";import{T as M}from"./TablePagination-5e47b2d0.js";import"./yup-688ec4f6.js";import"./index.esm-3adfd9f7.js";import"./componentStyles-0803b39e.js";import"./floating-ui.dom-e7d69f3b.js";import"./OutlinedInput-ac933786.js";import"./useFormControl-c8d490e1.js";import"./List-4c24b3e8.js";import"./InputAdornment-b99403ce.js";import"./InputLabel-5ed57f0e.js";/* empty css                   */import"./PageBreadCrumb-465f4085.js";import"./PageMetaData-e5080ba8.js";import"./ScrollableList-4dae3697.js";import"./Loader-9f443a4c.js";import"./index.esm-ad8a7c9f.js";import"./TextField-9c64a4a2.js";import"./FormControl-c671c595.js";import"./Select-338083eb.js";import"./Menu-ed7c6894.js";import"./Grow-84b30c0e.js";import"./useControlled-e03384de.js";import"./createSvgIcon-01ec10fc.js";import"./FilterFilled-aa7d40e4.js";import"./AntdIcon-55dc1b5f.js";import"./objectSpread2-51b6810f.js";import"./FilterOutlined-91aa15e3.js";import"./useMediaQuery-8cb39c65.js";import"./MenuItem-cff1abce.js";import"./dividerClasses-45958eb8.js";import"./listItemTextClasses-89e7894e.js";import"./KeyboardArrowRight-8920e265.js";const O=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"}})),W=({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(U,{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(O,{}):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(D,{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 Le(){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(W,{data:x,pageParams:s}),e.jsx(M,{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{Le as default};
