import{N as k}from"./Navbar-q0k4RO4J.js";import{B as C}from"./BaseLayout-DP0bVFSH.js";import{C as I}from"./ContentLayout-Dy6tzaCM.js";import{C as x}from"./CrudView-Cy08eecj.js";import{a as N}from"./asyncComputed-ClqYWeom.js";import{F as O}from"./PhArrowSquareOut.vue-D7Ph3Tz-.js";import{G as B}from"./PhPencil.vue-BoVVsHS_.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 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-Cqi12V-N.js";import"./router-Dc2CEtZs.js";import{O as p}from"./organization-BFOM9gs-.js";import"./tables-LaWGUl2e.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang-DHOjnHlq.js";import"./constants-CnytNyhp.js";import"./PhTranslate.vue-CJTHflmA.js";import"./PhSignOut.vue-BlODgy33.js";import"./index-B1jPs2Ta.js";import"./index-Bf4MB6er.js";import"./omniChatStore-EZvnUcgY.js";import"./record-drY-gKry.js";import"./uuid-ClHb9zsJ.js";import"./PhCopySimple.vue-DMDMlJNj.js";import"./PhSparkle.vue-0z7d5xhz.js";import"./index-BZof8Hij.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-DcHuXW8J.js";import"./url-BVQP5Ns3.js";import"./PhDotsThreeVertical.vue-BnpXkzyI.js";import"./ts.worker-B6T9w9Ua.js";import"./string-USUkOvGu.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]="d726d554-3f91-4f26-b580-62c470179230",s._sentryDebugIdIdentifier="sentry-dbid-d726d554-3f91-4f26-b580-62c470179230")}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: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);d({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:d},{icon:B,label:a.translate("i18n_organizations_rename"),onClick:()=>b(t)}]}]}))??[]}));return(t,e)=>(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: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"?(c(),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-10h7IjC0.js.map
