import{N as k}from"./Navbar-CsiFYgrX.js";import{B as C}from"./BaseLayout-NniIuGaa.js";import{C as I}from"./ContentLayout-t6MXItbR.js";import{C as x}from"./CrudView-DB2mMVy_.js";import{a as N}from"./asyncComputed-D5HqUDwR.js";import{F as O}from"./PhArrowSquareOut.vue-ByXC47Qj.js";import{G as B}from"./PhPencil.vue-9qE0PBL8.js";import{a as D,af as a,ae 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-DyyavT6h.js";import"./router-BhKBgDIv.js";import{O as p}from"./organization-74sGTG_j.js";import"./tables-sMYALme4.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang-C8pP27Qo.js";import"./constants-BEk-t5le.js";import"./PhTranslate.vue-AmAtOtBe.js";import"./PhSignOut.vue-hw-7sNAH.js";import"./index-DdqJ9EQR.js";import"./index-CHZRANF0.js";import"./omniChatStore-n1MkGLEa.js";import"./record-Dva_8M1P.js";import"./uuid-DHL8I4Aa.js";import"./PhCopySimple.vue-qVDAfznd.js";import"./PhSparkle.vue-M1I_bE0u.js";import"./index-CREYrgWF.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-BZXWm6NO.js";import"./url-CaxRUwff.js";import"./PhDotsThreeVertical.vue-BXrShwWD.js";import"./ts.worker-Do44s_XH.js";import"./string-C33uYcCb.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]="bf3bed55-43d8-4ae2-ad49-f294f39a0446",s._sentryDebugIdIdentifier="sentry-dbid-bf3bed55-43d8-4ae2-ad49-f294f39a0446")}catch{}})();const _t=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(),{loading:f,result:y,refetch:z}=N(()=>p.list()),d=({key:t})=>{_.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(f),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{_t as default};
//# sourceMappingURL=Organizations-C2FbmvNU.js.map
