"use strict";(self.webpackChunkhws_plugin_authorization_access_manager=self.webpackChunkhws_plugin_authorization_access_manager||[]).push([[6982],{26982:function(e,i,n){n.r(i),n.d(i,{default:function(){return y}});var l=n(1995),s=n(45225),t=n(18160),a=n(26385),o=n(44056),r=n(3718),d=n(29434),c=n(6701);let u=e=>{var i,n,l,s;return null!==(s=null===(l=window)||void 0===l?void 0:null===(n=l.HWS)||void 0===n?void 0:null===(i=n.I18n)||void 0===i?void 0:i.t(e))&&void 0!==s?s:e};var A=function(){var e;let{policyAttributeTypes:i}=(0,r.A)();return(0,l.jsxs)("div",{className:"flex space-y-12 sm:space-y-0 flex-1 w-full items-center justify-between py-8 sm:py-16 px-16 md:px-24",children:[(0,l.jsx)(o.motion.span,{initial:{x:-20},animate:{x:0,transition:{delay:.2}},children:(0,l.jsx)(a.A,{className:"text-24 md:text-32 font-extrabold tracking-tight",children:u("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_ATTRIBUTE_TYPES")})}),(null==i?void 0:null===(e=i.permissions)||void 0===e?void 0:e.includes("Write"))&&(0,l.jsx)("div",{className:"flex flex-1 items-center justify-end space-x-8",children:(0,l.jsx)(o.motion.div,{className:"flex flex-grow-0",initial:{opacity:0,x:20},animate:{opacity:1,x:0,transition:{delay:.2}},children:(0,l.jsxs)(t.A,{className:"",variant:"contained",color:"secondary",component:c.jZ,to:"/plugin/access-manager/attribute-types?action=create",size:"medium",children:[(0,l.jsx)(c.ri,{size:20,children:"heroicons-outline:plus"}),(0,l.jsx)("span",{className:"mx-4 sm:mx-8",children:u("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_CREATE")})]})})})]})},x=n(57868),_=n(36856),m=n(46875),h=n(25793),v=n(32591),N=n(905),I=n(60707),p=n(74985),S=n(28578),E=n(46141),T=n(48671),f=n(85052);let j=e=>{var i,n,l,s;return null!==(s=null===(l=window)||void 0===l?void 0:null===(n=l.HWS)||void 0===n?void 0:null===(i=n.I18n)||void 0===i?void 0:i.t(e))&&void 0!==s?s:e};function C(e){let{open:i,onClose:n,id:s}=e,{deleteData:a}=(0,r.A)(),[o,c]=d.useState(!1),u=async()=>{c(!0),null!=s&&await a(f.H.PolicyAttributeTypes,s),c(!1),n()};return(0,l.jsxs)(v.A,{open:i,disableEnforceFocus:!0,disableAutoFocus:!0,disableRestoreFocus:!0,onClose:n,sx:{"& .MuiDialog-paper":{width:"30%",maxHeight:400}},maxWidth:"sm",children:[(0,l.jsxs)(N.A,{id:"alert-dialog-title",sx:{textAlign:"center",alignItems:"center",display:"flex"},children:[(0,l.jsx)(T.A,{sx:{color:"red",marginRight:"0.5rem"}}),j("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_DELETE")]}),(0,l.jsx)(I.A,{dividers:!0,children:(0,l.jsx)(p.A,{id:"alert-dialog-description",sx:{color:"red"},children:j("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_DELETE_ATTRIBUTE_TYPE_DIALOG")})}),(0,l.jsxs)(S.A,{children:[(0,l.jsx)(t.A,{onClick:n,disabled:o,color:"primary",children:j("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_NO")}),(0,l.jsxs)(t.A,{onClick:u,disabled:o,variant:"contained",color:"error",children:[j("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_YES"),o&&(0,l.jsx)(E.A,{style:{marginLeft:"3px"},size:"2rem"})]})]})]})}let g=e=>{var i,n,l,s;return null!==(s=null===(l=window)||void 0===l?void 0:null===(n=l.HWS)||void 0===n?void 0:null===(i=n.I18n)||void 0===i?void 0:i.t(e))&&void 0!==s?s:e};var R=function(){let{policyAttributeTypes:e}=(0,r.A)(),[i,n]=d.useState([]),[s,t]=d.useState(!1),[o,u]=d.useState(null),A=e=>{u(e),t(!0)},v=(0,d.useMemo)(()=>[{accessorKey:"Name",header:g("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_NAME"),Cell:e=>{let{row:i}=e;return(0,l.jsx)(a.A,{component:h.Link,to:"/plugin/access-manager/attribute-types?action=edit&id=".concat(i.original.Id),className:"underline",color:"secondary",role:"button",children:i.original.Name})}},{accessorKey:"Description",header:g("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_DESCRIPTION"),accessorFn:e=>e.Description}],[]);return d.useEffect(()=>{var i;(null==e?void 0:null===(i=e.data)||void 0===i?void 0:i.length)>0?n(e.data.map(e=>({Id:e.Id,Name:e.Name,Description:e.Description}))):n([])},[e]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x.A,{className:"flex flex-col flex-auto shadow-3 rounded-t-16 overflow-hidden rounded-b-0 w-full h-full",elevation:0,children:(0,l.jsx)(c.qZ,{name:"dataTable",column:{Name:"dataTable",Datatype:"DataTable"},data:i,columns:v,enableSelectAll:!1,enableRowSelection:!1,enableRowActions:e.permissions.includes("Delete"),renderRowActionMenuItems:e=>{let{closeMenu:i,row:n,table:s}=e;return[(0,l.jsxs)(_.A,{onClick:()=>{A(n.original.Id)},children:[(0,l.jsx)(m.A,{children:(0,l.jsx)(c.ri,{children:"heroicons-outline:trash"})}),g("HWS_PLUGIN_AUTHORIZATION_ACCESS_MANAGER_DELETE")]},0)]}})}),s&&(0,l.jsx)(C,{open:s,id:o,onClose:()=>{u(null),t(!1)}})]})},y=function(){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s.A,{styles:()=>({"#root":{maxHeight:"100vh"}})}),(0,l.jsxs)("div",{className:"w-full h-full container flex flex-col",children:[(0,l.jsx)(A,{}),(0,l.jsx)(R,{})]})]})}}}]);