import{d as E,z as A,b4 as G,a as _,lv as B,b as F,r as g,j as e,I as D,lb as L,S as u,eZ as h,T as x,kV as r}from"./index-dc933734.js";import{T as N}from"./index-ad373baf.js";import{T as O}from"./TopComponent-bb43a12c.js";import{M as R}from"./Select-e75c6695.js";import{M as f}from"./MenuItem-03911a3a.js";import"./TableRow-f425a931.js";import"./useMediaQuery-c00165e7.js";import"./TableContainer-dd105b51.js";import"./TableHead-2909bf19.js";import"./Grow-3459ea54.js";import"./TablePagination-4ad2d9ff.js";import"./KeyboardArrowRight-e096ea37.js";import"./Toolbar-e48cc4d1.js";import"./yup-5b2e0cf9.js";import"./index.esm-288e984c.js";import"./GenericThumbnailView-69a8725b.js";import"./index-9b86adbc.js";import"./popper-f3391c26.js";import"./InputAdornment-a4d846b9.js";import"./TextField-a8016ff3.js";import"./isMuiElement-f75ebb7c.js";import"./ScrollableList-c8354e44.js";import"./CircularProgress-b8ef250f.js";import"./componentStyles-4df963a1.js";import"./PageBreadCrumb-e8300c1b.js";import"./PageMetaData-7ff53e2b.js";import"./TextArea-80ac5c9b.js";import"./Grid2-9337452f.js";import"./FilterFilled-5453348f.js";import"./AntdIcon-bb02d05f.js";import"./objectSpread2-d52818a5.js";import"./FilterOutlined-7e274bb4.js";import"./index-e5978b8b.js";import"./dividerClasses-75377d2f.js";import"./listItemTextClasses-436d31bc.js";const Ct=()=>{const n=E(),l=A(),m=G(),{manageGroups:{profileList:j,profileParams:a,loading:b,listCount:v},system:{userAccessList:p}}=_(t=>({manageGroups:B(t),system:F(t)})),z=[{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:v,columns:z,rows:P,loading:b,page:a.page,pageSize:a.page_size,handleChangePage:k,handleChangeRowsPerPage:I})]})};export{Ct as default};
