import{N as C}from"./Navbar.2c23de9f.js";import{B as I}from"./BaseLayout.44e83a23.js";import{C as x}from"./ContentLayout.c12f2ad8.js";import{C as N}from"./CrudView.243b212b.js";import{a as O}from"./asyncComputed.29ba9357.js";import{F as B}from"./PhArrowSquareOut.vue.5643a79c.js";import{G as D}from"./PhPencil.vue.4e45fda4.js";import{d as h,i as e,r as F,c as R,ac as E,f as r,b as s,u as i,aY as M,ec as V,o as _,a as $,cE as L,bQ as U,cD as j,h as A,M as G}from"./jwt-decode.esm.7c9b757c.js";import"./router.95e6e4b6.js";import{a as p}from"./organization.45e092f2.js";import"./tables.4a013a6e.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.d8bcc7e4.js";import"./constants.6f371b22.js";import"./PhTranslate.vue.453b71d5.js";import"./PhSignOut.vue.354e5bf2.js";import"./index.b636bb44.js";import"./index.3a0bf605.js";import"./omniChatStore.8a94c755.js";import"./record.c6bfac6e.js";import"./uuid.60efe701.js";import"./PhCopySimple.vue.c37a5bbd.js";import"./PhSparkle.vue.e25ae481.js";import"./index.2afdfa89.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.95065a46.js";import"./url.e6b61fa1.js";import"./PhDotsThreeVertical.vue.23d4ad15.js";import"./index.33534fc9.js";import"./string.fea0919a.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]="6c7db8ee-744e-4101-a529-b0e3a40e44b4",l._sentryDebugIdIdentifier="sentry-dbid-6c7db8ee-744e-4101-a529-b0e3a40e44b4")}catch{}})();const ft=h({__name:"Organizations",setup(l){const m=[{label:e.translate("i18n_organizations_my_organizations"),path:"/organizations"}],u=[{key:"name",label:e.translate("i18n_organizations_organization_name")}],f=V(),{loading:b,result:y,refetch:z}=O(()=>p.list()),d=({key:a})=>{f.push({name:"organization",params:{organizationId:a}})},o=F({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:n}=o.value;await p.rename(t,n),z()}o.value={state:"idle"}}const w=async a=>{const t=await p.create(a.name);d({key:t.id})},k=R(()=>{var a,t;return{columns:[{title:e.translate("i18n_organizations_organization_name"),align:"left"},{title:e.translate("i18n_organizations_path")},{title:"",align:"right"}],rows:(t=(a=y.value)==null?void 0:a.map(n=>{var g;return{key:n.id,cells:[{type:"link",text:n.name,to:`/organizations/${encodeURIComponent(n.id)}`},{type:"text",text:(g=n.id)!=null?g:null},{type:"actions",actions:[{icon:B,label:e.translate("i18n_organizations_go_to_projects"),onClick:d},{icon:D,label:e.translate("i18n_organizations_rename"),onClick:()=>v(n)}]}]}}))!=null?t:[]}});return(a,t)=>(_(),E(M,null,[r(I,null,{navbar:s(()=>[r(C,{breadcrumb:m})]),content:s(()=>[r(x,null,{default:s(()=>[r(N,{"entity-name":"organization",loading:i(b),title:i(e).translate("i18n_organizations_my_organizations"),description:i(e).translate("i18n_organizations_description"),"create-button-text":i(e).translate("i18n_organizations_create_organization"),"empty-title":i(e).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(e).translate("i18n_organizations_rename_organization"),onCancel:t[1]||(t[1]=n=>c(!1)),onOk:t[2]||(t[2]=n=>c(!0))},{default:s(()=>[o.value.state==="renaming"?(_(),$(i(j),{key:0,layout:"vertical"},{default:s(()=>[r(i(L),{label:i(e).translate("i18n_organizations_new_name")},{default:s(()=>[r(i(U),{value:o.value.newName,"onUpdate:value":t[0]||(t[0]=n=>o.value.newName=n)},null,8,["value"])]),_:1},8,["label"])]),_:1})):A("",!0)]),_:1},8,["open","title"])],64))}});export{ft as default};
//# sourceMappingURL=Organizations.f7c8203a.js.map
