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-5768b108.js";import{c as F,b as u,g as y}from"./index.esm-85e2fec5.js";import{T as B}from"./index-fcf73630.js";import{u as L}from"./index.esm-4803c918.js";import{o as N}from"./yup-7ddf262a.js";import{T as q}from"./TopComponent-a10f4baf.js";import"./TableCell-73fa51e5.js";import"./TableRow-3593e946.js";import"./index-bed7b08c.js";import"./useMediaQuery-493fa36e.js";import"./TableHead-1c4bab1f.js";import"./createSvgIcon-51b522b8.js";import"./TablePagination-e6e264e7.js";import"./Toolbar-96b35f70.js";import"./Select-3950b24e.js";import"./Menu-7988a333.js";import"./isHostComponent-73d6e646.js";import"./Grow-c21b912f.js";import"./List-2cd167d2.js";import"./useSlotProps-ed538db1.js";import"./OutlinedInput-8a98392b.js";import"./useFormControl-e91ce3d1.js";import"./useControlled-821282b7.js";import"./MenuItem-51065bfa.js";import"./dividerClasses-a2ef427b.js";import"./listItemTextClasses-3e91d186.js";import"./KeyboardArrowRight-56dea4db.js";import"./LastPage-f21d7153.js";import"./CustomDatepicker-c97efda4.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-82d0c147.js";import"./index-c58b1ae1.js";import"./index-4ca9e290.js";import"./InputLabel-bfa922b7.js";import"./index-42cce9d5.js";import"./SectionDivider-bc494fef.js";import"./resolveProps-5b0bdb14.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-9a8473c9.js";import"./PageBreadCrumb-5c3ff2bc.js";import"./PageMetaData-84e26924.js";import"./Breadcrumbs-37f99f42.js";import"./Link-a5e92257.js";import"./ScrollableList-c8e84a4e.js";import"./TextField-265270c2.js";import"./FormControl-47bb025d.js";import"./FilterOutlined-52596c0e.js";import"./AntdIcon-3a079263.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-d5d2b678.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};
