import{c as z,bd as S,ss as T,r as U,st as i,j as s,B as b,T as l}from"./index-c1429e77.js";import{c as F,b as u,g as y}from"./index.esm-85841cf7.js";import{T as B}from"./index-50437a1d.js";import{u as L}from"./index.esm-e372dd1f.js";import{o as N}from"./yup-0d492cec.js";import{T as q}from"./TopComponent-de5045a6.js";import"./TableCell-f7ad5597.js";import"./TableRow-18e2a4e3.js";import"./index-0710c981.js";import"./useMediaQuery-6763b70c.js";import"./TableHead-89a0b6da.js";import"./createSvgIcon-74b4ff5d.js";import"./TablePagination-8b574091.js";import"./Toolbar-d8e3299a.js";import"./Select-ea3744da.js";import"./Menu-3e8761c1.js";import"./isHostComponent-73d6e646.js";import"./Grow-67aedb5f.js";import"./List-7dd83a15.js";import"./useSlotProps-8fc8da82.js";import"./OutlinedInput-7d44f8dd.js";import"./useFormControl-674270c6.js";import"./useControlled-f1a5b61d.js";import"./MenuItem-352b4536.js";import"./dividerClasses-91c74733.js";import"./listItemTextClasses-7e80198b.js";import"./KeyboardArrowRight-e84473c8.js";import"./LastPage-931a2b6d.js";import"./CustomDatepicker-9a80af6c.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-7b2a78bf.js";import"./index-6d8a6cf3.js";import"./index-10a98b8b.js";import"./InputLabel-e729048c.js";import"./index-938f4514.js";import"./SectionDivider-0f38a779.js";import"./resolveProps-3c56301c.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-54544d88.js";import"./PageBreadCrumb-6dc7bfb4.js";import"./PageMetaData-779a2dc1.js";import"./Breadcrumbs-24e40a14.js";import"./Link-a63687a8.js";import"./ScrollableList-85f6c22b.js";import"./TextField-2ccc0cd3.js";import"./FormControl-63806889.js";import"./FilterOutlined-83ecc56f.js";import"./AntdIcon-86b9d15e.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-a3c10d55.js";const De=()=>{const o=z(),c=S(),{loggedUsers:{list:d,pageParams:t,loading:h,count:g,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,r,m,a,p,n){return{index:e,username:r,fullname:m,email:a,phone:p,group:n}}const P=d.map((e,r)=>{var p;const m=(t.page-1)*t.page_size+(r+1),a=(p=e==null?void 0:e.groups)==null?void 0:p.map(n=>n).join(", ");return console.log(a),f(m,e.username||"",e.full_name||"",e.email||"",e.phone||"",a||"")}),j=({search:e})=>{o(i({...t,search:e||"",page:1,page_size:10}))},C=(e,r)=>{o(i({...t,search:"",page:r+1}))},_=e=>{o(i({...t,search:"",page:1,page_size:parseInt(e.target.value)}))};U.useEffect(()=>{o(i({...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([y("newPassword"),""],"Passwords must match").required("Confirm Password is required")});L({resolver:N(v)});const w=e=>{const r=e.target.value;o(i({...t,search:r||"",page:1,page_size:10}))};return s.jsxs(s.Fragment,{children:[s.jsx(q,{permissionPreFix:"Users",permissionPostFix:"current_logged_users",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:j,handleInputChange:w,children:s.jsxs(b,{sx:{display:"flex",gap:2},children:[s.jsx(l,{variant:"h4",children:" Count"}),s.jsx(l,{variant:"subtitle1",color:"primary",children:g})]})}),s.jsx(B,{count:g,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:C,handleChangeRowsPerPage:_})]})};export{De as default};
