funky-framadate-front/src/app/features/administration/stepper/stepper.component.ts

69 lines
1.9 KiB
TypeScript
Raw Normal View History

import { ChangeDetectorRef, Component, Inject, 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:16:47 +01:00
import { Router } from '@angular/router';
import { DOCUMENT } from '@angular/common';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { ToastService } from '../../../core/services/toast.service';
2020-05-01 19:10:17 +02:00
@Component({
selector: 'app-stepper',
templateUrl: './stepper.component.html',
styleUrls: ['./stepper.component.scss'],
})
export class StepperComponent implements OnInit {
2021-12-01 19:00:00 +01:00
@Input()
public stepperConfirm: HTMLElement;
@Input()
2021-11-07 14:52:49 +01:00
public step_current: number = 1;
@Input()
public step_max: number = 5;
@Input()
public optionnal_step: boolean = false;
public environment = environment;
2021-12-17 17:47:57 +01:00
display_cancel_dialog: boolean = false;
2022-02-11 10:59:02 +01:00
display_mobile_menu: boolean = false;
2021-11-17 15:16:47 +01:00
constructor(
public pollService: PollService,
@Inject(DOCUMENT) private document: any,
private cd: ChangeDetectorRef,
private titleService: Title,
private toastService: ToastService,
private translate: TranslateService,
2021-11-17 15:16:47 +01:00
private router: Router
) {}
ngOnInit() {}
2021-11-17 15:06:36 +01:00
showCancelDialog() {
2021-12-06 12:13:47 +01:00
this.display_cancel_dialog = true;
this.cd.detectChanges();
2021-12-17 12:13:34 +01:00
let buttonClosepopup = this.document.querySelector('#close_dialog');
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-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(['/']);
}
2022-02-11 10:59:02 +01:00
toggle_mobile_menu() {
this.display_mobile_menu = !this.display_mobile_menu;
}
2020-05-01 19:10:17 +02:00
}