Update chat_window.php
This commit is contained in:
+16
-5
@@ -1030,10 +1030,9 @@ if (empty($user_id)) {
|
||||
}
|
||||
});
|
||||
|
||||
// Mostrar contenedor solo si hay respuestas
|
||||
if (container.children.length) {
|
||||
wrapper.style.display = 'block';
|
||||
} else {
|
||||
// No mostrar automáticamente el contenedor al cargar la conversación.
|
||||
// Dejamos que el usuario lo abra con el botón toggle. Si no hay respuestas, mantener oculto.
|
||||
if (!container.children.length) {
|
||||
wrapper.style.display = 'none';
|
||||
}
|
||||
} else {
|
||||
@@ -1046,8 +1045,20 @@ if (empty($user_id)) {
|
||||
|
||||
function toggleQuickReplies() {
|
||||
const wrapper = document.getElementById('quickRepliesContainer');
|
||||
const container = document.getElementById('quickRepliesButtons');
|
||||
if (!wrapper) return;
|
||||
wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block';
|
||||
|
||||
// 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';
|
||||
}).catch(() => {
|
||||
// on error, mantener oculto
|
||||
wrapper.style.display = 'none';
|
||||
});
|
||||
} else {
|
||||
wrapper.style.display = (wrapper.style.display === 'block') ? 'none' : 'block';
|
||||
}
|
||||
}
|
||||
|
||||
function showError(message) {
|
||||
|
||||
Reference in New Issue
Block a user