import{N as k}from"./Navbar.a4f560fd.js";import{B as N}from"./BaseLayout.d665f90f.js";import{C as I}from"./ContentLayout.99fbdc50.js";import{C as _}from"./CrudView.9ca73714.js";import{a as O}from"./asyncComputed.c4d23a56.js";import{F as x}from"./PhArrowSquareOut.vue.8036234c.js";import{G as R}from"./PhPencil.vue.31c50786.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.9cc3d5c7.js";import"./gateway.22c5659c.js";import{a as m}from"./organization.22789a4d.js";import"./tables.76f4fbaa.js";import"./PhChats.vue.615e952e.js";import"./PhSignOut.vue.348b03f4.js";import"./router.72eb9cf0.js";import"./Badge.7e1554af.js";import"./index.ccd42e69.js";import"./Avatar.968b4249.js";import"./index.6c766824.js";import"./index.60d46dfe.js";import"./BookOutlined.548b6b44.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.de8ed59e.js";import"./url.185ef886.js";import"./PhDotsThreeVertical.vue.a9a966a9.js";import"./index.14f6514a.js";import"./popupNotifcation.37bbe14e.js";import"./record.6b6ff6df.js";import"./string.22f3398b.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]="364fd93d-073f-42ec-9058-a7bf17540490",r._sentryDebugIdIdentifier="sentry-dbid-364fd93d-073f-42ec-9058-a7bf17540490")}catch{}})();const ft=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:e})=>{g.push({name:"organization",params:{organizationId:e}})},n=M({state:"idle"});function z(e){n.value={state:"renaming",organizationId:e.id,newName:e.name}}async function d(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=h(()=>{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 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?t:[]}});return(e,t)=>(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:t[1]||(t[1]=a=>d(!1)),onOk:t[2]||(t[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":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.5d3dc0b7.js.map
