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-d895656a.js";import{c as b,b as u,k as y,u as A}from"./index.esm-1087b2f3.js";import{T as B}from"./index-ea344eac.js";import{o as L}from"./yup-9573aa79.js";import{T as N}from"./TopComponent-17bc7e9c.js";import"./TableRow-5557ab84.js";import"./useMediaQuery-dbbc87b0.js";import"./TableContainer-a89da0a1.js";import"./TableHead-1b575958.js";import"./Grow-d4be81a5.js";import"./TablePagination-582dd1d9.js";import"./Menu-1728e1dd.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-5067dfe9.js";import"./Toolbar-adca1e0f.js";import"./Select-6d425a72.js";import"./MenuItem-f1f55b7e.js";import"./dividerClasses-f4dcf412.js";import"./listItemTextClasses-1ed38b44.js";import"./GenericThumbnailView-532ea2d7.js";import"./index-45bf15b6.js";import"./popper-f3391c26.js";import"./InputAdornment-36977269.js";import"./TextField-6f73e19a.js";import"./isMuiElement-424c145f.js";import"./ScrollableList-e2b22048.js";import"./CircularProgress-1f3ca34c.js";import"./componentStyles-866300fe.js";import"./PageBreadCrumb-5e129db8.js";import"./PageMetaData-47148824.js";import"./TextArea-fb0d0821.js";import"./Grid2-5bd460ea.js";import"./FilterFilled-9d5acdc3.js";import"./AntdIcon-19e16777.js";import"./objectSpread2-c21546fe.js";import"./FilterOutlined-b6007bf1.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};
