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
+697 -32284
View File
File diff suppressed because it is too large Load Diff
@@ -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
@@ -166,15 +166,49 @@ export class NewEventPage implements OnInit {
}
};
}
close() {
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 => {
@@ -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,7 +130,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"
@@ -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;
@@ -137,7 +137,7 @@ export class NewEventPage implements OnInit {
ngOnInit() {
// this.roundTimeQuarterHour();
if(!this.CalendarName) {
this.CalendarName = this.loggeduser.Profile;
@@ -211,12 +211,51 @@ export class NewEventPage implements OnInit {
}
this.date = new Date(2021,9,4,5,6,7);
this.injectValidation();
}
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()){
+53 -7
View File
@@ -1,46 +1,92 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
// const DEV = {
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
// apiChatUrl: 'https://www.tabularium.pt/api/v1/',
// apiWsChatUrl: 'wss://www.tabularium.pt/websocket',
// defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
// defaultuserpwd: 'tabteste@006', //tabteste@006,
// }
// const QEI = {
// apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/',
// apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket',
// apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
// defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
// defaultuserpwd: 'tabteste@006', //tabteste@006,
// }
export const environment = {
production: false,
//apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
//apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
// apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
// apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
apiURL: 'https://gd-api.oapr.gov.ao/api/',
//apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
apiWsChatUrl: 'ws://gd-chat.oapr.gov.ao/websocket',
// apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
// apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/',
apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */
domain: 'gabinetedigital.local', //gabinetedigital.local
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
defaultuserpwd: 'tabteste@006', //tabteste@006,
chatOffline: true
chatOffline: true,
presidencia: false,
};
/*
* For easier debugging in dev elopment mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.