invoice-processing-google-d.../templates/dashboard.html
2025-08-26 12:26:03 +02:00

65 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard - ACME Invoice Processor</title>
<!-- ======================= INICIO DEL GUARDIA DE SEGURIDAD ======================= -->
<script>
const token = localStorage.getItem('accessToken');
if (!token) {
// Si NO hay token, no cargues esta página. ¡Redirige al login!
window.location.href = '/';
}
</script>
<!-- ======================== FIN DEL GUARDIA DE SEGURIDAD ========================= -->
<style>
/* ... (tus estilos CSS no cambian) ... */
body { font-family: sans-serif; margin: 0; background-color: #f4f4f9; }
.navbar { background-color: #333; overflow: hidden; }
.navbar a { float: left; display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; }
.navbar .logout { float: right; cursor: pointer; }
.container { max-width: 800px; margin: 2rem auto; padding: 2rem; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
h1 { color: #333; }
.upload-form { margin-top: 2rem; border: 2px dashed #ccc; padding: 2rem; border-radius: 8px; text-align: center; }
.upload-form input[type="file"] { border: none; }
.results { margin-top: 2rem; background-color: #e9ecef; padding: 1rem; border-radius: 8px; display: none; }
.results pre { white-space: pre-wrap; word-wrap: break-word; }
.message { text-align: center; padding: 1rem; margin-top: 1rem; border-radius: 4px; display: none; }
.error { background-color: #f8d7da; color: #721c24; }
</style>
</head>
<body>
<!-- El resto del HTML no cambia -->
<div class="navbar">
<a href="/dashboard">Dashboard</a>
<a id="logout-button" class="logout">Cerrar Sesión</a>
</div>
<div class="container">
<h1>Sube una Factura para Procesar</h1>
<form id="upload-form" class="upload-form">
<input type="file" id="invoice-file" name="invoice" required>
<button type="submit">Procesar Factura</button>
</form>
<div id="message-container" class="message"></div>
<div id="results-container" class="results">
<h2>Resultados de la Extracción:</h2>
<pre id="results-data"></pre>
</div>
</div>
<script>
// --- El resto del script no cambia ---
document.getElementById('logout-button').addEventListener('click', () => {
localStorage.removeItem('accessToken');
window.location.href = '/';
});
const uploadForm = document.getElementById('upload-form');
// ... (el resto del script de subida) ...
</script>
</body>
</html>