import{N as k}from"./Navbar.ef64aa09.js";import{B as N}from"./BaseLayout.72a6c8f2.js";import{C as I}from"./ContentLayout.0db8d7fb.js";import{C as _}from"./CrudView.cc6aeaf0.js";import{a as O}from"./asyncComputed.47aec2b5.js";import{F as x}from"./PhArrowSquareOut.vue.2ddfc219.js";import{G as R}from"./PhPencil.vue.feb383e2.js";import{d as M,e5 as h,r as B,c as D,a5 as F,f as o,b as i,u as s,aR as V,o as f,a as $,cx as j,bJ as A,cw as E,h as G,M as L}from"./jwt-decode.esm.54a1ea22.js";import"./router.4dfadf5d.js";import{a as m}from"./organization.668d1b58.js";import"./tables.1bcb1140.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.aefce2d3.js";import"./constants.d569f33d.js";import"./PhChats.vue.71e5cb89.js";import"./PhSignOut.vue.d1d6498f.js";import"./index.966ac1b9.js";import"./index.c8a56795.js";import"./omniChatStore.dd7a1c46.js";import"./record.e83a2eb2.js";import"./uuid.5b8ba8af.js";import"./PhCopySimple.vue.5d0f839d.js";import"./PhBookBookmark.vue.41108214.js";import"./PhSparkle.vue.b6712d34.js";import"./index.482df04a.js";import"./Breadcrumb.5c786c09.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.689d8ce7.js";import"./url.f5664225.js";import"./PhDotsThreeVertical.vue.5e8ae2a9.js";import"./index.c7a996a6.js";import"./string.61e11a30.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]="ef566e23-d647-4a5b-8aba-289f34bc9358",r._sentryDebugIdIdentifier="sentry-dbid-ef566e23-d647-4a5b-8aba-289f34bc9358")}catch{}})();const yt=M({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],g=h(),{loading:b,result:y,refetch:v}=O(()=>m.list()),p=({key:e})=>{g.push({name:"organization",params:{organizationId:e}})},n=B({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=D(()=>{var e,t;return{columns:[{title:"Organization Name",align:"left"},{title:"Path"},{title:"",align:"right"}],rows:(t=(e=y.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(),F(V,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(L),{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(E),{key:0,layout:"vertical"},{default:i(()=>[o(s(j),{label:"New name"},{default:i(()=>[o(s(A),{value:n.value.newName,"onUpdate:value":t[0]||(t[0]=a=>n.value.newName=a)},null,8,["value"])]),_:1})]),_:1})):G("",!0)]),_:1},8,["open"])],64))}});export{yt as default};
//# sourceMappingURL=Organizations.47868beb.js.map
