import{d as E,z as A,b4 as B,a as G,lB as _,b as F,r as g,j as e,I as D,lh as L,S as u,f5 as h,T as x,k$ as r}from"./index-0698dbe6.js";import{T as N}from"./index-60056aa1.js";import{T as O}from"./TopComponent-1e487f98.js";import{M as R}from"./Select-371fc2c6.js";import{M as f}from"./MenuItem-aa4e2c66.js";import"./TableRow-2848b050.js";import"./useMediaQuery-98e2832a.js";import"./TableContainer-99852104.js";import"./TableHead-0cf6a9bf.js";import"./Grow-ea87e600.js";import"./TablePagination-a4795561.js";import"./KeyboardArrowRight-4fe4c481.js";import"./LastPage-1dfd52ba.js";import"./Toolbar-14560ae2.js";import"./yup-7a53beb8.js";import"./index.esm-85d015f3.js";import"./GenericThumbnailView-dca658f3.js";import"./index-c9a9ee7a.js";import"./createClass-61c32f27.js";import"./popper-f3391c26.js";import"./InputAdornment-0c2174b6.js";import"./TextField-4222c766.js";import"./isMuiElement-d179539f.js";import"./ScrollableList-fc87149c.js";import"./CircularProgress-4f55e66c.js";import"./componentStyles-91278318.js";import"./PageBreadCrumb-4672acbd.js";import"./PageMetaData-cd33e3c3.js";import"./TextArea-91c96faf.js";import"./Grid2-a3850bef.js";import"./FilterFilled-b68f936d.js";import"./AntdIcon-ef833303.js";import"./objectSpread2-86ebda25.js";import"./FilterOutlined-0ae4b12f.js";import"./index-e5978b8b.js";import"./dividerClasses-2d12c750.js";import"./listItemTextClasses-d0728874.js";import"./listItemIconClasses-6eed47b3.js";const Mt=()=>{const n=E(),l=A(),m=B(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:b},system:{userAccessList:p}}=G(t=>({manageGroups:_(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{Mt as default};
