import{b as E,F as A,e8 as F,a as G,f7 as _,h as B,r as g,j as e,I as D,ey as L,S as u,b2 as h,T as x,sX as r}from"./index-43bf7a1c.js";import{T as N}from"./index-2d303f1d.js";import{T as O}from"./TopComponent-6b8acdbd.js";import{M as R}from"./Menu-362130d3.js";import{M as f}from"./MenuItem-58b8887e.js";import"./TableContainer-b977c6cc.js";import"./TableRow-86264944.js";import"./Skeleton-ed4df299.js";import"./index-5757b954.js";import"./useMediaQuery-d6627623.js";import"./TableHead-fb4972c5.js";import"./createSvgIcon-f118be02.js";import"./TablePagination-9147f93d.js";import"./Select-44fd3147.js";import"./OutlinedInput-6bcf3cf8.js";import"./useFormControl-2c5d60c2.js";import"./List-6fcc4821.js";import"./useControlled-ab567149.js";import"./KeyboardArrowRight-8bd7c13f.js";import"./yup-3b80ed10.js";import"./index.esm-0548c843.js";import"./componentStyles-4624000e.js";import"./floating-ui.dom-e7d69f3b.js";import"./InputAdornment-b1a1aa58.js";import"./index-913b2dc6.js";import"./InputLabel-6c7474f0.js";/* empty css                   */import"./PageBreadCrumb-9a31a3c1.js";import"./PageMetaData-7350980e.js";import"./ScrollableList-e19132c3.js";import"./Loader-aabe9ed3.js";import"./index.esm-f9e0a906.js";import"./TextField-4da97115.js";import"./FormControl-8d011aab.js";import"./FilterFilled-ccc86e02.js";import"./AntdIcon-634507e8.js";import"./objectSpread2-c31b885b.js";import"./presets-bb9bdfd8.js";import"./FilterOutlined-908c8e25.js";import"./Grow-ca573f65.js";import"./dividerClasses-497df10c.js";import"./listItemTextClasses-0ea25cee.js";const kt=()=>{const n=E(),c=A(),l=F(),{manageGroups:{profileList:j,profileParams:s,loading:b,listCount:v},system:{userAccessList:p}}=G(t=>({manageGroups:_(t),system:B(t)})),z=[{title:"S.No",width:100},{title:"Name",width:100},{title:"Actions",width:100}];function C(t,i,a){return{index:t,title:i,actions:a}}const[o,d]=g.useState({}),S=(t,i)=>{d(a=>({...a,[i]:t.currentTarget}))},m=t=>{d(i=>({...i,[t]:null}))},P=j.map((t,i)=>{const a=(s.page-1)*s.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(a,t.name,T)}),M=({search:t})=>{n(r({search:t||"",page:1,page_size:10}))},y=(t,i)=>{n(r({...s,search:"",page:i+1}))},I=t=>{n(r({...s,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:s}),e.jsx(N,{count:v,columns:z,rows:P,loading:b,page:s.page,pageSize:s.page_size,handleChangePage:y,handleChangeRowsPerPage:I})]})};export{kt as default};
