import{d as z,b6 as S,lB as T,r as b,lC as o,j as r,B,T as g}from"./index-6f149d0c.js";import{c as F,b as u,l as U,u as y}from"./index.esm-88773116.js";import{T as L}from"./index-2cd683b8.js";import{o as N}from"./yup-7ebcc99d.js";import{T as q}from"./TopComponent-18d86a87.js";import"./TableRow-1e254c97.js";import"./useMediaQuery-4f481de0.js";import"./TableContainer-98fd6e5d.js";import"./TableHead-483470b3.js";import"./Grow-aea427ae.js";import"./TablePagination-40662a32.js";import"./Select-70a66099.js";import"./index-e5978b8b.js";import"./KeyboardArrowRight-1f33e1ff.js";import"./LastPage-de948385.js";import"./Toolbar-7b4b233b.js";import"./MenuItem-8bc5d37f.js";import"./dividerClasses-aa25d579.js";import"./listItemTextClasses-6dace016.js";import"./listItemIconClasses-4d219f9a.js";import"./GenericThumbnailView-01fef5a2.js";import"./index-a88b83d7.js";import"./createClass-925b8ab0.js";import"./popper-f3391c26.js";import"./InputAdornment-ca5e29e7.js";import"./TextField-a5af71e6.js";import"./isMuiElement-36ccba67.js";import"./ScrollableList-e382be10.js";import"./CircularProgress-49299c74.js";import"./componentStyles-d6393a0a.js";import"./PageBreadCrumb-7efa6a84.js";import"./PageMetaData-456ccb42.js";import"./TextArea-eb0beb3a.js";import"./Grid2-3d1a13f9.js";import"./Badge-806f3b3c.js";import"./FilterFilled-843cffe9.js";import"./AntdIcon-d56b3db9.js";import"./objectSpread2-bd69b5ce.js";import"./FilterOutlined-8cc7981d.js";const ve=()=>{const a=z(),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||"")}),C=({search:e})=>{a(o({...t,search:e||"",page:1,page_size:10}))},_=(e,s)=>{a(o({...t,search:"",page:s+1}))},j=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:N(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(q,{permissionPreFix:"core_users",permissionPostFix:"current_logged_users",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:C,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(L,{count:l,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:_,handleChangeRowsPerPage:j})]})};export{ve as default};
