diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 2249119..feed61d 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -6,6 +6,12 @@ const loadIndicadores = () => import('./features/indicadores/indicadores-page'). export const routes: Routes = [ { path: '', component: Home, title: 'Análisis de información | ISSSTELEON' }, + { + path: 'indicadores/tea-estatus', + title: 'Casos por estatus | ISSSTELEON', + loadComponent: () => import('./features/indicadores/tea-status-page').then(m => m.TeaStatusPage), + data: { workspace: true, breadcrumb: 'Casos por estatus' }, + }, { path: 'conectar', title: 'Conectar datos | ISSSTELEON', diff --git a/src/app/features/indicadores/tea-status-page.spec.ts b/src/app/features/indicadores/tea-status-page.spec.ts new file mode 100644 index 0000000..74ac0c0 --- /dev/null +++ b/src/app/features/indicadores/tea-status-page.spec.ts @@ -0,0 +1,24 @@ +import { provideHttpClient } from '@angular/common/http'; +import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; +import { TeaStatusPage } from './tea-status-page'; + +describe('TeaStatusPage', () => { + it('shows the stages in a FHIR report and reports a failed query', () => { + TestBed.configureTestingModule({ providers: [provideHttpClient(), provideHttpClientTesting()] }); + const component = TestBed.createComponent(TeaStatusPage).componentInstance; + const http = TestBed.inject(HttpTestingController); + component.consultar(); + const request = http.expectOne('/tea/fhir/Measure/M28_casos_por_estado/$evaluate-measure?periodo=2025-S1'); + request.flush({ group: [{ population: [{ count: 6 }], stratifier: [{ stratum: [ + { value: { coding: [{ code: 'SOLO_MCHAT' }] }, population: [{ count: 2 }] }, + ] }] }] }); + expect(component.total()).toBe(6); + expect(component.filas()).toEqual([{ codigo: 'SOLO_MCHAT', nombre: 'M-CHAT', cantidad: 2 }]); + component.consultar(); + http.expectOne('/tea/fhir/Measure/M28_casos_por_estado/$evaluate-measure?periodo=2025-S1') + .flush({}, { status: 404, statusText: 'Not Found' }); + expect(component.estado()).toBe('error'); + http.verify(); + }); +}); diff --git a/src/app/features/indicadores/tea-status-page.ts b/src/app/features/indicadores/tea-status-page.ts new file mode 100644 index 0000000..99b7b31 --- /dev/null +++ b/src/app/features/indicadores/tea-status-page.ts @@ -0,0 +1,53 @@ +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Component, inject, signal } from '@angular/core'; +import { FormsModule } from '@angular/forms'; + +interface Population { count?: number } +interface Stratum { value?: { coding?: { code?: string; display?: string }[] }; population?: Population[] } +interface Report { group?: { population?: Population[]; stratifier?: { stratum?: Stratum[] }[] }[] } + +@Component({ + selector: 'app-tea-status-page', + imports: [FormsModule], + template: ` +
Consulte la etapa alcanzada por las niñas y los niños en el periodo seleccionado.
+ + @if (estado() === 'cargando') {Consultando información…
} + @if (estado() === 'error') {No fue posible consultar el periodo. Verifique el periodo e intente de nuevo.
} + @if (estado() === 'listo') { +Total: {{ total() }}
+ @if (filas().length === 0) {No hay casos para este periodo.
} + @else {