import{d as z,b6 as S,lA as T,r as b,lB as o,j as r,B,T as g}from"./index-e6164346.js";import{c as F,b as u,l as U,u as y}from"./index.esm-0a041314.js";import{T as A}from"./index-8e856c3a.js";import{o as L}from"./yup-5fd5d57b.js";import{T as N}from"./TopComponent-3000777e.js";import"./TableRow-bf4e60a0.js";import"./useMediaQuery-43140cef.js";import"./TableContainer-7ecd96ea.js";import"./TableHead-0c525f54.js";import"./Grow-306e2fd0.js";import"./TablePagination-b02830fa.js";import"./Select-9c2d8cd2.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-73af71dd.js";import"./LastPage-b9dcf78c.js";import"./Toolbar-82d22fac.js";import"./MenuItem-8dd174fb.js";import"./dividerClasses-932c3e8b.js";import"./listItemTextClasses-6b253cb4.js";import"./listItemIconClasses-a58b491d.js";import"./GenericThumbnailView-80c6fd98.js";import"./index-ce90e1a7.js";import"./createClass-ad55a3ca.js";import"./popper-f3391c26.js";import"./InputAdornment-59975edf.js";import"./TextField-db9cff08.js";import"./isMuiElement-5779af4f.js";import"./ScrollableList-5a17e8f4.js";import"./CircularProgress-7d99d864.js";import"./componentStyles-00385170.js";import"./PageBreadCrumb-87110024.js";import"./PageMetaData-3ca96413.js";import"./TextArea-f5c200de.js";import"./Grid2-c9c87842.js";import"./Badge-4f6d4e12.js";import"./FilterFilled-c0851aaa.js";import"./AntdIcon-4f5aa87b.js";import"./objectSpread2-7d7378cc.js";import"./FilterOutlined-3561fb77.js";const ve=()=>{const a=z(),c=S(),{loggedUsers:{list:d,pageParams:t,loading:h,count:l,selectedData:q},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 v=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")});y({resolver:L(v)});const w=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:w,children:r.jsxs(B,{sx:{display:"flex",gap:2},children:[r.jsx(g,{variant:"h4",children:" Count"}),r.jsx(g,{variant:"subtitle1",color:"primary",children:l})]})}),r.jsx(A,{count:l,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:j,handleChangeRowsPerPage:C})]})};export{ve as default};
