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-3141de2d.js";import{c as U,b as u,k as y,u as B}from"./index.esm-8b0c9a99.js";import{T as L}from"./index-a22dce01.js";import{o as N}from"./yup-c2fea6fa.js";import{T as k}from"./TopComponent-42db21e8.js";import"./TableRow-e26106d8.js";import"./useMediaQuery-aa4be5c2.js";import"./TableContainer-e4a79220.js";import"./TableHead-6dad4842.js";import"./Grow-e0aea29d.js";import"./TablePagination-377a84d4.js";import"./Select-369b8a03.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-d5826f7e.js";import"./Toolbar-c1e97401.js";import"./MenuItem-d41bf2e5.js";import"./dividerClasses-752b2dd5.js";import"./listItemTextClasses-5f5f8755.js";import"./GenericThumbnailView-c2621934.js";import"./index-a3f870f6.js";import"./popper-f3391c26.js";import"./InputAdornment-1680248d.js";import"./TextField-ec161c03.js";import"./isMuiElement-2bebf9f1.js";import"./ScrollableList-fa62971d.js";import"./CircularProgress-a64e9e1b.js";import"./componentStyles-24f97919.js";import"./PageBreadCrumb-cf694986.js";import"./PageMetaData-2b8c2cd7.js";import"./TextArea-ceaff311.js";import"./Grid2-488bb30d.js";import"./FilterFilled-94ea2c05.js";import"./AntdIcon-eb0da2c9.js";import"./objectSpread2-41b8b8d3.js";import"./FilterOutlined-d6dd1d6d.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};
