import { Component, Input, OnInit } from '@angular/core'; import { PollService } from '../../../core/services/poll.service'; import { environment } from '../../../../environments/environment'; import { ConfirmationService } from 'primeng/api'; import { Router } from '@angular/router'; @Component({ selector: 'app-stepper', templateUrl: './stepper.component.html', styleUrls: ['./stepper.component.scss'], }) export class StepperComponent { @Input() public stepperConfirm: HTMLElement; @Input() public step_current: number = 1; @Input() public step_max: number = 5; public environment = environment; public show_shortcuts = environment.showStepperShortcuts; constructor( public pollService: PollService, private confirmationService: ConfirmationService, private router: Router ) { this.step_current = this.pollService.step_current; } showCancelDialog() { this.confirmationService.confirm({ header: 'Quitter ?', message: 'Souhaitez-vous vraiment quitter le sondage ? Toutes les informations seront effacées.', accept: () => this.goToHome(), reject: () => console.log('rejected'), }); } goToHome() { this.confirmationService.close(); this.router.navigate(['/']); } }