import{b as y,E as _,eb as A,a as G,e_ as B,g as F,r as g,j as e,I as D,et as L,Q as u,b2 as h,T as x,sX as r}from"./index-d2b25495.js";import{T as N}from"./index-75fca24c.js";import{T as O}from"./TopComponent-23a44952.js";import{M as R}from"./Menu-337a466b.js";import{M as f}from"./MenuItem-2bdddad4.js";import"./TableContainer-dd7cf0ce.js";import"./TableRow-74f9cf3b.js";import"./Skeleton-1012c2e6.js";import"./index-1249dfe4.js";import"./useMediaQuery-b1fbc166.js";import"./TableHead-fac214d3.js";import"./createSvgIcon-e39ae511.js";import"./TablePagination-2c2a1682.js";import"./Select-ef36a2b2.js";import"./OutlinedInput-86f3ec98.js";import"./useFormControl-2b068664.js";import"./useControlled-8d737f13.js";import"./KeyboardArrowRight-7e978a8a.js";import"./yup-267e586f.js";import"./index.esm-ce3c2c20.js";import"./componentStyles-0e851d91.js";import"./index-709861af.js";import"./popper-f3391c26.js";import"./InputAdornment-d0c3ebef.js";import"./index-38f860bc.js";import"./InputLabel-bb6ab40e.js";/* empty css                   */import"./PageBreadCrumb-02480d86.js";import"./PageMetaData-7797a3b7.js";import"./ScrollableList-fc1de312.js";import"./Loader-1b927baf.js";import"./List-863f013e.js";import"./index.esm-3043d6d4.js";import"./TextField-e155d2be.js";import"./FormControl-73683015.js";import"./FilterFilled-4dfce120.js";import"./AntdIcon-8449be55.js";import"./objectSpread2-b41ee31b.js";import"./FilterOutlined-653b7cb0.js";import"./Grow-8719411b.js";import"./dividerClasses-02a44d89.js";import"./listItemTextClasses-cadd4b00.js";const kt=()=>{const n=y(),c=_(),l=A(),{manageGroups:{profileList:j,profileParams:s,loading:b,listCount:v},system:{userAccessList:p}}=G(t=>({manageGroups:B(t),system:F(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({}),P=(t,i)=>{d(a=>({...a,[i]:t.currentTarget}))},m=t=>{d(i=>({...i,[t]:null}))},S=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=>P(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}))},E=(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:S,loading:b,page:s.page,pageSize:s.page_size,handleChangePage:E,handleChangeRowsPerPage:I})]})};export{kt as default};
