import{d as E,z as A,b6 as F,a as G,mf as _,b as B,r as g,j as e,I as D,lX as L,S as u,ew as h,T as x,lF as r}from"./index-aa25c5ff.js";import{T as N}from"./index-1b842ccf.js";import{T as O}from"./TopComponent-093835c5.js";import{M as R}from"./Select-b8388c2f.js";import{M as f}from"./MenuItem-6f39aa2e.js";import"./TableRow-ee82d902.js";import"./useMediaQuery-5832b4d6.js";import"./TableContainer-150455ba.js";import"./TableHead-7918647e.js";import"./Grow-53c7e965.js";import"./TablePagination-7f533723.js";import"./KeyboardArrowRight-207c2b3b.js";import"./LastPage-cc741249.js";import"./Toolbar-aae1a453.js";import"./yup-72cc4918.js";import"./index.esm-a7f661dc.js";import"./GenericThumbnailView-e0343bac.js";import"./index-d4b36417.js";import"./createClass-d1bae5ec.js";import"./popper-f3391c26.js";import"./InputAdornment-1e7eea92.js";import"./TextField-55b66d20.js";import"./isMuiElement-1b254892.js";import"./ScrollableList-9498bc37.js";import"./CircularProgress-d6cfca6d.js";import"./componentStyles-e32842f3.js";import"./PageBreadCrumb-6e4973c8.js";import"./PageMetaData-ba7cb151.js";import"./TextArea-d1a16eb1.js";import"./Grid2-d00e0f6a.js";import"./Badge-9e87965d.js";import"./FilterFilled-8e291e82.js";import"./AntdIcon-b92b7162.js";import"./objectSpread2-f5b2f6aa.js";import"./FilterOutlined-7f40b65c.js";import"./index-e5978b8b.js";import"./dividerClasses-ce522944.js";import"./listItemTextClasses-88140258.js";import"./listItemIconClasses-31a870c1.js";const It=()=>{const n=E(),c=A(),l=F(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:b},system:{userAccessList:p}}=G(t=>({manageGroups:_(t),system:B(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)}),M=({search:t})=>{n(r({search:t||"",page:1,page_size:10}))},I=(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:M,showFilterButton:!1,filteredData:a}),e.jsx(N,{count:b,columns:v,rows:P,loading:z,page:a.page,pageSize:a.page_size,handleChangePage:I,handleChangeRowsPerPage:T})]})};export{It as default};
