import{N as k}from"./Navbar.663d01a6.js";import{B as N}from"./BaseLayout.3525f3db.js";import{C as I}from"./ContentLayout.b79bd195.js";import{C as _}from"./CrudView.75d6f80a.js";import{a as O}from"./asyncComputed.c4333d47.js";import{F as x}from"./PhArrowSquareOut.vue.98443872.js";import{G as R}from"./PhPencil.vue.bc89e8c2.js";import{d as M,e5 as h,r as B,c as D,a5 as F,f as o,b as i,u as s,aR as V,o as f,a as $,cx as j,bJ as A,cw as E,h as G,M as L}from"./jwt-decode.esm.c1356de1.js";import"./router.10a36819.js";import{a as m}from"./organization.45fb3cc4.js";import"./tables.356ea1ca.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.fcf10244.js";import"./constants.31a5b2c9.js";import"./PhChats.vue.a8076496.js";import"./PhSignOut.vue.ce223c0a.js";import"./index.33815650.js";import"./index.82da6b22.js";import"./omniChatStore.6b2bc826.js";import"./record.6e317d8b.js";import"./PhSparkle.vue.bbd055b1.js";import"./index.9850b4c4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e8f82a36.js";import"./url.99373f08.js";import"./PhDotsThreeVertical.vue.a655f2e4.js";import"./index.70806805.js";import"./string.dbe1a2f4.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l=new Error().stack;l&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[l]="a08f0ab3-3cbd-4516-91c5-00fa6fc2d3ba",r._sentryDebugIdIdentifier="sentry-dbid-a08f0ab3-3cbd-4516-91c5-00fa6fc2d3ba")}catch{}})();const dt=M({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],g=h(),{loading:b,result:y,refetch:v}=O(()=>m.list()),p=({key:a})=>{g.push({name:"organization",params:{organizationId:a}})},n=B({state:"idle"});function z(a){n.value={state:"renaming",organizationId:a.id,newName:a.name}}async function c(a){if(n.value.state==="renaming"&&a){const{organizationId:t,newName:e}=n.value;await m.rename(t,e),v()}n.value={state:"idle"}}const w=async a=>{const t=await m.create(a.name);p({key:t.id})},C=D(()=>{var a,t;return{columns:[{title:"Organization Name",align:"left"},{title:"Path"},{title:"",align:"right"}],rows:(t=(a=y.value)==null?void 0:a.map(e=>{var d;return{key:e.id,cells:[{type:"link",text:e.name,to:`/organizations/${encodeURIComponent(e.id)}`},{type:"text",text:(d=e.id)!=null?d:null},{type:"actions",actions:[{icon:x,label:"Go to projects",onClick:p},{icon:R,label:"Rename",onClick:()=>z(e)}]}]}}))!=null?t:[]}});return(a,t)=>(f(),F(V,null,[o(N,null,{navbar:i(()=>[o(k,{breadcrumb:l})]),content:i(()=>[o(I,null,{default:i(()=>[o(_,{"entity-name":"organization",loading:s(b),title:"My organizations",description:"An organization is your company\u2019s account. Manage editors, projects and billing.","create-button-text":"Create Organization","empty-title":"No organizations here yet",table:C.value,fields:u,create:w},null,8,["loading","table"])]),_:1})]),_:1}),o(s(L),{open:n.value.state==="renaming",title:"Rename organization",onCancel:t[1]||(t[1]=e=>c(!1)),onOk:t[2]||(t[2]=e=>c(!0))},{default:i(()=>[n.value.state==="renaming"?(f(),$(s(E),{key:0,layout:"vertical"},{default:i(()=>[o(s(j),{label:"New name"},{default:i(()=>[o(s(A),{value:n.value.newName,"onUpdate:value":t[0]||(t[0]=e=>n.value.newName=e)},null,8,["value"])]),_:1})]),_:1})):G("",!0)]),_:1},8,["open"])],64))}});export{dt as default};
//# sourceMappingURL=Organizations.fce211c7.js.map
