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-60a3c753.js";import{T as N}from"./index-7e55cf46.js";import{T as O}from"./TopComponent-69eda74c.js";import{M as R}from"./Menu-d1b7e1c3.js";import{M as f}from"./MenuItem-2f410bd2.js";import"./TableContainer-414c12e0.js";import"./TableRow-0b33776c.js";import"./Skeleton-98c353d9.js";import"./index-a99c9f65.js";import"./useMediaQuery-dba48e3b.js";import"./TableHead-f864c753.js";import"./createSvgIcon-de433e5f.js";import"./TablePagination-218dde38.js";import"./Select-99fc0d84.js";import"./OutlinedInput-3a884178.js";import"./useFormControl-e13b5747.js";import"./List-f567f8e4.js";import"./useControlled-194ef007.js";import"./KeyboardArrowRight-b2645aed.js";import"./yup-92678dde.js";import"./index.esm-c494934a.js";import"./componentStyles-7753bbb9.js";import"./floating-ui.dom-e7d69f3b.js";import"./InputAdornment-96c40dce.js";import"./index-900fa817.js";import"./InputLabel-71dfc9d4.js";/* empty css                   */import"./PageBreadCrumb-fcf1e00a.js";import"./PageMetaData-198e143e.js";import"./ScrollableList-1962b023.js";import"./Loader-466ccb5e.js";import"./index.esm-62d6b2f7.js";import"./TextField-32b29087.js";import"./FormControl-d13d2693.js";import"./FilterFilled-cdde02db.js";import"./AntdIcon-bed41c21.js";import"./objectSpread2-85813881.js";import"./presets-06d13753.js";import"./FilterOutlined-c131dc67.js";import"./Grow-68442588.js";import"./dividerClasses-3fa67596.js";import"./listItemTextClasses-36afdb92.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};
