29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
import type { ProcessingState } from './information-upload-dialog';
|
|
|
|
@Component({
|
|
imports: [MatButtonModule, MatIconModule, MatProgressBarModule],
|
|
selector: 'app-processing-status',
|
|
styleUrl: './processing-status.scss',
|
|
templateUrl: './processing-status.html',
|
|
})
|
|
export class ProcessingStatusComponent {
|
|
@Input({ required: true }) state!: ProcessingState;
|
|
@Input({ required: true }) progress = 0;
|
|
@Output() readonly finishRequested = new EventEmitter<void>();
|
|
|
|
get currentStage(): string {
|
|
if (this.progress <= 20) return 'Preparando información';
|
|
if (this.progress <= 80) return 'Procesando datos';
|
|
return 'Generando resultados';
|
|
}
|
|
|
|
stageStatus(stage: number): 'complete' | 'active' | 'pending' {
|
|
const active = this.progress <= 20 ? 0 : this.progress <= 80 ? 1 : 2;
|
|
return stage < active ? 'complete' : stage === active ? 'active' : 'pending';
|
|
}
|
|
}
|