81 lines
3.5 KiB
HTML
81 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Panel - IntegraRepara</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script src="https://unpkg.com/lucide@latest"></script>
|
|
<style>.fade-in { animation: fadeIn 0.5s ease-in-out; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }</style>
|
|
</head>
|
|
<body class="bg-gray-50 text-gray-800 font-sans antialiased">
|
|
|
|
<div class="flex h-screen overflow-hidden">
|
|
|
|
<div id="sidebar-container" class="h-full"></div>
|
|
|
|
<div class="flex-1 flex flex-col overflow-hidden relative">
|
|
|
|
<div id="header-container"></div>
|
|
|
|
<main class="flex-1 overflow-x-hidden overflow-y-auto bg-gray-50 p-8 fade-in">
|
|
|
|
<div class="flex justify-between items-center mb-8">
|
|
<h2 class="text-2xl font-bold text-gray-800">Dashboard</h2>
|
|
<button onclick="alert('Próximamente')" class="bg-blue-600 hover:bg-blue-700 text-white px-5 py-2 rounded-lg shadow-lg flex items-center gap-2">
|
|
<i data-lucide="plus-circle" class="w-5 h-5"></i> Nuevo
|
|
</button>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
|
|
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
|
<p class="text-xs font-semibold text-gray-500 uppercase">Servicios Activos</p>
|
|
<h3 class="text-2xl font-bold text-gray-800 mt-1" id="countServices">...</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
|
|
<h3 class="font-bold text-gray-800 mb-4">Servicios Recientes</h3>
|
|
<div id="servicesTableBody">Cargando...</div>
|
|
</div>
|
|
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="js/layout.js"></script>
|
|
|
|
<script>
|
|
// Esperamos a que cargue el layout y luego cargamos los datos
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
const token = localStorage.getItem("token");
|
|
if(token) loadServices(token);
|
|
});
|
|
|
|
async function loadServices(token) {
|
|
try {
|
|
const res = await fetch(`${API_URL}/services`, {
|
|
headers: { "Authorization": `Bearer ${token}` }
|
|
});
|
|
const data = await res.json();
|
|
if (data.ok) {
|
|
document.getElementById("countServices").innerText = data.services.length;
|
|
renderTable(data.services);
|
|
}
|
|
} catch (e) { console.error(e); }
|
|
}
|
|
|
|
function renderTable(services) {
|
|
const container = document.getElementById("servicesTableBody");
|
|
if(services.length === 0) { container.innerHTML = "No hay servicios."; return; }
|
|
|
|
let html = '<table class="w-full text-left"><thead><tr class="text-gray-500 text-sm"><th>Cliente</th><th>Servicio</th><th>Estado</th></tr></thead><tbody>';
|
|
services.forEach(s => {
|
|
html += `<tr class="border-t"><td class="p-3">${s.client_name}</td><td>${s.title}</td><td><span class="bg-yellow-100 px-2 rounded text-xs">En Proceso</span></td></tr>`;
|
|
});
|
|
html += '</tbody></table>';
|
|
container.innerHTML = html;
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |