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