import{d as w,aV as S,kz as T,r as F,kA as o,j as r,B as U,T as l}from"./index-4dfc510b.js";import{c as b,b as u,k as y,u as A}from"./index.esm-0a454763.js";import{T as B}from"./index-2560e6e6.js";import{o as L}from"./yup-80def618.js";import{T as N}from"./TopComponent-df931c7e.js";import"./TableRow-bee40746.js";import"./useMediaQuery-75ea24f6.js";import"./TableContainer-3d0f0f18.js";import"./TableHead-c19aff48.js";import"./Grow-a7315f12.js";import"./TablePagination-faf46d98.js";import"./Menu-0f556e12.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-605c8352.js";import"./Toolbar-1cf142b4.js";import"./Select-c8503f85.js";import"./MenuItem-9737e3d9.js";import"./dividerClasses-26c2a6d6.js";import"./listItemTextClasses-e85f7ff0.js";import"./GenericThumbnailView-6256cad7.js";import"./index-9a385720.js";import"./popper-f3391c26.js";import"./InputAdornment-ccd6e8ff.js";import"./TextField-c0d4022e.js";import"./isMuiElement-7be61a21.js";import"./ScrollableList-bef4a518.js";import"./CircularProgress-d36b5e75.js";import"./componentStyles-df94248d.js";import"./PageBreadCrumb-59ca32fd.js";import"./PageMetaData-9d85e469.js";import"./TextArea-a0cc14f3.js";import"./Grid2-713975b3.js";import"./FilterFilled-dc66781c.js";import"./AntdIcon-90a37458.js";import"./objectSpread2-66550f90.js";import"./FilterOutlined-6c52d192.js";const _e=()=>{const a=w(),c=S(),{loggedUsers:{list:d,pageParams:t,loading:h,count:g,selectedData:k},system:{userAccessList:q}}=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)}))};F.useEffect(()=>{a(o({...t,search:"",page:1,page_size:10})),c.setTitle("Logged Users"),c.setSubtitle("Settings")},[]);const z=b().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")});A({resolver:L(z)});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(N,{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(U,{sx:{display:"flex",gap:2},children:[r.jsx(l,{variant:"h4",children:" Count"}),r.jsx(l,{variant:"subtitle1",color:"primary",children:g})]})}),r.jsx(B,{count:g,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:j,handleChangeRowsPerPage:C})]})};export{_e as default};
