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

62 lines
1.6 KiB
TypeScript

/**
* une option de date dans les sondages spéciaux
*/
export interface DateOption {
timeList: any;
literal: string;
}
export const timeOfDay = [{
timeList: [],
literal: 'matin'
},
{timeList: [], literal: 'midi'},
{timeList: [], literal: 'après-midi'},
{timeList: [], literal: 'soirée'}];
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'}]
}
];
/**
* configuration of the poll, add new fields at will
*/
export class PollConfig {
step = 0;
stepMax = 3;
pollType = 'classic';
title = '';
description = '';
myName = '';
visibility = 'link_only';
// date specific poll
allowSeveralHours = 'true';
dateList: DateOption[] = defaultDates; // sets of days as strings, config to set identical time for days in a special days poll
timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings
answers: any = [{
id: 0,
text: 'réponse de démo 1'
},
{
id: 1,
text: 'réponse 2'
},
{
id: 2,
text: 'la réponse D'
}];
}