6df008bf8a
Paciente renders the TEA record and, on the risk route, the risk page with the same frame as CaCu and CaMa: back link, title with id, identity block from the FHIR Patient (name, birth date, sex, one row per identifier system), sections as one card component, Material controls for the altered-zones toggle and the pair choice, export button in rebuild's style. tea-patient.ts, tea-record.html, tea-risk.html and tea-section.html/scss are deleted; the logic specs follow the new structure.
90 lines
2.4 KiB
TypeScript
90 lines
2.4 KiB
TypeScript
import { Component, input } from '@angular/core';
|
|
import { MatCardModule } from '@angular/material/card';
|
|
import { Plot } from '../plot';
|
|
import { Section } from './tea-sections';
|
|
|
|
@Component({
|
|
selector: 'app-tea-section',
|
|
imports: [MatCardModule, Plot],
|
|
template: `
|
|
<mat-card appearance="outlined">
|
|
<mat-card-header><mat-card-title>{{ section().title }}</mat-card-title></mat-card-header>
|
|
<mat-card-content>
|
|
<ng-content />
|
|
@for (block of section().blocks; track $index) {
|
|
@if (block.title) {
|
|
<h3>{{ block.title }}</h3>
|
|
}
|
|
@if (block.text) {
|
|
<p>{{ block.text }}</p>
|
|
}
|
|
@if (block.fields; as fields) {
|
|
<dl>
|
|
@for (field of fields; track $index) {
|
|
<div>
|
|
<dt>{{ field[0] }}</dt>
|
|
<dd>{{ field[1] }}</dd>
|
|
</div>
|
|
}
|
|
</dl>
|
|
}
|
|
@if (block.table; as table) {
|
|
@if (table.rows.length) {
|
|
<table class="plain">
|
|
<thead>
|
|
<tr>
|
|
@for (header of table.headers; track $index) {
|
|
<th scope="col">{{ header }}</th>
|
|
}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@for (row of table.rows; track $index) {
|
|
<tr>
|
|
@for (cell of row; track $index) {
|
|
<td>{{ cell }}</td>
|
|
}
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
} @else {
|
|
<p class="muted">—</p>
|
|
}
|
|
}
|
|
@if (block.chart; as chart) {
|
|
<h3>{{ chart.title }}</h3>
|
|
<app-plot [figure]="chart.figure" [height]="chart.height ?? 340" />
|
|
}
|
|
} @empty {
|
|
<p class="muted">—</p>
|
|
}
|
|
</mat-card-content>
|
|
</mat-card>
|
|
`,
|
|
styles: `
|
|
:host {
|
|
display: block;
|
|
}
|
|
mat-card-content {
|
|
overflow-x: auto;
|
|
}
|
|
dl {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: var(--space-4);
|
|
margin-block: var(--space-3);
|
|
}
|
|
dt {
|
|
color: var(--color-text-secondary);
|
|
font-size: 12px;
|
|
}
|
|
dd {
|
|
margin: 0;
|
|
font-weight: 500;
|
|
}
|
|
`,
|
|
})
|
|
export class TeaSection {
|
|
readonly section = input.required<Section>();
|
|
} |