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.a7f9f083.js";import{e as h,f as x}from"./icons.71d8e4fb.js";import{a as z}from"./asyncComputed.b85a7eae.js";import{P as d}from"./project.fc83c6d4.js";import"./gateway.0b4ed6c7.js";import{O as D}from"./organization.ae4152fa.js";import"./index.384d1894.js";import{C as v}from"./CrudView.afba6907.js";import"./activeRecord.8c74a961.js";import"./pubsub.e3e6423a.js";import"./passwordlessManager.c97a120a.js";import"./DropdownMenu.bb9502d0.js";import"./Modal.9197d569.js";import"./LoadingIndicator.38364267.js";import"./lottie.0b007633.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]="fdb1946a-4d46-41bf-8e04-165a90d97785",r._sentryDebugIdIdentifier="sentry-dbid-fdb1946a-4d46-41bf-8e04-165a90d97785")}catch{}})();const J=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})},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(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=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:y,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:b.value,fields:a,onCreate:f},null,8,["loading","title","table"])):I("",!0)}});export{J as default};
//# sourceMappingURL=Projects.159d3ab1.js.map
