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-ba11e6ab.js";import{T as N}from"./index-cbb0ce26.js";import{T as O}from"./TopComponent-c12209b5.js";import{M as R}from"./Select-f9434f8a.js";import{M as f}from"./MenuItem-e4578955.js";import"./TableRow-e1616615.js";import"./useMediaQuery-c8eb26e5.js";import"./TableContainer-9178cc85.js";import"./TableHead-5a0d8cfc.js";import"./Grow-1038181b.js";import"./TablePagination-3b5112dd.js";import"./KeyboardArrowRight-36117cc9.js";import"./Toolbar-c7a1b81e.js";import"./yup-902af9ab.js";import"./index.esm-39ef576a.js";import"./GenericThumbnailView-511a7e33.js";import"./index-33824b7d.js";import"./popper-f3391c26.js";import"./InputAdornment-0f07311f.js";import"./TextField-16337ecc.js";import"./isMuiElement-f8265807.js";import"./ScrollableList-b4fc4d99.js";import"./CircularProgress-509803a6.js";import"./componentStyles-cc6f218d.js";import"./PageBreadCrumb-529dbb35.js";import"./PageMetaData-e3d52899.js";import"./TextArea-1c46e0e4.js";import"./Grid2-12794a3c.js";import"./FilterFilled-94a9d775.js";import"./AntdIcon-d49f53d6.js";import"./objectSpread2-d72b34ab.js";import"./FilterOutlined-6af8de61.js";import"./index-e5978b8b.js";import"./dividerClasses-ab944802.js";import"./listItemTextClasses-a4497781.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};
