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.eddbac36.js";import{e as z,b as D}from"./icons.08aaa24c.js";import{a as N}from"./asyncComputed.fbd351ba.js";import{P as d}from"./project.d3d29cca.js";import"./console.56ba8e89.js";import{O as v}from"./organization.69809293.js";import"./index.c1e978a8.js";import{_ as O}from"./CrudView.vue_vue_type_script_setup_true_lang.d009f8f3.js";import{a as A}from"./ant-design.109b29f5.js";import"./gateway.e4ec4a58.js";import"./activeRecord.64b754df.js";import"./pubsub.9aea5614.js";import"./index.cc18f239.js";import"./Form.f5163eed.js";import"./Title.7ca27be1.js";import"./index.1a0ec4ff.js";import"./index.31447910.js";import"./index.9c583b89.js";import"./dayjs.d80a3524.js";import"./index.8318ec36.js";import"./index.8b693270.js";import"./TabPane.05333dfb.js";import"./index.b6a61078.js";import"./index.7a28d537.js";import"./index.d099a09e.js";import"./index.933610ff.js";import"./index.2c51d0a8.js";import"./index.b131e8f9.js";import"./index.3475d619.js";import"./index.f428cf3a.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[a]="5c4b5717-d5b2-4182-9ae0-9a9c3f71e43c",r._sentryDebugIdIdentifier="sentry-dbid-5c4b5717-d5b2-4182-9ae0-9a9c3f71e43c")}catch{}})();const me=w({__name:"Projects",setup(r){const a=[{key:"name",label:"Project Name"}],n=_().params.organizationId,u=P(),{loading:f,result:i,refetch:y}=N(()=>Promise.all([d.list(n),v.get(n)]).then(([e,t])=>({projects:e,organization:t}))),m=({key:e})=>u.push({name:"project",params:{projectId:e}}),g=async e=>{const t=await d.create({organizationId:n,name:e.name});m({key:t.id})},b=async({key:e})=>{var o,p;if(await A("Are you sure you want to delete this project?"))try{await((p=(o=i.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=i.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:b,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>c(i)?(h(),I(O,{key:0,"entity-name":"project",loading:c(f),title:`${c(i).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:a,onCreate:g},null,8,["loading","title","table"])):C("",!0)}});export{me as default};
//# sourceMappingURL=Projects.af488c49.js.map
