import{N as k}from"./Navbar-DWL_IiVK.js";import{B as C}from"./BaseLayout-Kttv-SRZ.js";import{C as I}from"./ContentLayout-BIXBdIN2.js";import{C as x}from"./CrudView-BCKz8q7-.js";import{a as N}from"./asyncComputed-_0zTJceu.js";import{F as O}from"./PhArrowSquareOut.vue-vLeyI9UL.js";import{G as B}from"./PhPencil.vue-DbapJaiy.js";import{a as D,ae as a,ad as F,r as R,c as h,b as L,e as d,j as o,w as r,u as n,p as M,g as V,aJ as $,aK as j,aL as E,a8 as U,M as A}from"./jwt-decode.esm-CQm3LY6y.js";import"./router-iclNQ3sb.js";import{O as p}from"./organization-BmOGzVGx.js";import"./tables-D9fKw_fk.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang-BPJs_oss.js";import"./constants-BkB36yfF.js";import"./PhTranslate.vue-Bt-h5c91.js";import"./PhSignOut.vue-B-W1FD5i.js";import"./index-Bt656mEJ.js";import"./index-BtK_X6EO.js";import"./omniChatStore-2WRSxoBF.js";import"./record-Dzon-Vi8.js";import"./uuid-DEeQP7e4.js";import"./PhCopySimple.vue-B6w30IRp.js";import"./PhSparkle.vue-BKkSD4x6.js";import"./index-BaY8SZ_8.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-yaUz4fth.js";import"./url-DLnEW9pi.js";import"./PhDotsThreeVertical.vue-D4TsgP8r.js";import"./ts.worker-BIIJMa7D.js";import"./string-W5Qb0ZHU.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]="9ca617cc-2963-41b2-8e78-47932f14b190",s._sentryDebugIdIdentifier="sentry-dbid-9ca617cc-2963-41b2-8e78-47932f14b190")}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()),c=({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:e,newName:l}=i.value;await p.rename(e,l),z()}i.value={state:"idle"}}const v=async t=>{const e=await p.create(t.name);c({key:e.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:c},{icon:B,label:a.translate("i18n_organizations_rename"),onClick:()=>b(t)}]}]}))??[]}));return(t,e)=>(d(),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:n(f),title:n(a).translate("i18n_organizations_my_organizations"),description:n(a).translate("i18n_organizations_description"),"create-button-text":n(a).translate("i18n_organizations_create_organization"),"empty-title":n(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(n(U),{open:i.value.state==="renaming",title:n(a).translate("i18n_organizations_rename_organization"),onCancel:e[1]||(e[1]=l=>g(!1)),onOk:e[2]||(e[2]=l=>g(!0))},{default:r(()=>[i.value.state==="renaming"?(d(),M(n($),{key:0,layout:"vertical"},{default:r(()=>[o(n(j),{label:n(a).translate("i18n_organizations_new_name")},{default:r(()=>[o(n(E),{value:i.value.newName,"onUpdate:value":e[0]||(e[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-CuImZjEw.js.map
