import{d as E,z as A,b7 as G,a as _,mX as B,b as D,r as g,j as e,I as F,mD as L,S as u,eI as h,T as x,ml as r}from"./index-952e178b.js";import{T as N}from"./index-baa25e61.js";import{T as O}from"./TopComponent-014bb272.js";import{M as R}from"./Select-41d78585.js";import{M as f}from"./MenuItem-f41722f4.js";import"./TableRow-6a27d7f4.js";import"./useMediaQuery-86e0ce33.js";import"./TableContainer-e3ecf13b.js";import"./TableHead-e31d41f4.js";import"./TablePagination-b93979a3.js";import"./KeyboardArrowRight-c3d685e2.js";import"./LastPage-54692111.js";import"./Toolbar-201b514b.js";import"./yup-d92565dd.js";import"./index.esm-6feddb16.js";import"./GenericThumbnailView-4e535459.js";import"./index-22eb3e7f.js";import"./createClass-5a32667f.js";import"./popper-f3391c26.js";import"./InputAdornment-020147de.js";import"./TextField-d1a887ff.js";import"./isMuiElement-f03a71e4.js";import"./ScrollableList-cd5816a8.js";import"./CircularProgress-3b605689.js";import"./componentStyles-00160cc0.js";import"./PageBreadCrumb-816b8f21.js";import"./PageMetaData-7c78dec7.js";import"./TextArea-ce7716c9.js";import"./Grid2-7b742c2a.js";import"./Badge-77cbabc6.js";import"./FilterFilled-1ab4da14.js";import"./AntdIcon-54006664.js";import"./objectSpread2-a71852a2.js";import"./FilterOutlined-95879914.js";import"./index-e5978b8b.js";import"./dividerClasses-8e897c94.js";import"./listItemTextClasses-ca40551b.js";import"./listItemIconClasses-3e4286ad.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:D(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(F,{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)}),I=({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})),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:I,showFilterButton:!1,filteredData:a}),e.jsx(N,{count:b,columns:v,rows:P,loading:z,page:a.page,pageSize:a.page_size,handleChangePage:M,handleChangeRowsPerPage:T})]})};export{It as default};
