import{_ as f}from"./DomainEntityNav.BAO77Cju.js";import{f as _,g as h,r as y,h as l,n as c,i as m,j as v,s as b,_ as g,o as w,c as N,a as n,d as $,t as x,b as p,k as R}from"./entry.2l8qV6vk.js";import{u as F}from"./object.koeG6dC5.js";import{u as S}from"./api.HNdnc-09.js";import{u as T}from"./toast.Duw7-oGa.js";import{i as U}from"./utils.RlM3h-HS.js";import"./nuxt-link.CpFeHJNO.js";const k=_({components:{DomainEntityNav:f},async setup(){let e,s;const d=[{name:"General",icon:"fas fa-bars",urlSuffix:""},{name:"Permissions",icon:"fas fa-user-secret",urlSuffix:"permissions"},{name:"Roles",icon:"fa-solid fa-user-group",urlSuffix:"roles"}],t=T(),u=h(),a=y(null);try{a.value=([e,s]=l(()=>S().user.getOne(u.params.id,{fields:["+email"]})),e=await e,s(),e)}catch{throw[e,s]=l(()=>c({path:"/admin/users"})),await e,s(),m({})}const i=v(),{realmManagement:r}=b(i);if(!U(r.value,a.value.realm_id))throw[e,s]=l(()=>c({path:"/admin/users"})),await e,s(),m({});return{items:d,entity:a,handleUpdated:o=>{t&&t.show({variant:"success",body:"The user was successfully updated."}),F(a,o)},handleFailed:o=>{t&&t.show({variant:"warning",body:o.message})}}}},"$2mGreBrdRV"),B={class:"title no-border mb-3"},D=n("i",{class:"fa fa-user me-1"},null,-1),E=n("span",{class:"sub-title ms-1"}," Details ",-1),P={class:"mb-2"};function V(e,s,d,t,u,a){const i=f,r=R;return w(),N("div",null,[n("h1",B,[D,$(" "+x(e.entity.name)+" ",1),E]),n("div",P,[p(i,{items:e.items,path:`/admin/users/${e.entity.id}`,"prev-link":!0},null,8,["items","path"])]),n("div",null,[p(r,{entity:e.entity,onUpdated:e.handleUpdated,onFailed:e.handleFailed},null,8,["entity","onUpdated","onFailed"])])])}const z=g(k,[["render",V]]);export{z as default};
