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.751c4cc6.js";import{e as h,f as x}from"./icons.839289ff.js";import{a as z}from"./asyncComputed.4ba8b2d8.js";import{P as d}from"./project.83595b26.js";import"./gateway.a29f1b8a.js";import{O as D}from"./organization.b2a124d1.js";import"./index.1677387f.js";import{C as v}from"./CrudView.55a91fc3.js";import"./activeRecord.91f4e05e.js";import"./pubsub.87f27d54.js";import"./passwordlessManager.8b22003c.js";import"./storage.fbef8aee.js";import"./DropdownMenu.3730f8d7.js";import"./Modal.2619bb1d.js";import"./LoadingIndicator.e1d41754.js";import"./lottie.2da9cd67.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]="175d9a79-269f-46cc-804e-c8c878472f94",r._sentryDebugIdIdentifier="sentry-dbid-175d9a79-269f-46cc-804e-c8c878472f94")}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})},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(b=>b.id===e))==null?void 0:o.delete()),p())},j=_(()=>{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:j.value,fields:a,onCreate:f},null,8,["loading","title","table"])):I("",!0)}});export{K as default};
//# sourceMappingURL=Projects.81f503cb.js.map
