ISSSTELEON WebApp
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
import { Component, computed, inject, input, resource } from '@angular/core';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import type { Measure } from 'fhir/r4';
|
||||
import { DOMAINS } from '../app';
|
||||
import { Fhir, resources } from '../fhir';
|
||||
import { TabDefiniciones } from './tab-definiciones';
|
||||
import { TabIndicadores } from './tab-indicadores';
|
||||
import { TabRiesgos } from './tab-riesgos';
|
||||
import { TabRiesgosTea } from './tab-riesgos-tea';
|
||||
import { TabSeguimiento } from './tab-seguimiento';
|
||||
import { TabTrazabilidad } from './tab-trazabilidad';
|
||||
import { Loading } from '../loading';
|
||||
@Component({
|
||||
selector: 'app-indicadores',
|
||||
imports: [
|
||||
Loading,
|
||||
MatTabsModule,
|
||||
TabIndicadores,
|
||||
TabTrazabilidad,
|
||||
TabRiesgos,
|
||||
TabRiesgosTea,
|
||||
TabSeguimiento,
|
||||
TabDefiniciones,
|
||||
],
|
||||
template: `
|
||||
<section class="page">
|
||||
<h1>{{ title() }}</h1>
|
||||
<p class="subtitle">Explora los indicadores de {{ title().toLowerCase() }}.</p>
|
||||
@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">
|
||||
<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() === 'cacu') {
|
||||
<mat-tab label="Análisis de riesgos">
|
||||
<ng-template matTabContent>
|
||||
<app-tab-riesgos [domain]="domain()" />
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
} @else if (domain() === 'tea') {
|
||||
<mat-tab label="Análisis de Riesgo">
|
||||
<ng-template matTabContent>
|
||||
<app-tab-riesgos-tea [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;
|
||||
}
|
||||
/* As the old page: the domain's name and a line under it, then a white tab bar under
|
||||
an olive rule. */
|
||||
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>();
|
||||
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'),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user