import{d as y,A,b8 as G,a as _,nE as B,b as F,r as g,j as e,I as D,nk as L,S as u,eK as h,T as x,n2 as r}from"./index-c3f592b2.js";import{T as N}from"./index-6f96a8b8.js";import{T as O}from"./TopComponent-b33f8e61.js";import{M as R}from"./Select-9d10c4ab.js";import{M as f}from"./MenuItem-e7a45c4b.js";import"./TableRow-974e102e.js";import"./index-88943ce1.js";import"./TableContainer-a7e6bb64.js";import"./TableHead-98885dba.js";import"./Grow-f61cc5ca.js";import"./TablePagination-fd957a04.js";import"./KeyboardArrowRight-8b3fa289.js";import"./LastPage-a52503ff.js";import"./Toolbar-ac8f3726.js";import"./yup-abb4a026.js";import"./index.esm-70dd1c06.js";import"./GenericThumbnailView-9f1d2f81.js";import"./index-78da10f4.js";import"./createClass-c7973e27.js";import"./popper-f3391c26.js";import"./InputAdornment-fd596377.js";import"./TextField-7d0d5009.js";import"./isMuiElement-43203123.js";import"./ScrollableList-ecbfc0f3.js";import"./componentStyles-b8fcedb5.js";import"./PageBreadCrumb-3847db64.js";import"./PageMetaData-94316e20.js";import"./TextArea-674a9ec6.js";import"./Grid2-9e718eb0.js";import"./Badge-cd0016c6.js";import"./FilterFilled-90800ccd.js";import"./AntdIcon-b07622f5.js";import"./objectSpread2-890c3efa.js";import"./FilterOutlined-c55dda18.js";import"./dividerClasses-03c42ea7.js";import"./listItemTextClasses-3ff99335.js";import"./listItemIconClasses-b60c7a41.js";const Pt=()=>{const n=y(),m=A(),l=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),I=e.jsxs(e.Fragment,{children:[e.jsx(D,{sx:{px:"6px"},tabIndex:i,onClick:T=>S(T,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:""),m("/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:""),m("/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,I)}),M=({search:t})=>{n(r({search:t||"",page:1,page_size:10}))},k=(t,i)=>{n(r({...a,search:"",page:i+1}))},E=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:v,columns:z,rows:P,loading:b,page:a.page,pageSize:a.page_size,handleChangePage:k,handleChangeRowsPerPage:E})]})};export{Pt as default};
