import{b as z,e8 as S,sK as T,r as U,sL as a,j as r,B as b,T as l}from"./index-76d4793e.js";import{c as F,b as u,h as L}from"./index.esm-ad8a7c9f.js";import{T as y}from"./index-1fae9bc3.js";import{u as B}from"./index.esm-3adfd9f7.js";import{o as N}from"./yup-688ec4f6.js";import{T as q}from"./TopComponent-82b1f250.js";import"./TableContainer-4147c2f3.js";import"./TableRow-736f36bd.js";import"./Skeleton-5d9101fd.js";import"./index-85763c32.js";import"./useMediaQuery-8cb39c65.js";import"./TableHead-c6031541.js";import"./createSvgIcon-01ec10fc.js";import"./TablePagination-5e47b2d0.js";import"./Select-338083eb.js";import"./Menu-ed7c6894.js";import"./List-4c24b3e8.js";import"./Grow-84b30c0e.js";import"./OutlinedInput-ac933786.js";import"./useFormControl-c8d490e1.js";import"./useControlled-e03384de.js";import"./MenuItem-cff1abce.js";import"./dividerClasses-45958eb8.js";import"./listItemTextClasses-89e7894e.js";import"./KeyboardArrowRight-8920e265.js";import"./componentStyles-0803b39e.js";import"./floating-ui.dom-e7d69f3b.js";import"./InputAdornment-b99403ce.js";import"./index-ecea5cfc.js";import"./InputLabel-5ed57f0e.js";/* empty css                   */import"./PageBreadCrumb-465f4085.js";import"./PageMetaData-e5080ba8.js";import"./ScrollableList-4dae3697.js";import"./Loader-9f443a4c.js";import"./TextField-9c64a4a2.js";import"./FormControl-c671c595.js";import"./FilterFilled-aa7d40e4.js";import"./AntdIcon-55dc1b5f.js";import"./objectSpread2-51b6810f.js";import"./FilterOutlined-91aa15e3.js";const ze=()=>{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,n,i,p,m){return{index:e,username:s,fullname:n,email:i,phone:p,group:m}}const P=d.map((e,s)=>{var p;const n=(t.page-1)*t.page_size+(s+1),i=(p=e==null?void 0:e.groups)==null?void 0:p.map(m=>m).join(", ");return console.log(i),f(n,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([L("newPassword"),""],"Passwords must match").required("Confirm Password is required")});B({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(y,{count:g,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:C,handleChangeRowsPerPage:_})]})};export{ze as default};
