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.05268d5e.js";import{f as I,g as x}from"./icons.7c77483f.js";import{a as z}from"./asyncComputed.8f90be18.js";import{P as d}from"./project.79348d50.js";import"./gateway.c44af888.js";import{O as D}from"./organization.45bbed38.js";import{C as N}from"./CrudView.79f31df7.js";import"./activeRecord.bacc466b.js";import"./passwordlessManager.61e5b6aa.js";import"./DropdownMenu.7f9500ce.js";import"./Modal.ab17c1cc.js";import"./LoadingIndicator.cd761736.js";import"./lottie.ea647b01.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]="7b897849-b045-4eee-a5a3-ec48afcdd036",a._sentryDebugIdIdentifier="sentry-dbid-7b897849-b045-4eee-a5a3-ec48afcdd036")}catch{}})();const U=j({__name:"Projects",setup(a){const r=[{key:"name",label:"Project Name"}],i=h().params.organizationId,m=C(),{loading:u,result:n,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})},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(g=>g.id===e))==null?void 0:o.delete()),p())},b=P(()=>{var e,t;return{columns:[{name:"Project Name"},{name:"Path"},{name:"Project Actions"}],rows:(t=(e=n.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:y,dangerous:!0},{icon:x,label:"Edit Project",onClick:c}]}]})))!=null?t:[]}});return(e,t)=>s(n)?(w(),_(N,{key:0,"entity-name":"project",loading:s(u),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:s(b),fields:r,onCreate:f},null,8,["loading","title","table"])):k("",!0)}});export{U as default};
//# sourceMappingURL=Projects.9057d15d.js.map
