import{d as g,J as P,H as w,K as _,z as i,b as k,t as C,D as I}from"./registerWidgets.cecc7add.js";import{e as h,f as x}from"./icons.a47594f6.js";import{a as z}from"./asyncComputed.08fdcc30.js";import{P as d}from"./project.14d2a965.js";import"./gateway.c00982e9.js";import{O as D}from"./organization.152bdd94.js";import"./index.d9da78e8.js";import{C as v}from"./CrudView.48449181.js";import"./activeRecord.2a9ab687.js";import"./pubsub.a43e35aa.js";import"./passwordlessManager.8b0c672e.js";import"./DropdownMenu.4df8c96d.js";import"./Modal.4485a18b.js";import"./LoadingIndicator.06d4594a.js";import"./lottie.79ce2fdf.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[r]="6d0e7a32-6a5a-4227-925b-e35a95e62b4f",a._sentryDebugIdIdentifier="sentry-dbid-6d0e7a32-6a5a-4227-925b-e35a95e62b4f")}catch{}})();const F=g({__name:"Projects",setup(a){const r=[{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:r,onCreate:f},null,8,["loading","title","table"])):I("",!0)}});export{F as default};
//# sourceMappingURL=Projects.19fb9d5a.js.map
