From 9066ee5a3efbe6e766551fbaed4115caf1e6e0c3 Mon Sep 17 00:00:00 2001 From: marsalva Date: Sat, 7 Mar 2026 18:12:58 +0000 Subject: [PATCH] Actualizar calendario.html --- calendario.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/calendario.html b/calendario.html index a05ef41..1931af3 100644 --- a/calendario.html +++ b/calendario.html @@ -892,7 +892,23 @@ } } - async function loadChat(serviceId) { + async function loadChat(serviceId) { + // 🔔 MARCAR COMO LEÍDO AL ABRIR EL CHAT + try { + fetch(`${API_URL}/services/${serviceId}/chat/read`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${localStorage.getItem("token")}` + } + }).then(() => { + // Refrescar el globo de notificaciones inmediatamente para que desaparezca + if (typeof checkNotifications === "function") checkNotifications(); + }); + } catch (e) { + console.error("Error al marcar lectura:", e); + } + const chatBox = document.getElementById('chatBox'); chatBox.innerHTML = '
Cargando...
'; safeLoadIcons();