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-def636a4.js";import{T as N}from"./index-fc769754.js";import{T as O}from"./TopComponent-7f7c384d.js";import{M as R}from"./Menu-af49d134.js";import{M as f}from"./MenuItem-8fdd2340.js";import"./TableContainer-5944247b.js";import"./TableRow-2c544f58.js";import"./Skeleton-5cf57ed1.js";import"./index-b5a6fbe3.js";import"./useMediaQuery-4304fb25.js";import"./TableHead-f0476938.js";import"./createSvgIcon-ff487f53.js";import"./TablePagination-7d3b42e9.js";import"./Select-2cfb5afd.js";import"./OutlinedInput-ddb8bb3f.js";import"./useFormControl-880b2f7b.js";import"./List-17cd485b.js";import"./useControlled-bd643819.js";import"./KeyboardArrowRight-bfb3d848.js";import"./yup-c8535458.js";import"./index.esm-7d9d1491.js";import"./componentStyles-41382c67.js";import"./floating-ui.dom-e7d69f3b.js";import"./InputAdornment-196a5386.js";import"./index-f48c8aa0.js";import"./InputLabel-e2e73b27.js";/* empty css                   */import"./PageBreadCrumb-816019c3.js";import"./PageMetaData-0f9457e5.js";import"./ScrollableList-a550bc32.js";import"./Loader-16c57fae.js";import"./index.esm-eec4f448.js";import"./TextField-2ba95a45.js";import"./FormControl-1f811046.js";import"./FilterFilled-08c5b5a7.js";import"./AntdIcon-34324527.js";import"./objectSpread2-a4d0f5f6.js";import"./presets-dbb0f3bf.js";import"./FilterOutlined-03ee9578.js";import"./Grow-85576dd3.js";import"./dividerClasses-2b953c2a.js";import"./listItemTextClasses-063fcacf.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};
