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.1e9167ab.js";import{e as C,b as x}from"./icons.41af03d8.js";import{a as z}from"./asyncComputed.8a644895.js";import{P as d}from"./project.9f45bccb.js";import"./gateway.6096f5a8.js";import{O as D}from"./organization.a2c74ee1.js";import"./index.11f5d4e4.js";import{_ as v}from"./CrudView.vue_vue_type_script_setup_true_lang.e0bf9fc2.js";import"./activeRecord.60b6bd01.js";import"./pubsub.09eafe35.js";import"./passwordlessManager.b7f590c1.js";import"./storage.84fcb572.js";import"./Modal.b646cd22.js";import"./Title.d1f45d59.js";import"./transButton.755e702e.js";import"./index.9165a659.js";import"./Text.c8d7b4c0.js";import"./index.32c7f8ee.js";import"./index.d74062f4.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]="437dd957-fc76-4a82-bbf2-c49c2cd9f930",r._sentryDebugIdIdentifier="sentry-dbid-437dd957-fc76-4a82-bbf2-c49c2cd9f930")}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.7c917e9f.js.map
