import{d as g,K as P,J as w,L as _,A as i,b as k,u as C,E as I}from"./registerWidgets.2f354556.js";import{e as h,f as x}from"./icons.1cdfa11b.js";import{a as z}from"./asyncComputed.7c1b85ba.js";import{P as d}from"./project.3182f929.js";import"./gateway.b2e13b61.js";import{O as D}from"./organization.00ab1f23.js";import"./index.a8dd38cc.js";import{C as v}from"./CrudView.f76acddd.js";import"./activeRecord.931023a0.js";import"./pubsub.cb65003c.js";import"./passwordlessManager.96ab3f5a.js";import"./DropdownMenu.f3f9574e.js";import"./Modal.55b06151.js";import"./LoadingIndicator.14779776.js";import"./lottie.61602e49.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]="6367f9a1-75b9-4939-af57-4e54c9a9d84d",a._sentryDebugIdIdentifier="sentry-dbid-6367f9a1-75b9-4939-af57-4e54c9a9d84d")}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.cd6479a1.js.map
