(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8905],{16967:function(e,s,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user-management/profile/[id]",function(){return i(69404)}])},69404:function(e,s,i){"use strict";i.r(s),i.d(s,{default:function(){return y}});var r=i(24246),n=i(96306),t=i(86677),a=i(27378),d=i(16125),u=i(83696),l=i(91317),o=i(19904),c=i(21910),_=i(77830),f=i(58754),h=i(65497);let m=e=>{var s,i,r,n;let t=(0,d.v9)(l.dy),[a]=(0,h.Gl)(),u={username:null!==(s=e.username)&&void 0!==s?s:"",email_address:null!==(i=e.email_address)&&void 0!==i?i:"",first_name:null!==(r=e.first_name)&&void 0!==r?r:"",last_name:null!==(n=e.last_name)&&void 0!==n?n:"",password:"",password_login_enabled:!!e.password_login_enabled},_=async s=>a({...s,id:e.id}),f=!!t&&t.id===e.id,m=(0,o.Tg)([c.Sh.USER_UPDATE]);return{handleSubmit:_,isOwnProfile:f,canUpdateUser:!!f||m,initialValues:u}};var E=e=>{let{user:s}=e,{handleSubmit:i,canUpdateUser:n,initialValues:t}=m(s),a=(0,o.Tg)([c.Sh.USER_READ]);return(0,r.jsxs)("div",{children:[(0,r.jsx)(f.Z,{heading:"Users",breadcrumbItems:[{title:"All users",href:a?_.e3:void 0},{title:t.username}]}),(0,r.jsx)(u.Z,{onSubmit:i,initialValues:t,canEditNames:n})]})},j=i(16134),p=i(77213),y=()=>{let e=(0,t.useRouter)(),s=(0,j.T)(),i="";i=e.query.id?Array.isArray(e.query.id)?e.query.id[0]:e.query.id:"";let{data:d,isLoading:u}=(0,h.Fk)(i),_=(0,j.C)(l.dy),f=!!_&&!!d&&_.id===d.id,m=(0,o.Tg)([c.Sh.USER_UPDATE])||f;return(0,a.useEffect)(()=>{d&&s((0,h.Vv)(d.id))},[s,d,m]),(0,a.useEffect)(()=>{d&&!m&&e.push("/")},[e,m,d]),(0,r.jsxs)(p.Z,{title:"Users - Edit a user",children:[u&&(0,r.jsx)(n.jqI,{justify:"center",align:"center",className:"h-full",children:(0,r.jsx)(n.$jN,{color:"primary.900"})}),!u&&!d&&(0,r.jsx)(n.jqI,{justify:"center",children:(0,r.jsx)(n.DUx,{message:"Could not find user with this profile ID.",type:"warning",showIcon:!0})}),!!d&&(0,r.jsx)(E,{user:d})]})}}},function(e){e.O(0,[7476,3696,2888,9774,179],function(){return e(e.s=16967)}),_N_E=e.O()}]);