import{N as k}from"./Navbar.07ba9452.js";import{B as N}from"./BaseLayout.c63dfc2d.js";import{C as I}from"./ContentLayout.228d2328.js";import{C as _}from"./CrudView.c16e2f81.js";import{a as O}from"./asyncComputed.25309626.js";import{F as x}from"./PhArrowSquareOut.vue.d0c95a06.js";import{G as R}from"./PhPencil.vue.80ed4b2e.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 g,a as $,cz as j,bJ as A,cy as E,h as G,M as L}from"./jwt-decode.esm.7f2ef0df.js";import"./router.8fd5b2ad.js";import{a as m}from"./organization.a877b653.js";import"./tables.be1c51f8.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.441fcdfd.js";import"./constants.56e8988f.js";import"./PhChats.vue.54d692e4.js";import"./PhSignOut.vue.c9150da4.js";import"./index.23283fbb.js";import"./index.03d222dd.js";import"./omniChatStore.3431c026.js";import"./record.4ffc477c.js";import"./uuid.dadede91.js";import"./PhCopySimple.vue.43c74ebe.js";import"./PhBookBookmark.vue.42e49494.js";import"./PhSparkle.vue.84ea95fc.js";import"./index.8e871bae.js";import"./Breadcrumb.27110ec4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.61381525.js";import"./url.8583a595.js";import"./PhDotsThreeVertical.vue.0ea03d82.js";import"./index.9021ba5d.js";import"./string.2ed1cde3.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]="495603d7-36ce-4988-8adb-0d0126724b21",r._sentryDebugIdIdentifier="sentry-dbid-495603d7-36ce-4988-8adb-0d0126724b21")}catch{}})();const bt=M({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],f=h(),{loading:y,result:b,refetch:v}=O(()=>m.list()),p=({key:e})=>{f.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=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)=>(g(),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(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(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"?(g(),$(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{bt as default};
//# sourceMappingURL=Organizations.b630803f.js.map
