import{d as z,b4 as S,kX as T,r as b,kY as o,j as r,B as F,T as l}from"./index-858224db.js";import{c as U,b as u,k as y,u as B}from"./index.esm-241dec99.js";import{T as L}from"./index-e980fe31.js";import{o as N}from"./yup-9213c3af.js";import{T as k}from"./TopComponent-e6610146.js";import"./TableRow-ef998644.js";import"./useMediaQuery-f2f5fd7b.js";import"./TableContainer-0664e137.js";import"./TableHead-cf76ecee.js";import"./Grow-b7b43b3f.js";import"./TablePagination-4cf72ac4.js";import"./Select-8b602eed.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-b25c72ab.js";import"./LastPage-c7260b25.js";import"./Toolbar-9be5abc1.js";import"./MenuItem-bf5218a0.js";import"./dividerClasses-3bf2d765.js";import"./listItemTextClasses-ac0d77df.js";import"./listItemIconClasses-5ed9cb9d.js";import"./GenericThumbnailView-2d7b7363.js";import"./index-9223140c.js";import"./createClass-042c577b.js";import"./popper-f3391c26.js";import"./InputAdornment-583927e5.js";import"./TextField-bbb2480f.js";import"./isMuiElement-ec705bc2.js";import"./ScrollableList-bf78e54b.js";import"./CircularProgress-5bd54bd6.js";import"./componentStyles-107bd37e.js";import"./PageBreadCrumb-57332081.js";import"./PageMetaData-69741ff8.js";import"./TextArea-78cda1eb.js";import"./Grid2-274bb638.js";import"./FilterFilled-4ddeca5a.js";import"./AntdIcon-8f3bee6f.js";import"./objectSpread2-cfd43bb2.js";import"./FilterOutlined-c1046d9f.js";const Ce=()=>{const a=z(),c=S(),{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,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 v=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(v)});const w=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:w,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{Ce as default};
