import{N as C}from"./Navbar.299ef0ee.js";import{B as I}from"./BaseLayout.fed5adb7.js";import{C as x}from"./ContentLayout.b1b0e8fb.js";import{C as N}from"./CrudView.ca91f805.js";import{a as O}from"./asyncComputed.f9fa4c71.js";import{F as B}from"./PhArrowSquareOut.vue.5a8d2f86.js";import{G as D}from"./PhPencil.vue.e0099a7f.js";import{d as h,i as n,ec as F,r as R,c as E,ac as M,f as r,b as s,u as i,aY as V,o as f,a as $,cE as L,bQ as U,cD as j,h as A,M as G}from"./jwt-decode.esm.32f71954.js";import"./router.29e08ea4.js";import{a as p}from"./organization.2c5a9815.js";import"./tables.94d324c3.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.9c0844e1.js";import"./constants.b5d83622.js";import"./PhTranslate.vue.d4756feb.js";import"./PhSignOut.vue.4f6997f5.js";import"./index.c59ca45b.js";import"./index.5ecb9a37.js";import"./omniChatStore.10d769d2.js";import"./record.41c9caee.js";import"./uuid.77e093c3.js";import"./PhCopySimple.vue.7cacc0f7.js";import"./PhSparkle.vue.e6119d8d.js";import"./index.ab7dc629.js";import"./Breadcrumb.ae24888f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c50f6a0a.js";import"./url.79cc02c3.js";import"./PhDotsThreeVertical.vue.e305b3a2.js";import"./index.2400150a.js";import"./string.ff0b4ef9.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},m=new Error().stack;m&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[m]="8c618517-d1c1-4d79-9f1f-f1a5bef8326f",l._sentryDebugIdIdentifier="sentry-dbid-8c618517-d1c1-4d79-9f1f-f1a5bef8326f")}catch{}})();const yt=h({__name:"Organizations",setup(l){const m=[{label:n.translate("i18n_organizations_my_organizations"),path:"/organizations"}],u=[{key:"name",label:n.translate("i18n_organizations_organization_name")}],_=F(),{loading:y,result:z,refetch:b}=O(()=>p.list()),d=({key:a})=>{_.push({name:"organization",params:{organizationId:a}})},o=R({state:"idle"});function v(a){o.value={state:"renaming",organizationId:a.id,newName:a.name}}async function c(a){if(o.value.state==="renaming"&&a){const{organizationId:t,newName:e}=o.value;await p.rename(t,e),b()}o.value={state:"idle"}}const w=async a=>{const t=await p.create(a.name);d({key:t.id})},k=E(()=>{var a,t;return{columns:[{title:n.translate("i18n_organizations_organization_name"),align:"left"},{title:n.translate("i18n_organizations_path")},{title:"",align:"right"}],rows:(t=(a=z.value)==null?void 0:a.map(e=>{var g;return{key:e.id,cells:[{type:"link",text:e.name,to:`/organizations/${encodeURIComponent(e.id)}`},{type:"text",text:(g=e.id)!=null?g:null},{type:"actions",actions:[{icon:B,label:n.translate("i18n_organizations_go_to_projects"),onClick:d},{icon:D,label:n.translate("i18n_organizations_rename"),onClick:()=>v(e)}]}]}}))!=null?t:[]}});return(a,t)=>(f(),M(V,null,[r(I,null,{navbar:s(()=>[r(C,{breadcrumb:m})]),content:s(()=>[r(x,null,{default:s(()=>[r(N,{"entity-name":"organization",loading:i(y),title:i(n).translate("i18n_organizations_my_organizations"),description:i(n).translate("i18n_organizations_description"),"create-button-text":i(n).translate("i18n_organizations_create_organization"),"empty-title":i(n).translate("i18n_organizations_empty_title"),table:k.value,fields:u,create:w},null,8,["loading","title","description","create-button-text","empty-title","table"])]),_:1})]),_:1}),r(i(G),{open:o.value.state==="renaming",title:i(n).translate("i18n_organizations_rename_organization"),onCancel:t[1]||(t[1]=e=>c(!1)),onOk:t[2]||(t[2]=e=>c(!0))},{default:s(()=>[o.value.state==="renaming"?(f(),$(i(j),{key:0,layout:"vertical"},{default:s(()=>[r(i(L),{label:i(n).translate("i18n_organizations_new_name")},{default:s(()=>[r(i(U),{value:o.value.newName,"onUpdate:value":t[0]||(t[0]=e=>o.value.newName=e)},null,8,["value"])]),_:1},8,["label"])]),_:1})):A("",!0)]),_:1},8,["open","title"])],64))}});export{yt as default};
//# sourceMappingURL=Organizations.96e88f77.js.map
