import{N}from"./Navbar.4fcfa988.js";import{B as k}from"./BaseLayout.a0a1a562.js";import{C as I}from"./ContentLayout.728ae941.js";import{C as _}from"./CrudView.fdf2a3ee.js";import{a as O}from"./asyncComputed.451e9a72.js";import{F as x}from"./PhArrowSquareOut.vue.2cb9ddbc.js";import{G as B}from"./PhPencil.vue.8b609b8e.js";import{d as R,eo as M,e as h,f as D,o as g,Y as F,b as o,w as i,u as s,aS as A,c as L,cB as S,bL as V,cA as $,S as j,cN as E}from"./index.f0b92b7e.js";import"./gateway.dd2bcb1f.js";import{a as m}from"./organization.cb0d450b.js";import"./tables.cf074385.js";import"./PhChats.vue.4fb761eb.js";import"./PhSignOut.vue.473b638b.js";import"./router.b636156b.js";import"./Badge.503c1d1d.js";import"./index.33db5ee2.js";import"./Avatar.e9d19919.js";import"./index.54c45960.js";import"./index.38fab6db.js";import"./BookOutlined.109c3ef4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a2d15d8f.js";import"./url.a5f3da23.js";import"./PhDotsThreeVertical.vue.0215e6b6.js";import"./index.26805589.js";import"./popupNotifcation.1a1aff4d.js";import"./record.aae20370.js";import"./string.1b82e875.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]="a95fe701-32ba-4639-ac03-50dcd6ea444d",r._sentryDebugIdIdentifier="sentry-dbid-a95fe701-32ba-4639-ac03-50dcd6ea444d")}catch{}})();const ge=R({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],f=M(),{loading:y,result:b,refetch:v}=O(()=>m.list()),d=({key:t})=>{f.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:B,label:"Rename",onClick:()=>z(a)}]}]}}))!=null?e:[]}});return(t,e)=>(g(),F(A,null,[o(k,null,{navbar:i(()=>[o(N,{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"?(g(),L(s($),{key:0,layout:"vertical"},{default:i(()=>[o(s(S),{label:"New name"},{default:i(()=>[o(s(V),{value:n.value.newName,"onUpdate:value":e[0]||(e[0]=a=>n.value.newName=a)},null,8,["value"])]),_:1})]),_:1})):j("",!0)]),_:1},8,["open"])],64))}});export{ge as default};
//# sourceMappingURL=Organizations.f5b11aa3.js.map
