import{d as g,ey as P,ex as w,F as _,bu as c,b as k,u as C,eu as I}from"./registerWidgets.2d3a9fa1.js";import{e as h,f as x}from"./icons.ef35efa7.js";import{a as z}from"./asyncComputed.da67dddd.js";import{P as l}from"./project.d201177e.js";import"./gateway.90839648.js";import{O as D}from"./organization.f163a5e9.js";import"./index.cc19b71e.js";import{C as v}from"./CrudView.a779dd60.js";import"./activeRecord.85525a95.js";import"./pubsub.f5cc447b.js";import"./passwordlessManager.7fdb47fd.js";import"./storage.2f9edc3d.js";import"./DropdownMenu.1c4bd517.js";import"./Modal.0a34e3f8.js";import"./LoadingIndicator.25e4e865.js";import"./lottie.8f8e4fb5.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]="71e6b815-8e5f-4c23-809e-69ce50c3c9c8",r._sentryDebugIdIdentifier="sentry-dbid-71e6b815-8e5f-4c23-809e-69ce50c3c9c8")}catch{}})();const K=g({__name:"Projects",setup(r){const n=[{key:"name",label:"Project Name"}],s=P().params.organizationId,m=w(),{loading:u,result:a,refetch:p}=z(()=>Promise.all([l.list(s),D.get(s)]).then(([e,t])=>({projects:e,organization:t}))),i=({key:e})=>m.push({name:"project",params:{projectId:e}}),f=async e=>{const t=await l.create({organizationId:s,name:e.name});i({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(j=>j.id===e))==null?void 0:o.delete()),p())},b=_(()=>{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:i}]}]})))!=null?t:[]}});return(e,t)=>c(a)?(k(),C(v,{key:0,"entity-name":"project",loading:c(u),title:`${c(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:b.value,fields:n,onCreate:f},null,8,["loading","title","table"])):I("",!0)}});export{K as default};
//# sourceMappingURL=Projects.166f4206.js.map
