import{N as k}from"./Navbar.3108758c.js";import{B as N}from"./BaseLayout.98d04a38.js";import{C as I}from"./ContentLayout.4f819aa5.js";import{C as _}from"./CrudView.c237ea79.js";import{a as O}from"./asyncComputed.8007720a.js";import{F as x}from"./PhArrowSquareOut.vue.59603817.js";import{G as R}from"./PhPencil.vue.8938602a.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.2bd55860.js";import"./gateway.79c1aab3.js";import{a as m}from"./organization.dc1f04bf.js";import"./columns.0eb7599e.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.3d303c38.js";import"./PhChats.vue.7a3c8ffe.js";import"./PhSignOut.vue.f455173c.js";import"./router.562a04cc.js";import"./index.3bcf7d9f.js";import"./Avatar.fa219617.js";import"./omniChatStore.5537d810.js";import"./record.5f72dfbb.js";import"./PhSparkle.vue.ec5f656a.js";import"./index.cb544d02.js";import"./index.26647590.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.97173c26.js";import"./url.8ddd701d.js";import"./PhDotsThreeVertical.vue.4801751a.js";import"./Badge.e8b64a72.js";import"./index.093686d2.js";import"./popupNotifcation.44e16211.js";import"./string.fcee8e82.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]="37162799-f32e-44e8-a4a6-ebbc6d24402e",r._sentryDebugIdIdentifier="sentry-dbid-37162799-f32e-44e8-a4a6-ebbc6d24402e")}catch{}})();const ye=B({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],f=F(),{loading:y,result:b,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 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)=>(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(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"?(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{ye as default};
//# sourceMappingURL=Organizations.a1edba3c.js.map
