import{d as E,k as A,aV as G,a as _,ld as B,b as D,r as g,j as e,I as F,kT as L,S as u,eS as h,T as x,kD as r}from"./index-4dfc510b.js";import{T as N}from"./index-2560e6e6.js";import{T as O}from"./TopComponent-df931c7e.js";import{M as R}from"./Menu-0f556e12.js";import{M as f}from"./MenuItem-9737e3d9.js";import"./TableRow-bee40746.js";import"./useMediaQuery-75ea24f6.js";import"./TableContainer-3d0f0f18.js";import"./TableHead-c19aff48.js";import"./Grow-a7315f12.js";import"./TablePagination-faf46d98.js";import"./KeyboardArrowRight-605c8352.js";import"./Toolbar-1cf142b4.js";import"./Select-c8503f85.js";import"./index-e5978b8b.js";import"./yup-80def618.js";import"./index.esm-0a454763.js";import"./GenericThumbnailView-6256cad7.js";import"./index-9a385720.js";import"./popper-f3391c26.js";import"./InputAdornment-ccd6e8ff.js";import"./TextField-c0d4022e.js";import"./isMuiElement-7be61a21.js";import"./ScrollableList-bef4a518.js";import"./CircularProgress-d36b5e75.js";import"./componentStyles-df94248d.js";import"./PageBreadCrumb-59ca32fd.js";import"./PageMetaData-9d85e469.js";import"./TextArea-a0cc14f3.js";import"./Grid2-713975b3.js";import"./FilterFilled-dc66781c.js";import"./AntdIcon-90a37458.js";import"./objectSpread2-66550f90.js";import"./FilterOutlined-6c52d192.js";import"./dividerClasses-26c2a6d6.js";import"./listItemTextClasses-e85f7ff0.js";const bt=()=>{const n=E(),l=A(),m=G(),{manageGroups:{profileList:j,profileParams:a,loading:v,listCount:z},system:{userAccessList:p}}=_(t=>({manageGroups:B(t),system:D(t)})),C=[{title:"S.No",width:100},{title:"Name",width:100},{title:"Actions",width:100}];function S(t,i,s){return{index:t,title:i,actions:s}}const[o,d]=g.useState({}),b=(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),I=e.jsxs(e.Fragment,{children:[e.jsx(F,{sx:{px:"6px"},tabIndex:i,onClick:y=>b(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 S(s,t.name,I)}),k=({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})),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:k,showFilterButton:!1,filteredData:a}),e.jsx(N,{count:z,columns:C,rows:P,loading:v,page:a.page,pageSize:a.page_size,handleChangePage:M,handleChangeRowsPerPage:T})]})};export{bt as default};
