import{d as g,ey as P,ex as w,F as _,bu as i,b as k,u as C,eu as I}from"./registerWidgets.92d2f644.js";import{e as h,f as x}from"./icons.f7e2c66d.js";import{a as z}from"./asyncComputed.969e5e52.js";import{P as d}from"./project.76f68b3e.js";import"./gateway.b5fd6e0f.js";import{O as D}from"./organization.677061f5.js";import"./index.a8106eac.js";import{C as v}from"./CrudView.bf94fe37.js";import"./activeRecord.1a640186.js";import"./pubsub.cabffe13.js";import"./passwordlessManager.d1484834.js";import"./storage.63ab52ef.js";import"./DropdownMenu.737d17d7.js";import"./Modal.2ef1e90a.js";import"./LoadingIndicator.6e991a44.js";import"./lottie.8475a642.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[a]="e890b46d-72a9-47d5-90f4-18f9f223bb68",r._sentryDebugIdIdentifier="sentry-dbid-e890b46d-72a9-47d5-90f4-18f9f223bb68")}catch{}})();const K=g({__name:"Projects",setup(r){const a=[{key:"name",label:"Project Name"}],s=P().params.organizationId,m=w(),{loading:u,result:n,refetch:p}=z(()=>Promise.all([d.list(s),D.get(s)]).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:s,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=n.value)==null?void 0:t.projects.find(j=>j.id===e))==null?void 0:o.delete()),p())},y=_(()=>{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),classes:["centered"]},{text:o.name,classes:["title"],link:`/projects/${encodeURIComponent(o.id)}`},{text:"",classes:["centered"],actions:[{icon:h,label:"Delete",onClick:b,dangerous:!0},{icon:x,label:"Edit Project",onClick:c}]}]})))!=null?t:[]}});return(e,t)=>i(n)?(k(),C(v,{key:0,"entity-name":"project",loading:i(u),title:`${i(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:y.value,fields:a,onCreate:f},null,8,["loading","title","table"])):I("",!0)}});export{K as default};
//# sourceMappingURL=Projects.c83dcf66.js.map
