funky-framadate-front/src/app/config/PollConfig.ts

62 lines
1.6 KiB
TypeScript
Raw Normal View History

/**
* une option de date dans les sondages spéciaux
*/
export interface DateOption {
timeList: any;
2019-08-12 14:40:33 +02:00
literal: string;
}
export const timeOfDay = [{
timeList: [],
literal: 'matin'
},
{timeList: [], literal: 'midi'},
{timeList: [], literal: 'après-midi'},
{timeList: [], literal: 'soirée'}];
2019-11-15 15:19:42 +01:00
export const defaultDates = [
{
literal: `${new Date().getDate()}-${new Date().getMonth()}-${new Date().getFullYear()}`,
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
},
{
literal: `${new Date().getDate() + 1}-${new Date().getMonth()}-${new Date().getFullYear()}`,
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
},
{
literal: `${new Date().getDate() + 2}-${new Date().getMonth()}-${new Date().getFullYear()}`,
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
}
];
/**
2019-08-10 17:41:01 +02:00
* configuration of the poll, add new fields at will
*/
export class PollConfig {
step = 0;
stepMax = 3;
pollType = 'classic';
title = '';
description = '';
2019-08-11 17:44:11 +02:00
myName = '';
2019-08-10 17:41:01 +02:00
visibility = 'link_only';
// date specific poll
2019-11-15 15:19:42 +01:00
allowSeveralHours = 'true';
dateList: DateOption[] = defaultDates; // sets of days as strings, config to set identical time for days in a special days poll
2019-11-15 15:19:42 +01:00
timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings
2019-08-10 18:14:00 +02:00
answers: any = [{
id: 0,
text: 'réponse de démo 1'
},
2019-08-10 18:14:00 +02:00
{
id: 1,
text: 'réponse 2'
},
{
id: 2,
text: 'la réponse D'
}];
2019-08-10 17:41:01 +02:00
}