import{N as k}from"./Navbar.c14c43a5.js";import{B as N}from"./BaseLayout.e8875241.js";import{C as I}from"./ContentLayout.b536adcf.js";import{C as _}from"./CrudView.d781e8fd.js";import{a as O}from"./asyncComputed.5f4a7018.js";import{F as x}from"./PhArrowSquareOut.vue.5d546b65.js";import{G as R}from"./PhPencil.vue.34413cfd.js";import{d as B,eH 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.a1506152.js";import"./gateway.36e126ca.js";import{a as m}from"./organization.8c8450bc.js";import"./tables.ca746641.js";import"./PhChats.vue.5cfe85f1.js";import"./PhSignOut.vue.0c72747b.js";import"./router.2d44d6fc.js";import"./Badge.07d26512.js";import"./index.4f812115.js";import"./Avatar.52002437.js";import"./index.2864b188.js";import"./index.ba0d88c1.js";import"./BookOutlined.989c2e9e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.30c09690.js";import"./url.e9cfa1d3.js";import"./PhDotsThreeVertical.vue.0cdf9efb.js";import"./index.a25bcd68.js";import"./popupNotifcation.7c2101f3.js";import"./record.d6bf7292.js";import"./string.a9f2e2e2.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]="d833a1ed-2a9c-40e3-aea1-174daeff3bde",r._sentryDebugIdIdentifier="sentry-dbid-d833a1ed-2a9c-40e3-aea1-174daeff3bde")}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.39c2cae5.js.map
