Update: Opciones de exportar
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
<section class="dashboard" aria-labelledby="dashboard-title">
|
||||
<div class="dashboard__intro">
|
||||
<p class="dashboard__eyebrow">ISSSTELEON · Análisis de información</p>
|
||||
<h1 id="dashboard-title">Resultados del análisis</h1>
|
||||
<div class="dashboard__metadata">
|
||||
<span class="dashboard__area">{{ result.analysisType }}</span>
|
||||
<span class="dashboard__demo">Datos de demostración</span>
|
||||
<button class="dashboard__back" type="button" (click)="returnHome()"><mat-icon aria-hidden="true">arrow_back</mat-icon><span>Volver al inicio</span></button>
|
||||
<div class="dashboard__heading">
|
||||
<div class="dashboard__intro">
|
||||
<p class="dashboard__eyebrow">ISSSTELEON · Análisis de información</p>
|
||||
<h1 id="dashboard-title">Resultados del análisis</h1>
|
||||
<div class="dashboard__metadata">
|
||||
<span class="dashboard__area">{{ result.analysisType }}</span>
|
||||
<span class="dashboard__demo">Datos de demostración</span>
|
||||
</div>
|
||||
<p class="dashboard__note">Los indicadores y las gráficas muestran valores obtenidos del procesamiento de los datos.</p>
|
||||
</div>
|
||||
<div class="dashboard__actions">
|
||||
<button class="dashboard__upload" type="button" (click)="openInformationDialog()"><mat-icon aria-hidden="true">upload_file</mat-icon><span>Cargar información</span></button>
|
||||
<button class="dashboard__export" type="button" (click)="openExportDialog()"><mat-icon aria-hidden="true">download</mat-icon><span>Exportar</span></button>
|
||||
</div>
|
||||
<p class="dashboard__note">Los indicadores y las gráficas muestran valores obtenidos del procesamiento de los datos.</p>
|
||||
</div>
|
||||
|
||||
<div class="dashboard__kpis" aria-label="Indicadores de demostración">
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
:host { display: block; flex: 1; min-width: 0; }
|
||||
.dashboard { margin: 0 auto; max-width: 1440px; padding: 42px clamp(20px, 4vw, 56px) 72px; width: 100%; }
|
||||
.dashboard__back { align-items: center; background: transparent; border: 0; border-radius: 6px; color: var(--color-text); cursor: pointer; display: inline-flex; font: inherit; gap: 7px; margin: 0 0 22px; min-height: 40px; padding: 6px 8px; }
|
||||
.dashboard__back:hover { background: #eef1e8; }
|
||||
.dashboard__back mat-icon { font-size: 20px; height: 20px; width: 20px; }
|
||||
.dashboard__back:focus-visible, .dashboard__export:focus-visible { outline: 3px solid rgb(168 194 67 / 55%); outline-offset: 3px; }
|
||||
.dashboard__heading { align-items: center; display: flex; gap: 24px; justify-content: space-between; }
|
||||
.dashboard__intro { min-width: 0; }
|
||||
.dashboard__actions { align-items: center; display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 10px; }
|
||||
.dashboard__upload { align-items: center; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; color: var(--color-text); cursor: pointer; display: inline-flex; flex: 0 0 auto; font: inherit; font-weight: 600; gap: 9px; min-height: 50px; padding: 12px 20px; transition: background-color .2s ease, border-color .2s ease; }
|
||||
.dashboard__upload:hover { background: #e9ecef; border-color: #5f9ea0; }
|
||||
.dashboard__upload mat-icon { color: #5f9ea0; }
|
||||
.dashboard__upload:focus-visible { outline: 3px solid rgb(168 194 67 / 55%); outline-offset: 3px; }
|
||||
.dashboard__export { align-items: center; background: #fff; border: 1px solid #d7dccf; border-radius: 8px; color: var(--color-text); cursor: pointer; display: inline-flex; font: inherit; font-weight: 600; gap: 9px; min-height: 50px; padding: 12px 20px; transition: background-color .2s ease, border-color .2s ease; }
|
||||
.dashboard__export:hover { background: #f3f6e9; border-color: #a8c243; }
|
||||
.dashboard__export mat-icon { color: #52691f; }
|
||||
.dashboard__eyebrow { color: var(--color-text-secondary); font-size: 12px; font-weight: 600; letter-spacing: .12em; margin: 0 0 12px; text-transform: uppercase; }
|
||||
h1, h2, p { margin-top: 0; }
|
||||
h1 { color: var(--color-text); font-family: var(--font-heading); font-size: clamp(32px, 3.8vw, 46px); line-height: 1.1; margin-bottom: 16px; }
|
||||
@@ -18,4 +32,6 @@ h1 { color: var(--color-text); font-family: var(--font-heading); font-size: clam
|
||||
.chart-card h2 { color: var(--color-text); font-family: var(--font-heading); font-size: 22px; font-weight: 700; line-height: 1.2; margin: 0 0 12px; }
|
||||
.chart-card--line { grid-column: 1 / -1; }
|
||||
@media (max-width: 860px) { .dashboard__charts { grid-template-columns: minmax(0, 1fr); } .chart-card--line { grid-column: auto; } }
|
||||
@media (max-width: 700px) { .dashboard__heading { align-items: flex-start; flex-direction: column; gap: 18px; } .dashboard__actions { width: 100%; } }
|
||||
@media (max-width: 420px) { .dashboard__actions { align-items: stretch; flex-direction: column; } .dashboard__actions button { justify-content: center; width: 100%; } }
|
||||
@media (max-width: 600px) { .dashboard { padding: 30px 16px 48px; } .dashboard__kpis { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 26px; } .kpi { padding: 18px 20px; } .chart-card { padding: 18px 12px 12px; } .chart-card h2 { font-size: 20px; margin-left: 6px; } }
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Router } from '@angular/router';
|
||||
import { take } from 'rxjs';
|
||||
import { mockAnalysisResult } from './dashboard.mock';
|
||||
import { ChartFigure, PlotlyChart } from './plotly-chart';
|
||||
import { InformationUploadDialog } from '../information-upload-dialog';
|
||||
import { ExportResultsDialog } from './export-results-dialog';
|
||||
|
||||
const ink = '#081839';
|
||||
const grid = '#e9ede5';
|
||||
@@ -11,13 +17,37 @@ const muted = '#7a7a7a';
|
||||
const font = { family: 'Roboto, sans-serif', color: ink, size: 12 };
|
||||
|
||||
@Component({
|
||||
imports: [PlotlyChart],
|
||||
imports: [MatDialogModule, MatIconModule, PlotlyChart],
|
||||
selector: 'app-dashboard',
|
||||
styleUrl: './dashboard.scss',
|
||||
templateUrl: './dashboard.html',
|
||||
})
|
||||
export class Dashboard {
|
||||
private readonly dialog = inject(MatDialog);
|
||||
private readonly router = inject(Router);
|
||||
readonly result = mockAnalysisResult;
|
||||
|
||||
returnHome(): void { void this.router.navigateByUrl('/'); }
|
||||
|
||||
openExportDialog(): void {
|
||||
if (this.dialog.openDialogs.length > 0) return;
|
||||
this.dialog.open(ExportResultsDialog, {
|
||||
width: '640px', maxWidth: 'calc(100vw - 32px)',
|
||||
autoFocus: 'first-tabbable', restoreFocus: true,
|
||||
panelClass: 'export-results-dialog-panel',
|
||||
});
|
||||
}
|
||||
|
||||
openInformationDialog(): void {
|
||||
if (this.dialog.openDialogs.length > 0) return;
|
||||
this.dialog.open<InformationUploadDialog, { entryPoint: 'dashboard' }, 'completed' | undefined>(InformationUploadDialog, {
|
||||
data: { entryPoint: 'dashboard' }, width: '800px', maxWidth: 'calc(100vw - 32px)',
|
||||
autoFocus: 'first-tabbable', restoreFocus: true, disableClose: true,
|
||||
panelClass: 'information-upload-dialog-panel',
|
||||
}).afterClosed().pipe(take(1)).subscribe((result) => {
|
||||
if (result === 'completed') void this.router.navigateByUrl('/dashboard');
|
||||
});
|
||||
}
|
||||
readonly bars: ChartFigure = {
|
||||
data: [{
|
||||
type: 'bar',
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<section class="export-dialog" aria-labelledby="export-title" aria-describedby="export-description">
|
||||
<header class="export-dialog__header">
|
||||
<div>
|
||||
<h2 id="export-title">Exportar resultados</h2>
|
||||
<p id="export-description">Selecciona el formato en el que deseas exportar los resultados del análisis.</p>
|
||||
</div>
|
||||
<button class="export-dialog__close" type="button" aria-label="Cerrar diálogo" (click)="close()"><mat-icon aria-hidden="true">close</mat-icon></button>
|
||||
</header>
|
||||
|
||||
<div class="export-options" role="group" aria-label="Formato de exportación">
|
||||
<button class="export-option" [class.export-option--selected]="selection() === 'pdf'" [attr.aria-pressed]="selection() === 'pdf'" type="button" (click)="select('pdf')">
|
||||
<mat-icon class="export-option__icon" aria-hidden="true">picture_as_pdf</mat-icon>
|
||||
<span class="export-option__copy"><strong>PDF</strong><span>Reporte visual del análisis y sus gráficas.</span></span>
|
||||
@if (selection() === 'pdf') { <mat-icon class="export-option__check" aria-hidden="true">check_circle</mat-icon> }
|
||||
</button>
|
||||
<button class="export-option" [class.export-option--selected]="selection() === 'excel'" [attr.aria-pressed]="selection() === 'excel'" type="button" (click)="select('excel')">
|
||||
<mat-icon class="export-option__icon" aria-hidden="true">table_chart</mat-icon>
|
||||
<span class="export-option__copy"><strong>Excel</strong><span>Datos utilizados por los indicadores y las gráficas.</span></span>
|
||||
@if (selection() === 'excel') { <mat-icon class="export-option__check" aria-hidden="true">check_circle</mat-icon> }
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<footer class="export-dialog__footer">
|
||||
<p>La generación del archivo se implementará en la siguiente fase.</p>
|
||||
<div class="export-dialog__actions">
|
||||
<button class="export-dialog__cancel" type="button" (click)="close()">Cancelar</button>
|
||||
<button class="export-dialog__submit" type="button" disabled>Exportar</button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
@@ -0,0 +1,28 @@
|
||||
:host { display: block; }
|
||||
.export-dialog { background: #fff; color: var(--color-text); padding: 28px 32px 24px; }
|
||||
.export-dialog__header { align-items: flex-start; display: flex; gap: 20px; justify-content: space-between; }
|
||||
.export-dialog__header h2 { font-family: var(--font-heading); font-size: 30px; line-height: 1.15; margin: 0; }
|
||||
.export-dialog__header p { color: var(--color-text-secondary); font-size: 15px; line-height: 1.5; margin: 12px 0 0; }
|
||||
.export-dialog__close { align-items: center; background: transparent; border: 0; border-radius: 50%; color: #596273; cursor: pointer; display: inline-flex; flex: 0 0 auto; height: 40px; justify-content: center; margin: -8px -10px 0 0; width: 40px; }
|
||||
.export-dialog__close:hover { background: #f0f2ed; }
|
||||
.export-options { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 26px 0; }
|
||||
.export-option { align-items: flex-start; background: #fff; border: 1px solid #d7dccf; border-radius: 10px; color: var(--color-text); cursor: pointer; display: flex; gap: 13px; min-height: 112px; padding: 18px 15px; text-align: left; transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease; }
|
||||
.export-option:hover { background: #f7f9f3; border-color: #9aaa64; }
|
||||
.export-option:focus-visible, .export-dialog button:focus-visible { outline: 3px solid rgb(168 194 67 / 55%); outline-offset: 3px; }
|
||||
.export-option--selected { background: #f4f7e9; border: 2px solid #6f821c; padding: 17px 14px; }
|
||||
.export-option__icon { color: #52691f; flex: 0 0 auto; margin-top: 1px; }
|
||||
.export-option__copy { display: grid; gap: 7px; line-height: 1.4; }
|
||||
.export-option__copy strong { font-size: 16px; }
|
||||
.export-option__copy > span { color: var(--color-text-secondary); font-size: 13px; }
|
||||
.export-option__check { color: #52691f; flex: 0 0 auto; font-size: 20px; height: 20px; margin-left: auto; width: 20px; }
|
||||
.export-dialog__footer { align-items: flex-end; border-top: 1px solid var(--color-border); display: flex; gap: 16px; justify-content: space-between; padding-top: 18px; }
|
||||
.export-dialog__footer p { color: var(--color-text-secondary); font-size: 12px; line-height: 1.4; margin: 0; max-width: 240px; }
|
||||
.export-dialog__actions { display: flex; flex: 0 0 auto; gap: 10px; }
|
||||
.export-dialog__actions button { border-radius: 7px; cursor: pointer; font: inherit; font-weight: 600; min-height: 44px; padding: 10px 18px; }
|
||||
.export-dialog__cancel { background: #fff; border: 1px solid var(--color-border-subtle); color: var(--color-text); }
|
||||
.export-dialog__cancel:hover { background: var(--color-surface-hover); }
|
||||
.export-dialog__submit { background: var(--color-primary-action); border: 1px solid var(--color-primary-action); color: #fff; }
|
||||
.export-dialog__submit:disabled { background: #e8ecdf; border-color: #e8ecdf; color: #9da38f; cursor: not-allowed; }
|
||||
@media (max-width: 560px) { .export-dialog { padding: 22px 20px 18px; } .export-dialog__header h2 { font-size: 26px; } .export-options { grid-template-columns: minmax(0, 1fr); margin: 20px 0; } .export-option { min-height: 88px; } .export-dialog__footer { align-items: stretch; flex-direction: column; } .export-dialog__footer p { max-width: none; } .export-dialog__actions { justify-content: flex-end; } }
|
||||
@media (max-width: 360px) { .export-dialog { padding-inline: 16px; } .export-dialog__actions { gap: 6px; } .export-dialog__actions button { padding-inline: 12px; } }
|
||||
.export-dialog__close:focus-visible { outline: 3px solid rgb(168 194 67 / 55%); outline-offset: 2px; }
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Component, signal } from '@angular/core';
|
||||
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
export type ExportFormat = 'pdf' | 'excel';
|
||||
|
||||
@Component({
|
||||
imports: [MatDialogModule, MatIconModule],
|
||||
selector: 'app-export-results-dialog',
|
||||
styleUrl: './export-results-dialog.scss',
|
||||
templateUrl: './export-results-dialog.html',
|
||||
})
|
||||
export class ExportResultsDialog {
|
||||
readonly selection = signal<ExportFormat | null>(null);
|
||||
|
||||
constructor(private readonly dialogRef: MatDialogRef<ExportResultsDialog>) {}
|
||||
|
||||
select(format: ExportFormat): void { this.selection.set(format); }
|
||||
close(): void { this.dialogRef.close(); }
|
||||
}
|
||||
Reference in New Issue
Block a user