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-60657852.js";import{T as N}from"./index-bcfba32e.js";import{T as O}from"./TopComponent-494f0585.js";import{M as R}from"./Select-7d2a5359.js";import{M as f}from"./MenuItem-64348b57.js";import"./TableRow-0ab1e69a.js";import"./index-c6051076.js";import"./TableContainer-c3087864.js";import"./TableHead-1ba4d27d.js";import"./Grow-a21bdd26.js";import"./TablePagination-dd506b19.js";import"./KeyboardArrowRight-5039311c.js";import"./LastPage-c4cc7e5b.js";import"./Toolbar-e6f520d9.js";import"./yup-75ad371b.js";import"./index.esm-509a598d.js";import"./GenericThumbnailView-f8b17afa.js";import"./index-980acb6c.js";import"./createClass-2b895736.js";import"./popper-f3391c26.js";import"./InputAdornment-12fc79ce.js";import"./TextField-6b778b78.js";import"./isMuiElement-82a67859.js";import"./ScrollableList-ef4c85dc.js";import"./componentStyles-19763afb.js";import"./PageBreadCrumb-0eb095e6.js";import"./PageMetaData-d5633bbc.js";import"./TextArea-d897dbf9.js";import"./Grid2-09163d35.js";import"./Badge-eded23ca.js";import"./FilterFilled-e5a9bf0e.js";import"./AntdIcon-53906b68.js";import"./objectSpread2-b46e5e65.js";import"./FilterOutlined-6f602090.js";import"./dividerClasses-590294d7.js";import"./listItemTextClasses-81f8effc.js";import"./listItemIconClasses-39f47a05.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};
