import{N as k}from"./Navbar.74c5173c.js";import{B as N}from"./BaseLayout.e38326c9.js";import{C as I}from"./ContentLayout.c72cf0b6.js";import{C as _}from"./CrudView.b0205a71.js";import{a as O}from"./asyncComputed.dea6d978.js";import{F as x}from"./PhArrowSquareOut.vue.b966bb7c.js";import{G as R}from"./PhPencil.vue.945173fd.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.57388330.js";import"./gateway.e592f357.js";import{a as m}from"./organization.b73306db.js";import"./tables.01dc6a89.js";import"./PhChats.vue.b199fd70.js";import"./PhSignOut.vue.261bd3d7.js";import"./router.7e66296a.js";import"./Badge.b4017a04.js";import"./index.1b2729a9.js";import"./Avatar.d0198d03.js";import"./index.7459f9fa.js";import"./index.85b4d3b9.js";import"./BookOutlined.7b183253.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.834b9f8a.js";import"./url.40a6ac51.js";import"./PhDotsThreeVertical.vue.b90e775f.js";import"./index.09157d5c.js";import"./popupNotifcation.cc3d27fb.js";import"./record.82dac5d0.js";import"./string.b6e197ca.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]="88d1fad7-c34d-40af-8e09-d9fe55e6b017",r._sentryDebugIdIdentifier="sentry-dbid-88d1fad7-c34d-40af-8e09-d9fe55e6b017")}catch{}})();const fe=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()),d=({key:t})=>{g.push({name:"organization",params:{organizationId:t}})},n=h({state:"idle"});function z(t){n.value={state:"renaming",organizationId:t.id,newName:t.name}}async function p(t){if(n.value.state==="renaming"&&t){const{organizationId:e,newName:a}=n.value;await m.rename(e,a),v()}n.value={state:"idle"}}const w=async t=>{const e=await m.create(t.name);d({key:e.id})},C=D(()=>{var t,e;return{columns:[{title:"Organization Name",align:"left"},{title:"Path"},{title:"",align:"right"}],rows:(e=(t=b.value)==null?void 0:t.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:d},{icon:R,label:"Rename",onClick:()=>z(a)}]}]}}))!=null?e:[]}});return(t,e)=>(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:e[1]||(e[1]=a=>p(!1)),onOk:e[2]||(e[2]=a=>p(!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":e[0]||(e[0]=a=>n.value.newName=a)},null,8,["value"])]),_:1})]),_:1})):A("",!0)]),_:1},8,["open"])],64))}});export{fe as default};
//# sourceMappingURL=Organizations.adf67fd8.js.map
