import{N as k}from"./Navbar.69735a6d.js";import{B as N}from"./BaseLayout.05adf1e1.js";import{C as I}from"./ContentLayout.aa773e18.js";import{C as _}from"./CrudView.dc8ec5ca.js";import{a as O}from"./asyncComputed.3e41b686.js";import{F as x}from"./PhArrowSquareOut.vue.635a2852.js";import{G as R}from"./PhPencil.vue.2048d912.js";import{d as B,eo as M,e as h,f as D,o as f,Y as F,b as o,w as i,u as s,aS as L,c as S,cz as V,bL as $,cy as j,S as A,cL as E}from"./index.3d66ab3f.js";import"./gateway.c90c4cc0.js";import{a as m}from"./organization.4aa72199.js";import"./tables.00563f55.js";import"./PhChats.vue.7fe9b11a.js";import"./PhSignOut.vue.0a7ccc74.js";import"./router.ea31524e.js";import"./Badge.51abc7fa.js";import"./index.2a5e7e41.js";import"./Avatar.3702ea95.js";import"./index.d6f333ee.js";import"./index.56cb97c5.js";import"./BookOutlined.e97635c4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.945c4045.js";import"./url.64c961af.js";import"./PhDotsThreeVertical.vue.1eba4335.js";import"./index.103fa591.js";import"./popupNotifcation.f439583b.js";import"./record.20acbd16.js";import"./string.4c6457d7.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]="0e96bf95-f74f-43b9-b961-62f89d3c547f",r._sentryDebugIdIdentifier="sentry-dbid-0e96bf95-f74f-43b9-b961-62f89d3c547f")}catch{}})();const ft=B({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],g=M(),{loading:y,result:b,refetch:v}=O(()=>m.list()),p=({key:e})=>{g.push({name:"organization",params:{organizationId:e}})},n=h({state:"idle"});function z(e){n.value={state:"renaming",organizationId:e.id,newName:e.name}}async function d(e){if(n.value.state==="renaming"&&e){const{organizationId:t,newName:a}=n.value;await m.rename(t,a),v()}n.value={state:"idle"}}const w=async e=>{const t=await m.create(e.name);p({key:t.id})},C=D(()=>{var e,t;return{columns:[{title:"Organization Name",align:"left"},{title:"Path"},{title:"",align:"right"}],rows:(t=(e=b.value)==null?void 0:e.map(a=>{var c;return{key:a.id,cells:[{type:"link",text:a.name,to:`/organizations/${encodeURIComponent(a.id)}`},{type:"text",text:(c=a.id)!=null?c:null},{type:"actions",actions:[{icon:x,label:"Go to projects",onClick:p},{icon:R,label:"Rename",onClick:()=>z(a)}]}]}}))!=null?t:[]}});return(e,t)=>(f(),F(L,null,[o(N,null,{navbar:i(()=>[o(k,{breadcrumb:l})]),content:i(()=>[o(I,null,{default:i(()=>[o(_,{"entity-name":"organization",loading:s(y),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(E),{open:n.value.state==="renaming",title:"Rename organization",onCancel:t[1]||(t[1]=a=>d(!1)),onOk:t[2]||(t[2]=a=>d(!0))},{default:i(()=>[n.value.state==="renaming"?(f(),S(s(j),{key:0,layout:"vertical"},{default:i(()=>[o(s(V),{label:"New name"},{default:i(()=>[o(s($),{value:n.value.newName,"onUpdate:value":t[0]||(t[0]=a=>n.value.newName=a)},null,8,["value"])]),_:1})]),_:1})):A("",!0)]),_:1},8,["open"])],64))}});export{ft as default};
//# sourceMappingURL=Organizations.b5daebf9.js.map
