import{b as z,e8 as S,sP as T,r as U,sQ as a,j as r,B as b,T as l}from"./index-43bf7a1c.js";import{c as F,b as u,h as y}from"./index.esm-f9e0a906.js";import{T as B}from"./index-2d303f1d.js";import{u as L}from"./index.esm-0548c843.js";import{o as N}from"./yup-3b80ed10.js";import{T as q}from"./TopComponent-6b8acdbd.js";import"./TableContainer-b977c6cc.js";import"./TableRow-86264944.js";import"./Skeleton-ed4df299.js";import"./index-5757b954.js";import"./useMediaQuery-d6627623.js";import"./TableHead-fb4972c5.js";import"./createSvgIcon-f118be02.js";import"./TablePagination-9147f93d.js";import"./Select-44fd3147.js";import"./Menu-362130d3.js";import"./List-6fcc4821.js";import"./Grow-ca573f65.js";import"./OutlinedInput-6bcf3cf8.js";import"./useFormControl-2c5d60c2.js";import"./useControlled-ab567149.js";import"./MenuItem-58b8887e.js";import"./dividerClasses-497df10c.js";import"./listItemTextClasses-0ea25cee.js";import"./KeyboardArrowRight-8bd7c13f.js";import"./componentStyles-4624000e.js";import"./floating-ui.dom-e7d69f3b.js";import"./InputAdornment-b1a1aa58.js";import"./index-913b2dc6.js";import"./InputLabel-6c7474f0.js";/* empty css                   */import"./PageBreadCrumb-9a31a3c1.js";import"./PageMetaData-7350980e.js";import"./ScrollableList-e19132c3.js";import"./Loader-aabe9ed3.js";import"./TextField-4da97115.js";import"./FormControl-8d011aab.js";import"./FilterFilled-ccc86e02.js";import"./AntdIcon-634507e8.js";import"./objectSpread2-c31b885b.js";import"./presets-bb9bdfd8.js";import"./FilterOutlined-908c8e25.js";const Se=()=>{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,s,m,i,p,n){return{index:e,username:s,fullname:m,email:i,phone:p,group:n}}const P=d.map((e,s)=>{var p;const m=(t.page-1)*t.page_size+(s+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,s)=>{o(a({...t,search:"",page:s+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 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 s=e.target.value;o(a({...t,search:s||"",page:1,page_size:10}))};return r.jsxs(r.Fragment,{children:[r.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:r.jsxs(b,{sx:{display:"flex",gap:2},children:[r.jsx(l,{variant:"h4",children:" Count"}),r.jsx(l,{variant:"subtitle1",color:"primary",children:g})]})}),r.jsx(B,{count:g,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:C,handleChangeRowsPerPage:_})]})};export{Se as default};
