import{d as w,b4 as z,kR as T,r as b,kS as o,j as r,B as F,T as l}from"./index-dc933734.js";import{c as U,b as u,k as y,u as B}from"./index.esm-288e984c.js";import{T as L}from"./index-ad373baf.js";import{o as N}from"./yup-5b2e0cf9.js";import{T as k}from"./TopComponent-bb43a12c.js";import"./TableRow-f425a931.js";import"./useMediaQuery-c00165e7.js";import"./TableContainer-dd105b51.js";import"./TableHead-2909bf19.js";import"./Grow-3459ea54.js";import"./TablePagination-4ad2d9ff.js";import"./Select-e75c6695.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-e096ea37.js";import"./Toolbar-e48cc4d1.js";import"./MenuItem-03911a3a.js";import"./dividerClasses-75377d2f.js";import"./listItemTextClasses-436d31bc.js";import"./GenericThumbnailView-69a8725b.js";import"./index-9b86adbc.js";import"./popper-f3391c26.js";import"./InputAdornment-a4d846b9.js";import"./TextField-a8016ff3.js";import"./isMuiElement-f75ebb7c.js";import"./ScrollableList-c8354e44.js";import"./CircularProgress-b8ef250f.js";import"./componentStyles-4df963a1.js";import"./PageBreadCrumb-e8300c1b.js";import"./PageMetaData-7ff53e2b.js";import"./TextArea-80ac5c9b.js";import"./Grid2-9337452f.js";import"./FilterFilled-5453348f.js";import"./AntdIcon-bb02d05f.js";import"./objectSpread2-d52818a5.js";import"./FilterOutlined-7e274bb4.js";const Pe=()=>{const a=w(),c=z(),{loggedUsers:{list:d,pageParams:t,loading:h,count:g,selectedData:q},system:{userAccessList:A}}=T(),x=[{title:"S.No"},{title:"UserName"},{title:"Full Name"},{title:"Email"},{title:"Phone"},{title:"Group",width:100}];function f(e,s,n,i,p,m){return{index:e,username:s,fullname:n,email:i,phone:p,group:m}}const P=d.map((e,s)=>{var p;const n=(t.page-1)*t.page_size+(s+1),i=(p=e==null?void 0:e.groups)==null?void 0:p.map(m=>m).join(", ");return console.log(i),f(n,e.username||"",e.full_name||"",e.email||"",e.phone||"",i||"")}),_=({search:e})=>{a(o({...t,search:e||"",page:1,page_size:10}))},j=(e,s)=>{a(o({...t,search:"",page:s+1}))},C=e=>{a(o({...t,search:"",page:1,page_size:parseInt(e.target.value)}))};b.useEffect(()=>{a(o({...t,search:"",page:1,page_size:10})),c.setTitle("Logged Users"),c.setSubtitle("Settings")},[]);const S=U().shape({newPassword:u().min(8,"Password must be at least 8 characters long").required("New Password is required"),confirmPassword:u().oneOf([y("newPassword"),""],"Passwords must match").required("Confirm Password is required")});B({resolver:N(S)});const v=e=>{const s=e.target.value;a(o({...t,search:s||"",page:1,page_size:10}))};return r.jsxs(r.Fragment,{children:[r.jsx(k,{permissionPreFix:"core_users",permissionPostFix:"current_logged_users",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:_,handleInputChange:v,children:r.jsxs(F,{sx:{display:"flex",gap:2},children:[r.jsx(l,{variant:"h4",children:" Count"}),r.jsx(l,{variant:"subtitle1",color:"primary",children:g})]})}),r.jsx(L,{count:g,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:j,handleChangeRowsPerPage:C})]})};export{Pe as default};
