import{N as k}from"./Navbar.57310a5c.js";import{B as N}from"./BaseLayout.16b4e4b3.js";import{C as I}from"./ContentLayout.5eb06f3f.js";import{C as _}from"./CrudView.8dac6e2f.js";import{a as O}from"./asyncComputed.b31540a4.js";import{F as x}from"./PhArrowSquareOut.vue.1aeb60d7.js";import{G as R}from"./PhPencil.vue.fb0b2f4b.js";import{d as B,eF as F,e as M,f as h,o as f,Y as D,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.82b3148c.js";import"./gateway.8733a5f3.js";import{a as m}from"./organization.57cbe21a.js";import"./tables.b60a390b.js";import"./PhChats.vue.ed7527c2.js";import"./PhSignOut.vue.9498f732.js";import"./router.aacfb520.js";import"./Badge.8b0acfd8.js";import"./index.867114ba.js";import"./Avatar.c076649d.js";import"./index.9c784d83.js";import"./index.cb0bcf94.js";import"./BookOutlined.e58a4796.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b4d03e94.js";import"./url.3209a6f7.js";import"./PhDotsThreeVertical.vue.c0360e2e.js";import"./index.39ceca4f.js";import"./popupNotifcation.e1bf1f8c.js";import"./record.cb9a902e.js";import"./string.ab0c206a.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]="1416a64e-cd79-4f3e-9175-ecc821b8f732",r._sentryDebugIdIdentifier="sentry-dbid-1416a64e-cd79-4f3e-9175-ecc821b8f732")}catch{}})();const fe=B({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],g=F(),{loading:y,result:b,refetch:v}=O(()=>m.list()),p=({key:t})=>{g.push({name:"organization",params:{organizationId:t}})},n=M({state:"idle"});function z(t){n.value={state:"renaming",organizationId:t.id,newName:t.name}}async function c(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);p({key:e.id})},C=h(()=>{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 d;return{key:a.id,cells:[{type:"link",text:a.name,to:`/organizations/${encodeURIComponent(a.id)}`},{type:"text",text:(d=a.id)!=null?d:null},{type:"actions",actions:[{icon:x,label:"Go to projects",onClick:p},{icon:R,label:"Rename",onClick:()=>z(a)}]}]}}))!=null?e:[]}});return(t,e)=>(f(),D(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=>c(!1)),onOk:e[2]||(e[2]=a=>c(!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.af146932.js.map
