(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8905],{16967:function(e,r,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user-management/profile/[id]",function(){return s(69404)}])},59849:function(e,r,s){"use strict";s.d(r,{Z:function(){return c}});var t=s(24246),n=s(36010),a=s(86677),i=s(88340);let l="/images/errors";var d=e=>{let{status:r}=e;return 404===r?(0,t.jsx)(n.Eep,{src:"".concat(l,"/404.svg"),alt:"Error 404",preview:!1}):500===r?(0,t.jsx)(n.Eep,{src:"".concat(l,"/500.svg"),alt:"Error 500",preview:!1}):(0,t.jsx)(n.Eep,{src:"".concat(l,"/unknown.svg"),alt:"Error Unknown",preview:!1})},u=s(812),c=e=>{let{error:r,defaultMessage:s="An unexpected error occurred.  Please try again",actions:l,showReload:c=!0}=e,o=(0,u.e$)(r,s),h="data"in r&&r.data?JSON.stringify(r.data):JSON.stringify(r),p="status"in r&&r.status?r.status:void 0,x=(0,a.useRouter)(),f=l&&l.length>0||c;return(0,t.jsx)(n.kCb,{vertical:!0,align:"center",justify:"center",className:"h-screen","data-testid":"error-page-result",children:(0,t.jsx)(n.x4B,{status:"error",icon:(0,t.jsx)(d,{status:p}),title:"Error ".concat(p),subTitle:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Typography.Paragraph,{type:"secondary",children:o}),(0,t.jsx)(n.kCb,{justify:"start",className:"max-w-96",children:(0,t.jsx)(n.UO1,{ghost:!0,size:"small",items:[{key:"1",label:"Show details",classNames:{header:"w-fit"},children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Typography.Text,{type:"secondary",children:h}),(0,t.jsx)(i.Z,{copyText:h})]})}]})})]}),extra:f&&(0,t.jsxs)(n.kCb,{gap:"small",justify:"center",children:[null==l?void 0:l.map((e,r)=>(0,t.jsx)(n.zxk,{...e,children:e.label},r)),c&&(0,t.jsx)(n.zxk,{onClick:()=>x.reload(),type:"primary",children:"Reload"})]})})})}},69404:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return _}});var t=s(24246),n=s(36010),a=s(86677),i=s(27378),l=s(16125),d=s(1346),u=s(91317),c=s(19904),o=s(96441),h=s(77830),p=s(58754),x=s(65497);let f=e=>{var r,s,t,n;let a=(0,l.v9)(u.dy),[i]=(0,x.Gl)(),d={username:null!==(r=e.username)&&void 0!==r?r:"",email_address:null!==(s=e.email_address)&&void 0!==s?s:"",first_name:null!==(t=e.first_name)&&void 0!==t?t:"",last_name:null!==(n=e.last_name)&&void 0!==n?n:"",password:"",password_login_enabled:!!e.password_login_enabled},h=async r=>i({...r,id:e.id}),p=!!a&&a.id===e.id,f=(0,c.Tg)([o.Sh.USER_UPDATE]);return{handleSubmit:h,isOwnProfile:p,canUpdateUser:!!p||f,initialValues:d}};var j=e=>{let{user:r}=e,{handleSubmit:s,canUpdateUser:n,initialValues:a}=f(r),i=(0,c.Tg)([o.Sh.USER_READ]);return(0,t.jsxs)("div",{children:[(0,t.jsx)(p.Z,{heading:"Users",breadcrumbItems:[{title:"All users",href:i?h.e3:void 0},{title:a.username}]}),(0,t.jsx)(d.Z,{onSubmit:s,initialValues:a,canEditNames:n})]})},m=s(16134),y=s(59849),g=s(77213),_=()=>{let e=(0,a.useRouter)(),r=(0,m.T)(),s="";s=e.query.id?Array.isArray(e.query.id)?e.query.id[0]:e.query.id:"";let{data:l,isLoading:d,error:p}=(0,x.Fk)(s),f=(0,m.C)(u.dy),_=!!f&&!!l&&f.id===l.id,v=(0,c.Tg)([o.Sh.USER_UPDATE])||_;return((0,i.useEffect)(()=>{l&&r((0,x.Vv)(l.id))},[r,l,v]),(0,i.useEffect)(()=>{l&&!v&&e.push("/")},[e,v,l]),p)?(0,t.jsx)(y.Z,{error:p,defaultMessage:"A problem occurred while fetching the user profile",actions:[{label:"Return to users",onClick:()=>e.push(h.e3)}]}):(0,t.jsxs)(g.Z,{title:"Users - Edit a user",children:[d&&(0,t.jsx)(n.kCb,{justify:"center",align:"center",className:"h-full",children:(0,t.jsx)(n.Y6B,{color:"primary.900"})}),!d&&!l&&(0,t.jsx)(n.kCb,{justify:"center",children:(0,t.jsx)(n.bZj,{message:"Could not find user with this profile ID.",type:"warning",showIcon:!0})}),!!l&&(0,t.jsx)(j,{user:l})]})}}},function(e){e.O(0,[7636,2888,9774,179],function(){return e(e.s=16967)}),_N_E=e.O()}]);