(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(5675)}])},5675:function(e,s,i){"use strict";i.r(s),i.d(s,{default:function(){return p}});var n=i(24246),r=i(5702),t=i(86677),u=i(27378),a=i(45007),d=i(33990),l=i(36223),c=i(38615),o=i(10284),f=i(11032),_=i(37541),m=i(31756);let h=e=>{var s,i,n,r;let t=(0,a.v9)(l.dy),[u]=(0,m.Gl)(),d={username:null!==(s=e.username)&&void 0!==s?s:"",email_address:null!==(i=e.email_address)&&void 0!==i?i:"",first_name:null!==(n=e.first_name)&&void 0!==n?n:"",last_name:null!==(r=e.last_name)&&void 0!==r?r:"",password:"",id:e.id},f=async s=>u({...e,...s}),_=!!t&&t.id===e.id,h=(0,c.Tg)([o.Sh.USER_UPDATE]);return{handleSubmit:f,isOwnProfile:_,canUpdateUser:!!_||h,initialValues:d}};var j=e=>{let{user:s}=e,{handleSubmit:i,canUpdateUser:r,initialValues:t}=h(s);return(0,n.jsxs)("div",{children:[(0,n.jsx)(_.Z,{heading:"Users",breadcrumbItems:[{title:"All users",href:f.e3},{title:t.username}]}),(0,n.jsx)(d.Z,{onSubmit:i,initialValues:t,canEditNames:r})]})},E=i(44296),y=i(43124),p=()=>{let e=(0,t.useRouter)(),s=(0,E.T)(),i="";i=e.query.id?Array.isArray(e.query.id)?e.query.id[0]:e.query.id:"";let{data:a,isLoading:d}=(0,m.Fk)(i),f=(0,E.C)(l.dy),_=!!f&&!!a&&f.id===a.id,h=(0,c.Tg)([o.Sh.USER_UPDATE])||_;return(0,u.useEffect)(()=>{a&&s((0,m.Vv)(a.id))},[s,a,h]),(0,u.useEffect)(()=>{a&&!h&&e.push("/")},[e,h,a]),(0,n.jsxs)(y.Z,{title:"Users - Edit a user",children:[d&&(0,n.jsx)(r.jqI,{justify:"center",align:"center",className:"h-full",children:(0,n.jsx)(r.$jN,{color:"minos.500"})}),!d&&!a&&(0,n.jsx)(r.jqI,{justify:"center",children:(0,n.jsx)(r.DUx,{message:"Could not find user with this profile ID.",type:"warning",showIcon:!0})}),!!a&&(0,n.jsx)(j,{user:a})]})}}},function(e){e.O(0,[53,3990,2888,9774,179],function(){return e(e.s=16967)}),_N_E=e.O()}]);