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 D,lU as L,S as u,fr as h,T as x,lC as r}from"./index-e0c07a84.js";import{T as N}from"./index-94063e98.js";import{T as O}from"./TopComponent-df917583.js";import{M as R}from"./Select-a8f8fd6a.js";import{M as f}from"./MenuItem-9dcf8782.js";import"./TableRow-248ce459.js";import"./useMediaQuery-61792d39.js";import"./TableContainer-84b94d99.js";import"./TableHead-3bf23892.js";import"./Grow-5c4c469c.js";import"./TablePagination-da0d0adf.js";import"./KeyboardArrowRight-aeb4c8ed.js";import"./LastPage-d8600c66.js";import"./Toolbar-c85ba7f8.js";import"./yup-74a95d85.js";import"./index.esm-79617ba5.js";import"./GenericThumbnailView-d192caf7.js";import"./index-c7a54fed.js";import"./createClass-1acb73b4.js";import"./popper-f3391c26.js";import"./InputAdornment-bf957c61.js";import"./TextField-23174150.js";import"./isMuiElement-953ce284.js";import"./ScrollableList-874c742d.js";import"./CircularProgress-cff840b0.js";import"./componentStyles-5432a72d.js";import"./PageBreadCrumb-6771b805.js";import"./PageMetaData-5fed2c1a.js";import"./TextArea-e9886f56.js";import"./Grid2-05f25635.js";import"./Badge-3eca5e1a.js";import"./FilterFilled-80640201.js";import"./AntdIcon-bc64d1d9.js";import"./objectSpread2-f946b5f0.js";import"./FilterOutlined-6138f61b.js";import"./index-e5978b8b.js";import"./dividerClasses-6c6c8dc7.js";import"./listItemTextClasses-e9c46ccd.js";import"./listItemIconClasses-129e65e5.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(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 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};
