import{b as w,eb as z,sP as S,r as T,sQ as a,j as r,B as U,T as l}from"./index-d2b25495.js";import{c as F,b as u,h as y}from"./index.esm-3043d6d4.js";import{T as B}from"./index-75fca24c.js";import{u as L}from"./index.esm-ce3c2c20.js";import{o as N}from"./yup-267e586f.js";import{T as q}from"./TopComponent-23a44952.js";import"./TableContainer-dd7cf0ce.js";import"./TableRow-74f9cf3b.js";import"./Skeleton-1012c2e6.js";import"./index-1249dfe4.js";import"./useMediaQuery-b1fbc166.js";import"./TableHead-fac214d3.js";import"./createSvgIcon-e39ae511.js";import"./TablePagination-2c2a1682.js";import"./Select-ef36a2b2.js";import"./Menu-337a466b.js";import"./Grow-8719411b.js";import"./List-863f013e.js";import"./OutlinedInput-86f3ec98.js";import"./useFormControl-2b068664.js";import"./useControlled-8d737f13.js";import"./MenuItem-2bdddad4.js";import"./dividerClasses-02a44d89.js";import"./listItemTextClasses-cadd4b00.js";import"./KeyboardArrowRight-7e978a8a.js";import"./componentStyles-0e851d91.js";import"./index-709861af.js";import"./popper-f3391c26.js";import"./InputAdornment-d0c3ebef.js";import"./index-38f860bc.js";import"./InputLabel-bb6ab40e.js";/* empty css                   */import"./PageBreadCrumb-02480d86.js";import"./PageMetaData-7797a3b7.js";import"./ScrollableList-fc1de312.js";import"./Loader-1b927baf.js";import"./TextField-e155d2be.js";import"./FormControl-73683015.js";import"./FilterFilled-4dfce120.js";import"./AntdIcon-8449be55.js";import"./objectSpread2-b41ee31b.js";import"./FilterOutlined-653b7cb0.js";const ze=()=>{const o=w(),c=z(),{loggedUsers:{list:d,pageParams:t,loading:h,count:g,selectedData:A},system:{userAccessList:E}}=S(),x=[{title:"S.No"},{title:"UserName"},{title:"Full Name"},{title:"Email"},{title:"Phone"},{title:"Group",width:100}];function f(e,s,m,i,p,n){return{index:e,username:s,fullname:m,email:i,phone:p,group:n}}const P=d.map((e,s)=>{var p;const m=(t.page-1)*t.page_size+(s+1),i=(p=e==null?void 0:e.groups)==null?void 0:p.map(n=>n).join(", ");return console.log(i),f(m,e.username||"",e.full_name||"",e.email||"",e.phone||"",i||"")}),j=({search:e})=>{o(a({...t,search:e||"",page:1,page_size:10}))},C=(e,s)=>{o(a({...t,search:"",page:s+1}))},_=e=>{o(a({...t,search:"",page:1,page_size:parseInt(e.target.value)}))};T.useEffect(()=>{o(a({...t,search:"",page:1,page_size:10})),c.setTitle("Logged Users"),c.setSubtitle("Settings")},[]);const b=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(b)});const v=e=>{const s=e.target.value;o(a({...t,search:s||"",page:1,page_size:10}))};return r.jsxs(r.Fragment,{children:[r.jsx(q,{permissionPreFix:"Users",permissionPostFix:"current_logged_users",navigateLink:"/pages/settings/manage-users/0",showAddButton:!1,showFilterButton:!1,addButtonName:"Add User",handleSearch:j,handleInputChange:v,children:r.jsxs(U,{sx:{display:"flex",gap:2},children:[r.jsx(l,{variant:"h4",children:" Count"}),r.jsx(l,{variant:"subtitle1",color:"primary",children:g})]})}),r.jsx(B,{count:g,columns:x,rows:P,loading:h,page:t.page,pageSize:t.page_size,handleChangePage:C,handleChangeRowsPerPage:_})]})};export{ze as default};
