2021-11-08 11:20:07 +01:00
|
|
|
import { Component, Inject, Input, OnInit } from '@angular/core';
|
2023-03-15 15:48:10 +01:00
|
|
|
import { UntypedFormGroup } from '@angular/forms';
|
2021-11-07 14:52:49 +01:00
|
|
|
import { PollService } from '../../../../../core/services/poll.service';
|
2021-11-08 11:20:07 +01:00
|
|
|
import { DOCUMENT } from '@angular/common';
|
2021-11-17 15:06:36 +01:00
|
|
|
import { ConfirmationService } from 'primeng/api';
|
|
|
|
import { Router } from '@angular/router';
|
2021-12-15 18:34:39 +01:00
|
|
|
import { environment } from '../../../../../../environments/environment';
|
|
|
|
import { Title } from '@angular/platform-browser';
|
2021-11-07 14:52:49 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-step-one',
|
|
|
|
templateUrl: './step-one.component.html',
|
|
|
|
styleUrls: ['./step-one.component.scss'],
|
|
|
|
})
|
|
|
|
export class StepOneComponent implements OnInit {
|
|
|
|
@Input()
|
|
|
|
step_max: any;
|
|
|
|
@Input()
|
2023-03-15 15:48:10 +01:00
|
|
|
form: UntypedFormGroup;
|
2022-02-02 15:38:51 +01:00
|
|
|
public environment = environment;
|
2021-11-07 14:52:49 +01:00
|
|
|
|
2021-11-17 15:06:36 +01:00
|
|
|
constructor(
|
|
|
|
public pollService: PollService,
|
|
|
|
@Inject(DOCUMENT) private document: any,
|
|
|
|
private router: Router,
|
2021-12-17 12:19:32 +01:00
|
|
|
private titleService: Title
|
2021-11-30 18:01:18 +01:00
|
|
|
) {
|
|
|
|
this.step_max = this.pollService.step_max;
|
2021-11-16 16:16:30 +01:00
|
|
|
this.pollService.step_current = 1;
|
2021-11-08 11:20:07 +01:00
|
|
|
}
|
2021-11-17 15:06:36 +01:00
|
|
|
|
2021-12-17 12:19:32 +01:00
|
|
|
ngOnInit(): void {}
|
|
|
|
|
2021-11-30 17:37:23 +01:00
|
|
|
leave(event: any) {
|
|
|
|
console.log('event', event);
|
|
|
|
if (event) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
2021-12-17 11:42:20 +01:00
|
|
|
const selector = '#title';
|
|
|
|
const firstField = this.document.querySelector(selector);
|
|
|
|
if (firstField) {
|
|
|
|
firstField.focus();
|
|
|
|
}
|
2021-11-30 17:37:23 +01:00
|
|
|
this.router.navigate(['/']);
|
|
|
|
}
|
2021-11-07 14:52:49 +01:00
|
|
|
}
|