From b8391e1f89f3508e1164a1a31ed6fca2c7ed965c Mon Sep 17 00:00:00 2001 From: marsalva Date: Sat, 21 Feb 2026 17:44:03 +0000 Subject: [PATCH] Actualizar calendario.html --- calendario.html | 64 ++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/calendario.html b/calendario.html index 3fe8162..7ce09f3 100644 --- a/calendario.html +++ b/calendario.html @@ -8,13 +8,14 @@ + @@ -240,11 +242,13 @@ const timeIso = r.scheduled_time ? r.scheduled_time + ':00' : '09:00:00'; const startStr = `${dateIso}T${timeIso}`; - // Calcular la fecha/hora de fin sumando los minutos (si existen, por defecto 60 min) + // Calcular la fecha/hora de fin sumando los minutos const startObj = new Date(startStr); const duration = parseInt(r.duration_minutes || 60); const endObj = new Date(startObj.getTime() + duration * 60000); - const endStr = endObj.toISOString().slice(0, 19); // YYYY-MM-DDTHH:mm:ss + + // Ajuste de offset horario local para la ISO String final + const endStr = new Date(endObj.getTime() - (endObj.getTimezoneOffset() * 60000)).toISOString().slice(0, 19); // Color según estado (o si es bloqueo) const status = isBlock ? 'SYSTEM_BLOCK' : (r.status_operativo || 'citado'); @@ -275,14 +279,15 @@ calendarInstance = new FullCalendar.Calendar(calendarEl, { initialView: 'timeGridWeek', - locale: 'es', + locale: 'es', // FORZAMOS IDIOMA ESPAÑOL PARA LA VENTANITA firstDay: 1, slotMinTime: '08:00:00', slotMaxTime: '22:00:00', expandRows: true, allDaySlot: false, nowIndicator: true, - dayMaxEvents: true, + dayMaxEvents: 3, // Cuántas caben antes de mostrar "X más" + moreLinkText: "más", // TRADUCCIÓN MANUAL POR SI ACASO buttonText: { today: 'Hoy', month: 'Mes', @@ -297,22 +302,29 @@ }, events: calendarEvents, + // INYECCIÓN DE HTML Y COLOR DENTRO DEL EVENTO eventContent: function(arg) { - const timeText = arg.timeText; + // Extraemos la hora para la tarjeta + let timeText = arg.timeText; + if (!timeText && arg.event.start) { + timeText = arg.event.start.toLocaleTimeString('es-ES', {hour: '2-digit', minute:'2-digit'}); + } + const title = arg.event.title; const op = arg.event.extendedProps.operatorName; const isBlock = arg.event.extendedProps.isBlock; + const bgColor = arg.event.backgroundColor; // Recuperamos el color oficial return { html: ` -
-
- ${timeText} +
+
+ ${timeText}

${op}

-

${title}

+

${title}

` }; }, @@ -334,13 +346,11 @@ const filteredEvents = calendarEvents.filter(ev => { const props = ev.extendedProps; - // Si es un bloqueo, lo mostramos siempre si cumple el filtro de operario, - // e ignoramos el texto/compañía para que el admin siempre vea los bloqueos de esa persona. + // Los bloqueos se muestran siempre si cumplen el filtro de operario if (props.isBlock) { return (opFilter === 'ALL' || props.operatorName === opFilter); } - // Filtrado normal const matchText = ev.title.toUpperCase().includes(textFilter) || props.originalData.service_ref.toUpperCase().includes(textFilter); const matchOp = opFilter === 'ALL' || props.operatorName === opFilter; const matchComp = compFilter === 'ALL' || props.companyName === compFilter;