import{d as E,z as A,b6 as G,a as _,m4 as B,b as F,r as g,j as e,I as D,lM as L,S as u,fi as h,T as x,lu as r}from"./index-458d5762.js";import{T as N}from"./index-7483f8f7.js";import{T as O}from"./TopComponent-eac7a2e9.js";import{M as R}from"./Select-1c8a1710.js";import{M as f}from"./MenuItem-5cd95798.js";import"./TableRow-804f1ca0.js";import"./useMediaQuery-49fd660f.js";import"./TableContainer-e19f0ed8.js";import"./TableHead-f91d726f.js";import"./Grow-1b19ccc0.js";import"./TablePagination-a615fa80.js";import"./KeyboardArrowRight-d389d7f9.js";import"./LastPage-ff5a6182.js";import"./Toolbar-866a7faf.js";import"./yup-536c503d.js";import"./index.esm-b1b14098.js";import"./GenericThumbnailView-3cd8dbb5.js";import"./index-3b6e321a.js";import"./createClass-9305c513.js";import"./popper-f3391c26.js";import"./InputAdornment-84b43ef6.js";import"./TextField-e297d925.js";import"./isMuiElement-6ed6867f.js";import"./ScrollableList-ba92364a.js";import"./CircularProgress-cad31cee.js";import"./componentStyles-56425874.js";import"./PageBreadCrumb-935feb12.js";import"./PageMetaData-98466a56.js";import"./TextArea-233680fc.js";import"./Grid2-e3c9383e.js";import"./Badge-15ca6164.js";import"./FilterFilled-c223055e.js";import"./AntdIcon-99e065a0.js";import"./objectSpread2-cbe250a0.js";import"./FilterOutlined-41555a07.js";import"./index-e5978b8b.js";import"./dividerClasses-eff9af63.js";import"./listItemTextClasses-04d37f34.js";import"./listItemIconClasses-8da63284.js";const It=()=>{const n=E(),c=A(),l=G(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:b},system:{userAccessList:p}}=_(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}))},m=t=>{d(i=>({...i,[t]:null}))},P=j.map((t,i)=>{const s=(a.page-1)*a.page_size+(i+1),k=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:()=>m(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:()=>{m(t!=null&&t.id?t.id:""),c("/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:()=>{m(t!=null&&t.id?t.id:""),c("/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,k)}),M=({search:t})=>{n(r({search:t||"",page:1,page_size:10}))},I=(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})),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:b,columns:v,rows:P,loading:z,page:a.page,pageSize:a.page_size,handleChangePage:I,handleChangeRowsPerPage:T})]})};export{It as default};
