put back leaving modal, and focus on hour choice when we add one for a day

This commit is contained in:
tykayn 2022-03-21 13:50:38 +01:00 committed by Baptiste Lemoine
parent 5e92466854
commit 778f5b4716
2 changed files with 3 additions and 12 deletions

View File

@ -39,7 +39,7 @@
<div class="add-time-choice">
<button
class="has-text-primary has-no-border is-large-button has-text-left has-background-transparent has-background-plus has-background-icon-left is-filtered-icon-primary"
(click)="addChoiceForDay(day_id, dayChoice)"
(click)="addChoiceHourForDay(day_id, dayChoice)"
>
{{ 'hours.add' | translate }}
</button>

View File

@ -51,25 +51,16 @@ export class StepFourComponent implements OnInit {
});
}
addChoiceForDay(day_id, dayChoice: DateChoice): void {
addChoiceHourForDay(day_id, dayChoice: DateChoice): void {
let lastDateChoice = this.pollService.dateChoiceList[this.pollService.dateChoiceList.length];
let lastDateChoiceObject = this.dateUtilitiesService.addDaysToDate(
this.pollService.dateChoiceList.length,
new Date()
);
if (lastDateChoice && lastDateChoice.date_object) {
lastDateChoiceObject = lastDateChoice.date_object;
} else {
lastDateChoiceObject = new Date();
}
dayChoice.timeSlices.push({
literal: '',
});
dayChoice.timeSlices.sort((a: any, b: any) => {
return a.date_object - b.date_object;
});
this.focusOnChoice(day_id, this.storageService.dateChoices.length - 1);
this.focusOnChoice(day_id, dayChoice.timeSlices.length - 1);
}
focusOnChoice(day_id, index): void {