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-55b8aeb0.js";import{c as F,b as u,g as y}from"./index.esm-8f37a121.js";import{T as B}from"./index-9b42a4fa.js";import{u as L}from"./index.esm-31587b9b.js";import{o as N}from"./yup-21078b88.js";import{T as q}from"./TopComponent-deb74522.js";import"./TableCell-53983040.js";import"./TableRow-abb96e14.js";import"./index-136ea595.js";import"./useMediaQuery-74f5c38e.js";import"./TableHead-75c76b5a.js";import"./createSvgIcon-61f1439a.js";import"./TablePagination-52f19a14.js";import"./Toolbar-880b00d0.js";import"./Select-67acd544.js";import"./Menu-755754ee.js";import"./isHostComponent-73d6e646.js";import"./Grow-f7742528.js";import"./List-131a37dd.js";import"./useSlotProps-999c26ad.js";import"./OutlinedInput-113a096e.js";import"./useFormControl-0fae9ee7.js";import"./useControlled-dc1d5a3a.js";import"./MenuItem-60289e9c.js";import"./dividerClasses-8edbe511.js";import"./listItemTextClasses-425c9ee5.js";import"./KeyboardArrowRight-6d59349d.js";import"./LastPage-1a2e56d1.js";import"./CustomDatepicker-9892b2ee.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-a1329ca0.js";import"./index-b46d078b.js";import"./index-3c3af0a2.js";import"./InputLabel-0efc058b.js";import"./index-7c560a47.js";import"./SectionDivider-0fcc86df.js";import"./resolveProps-950d970c.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-ea700eba.js";import"./PageBreadCrumb-60248bbb.js";import"./PageMetaData-7be90250.js";import"./Breadcrumbs-932d9cf3.js";import"./Link-433ffec8.js";import"./ScrollableList-a069ff95.js";import"./TextField-54536ec2.js";import"./FormControl-ff03dcb8.js";import"./FilterOutlined-bcd42762.js";import"./AntdIcon-4834ad0b.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-1e39d65c.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};
