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-6fe66247.js";import{c as F,b as u,g as y}from"./index.esm-34c2a639.js";import{T as B}from"./index-2cc408cd.js";import{u as L}from"./index.esm-8dc7c617.js";import{o as N}from"./yup-ef931f05.js";import{T as q}from"./TopComponent-3a5f48d0.js";import"./TableCell-1aea1cc4.js";import"./TableRow-3949f515.js";import"./index-bf51d29c.js";import"./useMediaQuery-0f3d61e0.js";import"./TableHead-d8cbb45f.js";import"./createSvgIcon-00102b53.js";import"./TablePagination-5e52cd9b.js";import"./Toolbar-928aa284.js";import"./Select-f9dfa240.js";import"./Menu-e61076f9.js";import"./isHostComponent-73d6e646.js";import"./Grow-b68a569b.js";import"./List-11a0d6f8.js";import"./useSlotProps-d14db7f9.js";import"./OutlinedInput-982baeac.js";import"./useFormControl-35c6f1af.js";import"./useControlled-e803b382.js";import"./MenuItem-cae4b005.js";import"./dividerClasses-9c506d69.js";import"./listItemTextClasses-5758b05f.js";import"./KeyboardArrowRight-8a542f89.js";import"./LastPage-fa4056a6.js";import"./CustomDatepicker-8082706c.js";import"./floating-ui.dom-cd6c919d.js";import"./InputAdornment-33eb10d0.js";import"./index-25f54021.js";import"./index-b6605ad3.js";import"./InputLabel-76d7f8cb.js";import"./index-b6aec95e.js";import"./SectionDivider-ea552de1.js";import"./resolveProps-d8ef25a0.js";import"./composeClasses-b42b2e69.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./popper-f3391c26.js";import"./styled-a478ed92.js";import"./PageBreadCrumb-90e2746d.js";import"./PageMetaData-4821a42d.js";import"./Breadcrumbs-52f929ae.js";import"./Link-de7e0135.js";import"./ScrollableList-0f8e556e.js";import"./TextField-0748ea02.js";import"./FormControl-cc4d9109.js";import"./FilterOutlined-e90fa981.js";import"./AntdIcon-5ec370b1.js";import"./slicedToArray-f5e6f6d2.js";import"./defineProperty-83f36300.js";import"./objectSpread2-dd5dc5f3.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};
