71777537e1
Keep preview state in Modelos and reset the toggle on domain changes. Hide the form while collapsed so the current selections, run monitor and result dialog survive toggling. Keep the existing evaluation and PDF handlers. Use one wrapping button-row class with space-3 gaps and block margins. Inside table cells use the existing cell padding between rows. Apply the same class to the indicators export and keep the existing domain navigation bottom margin. Delete the training upload UI and hand-edit the client and OpenAPI. Preserve the generator format and update the Modelos component spec and Gobernanza page case to cover both toggle states.
136 lines
4.6 KiB
TypeScript
136 lines
4.6 KiB
TypeScript
import { Component, computed, inject, input, resource } from '@angular/core';
|
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
import type { Measure } from 'fhir/r4';
|
|
import { DOMAINS } from '../app';
|
|
import { Fhir, resources } from '../fhir';
|
|
import { ReportButton } from '../report-button';
|
|
import { TabDefiniciones } from './tab-definiciones';
|
|
import { TabIndicadores } from './tab-indicadores';
|
|
import { TabRiesgos } from './tab-riesgos';
|
|
import { TabSeguimiento } from './tab-seguimiento';
|
|
import { TabTrazabilidad } from './tab-trazabilidad';
|
|
import { Loading } from '../loading';
|
|
|
|
@Component({
|
|
selector: 'app-indicadores',
|
|
imports: [
|
|
Loading,
|
|
MatTabsModule,
|
|
ReportButton,
|
|
TabIndicadores,
|
|
TabTrazabilidad,
|
|
TabRiesgos,
|
|
TabSeguimiento,
|
|
TabDefiniciones,
|
|
],
|
|
template: `
|
|
<section class="page">
|
|
<h1>{{ title() }}</h1>
|
|
<p class="subtitle">Explora los indicadores de {{ title().toLowerCase() }}.</p>
|
|
<app-report-button class="button-row" />
|
|
@if (measures.isLoading()) {
|
|
<app-loading what="los indicadores" />
|
|
} @else if (measures.error()) {
|
|
<p class="muted" role="alert">No se pudieron leer los indicadores.</p>
|
|
} @else if (!measures.value()?.length) {
|
|
<p class="muted empty">Este dominio todavía no tiene indicadores publicados.</p>
|
|
} @else {
|
|
<mat-tab-group
|
|
mat-stretch-tabs="false"
|
|
mat-align-tabs="center"
|
|
animationDuration="0ms"
|
|
[selectedIndex]="seguimiento() ? 2 : 0"
|
|
>
|
|
<mat-tab [label]="domain() === 'tea' ? 'Resumen' : 'Indicadores'">
|
|
<app-tab-indicadores [domain]="domain()" [measures]="measures.value()!" />
|
|
</mat-tab>
|
|
<mat-tab label="Trazabilidad">
|
|
<ng-template matTabContent>
|
|
<app-tab-trazabilidad [domain]="domain()" [measures]="measures.value()!" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
@if (domain() === 'tea') {
|
|
<mat-tab label="Seguimiento">
|
|
<ng-template matTabContent>
|
|
<app-tab-seguimiento [domain]="domain()" [patientId]="seguimiento()" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
<mat-tab label="Análisis de riesgo">
|
|
<ng-template matTabContent>
|
|
<app-tab-riesgos [domain]="domain()" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
} @else if (domain() === 'cacu') {
|
|
<mat-tab label="Análisis de riesgos">
|
|
<ng-template matTabContent>
|
|
<app-tab-riesgos [domain]="domain()" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
} @else if (domain() === 'cama') {
|
|
<mat-tab label="Análisis de riesgos">
|
|
<ng-template matTabContent>
|
|
<app-tab-seguimiento [domain]="domain()" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
}
|
|
<mat-tab label="Datos y definiciones">
|
|
<ng-template matTabContent>
|
|
<app-tab-definiciones [domain]="domain()" [measures]="measures.value()!" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
</mat-tab-group>
|
|
}
|
|
</section>
|
|
`,
|
|
styles: `
|
|
:host {
|
|
display: block;
|
|
}
|
|
h1 {
|
|
font-size: 28px;
|
|
font-weight: 500;
|
|
margin: 16px 0 8px;
|
|
}
|
|
.subtitle {
|
|
font-size: 16px;
|
|
margin: 0 0 24px;
|
|
}
|
|
::ng-deep .mat-mdc-tab-header {
|
|
background: var(--color-surface);
|
|
border-top: 2px solid var(--color-primary);
|
|
}
|
|
::ng-deep .mat-mdc-tab .mdc-tab__text-label {
|
|
font-size: 16px;
|
|
font-weight: 400;
|
|
}
|
|
::ng-deep .mat-mdc-tab.mdc-tab--active .mdc-tab__text-label {
|
|
font-weight: 700;
|
|
}
|
|
.empty {
|
|
padding: 48px 0;
|
|
text-align: center;
|
|
}
|
|
::ng-deep .mdc-tab-indicator__content--underline {
|
|
border-color: var(--color-primary) !important;
|
|
}
|
|
`,
|
|
})
|
|
export class Indicadores {
|
|
private readonly fhir = inject(Fhir);
|
|
readonly domain = input.required<string>();
|
|
private readonly query = toSignal(inject(ActivatedRoute).queryParamMap);
|
|
protected readonly seguimiento = computed(() =>
|
|
this.domain() === 'tea' ? (this.query()?.get('seguimiento') ?? undefined) : undefined,
|
|
);
|
|
protected readonly title = computed(
|
|
() => DOMAINS[this.domain() as keyof typeof DOMAINS] ?? this.domain(),
|
|
);
|
|
protected readonly measures = resource({
|
|
params: () => this.domain(),
|
|
loader: async ({ params }) =>
|
|
resources<Measure>(await this.fhir.all(params, 'Measure'), 'Measure'),
|
|
});
|
|
}
|