forked from tykayn/funky-framadate-front
dates and recap side to side
This commit is contained in:
parent
15bbf0e375
commit
61bf6a289c
@ -2,7 +2,7 @@
|
|||||||
* une option de date dans les sondages spéciaux
|
* une option de date dans les sondages spéciaux
|
||||||
*/
|
*/
|
||||||
import {environment} from "../../environments/environment";
|
import {environment} from "../../environments/environment";
|
||||||
import {defaultAnswers, defaultDates, defaultTimeOfDay} from "./defaultConfigs";
|
import {defaultAnswers, otherDefaultDates, otherTimeOfDay} from "./defaultConfigs";
|
||||||
|
|
||||||
export interface DateOption {
|
export interface DateOption {
|
||||||
timeList: any;
|
timeList: any;
|
||||||
@ -59,8 +59,8 @@ export class PollConfig {
|
|||||||
canModifyAnswers = true;// bool for the frontend selector
|
canModifyAnswers = true;// bool for the frontend selector
|
||||||
whoModifiesAnswers = "everybody";// everybody, self, nobody (= just admin)
|
whoModifiesAnswers = "everybody";// everybody, self, nobody (= just admin)
|
||||||
whoCanChangeAnswers = '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
|
dateList: any = otherDefaultDates; // 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
|
timeList: any = otherTimeOfDay; // ranges of time expressed as strings
|
||||||
|
|
||||||
answers: any = defaultAnswers;
|
answers: any = defaultAnswers;
|
||||||
|
|
||||||
|
@ -3,28 +3,67 @@ export const basicSlicesOfDay = [
|
|||||||
{literal: 'midi'},
|
{literal: 'midi'},
|
||||||
{literal: 'soir'}
|
{literal: 'soir'}
|
||||||
];
|
];
|
||||||
export const defaultTimeOfDay = [{
|
export const otherSlicesOfDay = [
|
||||||
timeList: Object.create(basicSlicesOfDay),
|
{literal: 'aux aurores'},
|
||||||
|
{literal: 'au petit dej'},
|
||||||
|
{literal: 'au deuxième petit dej des hobbits'}
|
||||||
|
];
|
||||||
|
export const defaultTimeOfDay = Array.from([{
|
||||||
|
timeList: [...basicSlicesOfDay],
|
||||||
literal: 'matin'
|
literal: 'matin'
|
||||||
},
|
},
|
||||||
{timeList: Object.create(basicSlicesOfDay), literal: 'midi'},
|
{timeList: [...basicSlicesOfDay], literal: 'midi'},
|
||||||
{timeList: Object.create(basicSlicesOfDay), literal: 'après-midi'},
|
{timeList: [...basicSlicesOfDay], literal: 'après-midi'},
|
||||||
{timeList: Object.create(basicSlicesOfDay), literal: 'soirée'}];
|
{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 = [
|
export const defaultDates = [
|
||||||
{
|
{
|
||||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`,
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`,
|
||||||
date_object: new Date(),
|
date_object: new Date(),
|
||||||
timeList: Object.create(basicSlicesOfDay)
|
timeList: [...otherSlicesOfDay]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`,
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`,
|
||||||
date_object: new Date(),
|
date_object: new Date(),
|
||||||
timeList: Object.create(basicSlicesOfDay)
|
timeList: [...basicSlicesOfDay]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`,
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`,
|
||||||
date_object: new Date(),
|
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 = [{
|
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',
|
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()}`,
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}`,
|
||||||
date_object: new Date(),
|
date_object: new Date(),
|
||||||
timeList: Object.create(basicSlicesOfDay)
|
timeList: Array.from(otherSlicesOfDay)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 1,
|
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',
|
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}`,
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 1}`,
|
||||||
date_object: new Date(),
|
date_object: new Date(),
|
||||||
|
timeList: Array.from(basicSlicesOfDay)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
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',
|
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}`,
|
literal: `${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate() + 2}`,
|
||||||
date_object: new Date(),
|
date_object: new Date(),
|
||||||
|
timeList: Array.from(otherSlicesOfDay)
|
||||||
}];
|
}];
|
||||||
|
@ -77,129 +77,139 @@
|
|||||||
</button >
|
</button >
|
||||||
<hr >
|
<hr >
|
||||||
</section >
|
</section >
|
||||||
<div class="dates-list " >
|
<div class='columns' >
|
||||||
<div class='title' >
|
<div class='column' >
|
||||||
|
<div class="dates-list " >
|
||||||
|
<div class='title' >
|
||||||
<span class="count-dates" >
|
<span class="count-dates" >
|
||||||
{{config.timeList.length}}
|
{{config.timeList.length}}
|
||||||
</span >
|
</span >
|
||||||
<span class="count-dates-txt " >
|
<span class="count-dates-txt " >
|
||||||
{{"dates.count_time"|translate}}
|
{{"dates.count_time"|translate}}
|
||||||
(pour chaque jour)
|
(pour chaque jour)
|
||||||
</span >
|
</span >
|
||||||
|
|
||||||
</div >
|
</div >
|
||||||
<div class='actions' >
|
<div class='actions' >
|
||||||
<button
|
<button
|
||||||
(click)="addTime()"
|
(click)="addTime()"
|
||||||
*ngIf=" 'false' === config.allowSeveralHours "
|
*ngIf=" 'false' === config.allowSeveralHours "
|
||||||
class="btn btn--primary"
|
class="btn btn--primary"
|
||||||
id="add_time_button"
|
id="add_time_button"
|
||||||
>
|
>
|
||||||
<i class='fa fa-plus' ></i >
|
<i class='fa fa-plus' ></i >
|
||||||
{{"dates.add_time"|translate}}
|
{{"dates.add_time"|translate}}
|
||||||
</button >
|
</button >
|
||||||
<button
|
<button
|
||||||
(click)="removeAllTimes()"
|
(click)="removeAllTimes()"
|
||||||
*ngIf=" 'false' === config.allowSeveralHours "
|
*ngIf=" 'false' === config.allowSeveralHours "
|
||||||
class="btn btn--warning"
|
class="btn btn--warning"
|
||||||
id="remove_time_button"
|
id="remove_time_button"
|
||||||
>
|
>
|
||||||
<i class='fa fa-trash' ></i >
|
<i class='fa fa-trash' ></i >
|
||||||
Aucune plage horaire
|
Aucune plage horaire
|
||||||
</button >
|
</button >
|
||||||
<button
|
<button
|
||||||
(click)="resetTimes()"
|
(click)="resetTimes()"
|
||||||
*ngIf=" 'false' === config.allowSeveralHours"
|
*ngIf=" 'false' === config.allowSeveralHours"
|
||||||
class="btn btn--warning"
|
class="btn btn--warning"
|
||||||
id="reset_time_button"
|
id="reset_time_button"
|
||||||
>
|
>
|
||||||
<i class='fa fa-refresh' ></i >
|
<i class='fa fa-refresh' ></i >
|
||||||
réinitialiser
|
réinitialiser
|
||||||
</button >
|
</button >
|
||||||
</div >
|
</div >
|
||||||
|
|
||||||
<div
|
<div
|
||||||
*ngIf=" 'false' === config.allowSeveralHours"
|
*ngIf=" 'false' === config.allowSeveralHours"
|
||||||
class="identical-dates"
|
class="identical-dates"
|
||||||
>
|
|
||||||
<div
|
|
||||||
*ngFor="let time of config.timeList; index as id"
|
|
||||||
class="time-choice"
|
|
||||||
>
|
|
||||||
<label for='timeChoices_{{id}}' >
|
|
||||||
<i class='fa fa-clock-o' ></i >
|
|
||||||
</label >
|
|
||||||
<input
|
|
||||||
[(ngModel)]="time.literal"
|
|
||||||
name="timeChoices_{{id}}"
|
|
||||||
type="text"
|
|
||||||
id='timeChoices_{{id}}'
|
|
||||||
>
|
>
|
||||||
<button
|
<div
|
||||||
(click)="time.timeList.splice(id, 1)"
|
*ngFor="let time of config.timeList; index as id"
|
||||||
class="btn btn-warning" ><i class="fa fa-times" ></i >
|
class="time-choice"
|
||||||
</button >
|
>
|
||||||
</div >
|
<label for='timeChoices_{{id}}' >
|
||||||
</div >
|
<i class='fa fa-clock-o' ></i >
|
||||||
<hr >
|
</label >
|
||||||
<span class="count-dates title" >
|
<input
|
||||||
|
[(ngModel)]="time.literal"
|
||||||
|
name="timeChoices_{{id}}"
|
||||||
|
type="text"
|
||||||
|
id='timeChoices_{{id}}'
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
(click)="time.timeList.splice(id, 1)"
|
||||||
|
class="btn btn-warning" ><i class="fa fa-times" ></i >
|
||||||
|
</button >
|
||||||
|
</div >
|
||||||
|
</div >
|
||||||
|
<hr >
|
||||||
|
<span class="count-dates title" >
|
||||||
{{config.dateList.length}}
|
{{config.dateList.length}}
|
||||||
</span >
|
</span >
|
||||||
<span >
|
<span >
|
||||||
{{"dates.count_dates"|translate}}
|
{{"dates.count_dates"|translate}}
|
||||||
</span >
|
</span >
|
||||||
<button
|
<button
|
||||||
class='btn btn--primary'
|
class='btn btn--primary'
|
||||||
(click)='addDate()' >
|
(click)='addDate()' >
|
||||||
{{"dates.add"|translate}}
|
{{"dates.add"|translate}}
|
||||||
</button >
|
</button >
|
||||||
<div
|
|
||||||
*ngFor="let choice of config.dateList; index as id"
|
|
||||||
class="date-choice"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
[(ngModel)]="choice.date_object"
|
|
||||||
name="dateChoices_{{id}}"
|
|
||||||
id="dateChoices_{{id}}"
|
|
||||||
useValueAsDate
|
|
||||||
type="date"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
(click)="config.dateList.splice(id, 1)"
|
|
||||||
class="btn btn-warning"
|
|
||||||
><i class="fa fa-times" ></i >
|
|
||||||
</button >
|
|
||||||
<button
|
|
||||||
(click)="addTimeToDate(choice, id)"
|
|
||||||
*ngIf=" 'true' === config.allowSeveralHours"
|
|
||||||
class="btn btn--primary"
|
|
||||||
>
|
|
||||||
{{"dates.add_time"|translate}}
|
|
||||||
</button >
|
|
||||||
<div
|
|
||||||
*ngIf=" 'true' === config.allowSeveralHours"
|
|
||||||
class="several-times"
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
*ngFor="let time of choice.timeList; index as idTime"
|
*ngFor="let choice of config.dateList; index as id"
|
||||||
class="time-choice"
|
class="date-choice"
|
||||||
>
|
>
|
||||||
|
{{id}})
|
||||||
<input
|
<input
|
||||||
[(ngModel)]="time.date_object"
|
[(ngModel)]="choice.date_object"
|
||||||
name="dateTime_{{id}}_Choices_{{idTime}}"
|
name="dateChoices_{{id}}"
|
||||||
id="dateTime_{{id}}_Choices_{{idTime}}"
|
id="dateChoices_{{id}}"
|
||||||
useValueAsDate
|
useValueAsDate
|
||||||
type="text"
|
type="date"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
(click)="choice.timeList.splice(idTime, 1)"
|
(click)="config.dateList.splice(id, 1)"
|
||||||
class="btn btn-warning"
|
class="btn btn-warning"
|
||||||
><i class="fa fa-times" ></i >
|
><i class="fa fa-times" ></i >
|
||||||
</button >
|
</button >
|
||||||
|
<button
|
||||||
|
(click)="addTimeToDate(choice, id)"
|
||||||
|
*ngIf=" 'true' === config.allowSeveralHours"
|
||||||
|
class="btn btn--primary"
|
||||||
|
>
|
||||||
|
{{"dates.add_time"|translate}}
|
||||||
|
</button >
|
||||||
|
<div
|
||||||
|
*ngIf=" 'true' === config.allowSeveralHours"
|
||||||
|
class="several-times"
|
||||||
|
>
|
||||||
|
<h2 >Several hours</h2 >
|
||||||
|
<div
|
||||||
|
*ngFor="let timeItem of choice.timeList; index as idTime"
|
||||||
|
class="time-choice"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
[(ngModel)]="timeItem.literal"
|
||||||
|
name="dateTime_{{id}}_Choices_{{idTime}}"
|
||||||
|
id="dateTime_{{id}}_Choices_{{idTime}}"
|
||||||
|
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
(click)="choice.timeList.splice(idTime, 1)"
|
||||||
|
class="btn btn-warning"
|
||||||
|
><i class="fa fa-times" ></i >
|
||||||
|
</button >
|
||||||
|
</div >
|
||||||
|
</div >
|
||||||
</div >
|
</div >
|
||||||
</div >
|
</div >
|
||||||
</div >
|
</div >
|
||||||
|
<div class='column' >
|
||||||
|
<framadate-resume ></framadate-resume >
|
||||||
|
</div >
|
||||||
</div >
|
</div >
|
||||||
|
|
||||||
<a
|
<a
|
||||||
[routerLink]="'/step/resume'"
|
[routerLink]="'/step/resume'"
|
||||||
class="btn btn--full btn--primary"
|
class="btn btn--full btn--primary"
|
||||||
|
@ -38,12 +38,12 @@
|
|||||||
<i class='fa fa-clock-o' ></i >
|
<i class='fa fa-clock-o' ></i >
|
||||||
<span
|
<span
|
||||||
class='well'
|
class='well'
|
||||||
*ngIf="true ===!!config.allowSeveralHours" >
|
*ngIf="'true' === config.allowSeveralHours" >
|
||||||
{{"dates.multiple.different"|translate}}
|
{{"dates.multiple.different"|translate}}
|
||||||
</span >
|
</span >
|
||||||
<span
|
<span
|
||||||
class='well'
|
class='well'
|
||||||
*ngIf="false ===!!config.allowSeveralHours" >
|
*ngIf="'false' === config.allowSeveralHours" >
|
||||||
{{"dates.multiple.identical"|translate}}
|
{{"dates.multiple.identical"|translate}}
|
||||||
</span >
|
</span >
|
||||||
<div
|
<div
|
||||||
@ -59,13 +59,15 @@
|
|||||||
|
|
||||||
<!-- CASE different slices of the day-->
|
<!-- CASE different slices of the day-->
|
||||||
<div
|
<div
|
||||||
*ngIf="true ===!!config.allowSeveralHours"
|
*ngIf="'true' === config.allowSeveralHours"
|
||||||
class="several-times"
|
class="several-times"
|
||||||
>
|
>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
*ngFor="let time of choice.timeList "
|
*ngFor="let time of choice.timeList ; index as idTime"
|
||||||
class="time-choice"
|
class="time-choice"
|
||||||
>
|
>
|
||||||
|
{{idTime}})
|
||||||
<i class='fa fa-square-o' ></i >
|
<i class='fa fa-square-o' ></i >
|
||||||
{{time.literal}}
|
{{time.literal}}
|
||||||
</div >
|
</div >
|
||||||
@ -73,13 +75,14 @@
|
|||||||
</div >
|
</div >
|
||||||
<!-- CASE all dates having the same slices of the day-->
|
<!-- CASE all dates having the same slices of the day-->
|
||||||
<div
|
<div
|
||||||
*ngIf="false ===!!config.allowSeveralHours"
|
*ngIf="'false' === config.allowSeveralHours"
|
||||||
class="same-times"
|
class="same-times"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
*ngFor="let time of config.timeList "
|
*ngFor="let time of config.timeList "
|
||||||
class="time-choice"
|
class="time-choice"
|
||||||
>
|
>
|
||||||
|
<i class='fa fa-square-o' ></i >
|
||||||
{{time.literal}}
|
{{time.literal}}
|
||||||
</div >
|
</div >
|
||||||
</div >
|
</div >
|
||||||
|
Loading…
x
Reference in New Issue
Block a user