mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
merge
This commit is contained in:
@@ -25,7 +25,7 @@ export class EditActionPage implements OnInit {
|
||||
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
|
||||
public maxDate: any;
|
||||
public stepHour = 1;
|
||||
public stepMinute = 5;
|
||||
public stepMinute = 15;
|
||||
public stepSecond = 5;
|
||||
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
|
||||
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
[(ngModel)]="folder.DateBegin"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
<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"
|
||||
@@ -83,7 +83,7 @@
|
||||
[(ngModel)]="folder.DateEnd"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
<mat-datepicker-toggle id="new-fim" matSuffix [for]="picker2"></mat-datepicker-toggle>
|
||||
<mat-datepicker-toggle id="new-fim" matSuffix [for]="picker2" (click)="setEndDate()"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #picker2
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
|
||||
@@ -23,7 +23,7 @@ export class NewActionPage implements OnInit {
|
||||
public touchUi = false;
|
||||
public enableMeridian = false;
|
||||
public stepHour = 1;
|
||||
public stepMinute = 5;
|
||||
public stepMinute = 15;
|
||||
public stepSecond = 5;
|
||||
currentDate = new Date();
|
||||
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
|
||||
@@ -134,7 +134,7 @@ export class NewActionPage implements OnInit {
|
||||
this.getActions.emit()
|
||||
} catch (error) {
|
||||
this.toastService._badRequest('Não foi possivel criar a acção presidencial')
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
@@ -144,4 +144,45 @@ export class NewActionPage implements OnInit {
|
||||
this.closeDesktopComponent.emit();
|
||||
}
|
||||
|
||||
|
||||
roundTimeQuarterHour() {
|
||||
var timeToReturn = new Date();
|
||||
var minutes = timeToReturn.getMinutes();
|
||||
var hours = timeToReturn.getHours();
|
||||
|
||||
var m = (Math.round(minutes/15) * 15) % 60;
|
||||
var h = minutes > 52 ? (hours === 23 ? 0 : ++hours) : hours;
|
||||
|
||||
if (m == 0) {
|
||||
if(minutes > m){
|
||||
m = m + 15;
|
||||
}
|
||||
timeToReturn.setHours(h);
|
||||
timeToReturn.setMinutes(m);
|
||||
}else{
|
||||
if(minutes > m){
|
||||
|
||||
m = m + 15;
|
||||
|
||||
timeToReturn.setHours(h);
|
||||
timeToReturn.setMinutes(m);
|
||||
}else {
|
||||
timeToReturn.setHours(h);
|
||||
timeToReturn.setMinutes(m);
|
||||
}
|
||||
}
|
||||
|
||||
// console.log("AFTER IF MINUTES: " +m);
|
||||
// console.log("AFTER HOURS: " +h);
|
||||
|
||||
return timeToReturn;
|
||||
}
|
||||
|
||||
setStartDate(){
|
||||
this.dateControlStart = new FormControl(moment(this.roundTimeQuarterHour()));
|
||||
}
|
||||
|
||||
setEndDate(){
|
||||
this.dateControlEnd = this.dateControlStart;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user