diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts index 7e3d88b4..d78524f6 100644 --- a/src/app/config/PollConfig.ts +++ b/src/app/config/PollConfig.ts @@ -2,7 +2,7 @@ * une option de date dans les sondages spéciaux */ import {environment} from "../../environments/environment"; -import {defaultAnswers, defaultDates, defaultTimeOfDay} from "./defaultConfigs"; +import {defaultAnswers, otherDefaultDates, otherTimeOfDay} from "./defaultConfigs"; export interface DateOption { timeList: any; @@ -59,8 +59,8 @@ export class PollConfig { canModifyAnswers = true;// bool for the frontend selector whoModifiesAnswers = "everybody";// everybody, self, nobody (= just admin) whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin) - dateList: any = defaultDates; // sets of days as strings, config to set identical time for days in a special days poll - timeList: any = defaultTimeOfDay; // ranges of time expressed as strings + dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll + timeList: any = otherTimeOfDay; // ranges of time expressed as strings answers: any = defaultAnswers; diff --git a/src/app/config/defaultConfigs.ts b/src/app/config/defaultConfigs.ts index c888bdf9..2ba2f10f 100644 --- a/src/app/config/defaultConfigs.ts +++ b/src/app/config/defaultConfigs.ts @@ -3,28 +3,67 @@ export const basicSlicesOfDay = [ {literal: 'midi'}, {literal: 'soir'} ]; -export const defaultTimeOfDay = [{ - timeList: Object.create(basicSlicesOfDay), +export const otherSlicesOfDay = [ + {literal: 'aux aurores'}, + {literal: 'au petit dej'}, + {literal: 'au deuxième petit dej des hobbits'} +]; +export const defaultTimeOfDay = Array.from([{ + timeList: [...basicSlicesOfDay], literal: 'matin' }, - {timeList: Object.create(basicSlicesOfDay), literal: 'midi'}, - {timeList: Object.create(basicSlicesOfDay), literal: 'après-midi'}, - {timeList: Object.create(basicSlicesOfDay), literal: 'soirée'}]; + {timeList: [...basicSlicesOfDay], literal: 'midi'}, + {timeList: [...basicSlicesOfDay], literal: 'après-midi'}, + {timeList: [...basicSlicesOfDay], literal: 'soirée'}]); +export const otherTimeOfDay = Array.from([{ + timeList: [ + {literal: 'aux aurores'}, + {literal: 'au petit dej'}, + {literal: 'au deuxième petit dej des hobbits'} + ], + literal: 'matin' +}, + { + timeList: [ + {literal: 'matin'}, + {literal: 'midi'}, + {literal: 'soir'} + ], literal: 'midi' + }, + {timeList: [...otherSlicesOfDay], literal: 'après-midi'}, + {timeList: [...basicSlicesOfDay], literal: 'soirée'}]); export const defaultDates = [ { literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`, date_object: new Date(), - timeList: Object.create(basicSlicesOfDay) + timeList: [...otherSlicesOfDay] }, { literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`, date_object: new Date(), - timeList: Object.create(basicSlicesOfDay) + timeList: [...basicSlicesOfDay] }, { literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`, date_object: new Date(), - timeList: Object.create(basicSlicesOfDay) + timeList: [...otherSlicesOfDay] + } +]; +export const otherDefaultDates = [ + { + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`, + date_object: new Date(), + timeList: [...otherSlicesOfDay] + }, + { + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`, + date_object: new Date(), + timeList: [...basicSlicesOfDay] + }, + { + literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`, + date_object: new Date(), + timeList: [...otherSlicesOfDay] } ]; export const defaultAnswers = [{ @@ -33,7 +72,7 @@ export const defaultAnswers = [{ url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`, date_object: new Date(), - timeList: Object.create(basicSlicesOfDay) + timeList: Array.from(otherSlicesOfDay) }, { id: 1, @@ -41,6 +80,7 @@ export const defaultAnswers = [{ url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`, date_object: new Date(), + timeList: Array.from(basicSlicesOfDay) }, { id: 2, @@ -48,4 +88,5 @@ export const defaultAnswers = [{ url: 'https://mastodon.cipherbliss.com/system/media_attachments/files/001/439/118/original/6fcf149bd902841b.png?1579471574', literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`, date_object: new Date(), + timeList: Array.from(otherSlicesOfDay) }]; diff --git a/src/app/pages/dates/dates.component.html b/src/app/pages/dates/dates.component.html index e6703e40..90c8258c 100644 --- a/src/app/pages/dates/dates.component.html +++ b/src/app/pages/dates/dates.component.html @@ -77,129 +77,139 @@
-
-
+
+
+
+
{{config.timeList.length}} - + {{"dates.count_time"|translate}} - (pour chaque jour) + (pour chaque jour) -
-
- - - -
+
+
+ + + +
-
-
- - - -
-
-
- +
+ + + +
+
+
+ {{config.dateList.length}} - + {{"dates.count_dates"|translate}} - -
- - - -
+
+ {{id}}) + +
+

Several hours

+
+ + +
+
+
+ +
+ + *ngIf="'true' === config.allowSeveralHours" > {{"dates.multiple.different"|translate}} + *ngIf="'false' === config.allowSeveralHours" > {{"dates.multiple.identical"|translate}}
+
+ {{idTime}}) {{time.literal}}
@@ -73,13 +75,14 @@
+ {{time.literal}}