import{_ as T}from"./Df9CyFaT.js";import{J as x,X as D,M as A,Y as E,A as i,B as r,C as N,N as B,E as t,b as a,G as F,Q as y,a8 as U,S as c,T as _,F as h,U as C,a4 as I}from"#entry";import{u as S}from"./D96dsyvB.js";import{V as X,a as G}from"./DlybGOWB.js";import{V as J}from"./DArAxlee.js";import{V as L}from"./tRJ_cXK7.js";import{V as M}from"./BLr-DtQu.js";import"./DCT0cttX.js";import"./0VvUL2KS.js";import"./LWaCnj-p.js";import"./CIr4U5gS.js";import"./BML-0xFj.js";import"./CZqgYEd3.js";import"./D_qxKlPu.js";import"./DSnRMG2T.js";import"./C1aoz2cp.js";import"./xGkJbl6f.js";import"./BNBrPSlz.js";import"./Cp3W8Jzz.js";import"./DkUOO-4a.js";import"./bVMbXo56.js";import"./5A-VMRTY.js";const P={key:0},de=x({__name:"my_events",async setup(Q){let p,v;const{t:d}=D(),{data:f,refresh:k}=([p,v]=A(()=>B("/api/events/mine","$AlXDDttVAD")),p=await p,v(),p),{$confirm:$,$notify:V}=E(),w=S(),u=I(""),g=[{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 b(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(N,null,{default:r(()=>[a(X,null,{default:r(()=>[a(G,null,{default:r(()=>[F(y(n.$t("common.my_events")),1)]),_:1}),a(J,{class:"pa-1 pa-md-3"},{default:r(()=>[a(L,{modelValue:c(u),"onUpdate:modelValue":l[0]||(l[0]=e=>U(u)?u.value=e:null),label:n.$t("common.search")},null,8,["modelValue","label"]),c(f)?(t(),i(M,{key:0,items:c(f),"hide-default-footer":c(f)?.length<10,density:"compact",search:c(u),headers:g},{"item.start_datetime":r(({item:e})=>[e.recurrent?C("",!0):(t(),_("span",P,y(c(w).when(e)),1))]),"item.actions":r(({item:e})=>[e.recurrent?(t(),_(h,{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(),_(h,{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=>b(e,e.recurrent)},null,8,["icon","onClick"])]),_:1},8,["items","hide-default-footer","search"])):C("",!0)]),_:1})]),_:1})]),_:1})}}});export{de as default};
