import{N as k}from"./Navbar.194bdcf5.js";import{B as N}from"./BaseLayout.7f294166.js";import{C as I}from"./ContentLayout.9c270180.js";import{C as _}from"./CrudView.5ea4f8e5.js";import{a as O}from"./asyncComputed.f3fe22c0.js";import{F as x}from"./PhArrowSquareOut.vue.cb1204cb.js";import{G as R}from"./PhPencil.vue.a29e7db1.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 $,cz as j,bJ as A,cy as E,h as G,M as L}from"./jwt-decode.esm.febfd28e.js";import"./router.f4c1fe8c.js";import{a as m}from"./organization.6806e5f4.js";import"./tables.5938d0d9.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.8c406a60.js";import"./constants.48af5f1d.js";import"./PhChats.vue.ccd15af6.js";import"./PhSignOut.vue.5ed403e3.js";import"./index.0e1a642f.js";import"./index.2682b561.js";import"./omniChatStore.51f8e32d.js";import"./record.a977dda7.js";import"./uuid.220f2065.js";import"./PhCopySimple.vue.54bfebb2.js";import"./PhBookBookmark.vue.cabaacb3.js";import"./PhSparkle.vue.5c278476.js";import"./index.c60508fc.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.70530128.js";import"./url.092f6baf.js";import"./PhDotsThreeVertical.vue.7bdc070f.js";import"./index.ab72d4ab.js";import"./string.f661edcd.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]="57cf78ac-86fa-45b3-af01-6e0879fa80f9",r._sentryDebugIdIdentifier="sentry-dbid-57cf78ac-86fa-45b3-af01-6e0879fa80f9")}catch{}})();const yt=M({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],g=h(),{loading:y,result:b,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 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=b.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)=>(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(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=>c(!1)),onOk:t[2]||(t[2]=a=>c(!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.9c72842f.js.map
