import{N as k}from"./Navbar.8dd141be.js";import{B as N}from"./BaseLayout.7ffcbde7.js";import{C as I}from"./ContentLayout.e5808468.js";import{C as _}from"./CrudView.c10ee41e.js";import{a as O}from"./asyncComputed.84aa5ffe.js";import{F as x}from"./PhArrowSquareOut.vue.1ec19773.js";import{G as R}from"./PhPencil.vue.10b5ae03.js";import{d as B,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 L,c as S,cz as V,bL as $,cy as j,S as A,cL as E}from"./index.abaf3ad4.js";import"./gateway.21d52798.js";import{a as m}from"./organization.4cd08cbb.js";import"./tables.2b820ae9.js";import"./PhChats.vue.14138a41.js";import"./PhSignOut.vue.42a44544.js";import"./router.3b57fb6b.js";import"./Badge.05c5a8ba.js";import"./index.877779f4.js";import"./Avatar.26fee0bf.js";import"./index.5484d772.js";import"./index.d045fd91.js";import"./BookOutlined.2ea62891.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a65e24ff.js";import"./url.8ee60884.js";import"./PhDotsThreeVertical.vue.b754dcc2.js";import"./index.12f607b2.js";import"./popupNotifcation.4879d617.js";import"./record.fee51533.js";import"./string.7a9e8232.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]="bc53dcdb-6308-4176-af29-1295c1834ac1",r._sentryDebugIdIdentifier="sentry-dbid-bc53dcdb-6308-4176-af29-1295c1834ac1")}catch{}})();const gt=B({__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()),c=({key:e})=>{f.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 p(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);c({key:t.id})},C=D(()=>{var e,t;return{columns:[{title:"Organization Name",align:"left"},{title:"Path"},{title:"",align:"right"}],rows:(t=(e=b.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:c},{icon:R,label:"Rename",onClick:()=>z(a)}]}]}}))!=null?t:[]}});return(e,t)=>(g(),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:t[1]||(t[1]=a=>p(!1)),onOk:t[2]||(t[2]=a=>p(!0))},{default:i(()=>[n.value.state==="renaming"?(g(),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{gt as default};
//# sourceMappingURL=Organizations.ae88d27d.js.map
