changed agenda timepicker interval by 15 minutes

This commit is contained in:
Hirondino Van-Dunem
2022-12-15 17:54:01 +01:00
parent eb2cfbd5c3
commit 042e815748
6 changed files with 847 additions and 32314 deletions
@@ -124,7 +124,7 @@
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" (click)="setStartDate()"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
@@ -147,16 +147,17 @@
<!--
[className]="Form?.get('Subject')?.invalid ? 'input-error ion-input-class flex-grow-1' : 'ion-input-class ion-input-class flex-grow-1' "
-->
<div (click)="openFim()" class="ion-input-class flex-grow-1 justify-center align-center materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<div class="ion-input-class flex-grow-1 justify-center align-center materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<mat-form-field appearance="none" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Data de fim*"
[(ngModel)]="postEvent.EndDate"
[disabled]="disabled"
[min]="currentDate"
[min]="postEvent.StartDate"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim" (click)="setEndDate()"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
@@ -47,10 +47,10 @@ export class NewEventPage implements OnInit {
public touchUi = false;
public enableMeridian = false;
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
public stepMinute = 15;
public stepSecond = 15;
public color: ThemePalette = 'primary';
currentDate = new Date();
currentDate = this.roundTimeQuarterHour();
Form: FormGroup;
validateFrom = false
@@ -164,10 +164,7 @@ export class NewEventPage implements OnInit {
if( window.innerWidth >= 1024){
this.modalController.dismiss();
}
};
};
}
@@ -175,6 +172,43 @@ export class NewEventPage implements OnInit {
this.modalController.dismiss();
}
roundTimeQuarterHour() {
var timeToReturn = new Date();
var minutes = timeToReturn.getMinutes();
var hours = timeToReturn.getHours();
// console.log("MINUTOS: " +minutes);
// console.log("BEFORE MINUTES: " +(Math.round(minutes/15) * 15));
var m = (Math.round(minutes/15) * 15) % 60;
var h = minutes > 52 ? (hours === 23 ? 0 : ++hours) : hours;
if (m == 0) {
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}else{
if(minutes > m){
m = m + 15;
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}
}
console.log("AFTER MINUTES: " +m);
console.log("AFTER HOURS: " +h);
return timeToReturn;
}
setStartDate(){
this.postEvent.StartDate = this.roundTimeQuarterHour();
}
setEndDate(){
this.postEvent.EndDate = this.postEvent.StartDate;
}
getRecurrenceTypes() {
this.eventService.getRecurrenceTypes().subscribe( res => {