import{d as y,z as A,b6 as G,a as _,me as B,b as F,r as g,j as e,I as D,lW as L,S as u,ew as h,T as x,lE as r}from"./index-e6164346.js";import{T as N}from"./index-8e856c3a.js";import{T as O}from"./TopComponent-3000777e.js";import{M as R}from"./Select-9c2d8cd2.js";import{M as f}from"./MenuItem-8dd174fb.js";import"./TableRow-bf4e60a0.js";import"./useMediaQuery-43140cef.js";import"./TableContainer-7ecd96ea.js";import"./TableHead-0c525f54.js";import"./Grow-306e2fd0.js";import"./TablePagination-b02830fa.js";import"./KeyboardArrowRight-73af71dd.js";import"./LastPage-b9dcf78c.js";import"./Toolbar-82d22fac.js";import"./yup-5fd5d57b.js";import"./index.esm-0a041314.js";import"./GenericThumbnailView-80c6fd98.js";import"./index-ce90e1a7.js";import"./createClass-ad55a3ca.js";import"./popper-f3391c26.js";import"./InputAdornment-59975edf.js";import"./TextField-db9cff08.js";import"./isMuiElement-5779af4f.js";import"./ScrollableList-5a17e8f4.js";import"./CircularProgress-7d99d864.js";import"./componentStyles-00385170.js";import"./PageBreadCrumb-87110024.js";import"./PageMetaData-3ca96413.js";import"./TextArea-f5c200de.js";import"./Grid2-c9c87842.js";import"./Badge-4f6d4e12.js";import"./FilterFilled-c0851aaa.js";import"./AntdIcon-4f5aa87b.js";import"./objectSpread2-7d7378cc.js";import"./FilterOutlined-3561fb77.js";import"./index-e5978b8b.js";import"./dividerClasses-932c3e8b.js";import"./listItemTextClasses-6b253cb4.js";import"./listItemIconClasses-a58b491d.js";const Et=()=>{const n=y(),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),T=e.jsxs(e.Fragment,{children:[e.jsx(D,{sx:{px:"6px"},tabIndex:i,onClick:k=>S(k,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,T)}),M=({search:t})=>{n(r({search:t||"",page:1,page_size:10}))},E=(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})),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:E,handleChangeRowsPerPage:I})]})};export{Et as default};
