|
|
|
@ -13,7 +13,7 @@ import { HttpClient } from '@angular/common/http';
|
|
|
|
|
import { environment } from '../../../environments/environment';
|
|
|
|
|
import { StorageService } from './storage.service';
|
|
|
|
|
import { Title } from '@angular/platform-browser';
|
|
|
|
|
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
|
|
|
import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
|
|
|
|
|
|
|
|
|
import { DOCUMENT } from '@angular/common';
|
|
|
|
|
import { DateChoice, TimeSlices } from '../models/dateChoice.model';
|
|
|
|
@ -31,7 +31,7 @@ import { CommentDTO } from '../models/comment.model';
|
|
|
|
|
export class PollService implements Resolve<Poll> {
|
|
|
|
|
public _poll: BehaviorSubject<Poll | undefined> = new BehaviorSubject<Poll | undefined>(undefined);
|
|
|
|
|
public readonly poll: Observable<Poll | undefined> = this._poll.asObservable();
|
|
|
|
|
public form: FormGroup;
|
|
|
|
|
public form: UntypedFormGroup;
|
|
|
|
|
public startDateInterval: string;
|
|
|
|
|
public endDateInterval: string;
|
|
|
|
|
public intervalDays: number = 1;
|
|
|
|
@ -68,7 +68,7 @@ export class PollService implements Resolve<Poll> {
|
|
|
|
|
private _clipboardService: ClipboardService,
|
|
|
|
|
private translate: TranslateService,
|
|
|
|
|
@Inject(DOCUMENT) private document: any,
|
|
|
|
|
private fb: FormBuilder
|
|
|
|
|
private fb: UntypedFormBuilder
|
|
|
|
|
) {
|
|
|
|
|
this.createFormGroup();
|
|
|
|
|
|
|
|
|
@ -180,7 +180,7 @@ export class PollService implements Resolve<Poll> {
|
|
|
|
|
description: ['', []],
|
|
|
|
|
password: ['', []],
|
|
|
|
|
password_repeat: ['', []],
|
|
|
|
|
choices: new FormArray([]),
|
|
|
|
|
choices: new UntypedFormArray([]),
|
|
|
|
|
whoModifiesAnswers: ['self', [Validators.required]],
|
|
|
|
|
whoCanChangeAnswers: ['self', [Validators.required]],
|
|
|
|
|
isAboutDate: [false, [Validators.required]],
|
|
|
|
@ -518,8 +518,8 @@ export class PollService implements Resolve<Poll> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get choices(): FormArray {
|
|
|
|
|
return this.form.get('choices') as FormArray;
|
|
|
|
|
get choices(): UntypedFormArray {
|
|
|
|
|
return this.form.get('choices') as UntypedFormArray;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reinitChoices(): void {
|
|
|
|
@ -547,7 +547,7 @@ export class PollService implements Resolve<Poll> {
|
|
|
|
|
* make a uniq slug for the current poll creation
|
|
|
|
|
* @param form
|
|
|
|
|
*/
|
|
|
|
|
makeSlug(form: FormGroup): string {
|
|
|
|
|
makeSlug(form: UntypedFormGroup): string {
|
|
|
|
|
let str = '';
|
|
|
|
|
str =
|
|
|
|
|
form.value.created_at.getFullYear() +
|
|
|
|
|