import{N as k}from"./Navbar-DEajFbel.js";import{B as C}from"./BaseLayout-D7oifgxM.js";import{C as I}from"./ContentLayout-75uyfXst.js";import{C as x}from"./CrudView-9z4hCmZC.js";import{a as N}from"./asyncComputed-D4eSsgb3.js";import{F as O}from"./PhArrowSquareOut.vue-CiVC81kj.js";import{G as B}from"./PhPencil.vue-DZeFxmyQ.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-WxnsjcWa.js";import"./router-845TlMat.js";import{O as p}from"./organization-C6l6FBcm.js";import"./tables-CfplhQzN.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang-d_vLkxp-.js";import"./constants-_UgM3BkR.js";import"./PhTranslate.vue-BoQBUekG.js";import"./PhSignOut.vue-Cz3Q18bM.js";import"./index-Bvc2mrwp.js";import"./index-CrKYrM9C.js";import"./omniChatStore-BQygA5Oz.js";import"./record-CLwbBMc2.js";import"./uuid-Cd1ehmhB.js";import"./PhCopySimple.vue-Cjod2F4I.js";import"./PhSparkle.vue-lnIN6ruS.js";import"./index-Da_leEyl.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-BfsR1yOB.js";import"./url-D3_feX5J.js";import"./PhDotsThreeVertical.vue-DbKuNIoU.js";import"./ts.worker-B_U1Chmr.js";import"./string-CLwgGjmi.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]="15a69735-0a16-4579-9538-a96834a7a610",s._sentryDebugIdIdentifier="sentry-dbid-15a69735-0a16-4579-9538-a96834a7a610")}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()),g=({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 d(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);g({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:g},{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=>d(!1)),onOk:e[2]||(e[2]=l=>d(!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-DnXbOAUp.js.map
