import{d as w,b6 as S,ly as T,r as b,lz as o,j as r,B as y,T as g}from"./index-e972fa8e.js";import{c as F,b as u,k as U,u as B}from"./index.esm-b3c20f6d.js";import{T as L}from"./index-0e298e38.js";import{o as N}from"./yup-b3178c01.js";import{T as q}from"./TopComponent-f908b1e2.js";import"./TableRow-c60adf0a.js";import"./useMediaQuery-f8b4772b.js";import"./TableContainer-ad9de4b5.js";import"./TableHead-11d85aea.js";import"./Grow-0b3a9797.js";import"./TablePagination-63dde5fc.js";import"./Select-a2938be0.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-4b11e6b9.js";import"./LastPage-69d51b6f.js";import"./Toolbar-fca75f8a.js";import"./MenuItem-fab52ff5.js";import"./dividerClasses-b771f620.js";import"./listItemTextClasses-f7cdafa8.js";import"./listItemIconClasses-bcb38dc7.js";import"./GenericThumbnailView-38007944.js";import"./index-44db81fe.js";import"./createClass-8ffbea6f.js";import"./popper-f3391c26.js";import"./InputAdornment-acd34c72.js";import"./TextField-77f9d647.js";import"./isMuiElement-fab695f8.js";import"./ScrollableList-4768c2b7.js";import"./CircularProgress-58819244.js";import"./componentStyles-7142291f.js";import"./PageBreadCrumb-bc440201.js";import"./PageMetaData-c3c9cb80.js";import"./TextArea-6c7f39e1.js";import"./Grid2-936c64bd.js";import"./Badge-ea57b795.js";import"./FilterFilled-61dd8e74.js";import"./AntdIcon-c86cb7c3.js";import"./objectSpread2-5ffd54f7.js";import"./FilterOutlined-aeeaa696.js";const ze=()=>{const a=w(),c=S(),{loggedUsers:{list:d,pageParams:t,loading:h,count:l,selectedData:A},system:{userAccessList:E}}=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 z=F().shape({newPassword:u().min(8,"Password must be at least 8 characters long").required("New Password is required"),confirmPassword:u().oneOf([U("newPassword"),""],"Passwords must match").required("Confirm Password is required")});B({resolver:N(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(q,{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(y,{sx:{display:"flex",gap:2},children:[r.jsx(g,{variant:"h4",children:" Count"}),r.jsx(g,{variant:"subtitle1",color:"primary",children:l})]})}),r.jsx(L,{count:l,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:j,handleChangeRowsPerPage:C})]})};export{ze as default};
