import{N as k}from"./Navbar.aee2ff23.js";import{B as N}from"./BaseLayout.03f31219.js";import{C as I}from"./ContentLayout.de397dc2.js";import{C as _}from"./CrudView.6697526b.js";import{a as O}from"./asyncComputed.a1be57e2.js";import{F as x}from"./PhArrowSquareOut.vue.54a06313.js";import{G as R}from"./PhPencil.vue.c4cff9f3.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.e58852ef.js";import"./gateway.b7d3c19b.js";import{a as m}from"./organization.37c16fad.js";import"./columns.d5f48803.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.5f323e98.js";import"./PhChats.vue.a2f172a7.js";import"./PhSignOut.vue.45e85a5a.js";import"./router.d2050549.js";import"./index.3ab6033d.js";import"./Avatar.948e7d73.js";import"./omniChatStore.93044769.js";import"./record.46ea3b16.js";import"./PhSparkle.vue.0f2d3eb5.js";import"./index.b2abd116.js";import"./index.8ac41b0f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a54b97a4.js";import"./url.b6362cd6.js";import"./PhDotsThreeVertical.vue.5d559278.js";import"./Badge.a8022ff6.js";import"./index.447f8712.js";import"./popupNotifcation.e1a13287.js";import"./string.0ca9260c.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]="3fb3eaef-708e-405f-ae4f-ad392990c7ab",r._sentryDebugIdIdentifier="sentry-dbid-3fb3eaef-708e-405f-ae4f-ad392990c7ab")}catch{}})();const ye=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:t})=>{g.push({name:"organization",params:{organizationId:t}})},n=M({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=h(()=>{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(),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:e[1]||(e[1]=a=>d(!1)),onOk:e[2]||(e[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":e[0]||(e[0]=a=>n.value.newName=a)},null,8,["value"])]),_:1})]),_:1})):A("",!0)]),_:1},8,["open"])],64))}});export{ye as default};
//# sourceMappingURL=Organizations.99b13fc7.js.map
