2021-11-07 15:21:27 +01:00
|
|
|
import { ChangeDetectorRef, Component, Inject, Input, OnInit } from '@angular/core';
|
2020-10-29 18:43:19 +01:00
|
|
|
import { Poll } from '../../../core/models/poll.model';
|
2021-11-07 15:21:27 +01:00
|
|
|
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
|
|
import { UuidService } from '../../../core/services/uuid.service';
|
2020-10-29 18:43:19 +01:00
|
|
|
import { ApiService } from '../../../core/services/api.service';
|
2020-11-03 16:13:47 +01:00
|
|
|
import { ToastService } from '../../../core/services/toast.service';
|
2020-11-05 19:13:43 +01:00
|
|
|
import { PollService } from '../../../core/services/poll.service';
|
2020-11-06 14:33:20 +01:00
|
|
|
import { DOCUMENT } from '@angular/common';
|
2021-11-07 15:21:27 +01:00
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
2021-12-06 12:13:47 +01:00
|
|
|
import { environment } from '../../../../environments/environment';
|
2020-10-29 18:43:19 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-admin-form',
|
|
|
|
templateUrl: './form.component.html',
|
|
|
|
styleUrls: ['./form.component.scss'],
|
|
|
|
})
|
2021-11-07 15:21:27 +01:00
|
|
|
export class FormComponent implements OnInit {
|
2020-10-29 18:43:19 +01:00
|
|
|
@Input()
|
|
|
|
public poll?: Poll;
|
2020-11-03 15:44:08 +01:00
|
|
|
public form: FormGroup;
|
2020-10-29 21:30:33 +01:00
|
|
|
|
2020-11-03 16:13:47 +01:00
|
|
|
constructor(
|
|
|
|
private fb: FormBuilder,
|
2020-11-06 14:33:20 +01:00
|
|
|
private cd: ChangeDetectorRef,
|
2021-11-07 15:21:27 +01:00
|
|
|
private uuidService: UuidService,
|
2020-11-03 16:13:47 +01:00
|
|
|
private toastService: ToastService,
|
2021-11-12 11:09:43 +01:00
|
|
|
public pollService: PollService,
|
2020-12-16 17:21:01 +01:00
|
|
|
private router: Router,
|
2021-11-07 15:21:27 +01:00
|
|
|
public route: ActivatedRoute,
|
|
|
|
private apiService: ApiService,
|
2020-11-06 14:33:20 +01:00
|
|
|
@Inject(DOCUMENT) private document: any
|
2021-11-07 15:21:27 +01:00
|
|
|
) {
|
|
|
|
this.form = this.pollService.form;
|
2020-11-09 11:32:12 +01:00
|
|
|
}
|
2021-04-30 10:59:46 +02:00
|
|
|
|
2021-11-07 15:21:27 +01:00
|
|
|
ngOnInit(): void {
|
2021-12-06 12:13:47 +01:00
|
|
|
if (environment.autofill_creation) {
|
|
|
|
this.pollService.askInitFormDefault();
|
|
|
|
}
|
2021-04-30 10:59:46 +02:00
|
|
|
}
|
2021-04-30 11:27:54 +02:00
|
|
|
|
2021-11-07 15:21:27 +01:00
|
|
|
goNextStep() {}
|
2020-10-29 18:43:19 +01:00
|
|
|
}
|