Actualizar calendario.html

This commit is contained in:
2026-03-07 18:12:58 +00:00
parent 825f5067c1
commit 9066ee5a3e

View File

@@ -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'); const chatBox = document.getElementById('chatBox');
chatBox.innerHTML = '<div class="text-center text-xs font-bold text-slate-400 mt-10 uppercase tracking-widest"><i data-lucide="loader-2" class="w-4 h-4 animate-spin mx-auto mb-2"></i> Cargando...</div>'; chatBox.innerHTML = '<div class="text-center text-xs font-bold text-slate-400 mt-10 uppercase tracking-widest"><i data-lucide="loader-2" class="w-4 h-4 animate-spin mx-auto mb-2"></i> Cargando...</div>';
safeLoadIcons(); safeLoadIcons();