retake of hour selections from step 3 to step 4

This commit is contained in:
Tykayn 2021-11-22 15:56:43 +01:00 committed by tykayn
parent 96799c8485
commit dba514dd46
6 changed files with 52 additions and 73 deletions

View File

@ -2,3 +2,8 @@
max-width: 5em; max-width: 5em;
max-height: 5em; max-height: 5em;
} }
.main-footer {
a {
color: #fff;
}
}

View File

@ -1,6 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { defaultTimeOfDay } from '../../../../mocks/old-stuff/config/defaultConfigs'; import { defaultTimeOfDay } from '../../../../mocks/old-stuff/config/defaultConfigs';
import { DateChoice } from '../models/dateChoice.model'; import { DateChoice } from '../models/dateChoice.model';
import { environment } from '../../../environments/environment';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -126,7 +127,7 @@ export class DateUtilitiesService {
let input = `${date.getFullYear()}-${date.getMonth() + 1}-${day}`; let input = `${date.getFullYear()}-${date.getMonth() + 1}-${day}`;
return { return {
literal: this.formateDateToInputStringNg(date), literal: this.formateDateToInputStringNg(date),
timeSlices: Object.create(defaultTimeOfDay), timeSlices: environment.autofill_default_timeslices ? Object.create(defaultTimeOfDay) : [],
date_object: date, date_object: date,
date_input: input, date_input: input,
}; };

View File

@ -5,7 +5,6 @@
<h2 class="title is-2"> <h2 class="title is-2">
Choisissez les horaires Choisissez les horaires
</h2> </h2>
<app-wip-todo></app-wip-todo>
<div <div
class="days-list-having-separated-time-slices rounded-block" class="days-list-having-separated-time-slices rounded-block"
*ngFor="let dayChoice of pollService.dateChoiceList; index as day_id" *ngFor="let dayChoice of pollService.dateChoiceList; index as day_id"
@ -59,6 +58,16 @@
<h3 class="title is-3"> <h3 class="title is-3">
Choisissez les horaires ou options à appliquer à toutes les dates Choisissez les horaires ou options à appliquer à toutes les dates
</h3> </h3>
<button
(click)="pollService.addTime()"
*ngIf="false == pollService.allowSeveralHours"
class="button is-primary is-block is-fullwidth"
id="add_time_button"
>
<i class="fa fa-plus" aria-hidden="true"></i>
{{ 'dates.add_time' | translate }}
</button>
<div *ngFor="let timeSlice of pollService.timeList; index as id" class="time-choice padded"> <div *ngFor="let timeSlice of pollService.timeList; index as id" class="time-choice padded">
<label for="timeList_{{ id }}"> Horaire / option {{ id + 1 }} </label> <label for="timeList_{{ id }}"> Horaire / option {{ id + 1 }} </label>
<input <input
@ -71,11 +80,43 @@
<i class="fa fa-trash"></i> supprimer <i class="fa fa-trash"></i> supprimer
</button> </button>
</div> </div>
<div class="title" *ngIf="pollService.timeList.length">
<span class="count-dates">
{{ pollService.timeList.length }}
</span>
<span class="count-dates-txt">
{{ 'dates.count_time' | translate }}
(pour chaque jour)
</span>
</div>
<button class="is-primary button" (click)="applyTimeSlicesToDateChoices()"> <button class="is-primary button" (click)="applyTimeSlicesToDateChoices()">
Appliquer ces créneaux Appliquer ces créneaux
</button> </button>
</section> </section>
</section> </section>
<div class="section copy-paste">
<div class="actions">
<button
(click)="pollService.removeAllTimes()"
*ngIf="pollService.timeList.length && false == pollService.allowSeveralHours"
class="btn is-warning marged"
id="remove_time_button"
>
<i class="fa fa-trash" aria-hidden="true"></i>
Aucune plage horaire
</button>
<button
(click)="pollService.resetTimes()"
*ngIf="pollService.timeList.length && false == pollService.allowSeveralHours"
class="btn is-warning marged"
id="reset_time_button"
>
<i class="fa fa-refresh" aria-hidden="true"></i>
réinitialiser
</button>
</div>
</div>
</div> </div>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">

View File

@ -31,75 +31,6 @@
></app-day-list> ></app-day-list>
</div> </div>
</div> </div>
<div class="columns">
<div class="column">
<div class="dates-list">
<div class="actions">
<button
(click)="pollService.addTime()"
*ngIf="false == pollService.allowSeveralHours"
class="button is-primary is-block is-fullwidth"
id="add_time_button"
>
<i class="fa fa-plus" aria-hidden="true"></i>
{{ 'dates.add_time' | translate }}
</button>
<button class="button" (click)="pollService.allowSeveralHours = !pollService.allowSeveralHours">
<i class="fa fa-clock-o" aria-hidden="true"></i> Horaires différentes pour chaque jour
</button>
<button
(click)="pollService.removeAllTimes()"
*ngIf="pollService.timeList.length && false == pollService.allowSeveralHours"
class="btn is-warning marged"
id="remove_time_button"
>
<i class="fa fa-trash" aria-hidden="true"></i>
Aucune plage horaire
</button>
<button
(click)="pollService.resetTimes()"
*ngIf="pollService.timeList.length && false == pollService.allowSeveralHours"
class="btn is-warning marged"
id="reset_time_button"
>
<i class="fa fa-refresh" aria-hidden="true"></i>
réinitialiser
</button>
</div>
<div class="title" *ngIf="pollService.timeList.length">
<span class="count-dates">
{{ pollService.timeList.length }}
</span>
<span class="count-dates-txt">
{{ 'dates.count_time' | translate }}
(pour chaque jour)
</span>
</div>
<div
*ngIf="pollService.timeList.length && false == pollService.allowSeveralHours"
class="marged padded identical-dates"
>
<div cdkDropList class="example-list" (cdkDropListDropped)="drop($event)">
<div *ngFor="let time of pollService.timeList; index as id" class="time-choice" cdkDrag>
<label for="timeChoices_{{ id }}">
<i class="fa fa-clock-o" aria-hidden="true"></i>
</label>
<input
[(ngModel)]="time.literal"
name="timeChoices_{{ id }}"
type="text"
id="timeChoices_{{ id }}"
/>
<button (click)="pollService.timeList.splice(id, 1)" class="btn btn-warning">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<button class="button is-secondary is-fullwidth" [routerLink]="['/administration/step/2']"> <button class="button is-secondary is-fullwidth" [routerLink]="['/administration/step/2']">

View File

@ -7,6 +7,6 @@
.calendar { .calendar {
margin-top: 1em; margin-top: 1em;
} }
#add_time_button { .text-date-list {
margin-bottom: 1em; margin-top: 1em;
} }

View File

@ -14,6 +14,7 @@ export const environment = {
autofill_creation: true, autofill_creation: true,
advanced_options_display: false, advanced_options_display: false,
autofill_participation: false, autofill_participation: false,
autofill_default_timeslices: false,
showDemoWarning: false, showDemoWarning: false,
autoSendNewPoll: false, autoSendNewPoll: false,
showStepperShortcuts: true, showStepperShortcuts: true,