Mis cambios locales
This commit is contained in:
commit
e80bfbcd77
|
@ -1,6 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Editor de Formación</title>
|
||||
|
@ -60,5 +61,83 @@
|
|||
</div>
|
||||
|
||||
<script src="js/piscina.js"></script>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Detalles de la Rutina</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
|
||||
<div class="container-fluid">
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="coach.html">Inicializar Rutina</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="equipoDisponibles.html">Equipos Disponibles</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#otroLink2">Catalogo de formaciones</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container mt-5 pt-4">
|
||||
<h2 id="routineName">Cargando nombre...</h2>
|
||||
<p><strong>Tipo:</strong> <span id="routineType">Cargando...</span></p>
|
||||
<p><strong>Modalidad:</strong> <span id="routineModalidad">Cargando...</span></p>
|
||||
<h4>Atletas:</h4>
|
||||
<ul id="atletasList">
|
||||
<li>Cargando lista de atletas...</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const routineId = urlParams.get('routineId');
|
||||
|
||||
if (routineId) {
|
||||
fetch(`/routines/${routineId}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('No se pudo cargar la rutina');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(routine => {
|
||||
document.getElementById('routineName').textContent = routine.nombreCompetencia;
|
||||
document.getElementById('routineType').textContent = routine.tipoCompetencia;
|
||||
document.getElementById('routineModalidad').textContent = routine.modalidad;
|
||||
|
||||
const atletasList = document.getElementById('atletasList');
|
||||
atletasList.innerHTML = '';
|
||||
|
||||
if (Array.isArray(routine.participantes) && routine.participantes.length > 0) {
|
||||
routine.participantes.forEach(p => {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = `${p.atletaId?.name || 'Atleta desconocido'} - ${p.rol}`;
|
||||
atletasList.appendChild(li);
|
||||
});
|
||||
} else {
|
||||
atletasList.innerHTML = '<li>No hay atletas asignados</li>';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
alert('Error al cargar la rutina.');
|
||||
});
|
||||
} else {
|
||||
alert('No se proporcionó ID de rutina.');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -71,6 +71,7 @@ router.post('/', async (req, res) => {
|
|||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
// Ruta para obtener una rutina específica por ID
|
||||
router.get('/:id', async (req, res) => {
|
||||
try {
|
||||
|
@ -82,3 +83,4 @@ router.get('/:id', async (req, res) => {
|
|||
res.status(500).json({ error: 'Error cargando rutina' });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue