import{d as E,z as _,b4 as A,a as G,lw as B,b as F,r as g,j as e,I as D,lc as L,S as u,e_ as h,T as x,kW as r}from"./index-83d9c1e2.js";import{T as N}from"./index-cc00c6a4.js";import{T as O}from"./TopComponent-63d5a830.js";import{M as R}from"./Select-1505055e.js";import{M as f}from"./MenuItem-26e66f0f.js";import"./TableRow-1c35ea2a.js";import"./useMediaQuery-c67ad591.js";import"./TableContainer-98997305.js";import"./TableHead-95baa189.js";import"./Grow-6cc6748b.js";import"./TablePagination-81b30c1b.js";import"./KeyboardArrowRight-b7bab219.js";import"./Toolbar-25a41873.js";import"./yup-dfe9f223.js";import"./index.esm-82874186.js";import"./GenericThumbnailView-ceecb14e.js";import"./index-1ceef347.js";import"./popper-f3391c26.js";import"./InputAdornment-4b0a9854.js";import"./TextField-39c52322.js";import"./isMuiElement-5c2699ea.js";import"./ScrollableList-2bb71a63.js";import"./CircularProgress-3ce9da74.js";import"./componentStyles-7858e543.js";import"./PageBreadCrumb-6e858b55.js";import"./PageMetaData-1fb92714.js";import"./TextArea-7d949f4d.js";import"./Grid2-78565a55.js";import"./FilterFilled-eb3492a9.js";import"./AntdIcon-f9724de9.js";import"./objectSpread2-e5f2d908.js";import"./FilterOutlined-d00fec62.js";import"./index-e5978b8b.js";import"./dividerClasses-f18f0f93.js";import"./listItemTextClasses-fcd068d2.js";const Ct=()=>{const n=E(),l=_(),m=A(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:b},system:{userAccessList:p}}=G(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}))},c=t=>{d(i=>({...i,[t]:null}))},P=j.map((t,i)=>{const s=(a.page-1)*a.page_size+(i+1),T=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:()=>c(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:()=>{c(t!=null&&t.id?t.id:""),l("/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:()=>{c(t!=null&&t.id?t.id:""),l("/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,T)}),M=({search:t})=>{n(r({search:t||"",page:1,page_size:10}))},k=(t,i)=>{n(r({...a,search:"",page:i+1}))},I=t=>{n(r({...a,search:"",page:1,page_size:parseInt(t.target.value)}))};return g.useEffect(()=>{n(r({search:"",page:1,page_size:10})),m.setTitle("Manage Groups"),m.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:M,showFilterButton:!1,filteredData:a}),e.jsx(N,{count:b,columns:v,rows:P,loading:z,page:a.page,pageSize:a.page_size,handleChangePage:k,handleChangeRowsPerPage:I})]})};export{Ct as default};
