import{N as k}from"./Navbar.08238e30.js";import{B as N}from"./BaseLayout.2260abda.js";import{C as I}from"./ContentLayout.9a1f0653.js";import{C as _}from"./CrudView.2b97fb7a.js";import{a as O}from"./asyncComputed.aa8ef1b1.js";import{F as x}from"./PhArrowSquareOut.vue.9d3c1103.js";import{G as R}from"./PhPencil.vue.0641312b.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 g,c as L,cs as V,bE as $,cr as j,F as A,cE as G}from"./index.0aa22eb1.js";import"./gateway.2c1f8fd2.js";import{a as m}from"./organization.ed8bdc9b.js";import"./columns.e4541305.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.d456821b.js";import"./PhChats.vue.488c4d40.js";import"./PhSignOut.vue.7fb426a0.js";import"./router.8fb73c5d.js";import"./index.7bc57f42.js";import"./Avatar.478b3c49.js";import"./omniChatStore.4fa66805.js";import"./record.f313467e.js";import"./PhSparkle.vue.7212749c.js";import"./index.9ac3026e.js";import"./index.27527eec.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.0de68ee9.js";import"./url.1b0df002.js";import"./PhDotsThreeVertical.vue.73a35ed9.js";import"./Badge.d9f0c186.js";import"./index.76fbee64.js";import"./popupNotifcation.f330a36a.js";import"./string.4db7b5b7.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]="1e497c69-ec43-4c1a-bbb1-601e2fae3304",r._sentryDebugIdIdentifier="sentry-dbid-1e497c69-ec43-4c1a-bbb1-601e2fae3304")}catch{}})();const be=B({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],f=F(),{loading:b,result:y,refetch:v}=O(()=>m.list()),p=({key:t})=>{f.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 c(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=y.value)==null?void 0:t.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:p},{icon:R,label:"Rename",onClick:()=>z(a)}]}]}}))!=null?e:[]}});return(t,e)=>(g(),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(b),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=>c(!1)),onOk:e[2]||(e[2]=a=>c(!0))},{default:i(()=>[n.value.state==="renaming"?(g(),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{be as default};
//# sourceMappingURL=Organizations.0aa5502d.js.map
