import{N as k}from"./Navbar.b8d1f818.js";import{B as N}from"./BaseLayout.b766196f.js";import{C as I}from"./ContentLayout.4be61bce.js";import{C as _}from"./CrudView.c9a70a38.js";import{a as O}from"./asyncComputed.d7c4e941.js";import{F as x}from"./PhArrowSquareOut.vue.aca0545c.js";import{G as R}from"./PhPencil.vue.6d6dc1ad.js";import{d as B,e3 as F,f as M,g as h,K as D,b as o,w as i,u as s,aL as E,o as f,c as L,cs as V,bE as $,cr as j,F as A,cE as G}from"./index.b7bd503f.js";import"./gateway.6db311e2.js";import{a as m}from"./organization.b055a096.js";import"./columns.c99cb402.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.bef4d8ba.js";import"./PhChats.vue.7f69aca3.js";import"./PhSignOut.vue.84503c82.js";import"./router.7c58172b.js";import"./index.173038d0.js";import"./Avatar.8a8cac11.js";import"./omniChatStore.0918de26.js";import"./record.c86f39d9.js";import"./PhSparkle.vue.d0b7c741.js";import"./index.5b720ad7.js";import"./index.ba206f89.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a6841fb4.js";import"./url.c0ede6d9.js";import"./PhDotsThreeVertical.vue.5c0a03a4.js";import"./Badge.53ab4d2d.js";import"./index.78ee4489.js";import"./popupNotifcation.bbf38424.js";import"./string.9a3a939b.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]="b8f9f049-a8c1-497a-8965-8d8b94a18f27",r._sentryDebugIdIdentifier="sentry-dbid-b8f9f049-a8c1-497a-8965-8d8b94a18f27")}catch{}})();const yt=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(E,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(G),{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(),L(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{yt as default};
//# sourceMappingURL=Organizations.c18c6bb2.js.map
