2019-08-10 17:21:40 +02:00
|
|
|
/**
|
|
|
|
* une option de date dans les sondages spéciaux
|
|
|
|
*/
|
2020-01-16 10:45:56 +01:00
|
|
|
import {environment} from "../../environments/environment";
|
|
|
|
|
2019-08-10 17:21:40 +02:00
|
|
|
export interface DateOption {
|
2019-11-19 10:36:53 +01:00
|
|
|
timeList: any;
|
2019-08-12 14:40:33 +02:00
|
|
|
literal: string;
|
2019-08-10 17:21:40 +02:00
|
|
|
}
|
|
|
|
|
2019-11-19 10:36:53 +01:00
|
|
|
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 = [
|
|
|
|
{
|
2019-11-19 14:23:51 +01:00
|
|
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`,
|
2019-11-15 15:19:42 +01:00
|
|
|
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
|
|
|
},
|
|
|
|
{
|
2019-11-19 14:23:51 +01:00
|
|
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`,
|
2019-11-15 15:19:42 +01:00
|
|
|
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
|
|
|
},
|
|
|
|
{
|
2019-11-19 14:23:51 +01:00
|
|
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`,
|
2019-11-15 15:19:42 +01:00
|
|
|
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
|
|
|
}
|
|
|
|
];
|
2019-11-23 14:30:19 +01:00
|
|
|
export const defaultAnswers = [{
|
|
|
|
id: 0,
|
|
|
|
text: 'réponse de démo 1'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
text: 'réponse 2'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 2,
|
|
|
|
text: 'la réponse D'
|
|
|
|
}];
|
2019-11-15 15:19:42 +01:00
|
|
|
|
2019-08-10 17:21:40 +02:00
|
|
|
/**
|
2019-08-10 17:41:01 +02:00
|
|
|
* configuration of the poll, add new fields at will
|
2019-08-10 17:21:40 +02:00
|
|
|
*/
|
|
|
|
export class PollConfig {
|
2019-11-23 15:35:27 +01:00
|
|
|
expiracyDateDefaultInDays = 60;
|
2019-08-10 17:21:40 +02:00
|
|
|
step = 0;
|
|
|
|
stepMax = 3;
|
2019-11-22 16:46:12 +01:00
|
|
|
pollType = 'classic';// classic or date
|
2019-11-23 15:46:07 +01:00
|
|
|
title = 'titre';
|
|
|
|
description = 'ma description';
|
|
|
|
myName = 'mon pseudo';
|
2019-11-19 11:19:21 +01:00
|
|
|
|
2019-11-22 16:46:12 +01:00
|
|
|
// date specific poll, we have the choice to setup different hours (timeList) for all possible dates (dateList), or use the same hours for all dates
|
2019-11-19 11:19:21 +01:00
|
|
|
allowSeveralHours = 'false';
|
|
|
|
// access
|
|
|
|
visibility = 'link_only'; // visible to anyone with the link:
|
2019-11-23 14:30:19 +01:00
|
|
|
voteChoices = 'only_yes'; // possible answers to a vote choice: only "yes", "yes, maybe, no"
|
2020-01-16 11:33:13 +01:00
|
|
|
creationDate = new Date();
|
2019-11-23 15:35:27 +01:00
|
|
|
expirationDate = ''; // expiracy date
|
2019-12-04 12:45:50 +01:00
|
|
|
pollId = null; // id of the current poll when created. data given by the backend api
|
|
|
|
selectedPoll = null; // current poll selected with createPoll or getPoll of ConfigService
|
2019-11-23 14:58:44 +01:00
|
|
|
passwordAccess = 0;
|
2019-11-19 11:19:21 +01:00
|
|
|
password = '';
|
2020-01-16 11:33:13 +01:00
|
|
|
customUrl = ''; // custom slug in the url, must be unique
|
|
|
|
customUrlIsUnique = null; // given by the backend
|
2020-01-16 10:45:56 +01:00
|
|
|
urlPublic = environment.baseApiHref + '/default-url';
|
|
|
|
urlAdmin = environment.baseApiHref + '/default-url/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
|
2019-11-23 15:35:27 +01:00
|
|
|
canModifyAnswers = 1;// everybody, self, nobody (= just admin)
|
|
|
|
whoModifiesAnswers = "self";// everybody, self, nobody (= just admin)
|
2019-11-19 11:19:21 +01:00
|
|
|
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
|
2019-11-19 10:36:53 +01:00
|
|
|
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-11-23 14:30:19 +01:00
|
|
|
|
|
|
|
answers: any = defaultAnswers;
|
2019-08-10 17:41:01 +02:00
|
|
|
|
2020-01-15 15:55:15 +01:00
|
|
|
constructor() {
|
|
|
|
}
|
2019-08-10 17:21:40 +02:00
|
|
|
}
|