import{d as E,z as A,b6 as G,a as _,m4 as B,b as F,r as g,j as e,I as D,lM as L,S as u,fi as h,T as x,lu as r}from"./index-6c48ebe4.js";import{T as N}from"./index-f4e64c6d.js";import{T as O}from"./TopComponent-67802300.js";import{M as R}from"./Select-c5c274bb.js";import{M as f}from"./MenuItem-12bffc2f.js";import"./TableRow-31f0a4a1.js";import"./useMediaQuery-00a4851f.js";import"./TableContainer-45046f6e.js";import"./TableHead-37e5318b.js";import"./Grow-3d640bff.js";import"./TablePagination-cd240560.js";import"./KeyboardArrowRight-345292ac.js";import"./LastPage-6dc33080.js";import"./Toolbar-6122c8d7.js";import"./yup-75ac0470.js";import"./index.esm-fd3369ba.js";import"./GenericThumbnailView-e18774c4.js";import"./index-84485105.js";import"./createClass-8ad09c76.js";import"./popper-f3391c26.js";import"./InputAdornment-42748b9a.js";import"./TextField-3876249c.js";import"./isMuiElement-447b74a0.js";import"./ScrollableList-e9cb113e.js";import"./CircularProgress-7b4c6820.js";import"./componentStyles-1dd5fe29.js";import"./PageBreadCrumb-99fa2c5a.js";import"./PageMetaData-80da715a.js";import"./TextArea-4432195b.js";import"./Grid2-70d79e93.js";import"./Badge-16c8eac2.js";import"./FilterFilled-a2396aeb.js";import"./AntdIcon-3eb8cd38.js";import"./objectSpread2-31ff416c.js";import"./FilterOutlined-ff45270d.js";import"./index-e5978b8b.js";import"./dividerClasses-28ddda01.js";import"./listItemTextClasses-6920789d.js";import"./listItemIconClasses-a3efc5a3.js";const It=()=>{const n=E(),c=A(),l=G(),{manageGroups:{profileList:j,profileParams:a,loading:z,listCount:b},system:{userAccessList:p}}=_(t=>({manageGroups:B(t),system:F(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};
