import{d as E,z as A,b7 as G,a as _,nt as B,b as F,r as g,j as e,I as D,n9 as L,S as u,eI as h,T as x,mT as r}from"./index-e79f7aad.js";import{T as N}from"./index-a65810f4.js";import{T as O}from"./TopComponent-c7efe4ac.js";import{M as R}from"./Select-8a61e5a6.js";import{M as f}from"./MenuItem-c14df0e9.js";import"./TableRow-0ea91e40.js";import"./useMediaQuery-9155ba05.js";import"./TableContainer-00013c19.js";import"./TableHead-1f8b658d.js";import"./TablePagination-6f9f31d4.js";import"./KeyboardArrowRight-4ee9435c.js";import"./LastPage-1ca2417e.js";import"./Toolbar-d2cd5725.js";import"./yup-96f14780.js";import"./index.esm-1ca67d65.js";import"./GenericThumbnailView-8a83a30c.js";import"./index-310d07a1.js";import"./createClass-b86a4c8d.js";import"./popper-f3391c26.js";import"./InputAdornment-d42c17cd.js";import"./TextField-21e22d39.js";import"./isMuiElement-db2b7d4c.js";import"./ScrollableList-5929779e.js";import"./CircularProgress-8c35778c.js";import"./componentStyles-7718fc5e.js";import"./PageBreadCrumb-b94acfd7.js";import"./PageMetaData-8b0c63da.js";import"./TextArea-ec29d1d5.js";import"./Grid2-7786e458.js";import"./Badge-d6f9bad7.js";import"./FilterFilled-8d538f67.js";import"./AntdIcon-1cfbd840.js";import"./objectSpread2-d56e1476.js";import"./FilterOutlined-c331cda0.js";import"./index-e5978b8b.js";import"./dividerClasses-691b251c.js";import"./listItemTextClasses-d3a968ad.js";import"./listItemIconClasses-03011ebf.js";const It=()=>{const n=E(),c=A(),l=G(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:b},system:{userAccessList:p}}=_(t=>({manageGroups:B(t),system:F(t)})),v=[{title:"S.No",width:100},{title:"Name",width:100},{title:"Actions",width:100}];function C(t,i,s){return{index:t,title:i,actions:s}}const[o,d]=g.useState({}),S=(t,i)=>{d(s=>({...s,[i]:t.currentTarget}))},m=t=>{d(i=>({...i,[t]:null}))},P=j.map((t,i)=>{const s=(a.page-1)*a.page_size+(i+1),k=e.jsxs(e.Fragment,{children:[e.jsx(D,{sx:{px:"6px"},tabIndex:i,onClick:y=>S(y,t.id?`${t.id}`:""),"aria-controls":o[t!=null&&t.id?t.id:""]?"account-menu":void 0,"aria-haspopup":"true","aria-expanded":o[t!=null&&t.id?t.id:""]?"true":void 0,children:e.jsx(L,{size:16})}),e.jsxs(R,{anchorEl:o[t!=null&&t.id?t.id:""],id:"account-menu",open:!!o[t!=null&&t.id?t.id:""],onClose:()=>m(t!=null&&t.id?t.id:""),PaperProps:{elevation:0,sx:{overflow:"visible",filter:"drop-shadow(0px 1px 2px rgba(185, 185, 185, 0.32))",mt:1.5,"& .MuiAvatar-root":{width:32,height:32,ml:-.5,mr:1},"&:before":{content:'""',display:"block",position:"absolute",top:0,right:14,width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) rotate(45deg)",zIndex:0}}},transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},children:[(p==null?void 0:p.indexOf("auth.change_group"))!==-1&&e.jsx(f,{onClick:()=>{m(t!=null&&t.id?t.id:""),c("/pages/settings/manage-profile/"+t.id)},children:e.jsxs(u,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(h,{style:{cursor:"pointer",color:"#fc6f03",fontSize:"10px"}}),e.jsx(x,{children:"Edit"})]})}),e.jsx(f,{onClick:()=>{m(t!=null&&t.id?t.id:""),c("/pages/settings/datapermissions/"+t.id)},children:e.jsxs(u,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(h,{style:{cursor:"pointer",color:"#fc6f03",fontSize:"10px"}}),e.jsx(x,{children:"Data Permissions"})]})})]})]});return C(s,t.name,k)}),I=({search:t})=>{n(r({search:t||"",page:1,page_size:10}))},M=(t,i)=>{n(r({...a,search:"",page:i+1}))},T=t=>{n(r({...a,search:"",page:1,page_size:parseInt(t.target.value)}))};return g.useEffect(()=>{n(r({search:"",page:1,page_size:10})),l.setTitle("Manage Groups"),l.setSubtitle("Settings")},[]),e.jsxs(e.Fragment,{children:[e.jsx(O,{permissionPreFix:"auth",permissionPostFix:"group",navigateLink:"/pages/settings/manage-profile/0",showAddButton:!0,addButtonName:"Add Group",handleSearch:I,showFilterButton:!1,filteredData:a}),e.jsx(N,{count:b,columns:v,rows:P,loading:z,page:a.page,pageSize:a.page_size,handleChangePage:M,handleChangeRowsPerPage:T})]})};export{It as default};
