import{d as g,ey as _,ex as P,H as w,u as s,b as k,c as I,eu as h}from"./registerWidgets.d207d3d8.js";import{e as C,b as x}from"./icons.4cf3c6e7.js";import{a as z}from"./asyncComputed.9245c077.js";import{P as d}from"./project.02360aad.js";import"./gateway.b835e205.js";import{O as D}from"./organization.d491d126.js";import"./index.ec4e5819.js";import{_ as v}from"./CrudView.vue_vue_type_script_setup_true_lang.892f2f1d.js";import"./activeRecord.3ac0bec0.js";import"./pubsub.a025efb1.js";import"./passwordlessManager.66faf323.js";import"./storage.955f9c37.js";import"./Modal.c3922cf6.js";import"./Title.db9c20f2.js";import"./transButton.c5e342ac.js";import"./index.ed3f099d.js";import"./Text.df3bd99f.js";import"./index.a3599972.js";import"./index.ce572c42.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]="672d7080-fbf8-4d58-ae05-429cf162bd94",r._sentryDebugIdIdentifier="sentry-dbid-672d7080-fbf8-4d58-ae05-429cf162bd94")}catch{}})();const S=g({__name:"Projects",setup(r){const a=[{key:"name",label:"Project Name"}],i=_().params.organizationId,l=P(),{loading:p,result:n,refetch:u}=z(()=>Promise.all([d.list(i),D.get(i)]).then(([e,t])=>({projects:e,organization:t}))),c=({key:e})=>l.push({name:"project",params:{projectId:e}}),f=async e=>{const t=await d.create({organizationId:i,name:e.name});c({key:t.id})},y=async({key:e})=>{var t,o;confirm("Are you sure you want to delete this project?")&&(await((o=(t=n.value)==null?void 0:t.projects.find(j=>j.id===e))==null?void 0:o.delete()),u())},b=w(()=>{var e,t;return{columns:[{name:"Id"},{name:"Project Name"},{name:"Project Actions"}],rows:(t=(e=n.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:C,label:"Edit Project",onClick:c},{icon:x,label:"Delete",onClick:y,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>s(n)?(k(),I(v,{key:0,"entity-name":"project",loading:s(p),title:`${s(n).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:b.value,fields:a,onCreate:f},null,8,["loading","title","table"])):h("",!0)}});export{S as default};
//# sourceMappingURL=Projects.b67c67d7.js.map
