2021-12-15 18:34:39 +01:00
|
|
|
import { ChangeDetectorRef, Component, Inject, Input } 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:16:47 +01:00
|
|
|
import { Router } from '@angular/router';
|
2021-12-15 18:34:39 +01:00
|
|
|
import { DOCUMENT } from '@angular/common';
|
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-12-17 17:47:57 +01:00
|
|
|
display_cancel_dialog: boolean = false;
|
2021-12-15 18:34:39 +01:00
|
|
|
|
2021-11-17 15:16:47 +01:00
|
|
|
constructor(
|
|
|
|
public pollService: PollService,
|
2021-12-15 18:34:39 +01:00
|
|
|
@Inject(DOCUMENT) private document: any,
|
|
|
|
private cd: ChangeDetectorRef,
|
2021-11-17 15:16:47 +01:00
|
|
|
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-12-06 12:13:47 +01:00
|
|
|
this.display_cancel_dialog = true;
|
2021-12-15 18:34:39 +01:00
|
|
|
this.cd.detectChanges();
|
2021-12-17 12:13:34 +01:00
|
|
|
let buttonClosepopup = this.document.querySelector('#close_dialog');
|
2021-12-15 18:34:39 +01:00
|
|
|
if (buttonClosepopup) {
|
|
|
|
buttonClosepopup.focus();
|
|
|
|
console.log('button close found');
|
|
|
|
} else {
|
|
|
|
console.log('not found');
|
|
|
|
}
|
2021-11-17 15:06:36 +01:00
|
|
|
}
|
2021-12-17 12:13:34 +01:00
|
|
|
focusOnCancelButton() {
|
|
|
|
this.display_cancel_dialog = false;
|
|
|
|
let buttonClose = this.document.querySelector('#display_cancel_popup_button');
|
|
|
|
if (buttonClose) {
|
|
|
|
buttonClose.focus();
|
|
|
|
}
|
|
|
|
}
|
2021-12-15 18:34:39 +01:00
|
|
|
|
2021-12-01 19:00:00 +01:00
|
|
|
goToHome() {
|
2021-12-06 12:13:47 +01:00
|
|
|
this.display_cancel_dialog = false;
|
2021-12-01 19:00:00 +01:00
|
|
|
this.router.navigate(['/']);
|
|
|
|
}
|
2020-05-01 19:10:17 +02:00
|
|
|
}
|