import{_ as L,r as _,c as I,o as j,w as q,g as D,f as H,a as $,b as G,d as s,e as n,h as e,i as P,v as C,F as A,j as F,t as d,k as i,u as v,l as y,m as J,n as w,p as S,q as K,B as O,s as Q,x as V,P as W,y as X,z as Y}from"./index-CulqAYq4.js";const o=h=>(X("data-v-31cb3c01"),h=h(),Y(),h),Z={class:"filtros"},ee={class:"filtroInstitucion"},te=o(()=>e("p",null,"Institución: ",-1)),ae=o(()=>e("option",{value:"todas"},"Todas",-1)),se=["value"],ne={class:"filtrofechas"},oe={class:"contenedorFiltroFecha"},le={class:"filtroFecha"},ce=o(()=>e("p",null,"Ver por:",-1)),ie=o(()=>e("option",{value:"semana"},"Semana",-1)),ue=o(()=>e("option",{value:"mes"},"Mes",-1)),re=[ie,ue],de={class:"navegacionFecha"},_e={key:0,class:"tablaEventos"},ve=o(()=>e("th",null,"Título",-1)),he=o(()=>e("th",null,"Institución",-1)),me=o(()=>e("th",null,"Resumen",-1)),pe=o(()=>e("th",null,"Fecha y Hora",-1)),ge=o(()=>e("th",null,"Lugar",-1)),fe={key:0},ke={class:"columnaTitulo"},ye={class:"columnaInstitucion"},we={class:"columnaResumen"},Se={class:"columnaFecha"},be=o(()=>e("br",null,null,-1)),Me={class:"columnaLugar"},Ee={key:0},b=9,Ie={__name:"TablaEventos",setup(h){const m=_("todas"),c=_("semana"),p=_([]),M=localStorage.getItem("credencial"),g=_([]),k=_(1),a=_(new Date),x=I(()=>{const r=new Set(p.value.map(l=>l.institucion));return Array.from(r)});j(async()=>{await u(),f()}),q([c,a],()=>{u()});const E=I(()=>{const r=(k.value-1)*b,l=r+b;return g.value.slice(r,l)}),B=async()=>{await u(),f()},f=()=>{m.value==="todas"?g.value=p.value:g.value=p.value.filter(r=>r.institucion===m.value)},T=async()=>{a.value=new Date(a.value.setDate(a.value.getDate()-7)),await u()},N=async()=>{a.value=new Date(a.value.setDate(a.value.getDate()+7)),await u()},R=async()=>{a.value=new Date(a.value.setMonth(a.value.getMonth()-1)),await u()},U=async()=>{a.value=new Date(a.value.setMonth(a.value.getMonth()+1)),await u()},u=async()=>{switch(c.value){case"semana":await D(p,$(a.value));break;case"mes":await D(p,H(a.value));break;default:return}f()};return(r,l)=>{const z=G("router-link");return s(),n("div",null,[e("div",Z,[e("div",ee,[te,P(e("select",{"onUpdate:modelValue":l[0]||(l[0]=t=>m.value=t),onChange:f},[ae,(s(!0),n(A,null,F(x.value,t=>(s(),n("option",{key:t,value:t},d(t),9,se))),128))],544),[[C,m.value]])]),e("div",ne,[e("div",oe,[e("div",le,[ce,P(e("select",{"onUpdate:modelValue":l[1]||(l[1]=t=>c.value=t),onChange:B},re,544),[[C,c.value]])])]),e("div",de,[c.value==="semana"?(s(),n("button",{key:0,onClick:T},"Semana Anterior")):i("",!0),c.value==="semana"?(s(),n("button",{key:1,onClick:N},"Semana Siguiente")):i("",!0),c.value==="mes"?(s(),n("button",{key:2,onClick:R},"Mes Anterior")):i("",!0),c.value==="mes"?(s(),n("button",{key:3,onClick:U},"Mes Siguiente")):i("",!0)])])]),E.value.length>0?(s(),n("table",_e,[e("thead",null,[e("tr",null,[ve,he,me,pe,ge,v(M)?(s(),n("th",fe,"Acciones")):i("",!0)])]),e("tbody",null,[(s(!0),n(A,null,F(E.value,t=>(s(),n("tr",{key:t.ideventos},[e("td",ke,[y(z,{to:{name:"evento-individual",params:{id:t.ideventos}}},{default:J(()=>[w(d(v(S)(t.titulo,60)),1)]),_:2},1032,["to"])]),e("td",ye,d(v(S)(t.institucion,30)),1),e("td",we,d(v(S)(t.detalles,150)),1),e("td",Se,[w(d(v(K)(t)),1),be,w(d(t.hora.substring(0,5))+" hrs",1)]),e("td",Me,d(t.lugar),1),v(M)?(s(),n("td",Ee,[e("td",null,[y(O,{idEvento:t.ideventos},null,8,["idEvento"])]),e("td",null,[y(Q,{eventoId:t.ideventos},null,8,["eventoId"])])])):i("",!0)]))),128))])])):i("",!0),g.value.length>9?(s(),V(W,{key:1,totalElementos:g.value.length,elementosPorPagina:b,paginaActual:k.value,"onUpdate:paginaActual":l[2]||(l[2]=t=>k.value=t)},null,8,["totalElementos","paginaActual"])):i("",!0)])}}},De=L(Ie,[["__scopeId","data-v-31cb3c01"]]),Ce={__name:"EventosView",setup(h){return(m,c)=>(s(),V(De))}};export{Ce as default};
