funcional
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Página principal del sistema WhatsApp Bot
|
||||
* Fecha: 13 de noviembre de 2025
|
||||
@@ -29,6 +30,7 @@ try {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -38,6 +40,7 @@ try {
|
||||
<link href="./assets/css/styles.css" rel="stylesheet">
|
||||
<link href="./assets/css/diagnostic.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Sidebar -->
|
||||
<nav class="sidebar">
|
||||
@@ -66,7 +69,7 @@ try {
|
||||
<div>
|
||||
<h1><i class="fas fa-robot"></i> Sistema de Gestión WhatsApp Bot</h1>
|
||||
<small class="text-muted">
|
||||
<i class="fas fa-user"></i> Conectado como <strong><?= htmlspecialchars(ADMIN_USERNAME) ?></strong>
|
||||
<i class="fas fa-user"></i> Conectado como <strong><?= htmlspecialchars(ADMIN_USERNAME) ?></strong>
|
||||
| <i class="fas fa-clock"></i> Sesión desde: <?= date('H:i:s', $_SESSION['login_time'] ?? time()) ?>
|
||||
</small>
|
||||
</div>
|
||||
@@ -101,7 +104,7 @@ try {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xl-3 col-md-6 mb-4">
|
||||
<div class="card card-stat bg-success text-white">
|
||||
<div class="card-body">
|
||||
@@ -117,7 +120,7 @@ try {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xl-3 col-md-6 mb-4">
|
||||
<div class="card card-stat bg-info text-white">
|
||||
<div class="card-body">
|
||||
@@ -133,7 +136,7 @@ try {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xl-3 col-md-6 mb-4">
|
||||
<div class="card card-stat bg-warning text-white">
|
||||
<div class="card-body">
|
||||
@@ -470,8 +473,12 @@ try {
|
||||
<label class="form-label">Webhook Verify Token</label>
|
||||
<input type="text" class="form-control" id="webhook-token" placeholder="Token de verificación del webhook">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">API URL</label>
|
||||
<input type="text" class="form-control" id="api-url" placeholder="URL de la API" value="https://graph.facebook.com/v22.0/">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mb-4">
|
||||
<h6 class="text-muted">Configuración General</h6>
|
||||
<div class="mb-3">
|
||||
@@ -483,7 +490,7 @@ try {
|
||||
<textarea class="form-control" id="welcome-message" rows="3" placeholder="Mensaje que se envía a usuarios nuevos"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-save"></i> Guardar Configuración
|
||||
</button>
|
||||
@@ -514,7 +521,7 @@ try {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Información del Sistema -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
@@ -524,13 +531,13 @@ try {
|
||||
<dl class="row">
|
||||
<dt class="col-sm-6">Versión:</dt>
|
||||
<dd class="col-sm-6">1.0.0</dd>
|
||||
|
||||
|
||||
<dt class="col-sm-6">PHP:</dt>
|
||||
<dd class="col-sm-6"><?php echo PHP_VERSION; ?></dd>
|
||||
|
||||
|
||||
<dt class="col-sm-6">Base de Datos:</dt>
|
||||
<dd class="col-sm-6"><?php echo $dbStatus; ?></dd>
|
||||
|
||||
|
||||
<dt class="col-sm-6">Webhook URL:</dt>
|
||||
<dd class="col-sm-6">
|
||||
<code><?php echo APP_URL; ?>/api/webhook.php</code>
|
||||
@@ -615,7 +622,7 @@ try {
|
||||
</select>
|
||||
</div>
|
||||
<div class="alert alert-info">
|
||||
<strong>⚠️ Importante:</strong> La plantilla debe ser creada y aprobada primero en WhatsApp Business Manager.
|
||||
<strong>⚠️ Importante:</strong> La plantilla debe ser creada y aprobada primero en WhatsApp Business Manager.
|
||||
Este formulario solo registra plantillas ya existentes en WhatsApp.
|
||||
</div>
|
||||
</form>
|
||||
@@ -669,13 +676,13 @@ try {
|
||||
const resultsDiv = document.getElementById('diagnostic-results');
|
||||
const actionsDiv = document.getElementById('diagnostic-actions');
|
||||
resultsDiv.innerHTML = '<p class="text-muted"><i class="fas fa-spinner fa-spin"></i> Ejecutando diagnóstico...</p>';
|
||||
|
||||
|
||||
fetch('/api/diagnose_whatsapp.php')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
let html = '<div class="diagnostic-report">';
|
||||
|
||||
|
||||
// Configuración
|
||||
html += `<div class="mb-3">
|
||||
<h6><i class="fas fa-cog"></i> Configuración WhatsApp</h6>
|
||||
@@ -683,7 +690,7 @@ try {
|
||||
${data.config.message} (${data.config.completion}% completa)
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
// Plantillas
|
||||
const templateIssues = data.templates.approved === 0 && data.templates.pending > 0;
|
||||
html += `<div class="mb-3">
|
||||
@@ -693,7 +700,7 @@ try {
|
||||
<br><small>Aprobadas: ${data.templates.approved} | Pendientes: ${data.templates.pending}</small>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
// API
|
||||
html += `<div class="mb-3">
|
||||
<h6><i class="fas fa-plug"></i> Conectividad API</h6>
|
||||
@@ -701,30 +708,30 @@ try {
|
||||
${data.api.message}
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
// Recomendaciones
|
||||
if (data.recommendations && data.recommendations.length > 0) {
|
||||
html += `<div class="mb-3">
|
||||
<h6><i class="fas fa-lightbulb"></i> Recomendaciones</h6>
|
||||
<ul class="list-unstyled">`;
|
||||
|
||||
|
||||
data.recommendations.forEach(rec => {
|
||||
html += `<li class="mb-1"><i class="fas fa-arrow-right text-primary"></i> ${rec}</li>`;
|
||||
});
|
||||
|
||||
|
||||
html += `</ul></div>`;
|
||||
}
|
||||
|
||||
|
||||
html += '</div>';
|
||||
resultsDiv.innerHTML = html;
|
||||
|
||||
|
||||
// Mostrar botones de acción si hay problemas con plantillas
|
||||
if (templateIssues) {
|
||||
actionsDiv.style.display = 'block';
|
||||
} else {
|
||||
actionsDiv.style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
resultsDiv.innerHTML = `<div class="alert alert-danger">Error: ${data.message}</div>`;
|
||||
actionsDiv.style.display = 'none';
|
||||
@@ -738,4 +745,5 @@ try {
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user