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,eS as h,T as x,kD as r}from"./index-d895656a.js";import{T as N}from"./index-ea344eac.js";import{T as O}from"./TopComponent-17bc7e9c.js";import{M as R}from"./Menu-1728e1dd.js";import{M as f}from"./MenuItem-f1f55b7e.js";import"./TableRow-5557ab84.js";import"./useMediaQuery-dbbc87b0.js";import"./TableContainer-a89da0a1.js";import"./TableHead-1b575958.js";import"./Grow-d4be81a5.js";import"./TablePagination-582dd1d9.js";import"./KeyboardArrowRight-5067dfe9.js";import"./Toolbar-adca1e0f.js";import"./Select-6d425a72.js";import"./index-e5978b8b.js";import"./yup-9573aa79.js";import"./index.esm-1087b2f3.js";import"./GenericThumbnailView-532ea2d7.js";import"./index-45bf15b6.js";import"./popper-f3391c26.js";import"./InputAdornment-36977269.js";import"./TextField-6f73e19a.js";import"./isMuiElement-424c145f.js";import"./ScrollableList-e2b22048.js";import"./CircularProgress-1f3ca34c.js";import"./componentStyles-866300fe.js";import"./PageBreadCrumb-5e129db8.js";import"./PageMetaData-47148824.js";import"./TextArea-fb0d0821.js";import"./Grid2-5bd460ea.js";import"./FilterFilled-9d5acdc3.js";import"./AntdIcon-19e16777.js";import"./objectSpread2-c21546fe.js";import"./FilterOutlined-b6007bf1.js";import"./dividerClasses-f4dcf412.js";import"./listItemTextClasses-1ed38b44.js";const bt=()=>{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 S(t,i,s){return{index:t,title:i,actions:s}}const[o,d]=g.useState({}),b=(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=>b(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 S(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{bt as default};
