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-c5c88b67.js";import{c as b,b as u,k as y,u as A}from"./index.esm-81620445.js";import{T as B}from"./index-f0b37835.js";import{o as L}from"./yup-41605283.js";import{T as N}from"./TopComponent-7c005d8e.js";import"./TableRow-2b359fa8.js";import"./useMediaQuery-fe3ce37c.js";import"./TableContainer-c31f204a.js";import"./TableHead-c2c21491.js";import"./Grow-7345f8ea.js";import"./TablePagination-0147f84a.js";import"./Menu-e7d2b2ee.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-261f4f43.js";import"./Toolbar-f8d4b0c4.js";import"./Select-4ed8db5d.js";import"./MenuItem-81e44793.js";import"./dividerClasses-6bc0ca72.js";import"./listItemTextClasses-88792089.js";import"./GenericThumbnailView-43782201.js";import"./index-c98d1d89.js";import"./createClass-fb49042e.js";import"./popper-f3391c26.js";import"./InputAdornment-d66117f3.js";import"./TextField-78388962.js";import"./isMuiElement-b3c21f38.js";import"./ScrollableList-21ab2b9c.js";import"./CircularProgress-13afa056.js";import"./componentStyles-a5e5a830.js";import"./PageBreadCrumb-94fdb2ed.js";import"./PageMetaData-deabce52.js";import"./TextArea-aad9dffe.js";import"./Grid2-0ff60c92.js";import"./FilterFilled-9066fadd.js";import"./AntdIcon-1a0d7a6b.js";import"./objectSpread2-65a0d991.js";import"./FilterOutlined-67649527.js";const je=()=>{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{je as default};
