import{d as j,K as P,z as s,b as w,t as _,D as k,J as C,H as I}from"./registerWidgets.60bba559.js";import{f as h,g as x}from"./icons.86798a2e.js";import{a as z}from"./asyncComputed.d00a688c.js";import{P as d}from"./project.d55020ea.js";import"./gateway.aefff1da.js";import{O as D}from"./organization.e7137f47.js";import"./index.320037c9.js";import{C as N}from"./CrudView.a60cfd24.js";import"./activeRecord.5794d4d2.js";import"./pubsub.6df2423b.js";import"./passwordlessManager.e1b568b1.js";import"./DropdownMenu.5abb73fd.js";import"./Modal.8fbea10f.js";import"./LoadingIndicator.0b01cf4c.js";import"./lottie.fd5d7b21.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]="773095fd-2323-4258-be2b-110d033d0d87",r._sentryDebugIdIdentifier="sentry-dbid-773095fd-2323-4258-be2b-110d033d0d87")}catch{}})();const F=j({__name:"Projects",setup(r){const n=[{key:"name",label:"Project Name"}],i=C().params.organizationId,m=I(),{loading:p,result:a,refetch:u}=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=a.value)==null?void 0:t.projects.find(g=>g.id===e))==null?void 0:o.delete()),u())},b=P(()=>{var e,t;return{columns:[{name:"Id"},{name:"Project Name"},{name:"Project Actions"}],rows:(t=(e=a.value)==null?void 0:e.projects.map(o=>({key:o.id,cells:[{text:o.id.slice(0,8),classes:["centered"]},{text:o.name,classes:["title"],link:`/projects/${encodeURIComponent(o.id)}`},{text:"",classes:["centered"],actions:[{icon:h,label:"Delete",onClick:y,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(p),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(b),fields:n,onCreate:f},null,8,["loading","title","table"])):k("",!0)}});export{F as default};
//# sourceMappingURL=Projects.188f327e.js.map
