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-7d3dbb9c.js";import{c as F,b as u,g as y}from"./index.esm-9d396c5f.js";import{T as B}from"./index-7a00ca34.js";import{u as L}from"./index.esm-12cc9f7b.js";import{o as N}from"./yup-55e79238.js";import{T as q}from"./TopComponent-6b690561.js";import"./TableCell-26014f2c.js";import"./TableRow-23a8435a.js";import"./index-3cd7bbe9.js";import"./useMediaQuery-77b67f07.js";import"./TableHead-ec26fced.js";import"./createSvgIcon-25cfe1a8.js";import"./TablePagination-f03db3c2.js";import"./Toolbar-b85f9581.js";import"./Select-762ec619.js";import"./Menu-5245abf0.js";import"./isHostComponent-73d6e646.js";import"./Grow-1b15246b.js";import"./List-d7c020ab.js";import"./useSlotProps-f2e72ab1.js";import"./OutlinedInput-e6d419ce.js";import"./useFormControl-7314cc67.js";import"./useControlled-338e346b.js";import"./MenuItem-02b6c30e.js";import"./dividerClasses-59256fce.js";import"./listItemTextClasses-626eaddb.js";import"./KeyboardArrowRight-ff7c065c.js";import"./LastPage-7938a031.js";import"./CustomDatepicker-6d5ad1ab.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-bbfa18ee.js";import"./index-7976e00d.js";import"./index-e9cb9551.js";import"./InputLabel-ade41a0b.js";import"./index-b5c17d61.js";import"./SectionDivider-be0a23cf.js";import"./resolveProps-4b8623f7.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-720374c3.js";import"./popper-f3391c26.js";import"./styled-446e5583.js";import"./PageBreadCrumb-6d7ee77a.js";import"./PageMetaData-69209ade.js";import"./Breadcrumbs-f8a93219.js";import"./Link-19ee87c9.js";import"./ScrollableList-ffeab0b0.js";import"./TextField-a362d747.js";import"./FormControl-f3d9cdb4.js";import"./FilterOutlined-459a9fa1.js";import"./AntdIcon-2da3a123.js";import"./objectSpread2-947328ce.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};
