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-60a3c753.js";import{c as F,b as u,h as y}from"./index.esm-62d6b2f7.js";import{T as B}from"./index-7e55cf46.js";import{u as L}from"./index.esm-c494934a.js";import{o as N}from"./yup-92678dde.js";import{T as q}from"./TopComponent-69eda74c.js";import"./TableContainer-414c12e0.js";import"./TableRow-0b33776c.js";import"./Skeleton-98c353d9.js";import"./index-a99c9f65.js";import"./useMediaQuery-dba48e3b.js";import"./TableHead-f864c753.js";import"./createSvgIcon-de433e5f.js";import"./TablePagination-218dde38.js";import"./Select-99fc0d84.js";import"./Menu-d1b7e1c3.js";import"./List-f567f8e4.js";import"./Grow-68442588.js";import"./OutlinedInput-3a884178.js";import"./useFormControl-e13b5747.js";import"./useControlled-194ef007.js";import"./MenuItem-2f410bd2.js";import"./dividerClasses-3fa67596.js";import"./listItemTextClasses-36afdb92.js";import"./KeyboardArrowRight-b2645aed.js";import"./componentStyles-7753bbb9.js";import"./floating-ui.dom-e7d69f3b.js";import"./InputAdornment-96c40dce.js";import"./index-900fa817.js";import"./InputLabel-71dfc9d4.js";/* empty css                   */import"./PageBreadCrumb-fcf1e00a.js";import"./PageMetaData-198e143e.js";import"./ScrollableList-1962b023.js";import"./Loader-466ccb5e.js";import"./TextField-32b29087.js";import"./FormControl-d13d2693.js";import"./FilterFilled-cdde02db.js";import"./AntdIcon-bed41c21.js";import"./objectSpread2-85813881.js";import"./presets-06d13753.js";import"./FilterOutlined-c131dc67.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};
