Files
WebApp/src/app/governance/components/tea-eeg-panel/reference-step/reference-step.html
T

73 lines
3.4 KiB
HTML

<section class="ref">
<h3 class="ref__title">Cohortes en el volumen de referencia</h3>
@if (loading()) {
<mat-progress-bar mode="indeterminate" aria-label="Cargando cohortes"></mat-progress-bar>
}
@if (loadError(); as error) {
<p class="ref__alert" role="alert"><mat-icon aria-hidden="true">error</mat-icon>{{ error }}</p>
}
@if (!loading() && !loadError()) {
@if (cohorts().length) {
<table mat-table [dataSource]="cohorts()" class="ref__table" aria-label="Cohortes de referencia">
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Nombre</th>
<td mat-cell *matCellDef="let c">{{ c.name }}</td>
</ng-container>
<ng-container matColumnDef="edfs">
<th mat-header-cell *matHeaderCellDef>EDF</th>
<td mat-cell *matCellDef="let c">{{ c.edfs | number }}</td>
</ng-container>
<ng-container matColumnDef="size">
<th mat-header-cell *matHeaderCellDef>Tamaño</th>
<td mat-cell *matCellDef="let c">{{ tamano(c.size_bytes) }}</td>
</ng-container>
<ng-container matColumnDef="ages">
<th mat-header-cell *matHeaderCellDef>Edades</th>
<td mat-cell *matCellDef="let c">{{ c.has_ages ? 'Sí' : 'No' }}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
} @else {
<p class="ref__muted">Aún no hay cohortes; sube la primera abajo.</p>
}
}
@if (choice().mode === 'remote') {
<p class="ref__note"><mat-icon aria-hidden="true">warning</mat-icon>En modo remoto los archivos subidos quedan en este servidor, no en el volumen que ven los trabajadores.</p>
}
<form class="ref__upload" (ngSubmit)="upload()">
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Nombre de la cohorte</mat-label>
<input matInput [formControl]="name" placeholder="referencia_2026" />
@if (name.hasError('pattern') || name.hasError('required')) {
<mat-error>1 a 64 caracteres: letras, dígitos, punto, guion o guion bajo.</mat-error>
}
</mat-form-field>
<label class="ref__files">
Archivos (.edf o edades.csv)
<input type="file" multiple accept=".edf,.csv" (change)="onFilesPicked($event)" [disabled]="uploading() || rootMissing()" />
</label>
<button mat-stroked-button type="submit" [disabled]="uploading() || name.invalid || !selectedFiles().length || rootMissing()">
<mat-icon aria-hidden="true">upload</mat-icon>Subir {{ selectedFiles().length ? '(' + selectedFiles().length + ')' : '' }}
</button>
</form>
@if (uploads().length) {
<ul class="ref__results">
@for (item of uploads(); track item.fileName) {
<li [class.ref__result--error]="item.status === 'error'">
<mat-icon aria-hidden="true">{{ item.status === 'done' ? 'check_circle' : item.status === 'error' ? 'error' : 'cloud_upload' }}</mat-icon>
<span class="ref__file">{{ item.fileName }}</span>
@if (item.status === 'uploading') {
<mat-progress-bar class="ref__progress" [mode]="item.progress === null ? 'indeterminate' : 'determinate'" [value]="item.progress ?? 0"></mat-progress-bar>
}
<span class="ref__detail">{{ item.detail }}</span>
</li>
}
</ul>
}
</section>