import{N as k}from"./Navbar-Ef9dvLOR.js";import{B as C}from"./BaseLayout-H8aSgH4r.js";import{C as I}from"./ContentLayout-D4BgGzDz.js";import{C as x}from"./CrudView-CSqLZQF3.js";import{a as N}from"./asyncComputed-BFeGpB4N.js";import{F as O}from"./PhArrowSquareOut.vue-Ml87HQlP.js";import{G as B}from"./PhPencil.vue-Di-hdME0.js";import{a as D,ae as a,ad as F,r as R,c as h,b as L,e as c,j as o,w as r,u as e,p as M,g as V,aJ as $,aK as j,aL as E,a8 as U,M as A}from"./jwt-decode.esm-C-pSId1x.js";import"./router-BOY9wvA7.js";import{O as p}from"./organization-K1oMmp3b.js";import"./tables-dJuecZ2r.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang-DVQCAEj2.js";import"./constants-C4XOKD8R.js";import"./PhTranslate.vue-Ck2QfeBo.js";import"./PhSignOut.vue-lg5R-_Kw.js";import"./index-SgEeyXlR.js";import"./index-DFmQE1Z1.js";import"./omniChatStore-BT3hCtq6.js";import"./record-DCCDzs6D.js";import"./uuid-EU9SeyOl.js";import"./PhCopySimple.vue-DRIvWMP-.js";import"./PhSparkle.vue-BPDi-i6e.js";import"./index-C55w6a92.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-AawO64rm.js";import"./url-E85CsM4U.js";import"./PhDotsThreeVertical.vue-CihrGXh5.js";import"./ts.worker-FgSjKf5B.js";import"./string-3_vhV9g4.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},m=new Error().stack;m&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[m]="ea008f68-2e6d-492f-b085-68f0afceb9fa",s._sentryDebugIdIdentifier="sentry-dbid-ea008f68-2e6d-492f-b085-68f0afceb9fa")}catch{}})();const ft=D({__name:"Organizations",setup(s){const m=[{label:a.translate("i18n_organizations_my_organizations"),path:"/organizations"}],u=[{key:"name",label:a.translate("i18n_organizations_organization_name")}],f=F(),{loading:_,result:y,refetch:z}=N(()=>p.list()),d=({key:t})=>{f.push({name:"organization",params:{organizationId:t}})},i=R({state:"idle"});function b(t){i.value={state:"renaming",organizationId:t.id,newName:t.name}}async function g(t){if(i.value.state==="renaming"&&t){const{organizationId:n,newName:l}=i.value;await p.rename(n,l),z()}i.value={state:"idle"}}const v=async t=>{const n=await p.create(t.name);d({key:n.id})},w=h(()=>({columns:[{title:a.translate("i18n_organizations_organization_name"),align:"left"},{title:a.translate("i18n_organizations_path")},{title:"",align:"right"}],rows:y.value?.map(t=>({key:t.id,cells:[{type:"link",text:t.name,to:`/organizations/${encodeURIComponent(t.id)}`},{type:"text",text:t.id??null},{type:"actions",actions:[{icon:O,label:a.translate("i18n_organizations_go_to_projects"),onClick:d},{icon:B,label:a.translate("i18n_organizations_rename"),onClick:()=>b(t)}]}]}))??[]}));return(t,n)=>(c(),L(A,null,[o(C,null,{navbar:r(()=>[o(k,{breadcrumb:m})]),content:r(()=>[o(I,null,{default:r(()=>[o(x,{"entity-name":"organization",loading:e(_),title:e(a).translate("i18n_organizations_my_organizations"),description:e(a).translate("i18n_organizations_description"),"create-button-text":e(a).translate("i18n_organizations_create_organization"),"empty-title":e(a).translate("i18n_organizations_empty_title"),table:w.value,fields:u,create:v},null,8,["loading","title","description","create-button-text","empty-title","table"])]),_:1})]),_:1}),o(e(U),{open:i.value.state==="renaming",title:e(a).translate("i18n_organizations_rename_organization"),onCancel:n[1]||(n[1]=l=>g(!1)),onOk:n[2]||(n[2]=l=>g(!0))},{default:r(()=>[i.value.state==="renaming"?(c(),M(e($),{key:0,layout:"vertical"},{default:r(()=>[o(e(j),{label:e(a).translate("i18n_organizations_new_name")},{default:r(()=>[o(e(E),{value:i.value.newName,"onUpdate:value":n[0]||(n[0]=l=>i.value.newName=l)},null,8,["value"])]),_:1},8,["label"])]),_:1})):V("",!0)]),_:1},8,["open","title"])],64))}});export{ft as default};
//# sourceMappingURL=Organizations-QBLO4Or5.js.map
