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-7b9530f9.js";import{c as F,b as u,k as U,u as B}from"./index.esm-9b014892.js";import{T as L}from"./index-691377cf.js";import{o as N}from"./yup-07ccc04e.js";import{T as q}from"./TopComponent-38b18bb0.js";import"./TableRow-18101d9c.js";import"./useMediaQuery-a500d209.js";import"./TableContainer-cc8cb87b.js";import"./TableHead-73cbf778.js";import"./Grow-ac96e569.js";import"./TablePagination-a3352557.js";import"./Select-71d7c76c.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-8531b083.js";import"./LastPage-4d921205.js";import"./Toolbar-99ba8a8c.js";import"./MenuItem-5f0ef7fb.js";import"./dividerClasses-be6617be.js";import"./listItemTextClasses-e5cedc04.js";import"./listItemIconClasses-9e903824.js";import"./GenericThumbnailView-c4b26278.js";import"./index-1f83e1d2.js";import"./createClass-b83ea73b.js";import"./popper-f3391c26.js";import"./InputAdornment-e3017a11.js";import"./TextField-a16050c5.js";import"./isMuiElement-a5b21fef.js";import"./ScrollableList-a1f8f012.js";import"./CircularProgress-ad60dd95.js";import"./componentStyles-32cc6bb2.js";import"./PageBreadCrumb-1ce57a66.js";import"./PageMetaData-5d44fb3f.js";import"./TextArea-d5cded1f.js";import"./Grid2-e0ccfa46.js";import"./Badge-59252017.js";import"./FilterFilled-70c51a7c.js";import"./AntdIcon-682f2518.js";import"./objectSpread2-12329e58.js";import"./FilterOutlined-ae23dbc1.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};
