Files
whatsapp/test_ses_fix.html
T
2026-01-12 11:06:43 -05:00

113 lines
5.0 KiB
HTML

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test SES Fix - WhatsApp Bot</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
<div class="container py-5">
<div class="row">
<div class="col-md-8 mx-auto">
<div class="card">
<div class="card-header bg-success text-white">
<h5><i class="fas fa-check-circle"></i> Test SES Fix</h5>
</div>
<div class="card-body">
<p>Esta página prueba que las funciones globales funcionen sin errores de SES.</p>
<div class="row">
<div class="col-md-6">
<h6>Funciones disponibles:</h6>
<button class="btn btn-primary d-block mb-2" onclick="testFunction('showCreateTemplateModal')">
<i class="fas fa-file-text"></i> Test showCreateTemplateModal
</button>
<button class="btn btn-success d-block mb-2" onclick="testFunction('showCreateMenuModal')">
<i class="fas fa-list"></i> Test showCreateMenuModal
</button>
<button class="btn btn-info d-block mb-2" onclick="clearLog()">
<i class="fas fa-eraser"></i> Limpiar Log
</button>
</div>
<div class="col-md-6">
<h6>Status Log:</h6>
<div id="status-log" class="bg-light border p-3 rounded" style="height: 200px; overflow-y: auto; font-family: monospace; font-size: 0.8rem;">
<div style="color: green;">✅ Página cargada sin errores de SES</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
const logDiv = document.getElementById('status-log');
function addLog(message, type = 'info') {
const timestamp = new Date().toLocaleTimeString();
const colors = {
info: '#17a2b8',
success: '#28a745',
error: '#dc3545',
warning: '#ffc107'
};
logDiv.innerHTML += `<div style="color: ${colors[type]};">[${timestamp}] ${message}</div>`;
logDiv.scrollTop = logDiv.scrollHeight;
}
function clearLog() {
logDiv.innerHTML = '<div style="color: green;">✅ Log limpiado</div>';
}
// Definir funciones de prueba localmente
window.showCreateTemplateModal = function() {
addLog('✅ showCreateTemplateModal llamada exitosamente', 'success');
alert('Modal de plantilla funcionando correctamente');
};
window.showCreateMenuModal = function() {
addLog('✅ showCreateMenuModal llamada exitosamente', 'success');
alert('Modal de menú funcionando correctamente');
};
function testFunction(functionName) {
addLog(`🧪 Probando función: ${functionName}`, 'info');
if (typeof window[functionName] === 'function') {
try {
window[functionName]();
addLog(`✅ Función ${functionName} ejecutada sin errores`, 'success');
} catch (error) {
addLog(`❌ Error ejecutando ${functionName}: ${error.message}`, 'error');
}
} else {
addLog(`❌ Función ${functionName} no encontrada`, 'error');
}
}
document.addEventListener('DOMContentLoaded', function() {
addLog('📄 DOM cargado', 'info');
// Verificar disponibilidad de funciones
addLog('🔍 Verificando funciones globales...', 'info');
const functions = ['showCreateTemplateModal', 'showCreateMenuModal'];
functions.forEach(func => {
if (typeof window[func] === 'function') {
addLog(`✅ ${func} disponible`, 'success');
} else {
addLog(`❌ ${func} no disponible`, 'error');
}
});
});
</script>
</body>
</html>