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-1350aa97.js";import{c as F,b as u,g as y}from"./index.esm-74444d29.js";import{T as B}from"./index-5a1f70d0.js";import{u as L}from"./index.esm-e43efa83.js";import{o as N}from"./yup-eafdc449.js";import{T as q}from"./TopComponent-189c1068.js";import"./TableCell-a6f79ef2.js";import"./TableRow-c7fca392.js";import"./index-78814c8f.js";import"./useMediaQuery-a3126238.js";import"./TableHead-ad1c6add.js";import"./createSvgIcon-2e83c7e0.js";import"./TablePagination-e8711540.js";import"./Toolbar-d333937b.js";import"./Select-8eee5a8a.js";import"./Menu-4f31c92d.js";import"./isHostComponent-73d6e646.js";import"./Grow-ffb74095.js";import"./List-538d4780.js";import"./useSlotProps-618d2e24.js";import"./OutlinedInput-8de92ced.js";import"./useFormControl-dd6168e4.js";import"./useControlled-39301d68.js";import"./MenuItem-5b6ab204.js";import"./dividerClasses-15d7c20c.js";import"./listItemTextClasses-8ebe873e.js";import"./KeyboardArrowRight-d6b7e992.js";import"./LastPage-718ed1f4.js";import"./CustomDatepicker-9019a583.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-0139a25d.js";import"./index-dd1e751c.js";import"./index-8daffd3f.js";import"./InputLabel-13efa73d.js";import"./index-bd875dae.js";import"./SectionDivider-474af95d.js";import"./resolveProps-d26bdf8f.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-a7d7cd46.js";import"./PageBreadCrumb-7473d003.js";import"./PageMetaData-88e17dcb.js";import"./Breadcrumbs-b905f8b1.js";import"./Link-93a82ccf.js";import"./ScrollableList-3f260516.js";import"./TextField-db0e4632.js";import"./FormControl-08732dac.js";import"./FilterOutlined-57d28dd2.js";import"./AntdIcon-a757300e.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-07822c35.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};
