Añade página pública para que el cliente descargue su estudio de comparativa de luz
This commit is contained in:
79
estudio-luz.html
Normal file
79
estudio-luz.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>Tu estudio de ahorro en la factura de luz - Marsalva</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
<style>
|
||||
:root { --primary: #2563eb; --app-bg: #f4f7f9; }
|
||||
body { background: var(--app-bg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
|
||||
.fade-in { animation: fadeIn .3s ease-out; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="min-h-screen flex flex-col items-center justify-center p-5">
|
||||
|
||||
<div class="w-full max-w-sm fade-in">
|
||||
|
||||
<div id="estado-cargando" class="bg-white rounded-[2rem] p-8 shadow-sm border border-slate-100 text-center">
|
||||
<div class="w-10 h-10 border-4 border-slate-200 border-t-blue-600 rounded-full animate-spin mx-auto"></div>
|
||||
<p class="text-sm font-bold text-slate-400 mt-4">Preparando tu estudio...</p>
|
||||
</div>
|
||||
|
||||
<div id="estado-error" class="hidden bg-white rounded-[2rem] p-8 shadow-sm border border-slate-100 text-center">
|
||||
<div class="w-14 h-14 bg-rose-50 rounded-full flex items-center justify-center mx-auto">
|
||||
<i data-lucide="file-x" class="w-7 h-7 text-rose-500"></i>
|
||||
</div>
|
||||
<p class="text-base font-black text-slate-800 mt-4">No encontramos este estudio</p>
|
||||
<p class="text-xs text-slate-400 font-medium mt-2">El enlace puede haber caducado o no ser correcto. Si crees que es un error, contacta con nosotros.</p>
|
||||
</div>
|
||||
|
||||
<div id="estado-listo" class="hidden">
|
||||
<div class="bg-white rounded-[2rem] p-6 shadow-sm border border-slate-100 text-center">
|
||||
<div class="w-14 h-14 bg-blue-50 rounded-full flex items-center justify-center mx-auto">
|
||||
<i data-lucide="file-check-2" class="w-7 h-7 text-blue-600"></i>
|
||||
</div>
|
||||
<p class="text-lg font-black text-slate-900 mt-4">Tu estudio de la factura de luz ya está listo</p>
|
||||
<p class="text-xs text-slate-400 font-medium mt-2">Comparativa detallada de tu factura actual frente a las mejores tarifas disponibles.</p>
|
||||
|
||||
<a id="btn-descargar" href="#" target="_blank" rel="noopener" class="mt-6 w-full bg-blue-600 text-white text-sm font-bold py-3.5 rounded-2xl active:scale-95 transition-transform flex items-center justify-center gap-2">
|
||||
<i data-lucide="download" class="w-4 h-4"></i> Ver y descargar mi PDF
|
||||
</a>
|
||||
|
||||
<p class="text-[10px] text-slate-300 font-semibold mt-4">Puedes volver a este enlace cuando quieras para consultarlo de nuevo.</p>
|
||||
</div>
|
||||
|
||||
<p class="text-center text-[11px] text-slate-400 font-semibold mt-5">Marsalva · Servicios de reparación y mantenimiento del hogar</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const API_URL = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
||||
? 'http://localhost:3000'
|
||||
: 'https://integrarepara-api.integrarepara.es';
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const token = params.get('token');
|
||||
|
||||
function mostrar(id) {
|
||||
['estado-cargando', 'estado-error', 'estado-listo'].forEach(x => {
|
||||
document.getElementById(x).classList.toggle('hidden', x !== id);
|
||||
});
|
||||
}
|
||||
|
||||
if (!token) {
|
||||
mostrar('estado-error');
|
||||
} else {
|
||||
const pdfUrl = `${API_URL}/public/energy-quote/${encodeURIComponent(token)}/pdf`;
|
||||
document.getElementById('btn-descargar').href = pdfUrl;
|
||||
mostrar('estado-listo');
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => { lucide.createIcons(); });
|
||||
lucide.createIcons();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user