import{N as C}from"./Navbar.5991f141.js";import{B as I}from"./BaseLayout.3c6f8614.js";import{C as x}from"./ContentLayout.a0d4199d.js";import{C as N}from"./CrudView.7997b881.js";import{a as O}from"./asyncComputed.515034b4.js";import{F as B}from"./PhArrowSquareOut.vue.1a0f1395.js";import{G as D}from"./PhPencil.vue.e6eaa716.js";import{d as h,i as e,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.f87c17f7.js";import"./router.09566602.js";import{a as p}from"./organization.70cdf915.js";import"./tables.1b5568d1.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.6efe348a.js";import"./constants.2cdc2025.js";import"./PhTranslate.vue.7ad27dac.js";import"./PhSignOut.vue.4b3b1f31.js";import"./index.97648248.js";import"./index.ed2240ea.js";import"./omniChatStore.e205a0cd.js";import"./record.a8da6046.js";import"./uuid.405a6e8d.js";import"./PhCopySimple.vue.f2bb863a.js";import"./PhSparkle.vue.efe111c8.js";import"./index.64d118e9.js";import"./Breadcrumb.438b89fb.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.39638c19.js";import"./url.acca5643.js";import"./PhDotsThreeVertical.vue.2c9a03d5.js";import"./index.9f357119.js";import"./string.0c102318.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]="3df7be5f-e51d-4be7-b2d3-df54bf26fbe9",l._sentryDebugIdIdentifier="sentry-dbid-3df7be5f-e51d-4be7-b2d3-df54bf26fbe9")}catch{}})();const bt=h({__name:"Organizations",setup(l){const m=[{label:e.translate("i18n_organizations_my_organizations"),path:"/organizations"}],d=[{key:"name",label:e.translate("i18n_organizations_organization_name")}],_=F(),{loading:b,result:y,refetch:z}=O(()=>p.list()),u=({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 g(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);u({key:t.id})},k=E(()=>{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 c;return{key:n.id,cells:[{type:"link",text:n.name,to:`/organizations/${encodeURIComponent(n.id)}`},{type:"text",text:(c=n.id)!=null?c:null},{type:"actions",actions:[{icon:B,label:e.translate("i18n_organizations_go_to_projects"),onClick:u},{icon:D,label:e.translate("i18n_organizations_rename"),onClick:()=>v(n)}]}]}}))!=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(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:d,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=>g(!1)),onOk:t[2]||(t[2]=n=>g(!0))},{default:s(()=>[o.value.state==="renaming"?(f(),$(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{bt as default};
//# sourceMappingURL=Organizations.5f418cc7.js.map
