import{c as z,be as S,sw as T,r as U,sx as a,j as s,B as b,T as l}from"./index-d9e0bbb9.js";import{c as F,b as u,g as y}from"./index.esm-65c50bc3.js";import{T as B}from"./index-07650f16.js";import{u as L}from"./index.esm-97139da9.js";import{o as N}from"./yup-267c2267.js";import{T as q}from"./TopComponent-76fa20a1.js";import"./TableCell-643437b4.js";import"./TableRow-113a14fe.js";import"./index-3220221a.js";import"./useMediaQuery-1b7ae287.js";import"./TableHead-2fc5d5a1.js";import"./createSvgIcon-c99d086f.js";import"./TablePagination-bee8c9bb.js";import"./Toolbar-eaf493cd.js";import"./Select-661ba76b.js";import"./Menu-c23c1491.js";import"./isHostComponent-73d6e646.js";import"./Grow-ca477235.js";import"./List-c3ed6b04.js";import"./useSlotProps-a7d9b3b8.js";import"./OutlinedInput-8f17518b.js";import"./useFormControl-8bb67ca0.js";import"./useControlled-ba6710bb.js";import"./MenuItem-086da23e.js";import"./dividerClasses-35463663.js";import"./listItemTextClasses-2867fd89.js";import"./KeyboardArrowRight-80f086b2.js";import"./LastPage-cf4835f4.js";import"./CustomDatepicker-9495774a.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-978b4608.js";import"./index-3bec8271.js";import"./index-1253245b.js";import"./InputLabel-8c8abfdd.js";import"./index-e61c8ded.js";import"./SectionDivider-95fcfa90.js";import"./resolveProps-ba55e2df.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-720374c3.js";import"./popper-f3391c26.js";import"./styled-8fd62552.js";import"./PageBreadCrumb-ab23f357.js";import"./PageMetaData-c80444e2.js";import"./Breadcrumbs-359b714e.js";import"./Link-3b5544a4.js";import"./ScrollableList-03cda798.js";import"./TextField-14942967.js";import"./FormControl-664346ce.js";import"./FilterOutlined-08135420.js";import"./AntdIcon-71a0f3e8.js";import"./objectSpread2-7f959c25.js";const qe=()=>{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,i,p,n){return{index:e,username:r,fullname:m,email:i,phone:p,group:n}}const P=d.map((e,r)=>{var p;const m=(t.page-1)*t.page_size+(r+1),i=(p=e==null?void 0:e.groups)==null?void 0:p.map(n=>n).join(", ");return console.log(i),f(m,e.username||"",e.full_name||"",e.email||"",e.phone||"",i||"")}),j=({search:e})=>{o(a({...t,search:e||"",page:1,page_size:10}))},C=(e,r)=>{o(a({...t,search:"",page:r+1}))},_=e=>{o(a({...t,search:"",page:1,page_size:parseInt(e.target.value)}))};U.useEffect(()=>{o(a({...t,search:"",page:1,page_size:10})),c.setTitle("Logged Users"),c.setSubtitle("Settings")},[]);const w=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(w)});const v=e=>{const r=e.target.value;o(a({...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:v,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{qe as default};
