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.5ceb46ef.js";import{e as C,b as x}from"./icons.b59fe784.js";import{a as z}from"./asyncComputed.fd157db2.js";import{P as m}from"./project.2ac52f46.js";import"./gateway.fadd845e.js";import{O as D}from"./organization.9116c226.js";import"./index.e1d2843e.js";import{_ as v}from"./CrudView.vue_vue_type_script_setup_true_lang.af549d55.js";import"./activeRecord.693e9703.js";import"./pubsub.451b7de0.js";import"./passwordlessManager.db35a950.js";import"./storage.4e9cf889.js";import"./Modal.4e47c5c5.js";import"./Title.d4cb8bc4.js";import"./index.1a41b32a.js";import"./index.f7704414.js";import"./index.4fdcdf65.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[r]="6576240c-a2c7-4ad6-9aea-b832f5e104f8",a._sentryDebugIdIdentifier="sentry-dbid-6576240c-a2c7-4ad6-9aea-b832f5e104f8")}catch{}})();const L=g({__name:"Projects",setup(a){const r=[{key:"name",label:"Project Name"}],i=_().params.organizationId,l=P(),{loading:p,result:n,refetch:u}=z(()=>Promise.all([m.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 m.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:r,onCreate:f},null,8,["loading","title","table"])):h("",!0)}});export{L as default};
//# sourceMappingURL=Projects.7d623fde.js.map
