import{N as k}from"./Navbar.9afe208e.js";import{B as N}from"./BaseLayout.282c61a4.js";import{C as I}from"./ContentLayout.991bbf22.js";import{C as _}from"./CrudView.f8c62bd5.js";import{a as O}from"./asyncComputed.6b1d4165.js";import{F as x}from"./PhArrowSquareOut.vue.2585952a.js";import{G as R}from"./PhPencil.vue.001dc101.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 f,c as L,cs as V,bE as $,cr as j,F as A,cE as G}from"./index.e310aebb.js";import"./gateway.4d0dc75b.js";import{a as m}from"./organization.be0aa541.js";import"./columns.b1346706.js";import"./AbstraButton.vue_vue_type_script_setup_true_lang.cbbef791.js";import"./PhChats.vue.e1b07b2c.js";import"./PhSignOut.vue.024a2a22.js";import"./router.2399bbbf.js";import"./index.3d882fa8.js";import"./Avatar.004ed8a2.js";import"./omniChatStore.755c548d.js";import"./record.d2935dfa.js";import"./PhSparkle.vue.56c31c6f.js";import"./index.6a1f7c3e.js";import"./index.baae1682.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d13fff5d.js";import"./url.fb968ca0.js";import"./PhDotsThreeVertical.vue.86ea10eb.js";import"./Badge.a954551a.js";import"./index.850d1dd3.js";import"./popupNotifcation.fa3e65fc.js";import"./string.a01d17aa.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]="49a4b983-ef91-4123-8f41-e79569979fa8",r._sentryDebugIdIdentifier="sentry-dbid-49a4b983-ef91-4123-8f41-e79569979fa8")}catch{}})();const yt=B({__name:"Organizations",setup(r){const l=[{label:"My organizations",path:"/organizations"}],u=[{key:"name",label:"Organization Name"}],g=F(),{loading:y,result:b,refetch:v}=O(()=>m.list()),p=({key:e})=>{g.push({name:"organization",params:{organizationId:e}})},n=M({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=h(()=>{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)=>(f(),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:t[1]||(t[1]=a=>d(!1)),onOk:t[2]||(t[2]=a=>d(!0))},{default:i(()=>[n.value.state==="renaming"?(f(),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":t[0]||(t[0]=a=>n.value.newName=a)},null,8,["value"])]),_:1})]),_:1})):A("",!0)]),_:1},8,["open"])],64))}});export{yt as default};
//# sourceMappingURL=Organizations.121340db.js.map
