import{N as k}from"./Navbar.84ee570e.js";import{B as N}from"./BaseLayout.8e0836b5.js";import{C as I}from"./ContentLayout.2ce25a75.js";import{C as _}from"./CrudView.81ab71a6.js";import{a as O}from"./asyncComputed.4467697c.js";import{F as x}from"./PhArrowSquareOut.vue.65714287.js";import{G as R}from"./PhPencil.vue.bb3ccc28.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.b466b20d.js";import"./gateway.973a0055.js";import{a as m}from"./organization.43dd96a4.js";import"./tables.1fa225bd.js";import"./PhChats.vue.2a25c04f.js";import"./PhSignOut.vue.682988c2.js";import"./router.3cd4b4c4.js";import"./Badge.4eadbb30.js";import"./index.12405f10.js";import"./Avatar.1c21d807.js";import"./index.f78751e0.js";import"./index.647ccb31.js";import"./BookOutlined.948f0a8b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.47b5b5cb.js";import"./url.0fe255f2.js";import"./PhDotsThreeVertical.vue.d63caaa3.js";import"./index.a02e478f.js";import"./popupNotifcation.d1201e83.js";import"./record.fd6fbc29.js";import"./string.42378387.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]="f5523b69-28fb-45f3-9f1b-c84cc2b1351f",r._sentryDebugIdIdentifier="sentry-dbid-f5523b69-28fb-45f3-9f1b-c84cc2b1351f")}catch{}})();const ft=B({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],g=M(),{loading:b,result:y,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 c(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=y.value)==null?void 0:e.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?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(b),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=>c(!1)),onOk:t[2]||(t[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":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.c796d6ec.js.map
