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-height: 5em;
}
.main-footer {
a {
color: #fff;
}
}

View File

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

View File

@ -5,7 +5,6 @@
<h2 class="title is-2">
Choisissez les horaires
</h2>
<app-wip-todo></app-wip-todo>
<div
class="days-list-having-separated-time-slices rounded-block"
*ngFor="let dayChoice of pollService.dateChoiceList; index as day_id"
@ -59,6 +58,16 @@
<h3 class="title is-3">
Choisissez les horaires ou options à appliquer à toutes les dates
</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">
<label for="timeList_{{ id }}"> Horaire / option {{ id + 1 }} </label>
<input
@ -71,11 +80,43 @@
<i class="fa fa-trash"></i> supprimer
</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>
<button class="is-primary button" (click)="applyTimeSlicesToDateChoices()">
Appliquer ces créneaux
</button>
</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 class="columns">
<div class="column">

View File

@ -31,75 +31,6 @@
></app-day-list>
</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="column">
<button class="button is-secondary is-fullwidth" [routerLink]="['/administration/step/2']">

View File

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

View File

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