diff --git a/src/app/core/services/storage.service.ts b/src/app/core/services/storage.service.ts
index e78912cb..71d8dc95 100644
--- a/src/app/core/services/storage.service.ts
+++ b/src/app/core/services/storage.service.ts
@@ -52,7 +52,9 @@ export class StorageService {
);
}
- this.dateList = this.dateUtilities.makeDefaultDateChoices();
+ if (!this.dateList.length) {
+ this.dateList = this.dateUtilities.makeDefaultDateChoices();
+ }
}
setChoicesForVoteStack(choices_list: Choice[]) {
diff --git a/src/app/features/administration/administration.module.ts b/src/app/features/administration/administration.module.ts
index 91783080..d4b00a17 100644
--- a/src/app/features/administration/administration.module.ts
+++ b/src/app/features/administration/administration.module.ts
@@ -16,7 +16,7 @@ import { TextSelectComponent } from './form/text-select/text-select.component';
import { KindSelectComponent } from './form/kind-select/kind-select.component';
import { BaseConfigComponent } from './form/base-config/base-config.component';
import { AdvancedConfigComponent } from './form/advanced-config/advanced-config.component';
-import { CalendarModule } from 'primeng';
+import { CalendarModule, DialogModule } from 'primeng';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { AppModule } from '../../app.module';
import { IntervalComponent } from './form/date/interval/interval.component';
@@ -51,6 +51,7 @@ import { TimeListComponent } from './form/date/list/time/time-list.component';
TranslateModule.forChild({ extend: true }),
DateValueAccessorModule,
DragDropModule,
+ DialogModule,
],
})
export class AdministrationModule {}
diff --git a/src/app/features/administration/form/date-select/date-select.component.html b/src/app/features/administration/form/date-select/date-select.component.html
index c72c772b..542a61ef 100644
--- a/src/app/features/administration/form/date-select/date-select.component.html
+++ b/src/app/features/administration/form/date-select/date-select.component.html
@@ -92,24 +92,11 @@
-
-
-
-
-
-
-
- {{ dateList.length }}
-
-
- {{ 'dates.count_dates' | translate }}
-
-
-
-
-
+
diff --git a/src/app/features/administration/form/date-select/date-select.component.ts b/src/app/features/administration/form/date-select/date-select.component.ts
index 472a56c1..a35591ff 100644
--- a/src/app/features/administration/form/date-select/date-select.component.ts
+++ b/src/app/features/administration/form/date-select/date-select.component.ts
@@ -32,8 +32,8 @@ export class DateSelectComponent implements OnInit {
endDateInterval: string;
intervalDaysDefault = 7;
- dateList: DateChoice[]; // sets of dateList as strings, config to set identical time for dateList in a special dateList poll
- timeList: TimeSlices[]; // ranges of time expressed as strings
+ dateList: DateChoice[] = []; // sets of dateList as strings, config to set identical time for dateList in a special dateList poll
+ timeList: TimeSlices[] = []; // ranges of time expressed as strings
selectionKind = 'range';
@@ -53,14 +53,6 @@ export class DateSelectComponent implements OnInit {
this.timeList = this.storageService.timeSlices;
}
- get choices(): FormArray {
- return this.form.get('choices') as FormArray;
- }
-
- get dateChoices() {
- return this.form.get('dateChoices') as FormArray;
- }
-
ngOnInit(): void {}
/**
@@ -84,56 +76,4 @@ export class DateSelectComponent implements OnInit {
this.dateList.map((elem) => (elem.timeList = Object.create(defaultTimeOfDay)));
this.toastService.display('périodes horaires réinitialisées');
}
-
- addChoice(optionalLabel = ''): void {
- if (this.form.value.kind == 'date') {
- this.storageService.dateList.push({
- literal: '',
- timeList: [],
- date_object: new Date(),
- });
- } else {
- const newControlGroup = this.fb.group({
- label: this.fb.control('', [Validators.required]),
- imageUrl: ['', [Validators.required]],
- });
-
- if (optionalLabel) {
- newControlGroup.patchValue({
- label: optionalLabel,
- imageUrl: 'mon url',
- });
- }
-
- this.dateChoices.push(newControlGroup);
- }
- // this.cd.detectChanges();
- console.log('this.choices.length', this.storageService.dateList.length);
-
- this.focusOnChoice(this.storageService.dateList.length - 1);
- }
-
- focusOnChoice(index): void {
- const selector = '#choice_label_' + index;
- const elem = this.document.querySelector(selector);
- if (elem) {
- elem.focus();
- }
- }
-
- deleteChoiceField(index: number): void {
- if (this.choices.length !== 1) {
- this.choices.removeAt(index);
- }
- }
-
- reinitChoices(): void {
- this.choices.setValue([]);
- }
-
- setDemoValues(): void {
- this.addChoice('orange');
- this.addChoice('raisin');
- this.addChoice('abricot');
- }
}
diff --git a/src/app/features/administration/form/date/list/day/day-list.component.html b/src/app/features/administration/form/date/list/day/day-list.component.html
index b887b1b5..3b0ff9c3 100644
--- a/src/app/features/administration/form/date/list/day/day-list.component.html
+++ b/src/app/features/administration/form/date/list/day/day-list.component.html
@@ -1,36 +1,120 @@
-