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-aa586041.js";import{c as F,b as u,g as y}from"./index.esm-5d8102a7.js";import{T as B}from"./index-a2d739d4.js";import{u as L}from"./index.esm-c1bef48d.js";import{o as N}from"./yup-75085264.js";import{T as q}from"./TopComponent-38ced44d.js";import"./TableCell-171b9885.js";import"./TableRow-6b2aeb5d.js";import"./index-67899cd7.js";import"./useMediaQuery-64e46ff0.js";import"./TableHead-a20733cc.js";import"./createSvgIcon-26e7576d.js";import"./TablePagination-e8098a58.js";import"./Toolbar-707eb110.js";import"./Select-03e2ed06.js";import"./Menu-3823c2ca.js";import"./isHostComponent-73d6e646.js";import"./Grow-6aaee206.js";import"./List-d99f3a17.js";import"./useSlotProps-01ed14c0.js";import"./OutlinedInput-8f0d0162.js";import"./useFormControl-1a7e7d92.js";import"./useControlled-e0c526ba.js";import"./MenuItem-0cb185cb.js";import"./dividerClasses-db0c3f8b.js";import"./listItemTextClasses-6f04b047.js";import"./KeyboardArrowRight-881c4d45.js";import"./LastPage-90e6357c.js";import"./CustomDatepicker-26155063.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-2dac8dca.js";import"./index-c5e91153.js";import"./index-1d230708.js";import"./InputLabel-fa135afd.js";import"./index-e3cd0864.js";import"./SectionDivider-2f9208fa.js";import"./resolveProps-185f0451.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-a6efd9c3.js";import"./PageBreadCrumb-654095db.js";import"./PageMetaData-1d7ce7c7.js";import"./Breadcrumbs-64a66b15.js";import"./Link-03d388f2.js";import"./ScrollableList-fcc6a14c.js";import"./TextField-5fe8ef1a.js";import"./FormControl-fed32f2b.js";import"./FilterOutlined-c8f43eef.js";import"./AntdIcon-c87bdadf.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-e05f2ee3.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};
