import{_ as T}from"./CDrkqPfX.js";import{aa as x,cm as D,cR as A,ct as B,X as i,cS as r,p as E,ch as F,bB as t,a3 as a,a2 as N,c0 as h,aV as I,c7 as c,Z as _,F as y,Y as C,bO as R}from"#entry";import{u as S}from"./DsNA9-h5.js";import{V as U,b as X}from"./RTCSF0Ks.js";import{V as L}from"./R1_j74h_.js";import{V as O}from"./C2L9cD_h.js";import{V as P}from"./C70KhWJ4.js";import"./7nzMR1a0.js";import"./BPHK4Dzs.js";import"./CEoxYnb5.js";import"./Cp3UUybv.js";import"./BKDgfSxC.js";import"./CAodMEV_.js";import"./D_qxKlPu.js";import"./BgQ5eU58.js";import"./DmHQoNBb.js";import"./BbcaTmac.js";import"./SPpKX9fG.js";import"./CFrOycco.js";import"./BbYgWsNS.js";import"./QUYPESwd.js";import"./-GcL7px7.js";const Y={key:0},de=x({__name:"my_events",async setup(Z){let p,v;const{t:d}=D(),{data:f,refresh:k}=([p,v]=A(()=>F("/api/events/mine","$AlXDDttVAD")),p=await p,v(),p),{$confirm:$,$notify:V}=B(),w=S(),u=R(""),b=[{value:"title",title:d("common.title")},{value:"place.name",title:d("common.place")},{value:"start_datetime",title:d("common.when")},{value:"actions",title:d("common.actions"),align:"end",sortable:!1,width:250}];async function s(n){const l=n.id;try{await $fetch(`/api/events/${l}/toggle`,{method:"PUT"}),k()}catch(o){console.error(o)}}async function g(n,l){await $(`event.remove_${l?"recurrent_":""}confirmation`,{event:n.title})&&(await $fetch(`/api/events/${n.id}`,{method:"DELETE"}),k(),V("admin.event_remove_ok"))}return(n,l)=>{const o=T;return t(),i(E,null,{default:r(()=>[a(U,null,{default:r(()=>[a(X,null,{default:r(()=>[N(h(n.$t("common.my_events")),1)]),_:1}),a(L,{class:"pa-1 pa-md-3"},{default:r(()=>[a(O,{modelValue:c(u),"onUpdate:modelValue":l[0]||(l[0]=e=>I(u)?u.value=e:null),label:n.$t("common.search")},null,8,["modelValue","label"]),c(f)?(t(),i(P,{key:0,items:c(f),"hide-default-footer":c(f)?.length<10,density:"compact",search:c(u),headers:b},{"item.start_datetime":r(({item:e})=>[e.recurrent?C("",!0):(t(),_("span",Y,h(c(w).when(e)),1))]),"item.actions":r(({item:e})=>[e.recurrent?(t(),_(y,{key:1},[e.is_visible?(t(),i(o,{key:1,color:"info",tooltip:"common.pause",icon:"mdi-pause",onClick:m=>s(e)},null,8,["onClick"])):(t(),i(o,{key:0,color:"success",tooltip:"common.start",icon:"mdi-play",onClick:m=>s(e)},null,8,["onClick"]))],64)):(t(),_(y,{key:0},[e.is_visible?e.parentId?(t(),i(o,{key:2,color:"info",tooltip:"common.skip",icon:"mdi-debug-step-over",onClick:m=>s(e)},null,8,["onClick"])):(t(),i(o,{key:1,color:"info",tooltip:"common.hide",icon:"mdi-eye-off",onClick:m=>s(e)},null,8,["onClick"])):(t(),i(o,{key:0,color:"success",tooltip:"common.confirm",icon:"mdi-eye",onClick:m=>s(e)},null,8,["onClick"])),a(o,{to:`/event/${e.slug||e.id}`,tooltip:"common.preview",icon:"mdi-arrow-right"},null,8,["to"])],64)),a(o,{to:`/add/${e.id}`,color:"yellow",tooltip:"common.edit",icon:"mdi-pencil"},null,8,["to"]),a(o,{color:"error",tooltip:"common.delete",icon:e.recurrent?"mdi-delete-forever":"mdi-delete",onClick:m=>g(e,e.recurrent)},null,8,["icon","onClick"])]),_:1},8,["items","hide-default-footer","search"])):C("",!0)]),_:1})]),_:1})]),_:1})}}});export{de as default};
