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-c910e189.js";import{c as F,b as u,g as y}from"./index.esm-4b824583.js";import{T as B}from"./index-ece39440.js";import{u as L}from"./index.esm-cb7a914e.js";import{o as N}from"./yup-e6171339.js";import{T as q}from"./TopComponent-7cc026a5.js";import"./TableCell-f4de0f25.js";import"./TableRow-778e2904.js";import"./index-2b6d61d0.js";import"./useMediaQuery-f2cfdb18.js";import"./TableHead-e4842399.js";import"./createSvgIcon-482c4579.js";import"./TablePagination-d388f34f.js";import"./Toolbar-ef2f3b22.js";import"./Select-11d028f2.js";import"./Menu-0b919c7f.js";import"./isHostComponent-73d6e646.js";import"./Grow-4f2c0713.js";import"./List-5ca02ce5.js";import"./useSlotProps-81a688b7.js";import"./OutlinedInput-5e0321ba.js";import"./useFormControl-2acc5484.js";import"./useControlled-e4156ecd.js";import"./MenuItem-424dbae4.js";import"./dividerClasses-f84f5755.js";import"./listItemTextClasses-ac790319.js";import"./KeyboardArrowRight-bd6f3607.js";import"./LastPage-e4e9bf3d.js";import"./CustomDatepicker-fa2ab383.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-9bf084ba.js";import"./index-3e499916.js";import"./index-eec67340.js";import"./InputLabel-8a73326d.js";import"./index-f58a077c.js";import"./SectionDivider-782acfa4.js";import"./resolveProps-d3929786.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-015539db.js";import"./PageBreadCrumb-2c66985b.js";import"./PageMetaData-1d38d5f3.js";import"./Breadcrumbs-3d9d6834.js";import"./Link-48695511.js";import"./ScrollableList-4f192da2.js";import"./TextField-d2437cd2.js";import"./FormControl-aa398a78.js";import"./FilterOutlined-726aecf0.js";import"./AntdIcon-f66217ef.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-ae4dd896.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};
