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-ba11e6ab.js";import{c as U,b as u,k as y,u as B}from"./index.esm-39ef576a.js";import{T as L}from"./index-cbb0ce26.js";import{o as N}from"./yup-902af9ab.js";import{T as k}from"./TopComponent-c12209b5.js";import"./TableRow-e1616615.js";import"./useMediaQuery-c8eb26e5.js";import"./TableContainer-9178cc85.js";import"./TableHead-5a0d8cfc.js";import"./Grow-1038181b.js";import"./TablePagination-3b5112dd.js";import"./Select-f9434f8a.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-36117cc9.js";import"./Toolbar-c7a1b81e.js";import"./MenuItem-e4578955.js";import"./dividerClasses-ab944802.js";import"./listItemTextClasses-a4497781.js";import"./GenericThumbnailView-511a7e33.js";import"./index-33824b7d.js";import"./popper-f3391c26.js";import"./InputAdornment-0f07311f.js";import"./TextField-16337ecc.js";import"./isMuiElement-f8265807.js";import"./ScrollableList-b4fc4d99.js";import"./CircularProgress-509803a6.js";import"./componentStyles-cc6f218d.js";import"./PageBreadCrumb-529dbb35.js";import"./PageMetaData-e3d52899.js";import"./TextArea-1c46e0e4.js";import"./Grid2-12794a3c.js";import"./FilterFilled-94a9d775.js";import"./AntdIcon-d49f53d6.js";import"./objectSpread2-d72b34ab.js";import"./FilterOutlined-6af8de61.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};
