import{c as z,bd as S,ss as T,r as U,st as i,j as s,B as b,T as l}from"./index-7414fd54.js";import{c as F,b as u,g as y}from"./index.esm-24ac0554.js";import{T as B}from"./index-04819da2.js";import{u as L}from"./index.esm-87a8ddec.js";import{o as N}from"./yup-42c56a9b.js";import{T as q}from"./TopComponent-f6c6e386.js";import"./TableCell-3cadf061.js";import"./TableRow-34be244e.js";import"./index-aa118901.js";import"./useMediaQuery-c16b4b9b.js";import"./TableHead-4965c3b4.js";import"./createSvgIcon-76207f66.js";import"./TablePagination-748823c3.js";import"./Toolbar-1aeab16d.js";import"./Select-48086034.js";import"./Menu-1900bd36.js";import"./isHostComponent-73d6e646.js";import"./Grow-2a8f811c.js";import"./List-5ed8845c.js";import"./useSlotProps-60b9b089.js";import"./OutlinedInput-dd801d4f.js";import"./useFormControl-99b033b3.js";import"./useControlled-dcaff400.js";import"./MenuItem-a928b422.js";import"./dividerClasses-5fe46a73.js";import"./listItemTextClasses-aec56de0.js";import"./KeyboardArrowRight-13711303.js";import"./LastPage-4b7b4114.js";import"./CustomDatepicker-6be798ca.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-038fa482.js";import"./index-b7f52b29.js";import"./index-89446b48.js";import"./InputLabel-d3b034a6.js";import"./index-b6124309.js";import"./SectionDivider-ec0341fc.js";import"./resolveProps-3552295b.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-c92acce6.js";import"./PageBreadCrumb-84ebe3c5.js";import"./PageMetaData-872a9787.js";import"./Breadcrumbs-3a0efba6.js";import"./Link-152aa696.js";import"./ScrollableList-abce50c2.js";import"./TextField-ee00f42e.js";import"./FormControl-0c273f44.js";import"./FilterOutlined-dcf68367.js";import"./AntdIcon-01378f64.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-8ef7a44c.js";const De=()=>{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,a,p,n){return{index:e,username:r,fullname:m,email:a,phone:p,group:n}}const P=d.map((e,r)=>{var p;const m=(t.page-1)*t.page_size+(r+1),a=(p=e==null?void 0:e.groups)==null?void 0:p.map(n=>n).join(", ");return console.log(a),f(m,e.username||"",e.full_name||"",e.email||"",e.phone||"",a||"")}),j=({search:e})=>{o(i({...t,search:e||"",page:1,page_size:10}))},C=(e,r)=>{o(i({...t,search:"",page:r+1}))},_=e=>{o(i({...t,search:"",page:1,page_size:parseInt(e.target.value)}))};U.useEffect(()=>{o(i({...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 r=e.target.value;o(i({...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:w,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{De as default};
