import{d as j,K as P,z as s,b as w,t as k,D as _,J as h,H as C}from"./registerWidgets.bbbd3e16.js";import{f as I,g as x}from"./icons.3f47812d.js";import{a as z}from"./asyncComputed.ad67be0e.js";import{P as d}from"./project.5bf8728e.js";import"./gateway.d8ce80c3.js";import{O as D}from"./organization.c2f79436.js";import{C as N}from"./CrudView.b0306c32.js";import"./activeRecord.9842b68f.js";import"./passwordlessManager.2d127f26.js";import"./DropdownMenu.f54cc23f.js";import"./CircularLoading.85040470.js";import"./Modal.2efbfa6a.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]="51e34142-3510-4b6e-9b6a-5f0e51de000e",a._sentryDebugIdIdentifier="sentry-dbid-51e34142-3510-4b6e-9b6a-5f0e51de000e")}catch{}})();const T=j({__name:"Projects",setup(a){const r=[{key:"name",label:"Project Name"}],i=h().params.organizationId,m=C(),{loading:u,result:n,refetch:p}=z(()=>Promise.all([d.list(i),D.get(i)]).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:i,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(g=>g.id===e))==null?void 0:o.delete()),p())},b=P(()=>{var e,t;return{columns:[{name:"Project Name"},{name:"Path"},{name:"Project Actions"}],rows:(t=(e=n.value)==null?void 0:e.projects.map(o=>({key:o.id,cells:[{text:o.name,classes:["title","centered"],link:`/projects/${encodeURIComponent(o.id)}`},{text:o.id},{text:"",classes:["centered"],actions:[{icon:I,label:"Delete",onClick:y,dangerous:!0},{icon:x,label:"Edit Project",onClick:c}]}]})))!=null?t:[]}});return(e,t)=>s(n)?(w(),k(N,{key:0,"entity-name":"project","ask-name-on-create":!0,loading:s(u),title:`${s(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:s(b),fields:r,onCreate:f},null,8,["loading","title","table"])):_("",!0)}});export{T as default};
//# sourceMappingURL=Projects.fa9943e1.js.map
