import{d as E,z as A,b6 as F,a as G,mf as _,b as B,r as g,j as e,I as D,lX as L,S as u,ew as h,T as x,lF as r}from"./index-6f149d0c.js";import{T as N}from"./index-2cd683b8.js";import{T as O}from"./TopComponent-18d86a87.js";import{M as R}from"./Select-70a66099.js";import{M as f}from"./MenuItem-8bc5d37f.js";import"./TableRow-1e254c97.js";import"./useMediaQuery-4f481de0.js";import"./TableContainer-98fd6e5d.js";import"./TableHead-483470b3.js";import"./Grow-aea427ae.js";import"./TablePagination-40662a32.js";import"./KeyboardArrowRight-1f33e1ff.js";import"./LastPage-de948385.js";import"./Toolbar-7b4b233b.js";import"./yup-7ebcc99d.js";import"./index.esm-88773116.js";import"./GenericThumbnailView-01fef5a2.js";import"./index-a88b83d7.js";import"./createClass-925b8ab0.js";import"./popper-f3391c26.js";import"./InputAdornment-ca5e29e7.js";import"./TextField-a5af71e6.js";import"./isMuiElement-36ccba67.js";import"./ScrollableList-e382be10.js";import"./CircularProgress-49299c74.js";import"./componentStyles-d6393a0a.js";import"./PageBreadCrumb-7efa6a84.js";import"./PageMetaData-456ccb42.js";import"./TextArea-eb0beb3a.js";import"./Grid2-3d1a13f9.js";import"./Badge-806f3b3c.js";import"./FilterFilled-843cffe9.js";import"./AntdIcon-d56b3db9.js";import"./objectSpread2-bd69b5ce.js";import"./FilterOutlined-8cc7981d.js";import"./index-e5978b8b.js";import"./dividerClasses-aa25d579.js";import"./listItemTextClasses-6dace016.js";import"./listItemIconClasses-4d219f9a.js";const It=()=>{const n=E(),c=A(),l=F(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:b},system:{userAccessList:p}}=G(t=>({manageGroups:_(t),system:B(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};
