|
|
|
@ -9,6 +9,7 @@ import { Router } from '@angular/router';
|
|
|
|
|
import { environment } from '../../../../environments/environment';
|
|
|
|
|
import { PollUtilitiesService } from '../../../core/services/poll.utilities.service';
|
|
|
|
|
import { StorageService } from '../../../core/services/storage.service';
|
|
|
|
|
import { defaultDates, defaultTimeOfDay } from '../../../../../mocks/old-stuff/config/defaultConfigs';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-admin-form',
|
|
|
|
@ -53,29 +54,29 @@ export class FormComponent implements OnInit {
|
|
|
|
|
creatorEmail: ['', [Validators.required]],
|
|
|
|
|
custom_url: [this.pollUtilitiesService.makeUuid(), [Validators.required]],
|
|
|
|
|
description: ['', [Validators.required]],
|
|
|
|
|
choices: this.fb.array([
|
|
|
|
|
this.fb.group({
|
|
|
|
|
label: ['', [Validators.required]],
|
|
|
|
|
imageUrl: ['', [Validators.required]],
|
|
|
|
|
}),
|
|
|
|
|
]),
|
|
|
|
|
dateChoices: this.fb.array([
|
|
|
|
|
this.fb.group({
|
|
|
|
|
label: ['', [Validators.required]],
|
|
|
|
|
// if we have enabled detailed time choices per date choice, we have to make a time property for each date choice
|
|
|
|
|
timeChoices: this.fb.array([
|
|
|
|
|
this.fb.group({
|
|
|
|
|
label: ['', [Validators.required]],
|
|
|
|
|
}),
|
|
|
|
|
]),
|
|
|
|
|
}),
|
|
|
|
|
]),
|
|
|
|
|
// these time choice are meant to be the same for each day
|
|
|
|
|
timeChoices: this.fb.array([
|
|
|
|
|
this.fb.group({
|
|
|
|
|
label: ['', [Validators.required]],
|
|
|
|
|
}),
|
|
|
|
|
]),
|
|
|
|
|
// choices: this.fb.array([
|
|
|
|
|
// this.fb.group({
|
|
|
|
|
// label: ['', [Validators.required]],
|
|
|
|
|
// imageUrl: ['', [Validators.required]],
|
|
|
|
|
// }),
|
|
|
|
|
// ]),
|
|
|
|
|
// dateChoices: this.fb.array([
|
|
|
|
|
// this.fb.group({
|
|
|
|
|
// label: ['', [Validators.required]],
|
|
|
|
|
// // if we have enabled detailed time choices per date choice, we have to make a time property for each date choice
|
|
|
|
|
// timeChoices: this.fb.array([
|
|
|
|
|
// this.fb.group({
|
|
|
|
|
// label: ['', [Validators.required]],
|
|
|
|
|
// }),
|
|
|
|
|
// ]),
|
|
|
|
|
// }),
|
|
|
|
|
// ]),
|
|
|
|
|
// // these time choice are meant to be the same for each day
|
|
|
|
|
// timeChoices: this.fb.array([
|
|
|
|
|
// this.fb.group({
|
|
|
|
|
// label: ['', [Validators.required]],
|
|
|
|
|
// }),
|
|
|
|
|
// ]),
|
|
|
|
|
kind: ['', [Validators.required]],
|
|
|
|
|
areResultsPublic: [true, [Validators.required]],
|
|
|
|
|
whoCanChangeAnswers: ['everybody', [Validators.required]],
|
|
|
|
@ -141,18 +142,14 @@ export class FormComponent implements OnInit {
|
|
|
|
|
startDateInterval: new Date(),
|
|
|
|
|
endDateInterval: new Date(),
|
|
|
|
|
comments: [],
|
|
|
|
|
choices: [
|
|
|
|
|
{
|
|
|
|
|
name: 'un choix',
|
|
|
|
|
url: 'https://placekitten.com/120/150',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
dateChoices: [
|
|
|
|
|
{
|
|
|
|
|
name: new Date(),
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
timeChoices: [],
|
|
|
|
|
// choices: [
|
|
|
|
|
// {
|
|
|
|
|
// name: 'un choix',
|
|
|
|
|
// url: 'https://placekitten.com/120/150',
|
|
|
|
|
// },
|
|
|
|
|
// ],
|
|
|
|
|
// dateChoices: defaultDates,
|
|
|
|
|
// timeChoices: defaultTimeOfDay,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|