68 lines
1.9 KiB
HTML
68 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Admin Panel</title>
|
|
<style>
|
|
body {
|
|
font-family: system-ui, sans-serif;
|
|
padding: 2rem;
|
|
max-width: 900px;
|
|
margin: 0 auto;
|
|
}
|
|
h1 {
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
.module {
|
|
border: 1px solid #ccc;
|
|
padding: 1rem;
|
|
border-radius: 10px;
|
|
margin-bottom: 1rem;
|
|
}
|
|
.badge {
|
|
display: inline-block;
|
|
padding: 0.2rem 0.6rem;
|
|
background: #e5e7eb;
|
|
border-radius: 9999px;
|
|
font-size: 0.8rem;
|
|
color: #111827;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Admin Panel</h1>
|
|
<p>Modular admin UI: cada módulo se registra automáticamente.</p>
|
|
<div id="modules"></div>
|
|
|
|
<script>
|
|
async function loadModules() {
|
|
const res = await fetch('/admin/modules');
|
|
const modules = await res.json();
|
|
const container = document.getElementById('modules');
|
|
container.innerHTML = '';
|
|
|
|
if (!modules.length) {
|
|
container.innerHTML = '<p>No hay módulos registrados aún.</p>';
|
|
return;
|
|
}
|
|
|
|
modules.forEach((mod) => {
|
|
const card = document.createElement('div');
|
|
card.className = 'module';
|
|
const title = document.createElement('h2');
|
|
title.textContent = mod.name;
|
|
const meta = document.createElement('p');
|
|
meta.innerHTML = `<span class="badge">${mod.key}</span> ${mod.description || ''}`;
|
|
const route = document.createElement('p');
|
|
route.textContent = mod.routePrefix ? `Route: ${mod.routePrefix}` : 'Sin ruta definida';
|
|
card.append(title, meta, route);
|
|
container.appendChild(card);
|
|
});
|
|
}
|
|
|
|
loadModules();
|
|
</script>
|
|
</body>
|
|
</html>
|