2020-06-16 18:40:48 +02:00
|
|
|
import { Component, Input, OnInit } from '@angular/core';
|
2021-11-14 15:26:26 +01:00
|
|
|
import { PollService } from '../../../core/services/poll.service';
|
|
|
|
import { environment } from '../../../../environments/environment';
|
2021-11-17 15:06:36 +01:00
|
|
|
import { ConfirmationService } from 'primeng/api';
|
2021-11-17 15:16:47 +01:00
|
|
|
import { Router } from '@angular/router';
|
2020-05-01 19:10:17 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-stepper',
|
|
|
|
templateUrl: './stepper.component.html',
|
|
|
|
styleUrls: ['./stepper.component.scss'],
|
|
|
|
})
|
2021-11-07 14:52:49 +01:00
|
|
|
export class StepperComponent {
|
2021-12-01 19:00:00 +01:00
|
|
|
@Input()
|
|
|
|
public stepperConfirm: HTMLElement;
|
|
|
|
|
2020-06-16 18:40:48 +02:00
|
|
|
@Input()
|
2021-11-07 14:52:49 +01:00
|
|
|
public step_current: number = 1;
|
|
|
|
@Input()
|
|
|
|
public step_max: number = 5;
|
2021-11-29 13:00:01 +01:00
|
|
|
public environment = environment;
|
2021-11-14 15:26:26 +01:00
|
|
|
public show_shortcuts = environment.showStepperShortcuts;
|
2021-11-17 15:16:47 +01:00
|
|
|
constructor(
|
|
|
|
public pollService: PollService,
|
|
|
|
private confirmationService: ConfirmationService,
|
|
|
|
private router: Router
|
2021-12-01 19:00:00 +01:00
|
|
|
) {
|
|
|
|
this.step_current = this.pollService.step_current;
|
|
|
|
}
|
2021-11-17 15:06:36 +01:00
|
|
|
|
2021-12-01 17:53:32 +01:00
|
|
|
showCancelDialog() {
|
2021-11-17 15:06:36 +01:00
|
|
|
this.confirmationService.confirm({
|
2021-12-01 19:00:00 +01:00
|
|
|
header: 'Quitter ?',
|
2021-12-02 15:52:08 +01:00
|
|
|
acceptLabel: 'Quitter',
|
|
|
|
rejectLabel: 'Rester',
|
2021-12-01 19:00:00 +01:00
|
|
|
message: 'Souhaitez-vous vraiment quitter le sondage ? Toutes les informations seront effacées.',
|
|
|
|
accept: () => this.goToHome(),
|
|
|
|
reject: () => console.log('rejected'),
|
2021-11-17 15:06:36 +01:00
|
|
|
});
|
|
|
|
}
|
2021-12-01 19:00:00 +01:00
|
|
|
goToHome() {
|
|
|
|
this.confirmationService.close();
|
|
|
|
this.router.navigate(['/']);
|
|
|
|
}
|
2020-05-01 19:10:17 +02:00
|
|
|
}
|