import{d as v,b4 as w,kS as z,r as b,kT as o,j as r,B as F,T as l}from"./index-83d9c1e2.js";import{c as U,b as u,k as y,u as B}from"./index.esm-82874186.js";import{T as L}from"./index-cc00c6a4.js";import{o as N}from"./yup-dfe9f223.js";import{T as k}from"./TopComponent-63d5a830.js";import"./TableRow-1c35ea2a.js";import"./useMediaQuery-c67ad591.js";import"./TableContainer-98997305.js";import"./TableHead-95baa189.js";import"./Grow-6cc6748b.js";import"./TablePagination-81b30c1b.js";import"./Select-1505055e.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-b7bab219.js";import"./Toolbar-25a41873.js";import"./MenuItem-26e66f0f.js";import"./dividerClasses-f18f0f93.js";import"./listItemTextClasses-fcd068d2.js";import"./GenericThumbnailView-ceecb14e.js";import"./index-1ceef347.js";import"./popper-f3391c26.js";import"./InputAdornment-4b0a9854.js";import"./TextField-39c52322.js";import"./isMuiElement-5c2699ea.js";import"./ScrollableList-2bb71a63.js";import"./CircularProgress-3ce9da74.js";import"./componentStyles-7858e543.js";import"./PageBreadCrumb-6e858b55.js";import"./PageMetaData-1fb92714.js";import"./TextArea-7d949f4d.js";import"./Grid2-78565a55.js";import"./FilterFilled-eb3492a9.js";import"./AntdIcon-f9724de9.js";import"./objectSpread2-e5f2d908.js";import"./FilterOutlined-d00fec62.js";const Pe=()=>{const a=v(),c=w(),{loggedUsers:{list:d,pageParams:t,loading:h,count:g,selectedData:q},system:{userAccessList:A}}=z(),x=[{title:"S.No"},{title:"UserName"},{title:"Full Name"},{title:"Email"},{title:"Phone"},{title:"Group",width:100}];function f(e,s,p,n,i,m){return{index:e,username:s,fullname:p,email:n,phone:i,group:m}}const P=d.map((e,s)=>{var i;const p=(t.page-1)*t.page_size+(s+1),n=(i=e==null?void 0:e.groups)==null?void 0:i.map(m=>m).join(", ");return f(p,e.username||"",e.full_name||"",e.email||"",e.phone||"",n||"")}),_=({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 T=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:T,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};
