import{d as w,eA as _,ez as P,J as k,u as c,b as h,c as I,ew as C,cN as x}from"./outputWidgets.d6897520.js";import{e as z,b as D}from"./icons.20b5fc8a.js";import{a as N}from"./asyncComputed.2c363ccc.js";import{P as d}from"./project.7c73974a.js";import"./console.526446d9.js";import{O as v}from"./organization.1bd1ec32.js";import"./index.a8a303e6.js";import{_ as O}from"./CrudView.vue_vue_type_script_setup_true_lang.eece189e.js";import{a as A}from"./ant-design.25ee6641.js";import"./gateway.c13063b9.js";import"./activeRecord.e97440b4.js";import"./pubsub.e0b33cd4.js";import"./index.40bea6c2.js";import"./Form.a2bccbf0.js";import"./Title.9e102f51.js";import"./index.65fddafd.js";import"./index.dcf9fd0a.js";import"./index.09e1dc09.js";import"./dayjs.dccbdd6f.js";import"./index.0f5fc52a.js";import"./index.fd09b35e.js";import"./TabPane.c8258ec5.js";import"./index.b11f642a.js";import"./index.7c1a9101.js";import"./index.e63bacfa.js";import"./index.30191c77.js";import"./index.33e7eca5.js";import"./index.16598f32.js";import"./index.a2784b6b.js";import"./index.59123055.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[i]="1fec5366-7f78-4ecb-ab8f-fffe9b8928c1",r._sentryDebugIdIdentifier="sentry-dbid-1fec5366-7f78-4ecb-ab8f-fffe9b8928c1")}catch{}})();const me=w({__name:"Projects",setup(r){const i=[{key:"name",label:"Project Name"}],n=_().params.organizationId,f=P(),{loading:u,result:a,refetch:y}=N(()=>Promise.all([d.list(n),v.get(n)]).then(([e,t])=>({projects:e,organization:t}))),m=({key:e})=>f.push({name:"project",params:{projectId:e}}),b=async e=>{const t=await d.create({organizationId:n,name:e.name});m({key:t.id})},g=async({key:e})=>{var o,p;if(await A("Are you sure you want to delete this project?"))try{await((p=(o=a.value)==null?void 0:o.projects.find(s=>s.id===e))==null?void 0:p.delete())}catch(s){x.error({message:"Error deleting project",description:String(s)})}finally{await y()}},j=k(()=>{var e,t;return{columns:[{name:"Id"},{name:"Project Name"},{name:"Actions",align:"right"}],rows:(t=(e=a.value)==null?void 0:e.projects.map(o=>({key:o.id,cells:[{text:o.id.slice(0,8)},{text:o.name,link:`/projects/${encodeURIComponent(o.id)}`},{text:"",actions:[{icon:z,label:"Edit Project",onClick:m},{icon:D,label:"Delete",onClick:g,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>c(a)?(h(),I(O,{key:0,"entity-name":"project",loading:c(u),title:`${c(a).organization.name}'s Projects`,description:"Organize your team's work into different Projects, each with it's own subdomain.","create-button-text":"Create Project","empty-title":"No projects here yet",table:j.value,fields:i,onCreate:b},null,8,["loading","title","table"])):C("",!0)}});export{me as default};
//# sourceMappingURL=Projects.b959779d.js.map
