import{N as k}from"./Navbar.82a38b58.js";import{B as N}from"./BaseLayout.5acc7524.js";import{C as I}from"./ContentLayout.9fcaf9f3.js";import{C as _}from"./CrudView.6122e2de.js";import{a as O}from"./asyncComputed.5a9dc807.js";import{F as x}from"./PhArrowSquareOut.vue.40487513.js";import{G as R}from"./PhPencil.vue.80955bf1.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.0050062d.js";import"./gateway.60411ad8.js";import{a as m}from"./organization.0409328f.js";import"./tables.2e0419c1.js";import"./PhChats.vue.e92f94b2.js";import"./PhSignOut.vue.35130611.js";import"./router.22eb3290.js";import"./Badge.3d214d5b.js";import"./index.58609537.js";import"./Avatar.6cdc5c6b.js";import"./index.826cf710.js";import"./index.75f15071.js";import"./BookOutlined.9a32f29a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.60f08b82.js";import"./url.3865bbae.js";import"./PhDotsThreeVertical.vue.24d42b16.js";import"./index.7afe76ca.js";import"./popupNotifcation.675f1b12.js";import"./record.ed103436.js";import"./string.867fe8ae.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]="15ae4808-af85-4891-81be-6efc0daf3e2a",r._sentryDebugIdIdentifier="sentry-dbid-15ae4808-af85-4891-81be-6efc0daf3e2a")}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()),p=({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 d(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=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:p},{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=>d(!1)),onOk:e[2]||(e[2]=a=>d(!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.e49d88cb.js.map
