import{d as g,ey as _,ex as P,H as w,u as s,b as k,c as I,eu as h}from"./registerWidgets.7c26f935.js";import{e as C,b as x}from"./icons.d315d375.js";import{a as z}from"./asyncComputed.cfc29dee.js";import{P as m}from"./project.0a4a4ba9.js";import"./gateway.e3086290.js";import{O as D}from"./organization.78d17aca.js";import"./index.bb66c593.js";import{_ as v}from"./CrudView.vue_vue_type_script_setup_true_lang.7813a1ae.js";import"./activeRecord.d07557d8.js";import"./pubsub.c3a63076.js";import"./passwordlessManager.5d139655.js";import"./storage.53222b6f.js";import"./index.315bc9f8.js";import"./index.01e54af7.js";import"./Title.9a021125.js";import"./Form.ac091445.js";import"./index.611607c8.js";import"./index.9a7a96c9.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]="0cca8048-3266-4256-b38f-c653a1f60b39",r._sentryDebugIdIdentifier="sentry-dbid-0cca8048-3266-4256-b38f-c653a1f60b39")}catch{}})();const Q=g({__name:"Projects",setup(r){const a=[{key:"name",label:"Project Name"}],i=_().params.organizationId,l=P(),{loading:p,result:n,refetch:u}=z(()=>Promise.all([m.list(i),D.get(i)]).then(([e,t])=>({projects:e,organization:t}))),c=({key:e})=>l.push({name:"project",params:{projectId:e}}),f=async e=>{const t=await m.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(j=>j.id===e))==null?void 0:o.delete()),u())},b=w(()=>{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)},{text:o.name,link:`/projects/${encodeURIComponent(o.id)}`},{text:"",actions:[{icon:C,label:"Edit Project",onClick:c},{icon:x,label:"Delete",onClick:y,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>s(n)?(k(),I(v,{key:0,"entity-name":"project",loading:s(p),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:b.value,fields:a,onCreate:f},null,8,["loading","title","table"])):h("",!0)}});export{Q as default};
//# sourceMappingURL=Projects.b7f83363.js.map
