import{N as k}from"./Navbar.d4751f52.js";import{B as N}from"./BaseLayout.d4459d3a.js";import{C as I}from"./ContentLayout.69b8ab09.js";import{C as _}from"./CrudView.56ebce1a.js";import{a as O}from"./asyncComputed.06839806.js";import{F as x}from"./PhArrowSquareOut.vue.06e1e087.js";import{G as R}from"./PhPencil.vue.aaf907d1.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.bcf2db26.js";import"./router.e5052323.js";import{a as m}from"./organization.017d0932.js";import"./tables.ecf1f359.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.ad9e23f0.js";import"./constants.d30e64e7.js";import"./PhChats.vue.bb8ced1d.js";import"./PhSignOut.vue.87084f39.js";import"./index.15909af6.js";import"./index.440bd76c.js";import"./omniChatStore.13045a23.js";import"./record.6b6d4da9.js";import"./uuid.3f5b8acd.js";import"./PhCopySimple.vue.1c5a0760.js";import"./PhBookBookmark.vue.b9569168.js";import"./PhSparkle.vue.707b3721.js";import"./index.ad15e486.js";import"./Breadcrumb.2d9d636f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.4eb7d335.js";import"./url.79c72bde.js";import"./PhDotsThreeVertical.vue.275748da.js";import"./index.cf5ef754.js";import"./string.2f1abff3.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]="4c9e5f8c-6b6a-4971-b631-b8516c52b637",r._sentryDebugIdIdentifier="sentry-dbid-4c9e5f8c-6b6a-4971-b631-b8516c52b637")}catch{}})();const yt=M({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],f=h(),{loading:b,result:y,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 c(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 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?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(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=>c(!1)),onOk:t[2]||(t[2]=a=>c(!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{yt as default};
//# sourceMappingURL=Organizations.91c269e6.js.map
