Update chat_window.php

This commit is contained in:
lizandrogd
2026-01-21 15:59:44 -05:00
parent d0e23742cb
commit 1c578b14b0
+15 -4
View File
@@ -1030,10 +1030,9 @@ if (empty($user_id)) {
} }
}); });
// Mostrar contenedor solo si hay respuestas // No mostrar automáticamente el contenedor al cargar la conversación.
if (container.children.length) { // Dejamos que el usuario lo abra con el botón toggle. Si no hay respuestas, mantener oculto.
wrapper.style.display = 'block'; if (!container.children.length) {
} else {
wrapper.style.display = 'none'; wrapper.style.display = 'none';
} }
} else { } else {
@@ -1046,8 +1045,20 @@ if (empty($user_id)) {
function toggleQuickReplies() { function toggleQuickReplies() {
const wrapper = document.getElementById('quickRepliesContainer'); const wrapper = document.getElementById('quickRepliesContainer');
const container = document.getElementById('quickRepliesButtons');
if (!wrapper) return; if (!wrapper) return;
// Si no hay botones cargados, intentar cargarlos y luego mostrar
if (container && container.children.length === 0) {
loadQuickReplies().then(() => {
wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block'; wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block';
}).catch(() => {
// on error, mantener oculto
wrapper.style.display = 'none';
});
} else {
wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block';
}
} }
function showError(message) { function showError(message) {