default time for created days

This commit is contained in:
Tykayn 2021-05-18 12:45:51 +02:00 committed by tykayn
parent 3c4c0b5337
commit 0834ea3ffa
5 changed files with 19 additions and 14 deletions

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { DateChoice } from '../../../../mocks/old-stuff/config/defaultConfigs'; import { DateChoice, defaultTimeOfDay } from '../../../../mocks/old-stuff/config/defaultConfigs';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -104,22 +104,22 @@ export class DateUtilitiesService {
return [ return [
{ {
literal: this.formateDateToInputStringNg(ladate), literal: this.formateDateToInputStringNg(ladate),
timeList: [], timeList: defaultTimeOfDay,
date_object: ladate, date_object: ladate,
}, },
{ {
literal: this.formateDateToInputStringNg(ladate2), literal: this.formateDateToInputStringNg(ladate2),
timeList: [], timeList: defaultTimeOfDay,
date_object: ladate2, date_object: ladate2,
}, },
{ {
literal: this.formateDateToInputStringNg(ladate3), literal: this.formateDateToInputStringNg(ladate3),
timeList: [], timeList: defaultTimeOfDay,
date_object: ladate3, date_object: ladate3,
}, },
{ {
literal: this.formateDateToInputStringNg(ladate4), literal: this.formateDateToInputStringNg(ladate4),
timeList: [], timeList: defaultTimeOfDay,
date_object: ladate4, date_object: ladate4,
}, },
]; ];

View File

@ -18,8 +18,8 @@
> >
<i class="fa fa-check-square-o" *ngIf="form.value.hasSeveralHours"></i> <i class="fa fa-check-square-o" *ngIf="form.value.hasSeveralHours"></i>
<i class="fa fa-square-o" *ngIf="!form.value.hasSeveralHours"></i> <i class="fa fa-square-o" *ngIf="!form.value.hasSeveralHours"></i>
<span> horaires avancées</span>
<i class="fa fa-clock-o"></i> <i class="fa fa-clock-o"></i>
<span> horaires avancées</span>
</button> </button>
<div class="is-info notification"> <div class="is-info notification">
<span *ngIf="form.value.hasSeveralHours"> <span *ngIf="form.value.hasSeveralHours">

View File

@ -32,7 +32,9 @@
> >
<span class="button is-default" for="dateChoices_{{ id }}"> <span class="button is-default" for="dateChoices_{{ id }}">
<i class="icon fa fa-arrows-v"></i> <i class="icon fa fa-arrows-v"></i>
{{ choice.date_object | date: 'E':'Europe/Paris':'fr_FR' }} <span *ngIf="choice.date_object">
{{ choice.date_object | date: 'E':'Europe/Paris':'fr_FR' }}
</span>
</span> </span>
<input <input
[(ngModel)]="choice.date_object" [(ngModel)]="choice.date_object"

View File

@ -56,11 +56,11 @@ export class DayListComponent {
/** /**
* add a time period to a specific date choice, * add a time period to a specific date choice,
* focus on the new input * focus on the new input
* @param config * @param choice DateChoice
* @param id * @param id number
*/ */
addTimeToDate(config: any, id: number) { addTimeToDate(choice: DateChoice, id: number) {
this.timeList.push({ choice.timeList.push({
literal: '', literal: '',
}); });
const selector = '[ng-reflect-choice_label="dateTime_' + id + '_ dateList_' + (this.timeList.length - 1) + '"]'; const selector = '[ng-reflect-choice_label="dateTime_' + id + '_ dateList_' + (this.timeList.length - 1) + '"]';
@ -147,7 +147,10 @@ export class DayListComponent {
} }
isWeekendDay(date_object: Date) { isWeekendDay(date_object: Date) {
const day = date_object.getDay(); if (date_object) {
return day === 6 || day === 0; const day = date_object.getDay();
return day === 6 || day === 0;
}
return false;
} }
} }

View File

@ -105,7 +105,7 @@ export class FormComponent implements OnInit {
creatorEmail: '', creatorEmail: '',
description: 'RSVP', description: 'RSVP',
isAboutDate: true, isAboutDate: true,
hasSeveralHours: false, hasSeveralHours: true,
kind: 'date', kind: 'date',
password: '', password: '',
whoCanChangeAnswers: 'everybody', whoCanChangeAnswers: 'everybody',