import{d as g,ey as P,ex as w,H as _,u as i,b as k,c as C,eu as I}from"./registerWidgets.e46eca28.js";import{a as h,e as x}from"./icons.db549bc5.js";import{a as z}from"./asyncComputed.15fd30e0.js";import{P as d}from"./project.0d1361a7.js";import"./gateway.0d210a45.js";import{O as D}from"./organization.aa9f5b9e.js";import"./index.05c509d5.js";import{C as v}from"./CrudView.2fb3f52f.js";import"./activeRecord.d83b1b14.js";import"./pubsub.8f2ecd1e.js";import"./passwordlessManager.f4cc4f94.js";import"./storage.f303ee10.js";import"./DropdownMenu.dd15f4e3.js";import"./Modal.47e24ea4.js";import"./LoadingIndicator.623149e9.js";import"./lottie.2b81658b.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]="04e324c0-1113-4834-a6b0-cae45ac0b2de",a._sentryDebugIdIdentifier="sentry-dbid-04e324c0-1113-4834-a6b0-cae45ac0b2de")}catch{}})();const K=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{K as default};
//# sourceMappingURL=Projects.0df0865a.js.map
