mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
changed agenda timepicker interval by 15 minutes
This commit is contained in:
@@ -121,7 +121,7 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" >
|
||||
|
||||
<mat-form-field appearance="none" class="date-hour-picker">
|
||||
<input matInput [ngxMatDatetimePicker]="picker1"
|
||||
@@ -130,8 +130,8 @@
|
||||
[disabled]="disabled"
|
||||
[min]="currentDate"
|
||||
>
|
||||
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #picker1
|
||||
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" (click)="setStartDate()"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #picker1
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
@@ -160,9 +160,9 @@
|
||||
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"
|
||||
|
||||
@@ -61,9 +61,9 @@ export class NewEventPage implements OnInit {
|
||||
public touchUi = false;
|
||||
public enableMeridian = false;
|
||||
public stepHour = 1;
|
||||
public stepMinute = 5;
|
||||
public stepSecond = 5;
|
||||
currentDate = new Date();
|
||||
public stepMinute = 15;
|
||||
public stepSecond = 15;
|
||||
currentDate = this.roundTimeQuarterHour();
|
||||
public color: ThemePalette = 'primary';
|
||||
recurringTypes = []
|
||||
selectedRecurringType: any;
|
||||
@@ -99,7 +99,7 @@ export class NewEventPage implements OnInit {
|
||||
Form: FormGroup;
|
||||
validateFrom = false;
|
||||
autoStartTime;
|
||||
autoEndTime;
|
||||
autoEndTime;
|
||||
|
||||
public options = [
|
||||
{ value: true, label: 'True' },
|
||||
@@ -131,13 +131,13 @@ export class NewEventPage implements OnInit {
|
||||
) {
|
||||
this.dateAdapter.setLocale('pt');
|
||||
this.loggeduser = userService.ValidatedUser;
|
||||
this.postEvent = new Event();
|
||||
this.postEvent = new Event();
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
// this.roundTimeQuarterHour();
|
||||
|
||||
if(!this.CalendarName) {
|
||||
this.CalendarName = this.loggeduser.Profile;
|
||||
@@ -210,6 +210,7 @@ export class NewEventPage implements OnInit {
|
||||
this.setIntervenientCC.emit(this.taskParticipantsCc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.date = new Date(2021,9,4,5,6,7);
|
||||
|
||||
@@ -217,6 +218,44 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// console.log("AFTER MINUTES: " +m);
|
||||
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 IF MINUTES: " +m);
|
||||
// console.log("AFTER HOURS: " +h);
|
||||
|
||||
return timeToReturn;
|
||||
}
|
||||
|
||||
setStartDate(){
|
||||
this.postEvent.StartDate = this.roundTimeQuarterHour();
|
||||
}
|
||||
|
||||
setEndDate(){
|
||||
this.postEvent.EndDate = this.postEvent.StartDate;
|
||||
}
|
||||
|
||||
runValidation() {
|
||||
this.validateFrom = true;
|
||||
if(new Date(this.postEvent.StartDate).getTime() > new Date(this.postEvent.EndDate).getTime()){
|
||||
|
||||
Reference in New Issue
Block a user