import{d as E,k as A,aV as G,a as _,ld as B,b as D,r as g,j as e,I as F,kT as L,S as u,eR as h,T as x,kD as r}from"./index-c5c88b67.js";import{T as N}from"./index-f0b37835.js";import{T as O}from"./TopComponent-7c005d8e.js";import{M as R}from"./Menu-e7d2b2ee.js";import{M as f}from"./MenuItem-81e44793.js";import"./TableRow-2b359fa8.js";import"./useMediaQuery-fe3ce37c.js";import"./TableContainer-c31f204a.js";import"./TableHead-c2c21491.js";import"./Grow-7345f8ea.js";import"./TablePagination-0147f84a.js";import"./KeyboardArrowRight-261f4f43.js";import"./Toolbar-f8d4b0c4.js";import"./Select-4ed8db5d.js";import"./index-e5978b8b.js";import"./yup-41605283.js";import"./index.esm-81620445.js";import"./GenericThumbnailView-43782201.js";import"./index-c98d1d89.js";import"./createClass-fb49042e.js";import"./popper-f3391c26.js";import"./InputAdornment-d66117f3.js";import"./TextField-78388962.js";import"./isMuiElement-b3c21f38.js";import"./ScrollableList-21ab2b9c.js";import"./CircularProgress-13afa056.js";import"./componentStyles-a5e5a830.js";import"./PageBreadCrumb-94fdb2ed.js";import"./PageMetaData-deabce52.js";import"./TextArea-aad9dffe.js";import"./Grid2-0ff60c92.js";import"./FilterFilled-9066fadd.js";import"./AntdIcon-1a0d7a6b.js";import"./objectSpread2-65a0d991.js";import"./FilterOutlined-67649527.js";import"./dividerClasses-6bc0ca72.js";import"./listItemTextClasses-88792089.js";const Pt=()=>{const n=E(),l=A(),m=G(),{manageGroups:{profileList:j,profileParams:a,loading:v,listCount:z},system:{userAccessList:p}}=_(t=>({manageGroups:B(t),system:D(t)})),C=[{title:"S.No",width:100},{title:"Name",width:100},{title:"Actions",width:100}];function b(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(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:()=>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:""),l("/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:""),l("/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 b(s,t.name,I)}),k=({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})),m.setTitle("Manage Groups"),m.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:k,showFilterButton:!1,filteredData:a}),e.jsx(N,{count:z,columns:C,rows:P,loading:v,page:a.page,pageSize:a.page_size,handleChangePage:M,handleChangeRowsPerPage:T})]})};export{Pt as default};
