import{d as j,K as P,z as s,b as w,t as _,D as k,J as h,H as C}from"./registerWidgets.966858c5.js";import{f as I,g as x}from"./icons.e22fc21e.js";import{a as z}from"./asyncComputed.af01c07f.js";import{P as d}from"./project.55413ff1.js";import"./gateway.e0302561.js";import{O as D}from"./organization.aacf58b8.js";import{C as N}from"./CrudView.081d6223.js";import"./activeRecord.250eaea9.js";import"./passwordlessManager.7ff47fc0.js";import"./DropdownMenu.668bc910.js";import"./Modal.cbda4e16.js";import"./LoadingIndicator.753c6681.js";import"./lottie.91935b30.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[n]="38681683-c43b-4960-be43-8df07dce02bf",r._sentryDebugIdIdentifier="sentry-dbid-38681683-c43b-4960-be43-8df07dce02bf")}catch{}})();const U=j({__name:"Projects",setup(r){const n=[{key:"name",label:"Project Name"}],i=h().params.organizationId,m=C(),{loading:u,result:a,refetch:p}=z(()=>Promise.all([d.list(i),D.get(i)]).then(([e,t])=>({projects:e,organization:t}))),c=({key:e})=>m.push({name:"project",params:{projectId:e}}),f=async e=>{const t=await d.create({organizationId:i,name:e.name});c({key:t.id})},b=async({key:e})=>{var t,o;confirm("Are you sure you want to delete this project?")&&(await((o=(t=a.value)==null?void 0:t.projects.find(g=>g.id===e))==null?void 0:o.delete()),p())},y=P(()=>{var e,t;return{columns:[{name:"Project Name"},{name:"Path"},{name:"Project Actions"}],rows:(t=(e=a.value)==null?void 0:e.projects.map(o=>({key:o.id,cells:[{text:o.name,classes:["title","centered"],link:`/projects/${encodeURIComponent(o.id)}`},{text:o.id},{text:"",classes:["centered"],actions:[{icon:I,label:"Delete",onClick:b,dangerous:!0},{icon:x,label:"Edit Project",onClick:c}]}]})))!=null?t:[]}});return(e,t)=>s(a)?(w(),_(N,{key:0,"entity-name":"project",loading:s(u),title:`${s(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:s(y),fields:n,onCreate:f},null,8,["loading","title","table"])):k("",!0)}});export{U as default};
//# sourceMappingURL=Projects.aee24909.js.map
