| ... | ... | @@ -135,25 +135,14 @@ Archivo `gestion/activaciones.ts`: |
|
|
|
|
|
|
|
```ts
|
|
|
|
// gestion/activaciones.ts
|
|
|
|
import activaciones from '../data/activaciones.json';
|
|
|
|
import { Activacion } from '../models/Activacion';
|
|
|
|
|
|
|
|
async function cargarActivaciones(): Promise<void> {
|
|
|
|
try {
|
|
|
|
const respuesta = await fetch('../data/activaciones.json');
|
|
|
|
|
|
|
|
if (!respuesta.ok) {
|
|
|
|
throw new Error(`Error al cargar los datos: ${respuesta.status}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
const activaciones: Activacion[] = await respuesta.json();
|
|
|
|
|
|
|
|
function cargarActivaciones(): void {
|
|
|
|
console.log('Activaciones registradas:');
|
|
|
|
activaciones.forEach((a: Activacion) => {
|
|
|
|
(activaciones as Activacion[]).forEach((a) => {
|
|
|
|
console.log(`- Activación #${a.id}: recurso ${a.recursoId} (${a.tipoSituacion}, ${a.tipoJornada})`);
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
console.error('No se pudieron cargar las activaciones', error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cargarActivaciones();
|
| ... | ... | @@ -179,10 +168,10 @@ export function formatearSituacion(situacion: string): string { |
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Archivo `reportes/actividadRecursos.ts`:
|
|
|
|
Archivo `informes/actividadRecursos.ts`:
|
|
|
|
|
|
|
|
```ts
|
|
|
|
// reportes/actividadRecursos.ts
|
|
|
|
// informes/actividadRecursos.ts
|
|
|
|
import { calcularPorcentajeActividad, formatearSituacion } from '../utils/calculos';
|
|
|
|
|
|
|
|
const totalRecursos: number = 20;
|
| ... | ... | |