import{d as E,z as A,b6 as G,a as _,mc as B,b as F,r as g,j as e,I as L,lU as D,S as u,eL as h,T as x,lC as r}from"./index-c121b02d.js";import{T as N}from"./index-4981d6f8.js";import{T as O}from"./TopComponent-fbb2eda6.js";import{M as R}from"./Select-dd7adaf8.js";import{M as f}from"./MenuItem-0f1fc7f8.js";import"./TableRow-0b65a5b3.js";import"./useMediaQuery-4319583b.js";import"./TableContainer-be48ac32.js";import"./TableHead-9a25be14.js";import"./Grow-9a484472.js";import"./TablePagination-6fddb4ff.js";import"./KeyboardArrowRight-87bf88d8.js";import"./LastPage-df7292bf.js";import"./Toolbar-600c82f3.js";import"./yup-1361ecb6.js";import"./index.esm-0c6778ff.js";import"./GenericThumbnailView-77114fcb.js";import"./index-2d756126.js";import"./createClass-66eb0661.js";import"./popper-f3391c26.js";import"./InputAdornment-ae4c2625.js";import"./TextField-f9d2a024.js";import"./isMuiElement-d52f64c2.js";import"./ScrollableList-dc408f1e.js";import"./CircularProgress-fa872e62.js";import"./componentStyles-2d610038.js";import"./PageBreadCrumb-c5db4f23.js";import"./PageMetaData-a1035f31.js";import"./TextArea-dfbfc4f6.js";import"./Grid2-1ceedf41.js";import"./Badge-fa1b30d0.js";import"./FilterFilled-a045b23e.js";import"./AntdIcon-28682171.js";import"./objectSpread2-d754d5ed.js";import"./FilterOutlined-2ca7e07d.js";import"./index-e5978b8b.js";import"./dividerClasses-81752629.js";import"./listItemTextClasses-27b4ea1b.js";import"./listItemIconClasses-b2c374f0.js";const It=()=>{const n=E(),c=A(),l=G(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:C},system:{userAccessList:p}}=_(t=>({manageGroups:B(t),system:F(t)})),b=[{title:"S.No",width:100},{title:"Name",width:100},{title:"Actions",width:100}];function v(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(L,{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(D,{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 v(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:C,columns:b,rows:P,loading:z,page:a.page,pageSize:a.page_size,handleChangePage:I,handleChangeRowsPerPage:T})]})};export{It as default};
