validated the last ocurrence date

This commit is contained in:
EQUILIBRIUM\hirondino.van-dunem
2022-07-06 09:12:57 +01:00
parent a25eea749e
commit 3a3ba605dd
8 changed files with 19 additions and 3 deletions
@@ -134,6 +134,7 @@
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date"
[(ngModel)]="postEvent.StartDate"
[min]="currentDate"
[max]="maxDate"
[disabled]="disabled"
>
@@ -162,6 +163,7 @@
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date"
[(ngModel)]="postEvent.EndDate"
[min]="currentDate"
[max]="maxDate"
[disabled]="disabled"
>
@@ -213,6 +215,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
[disabled]="disabled"
[min]="postEvent.EndDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
@@ -247,6 +247,9 @@ export class EditEventPage implements OnInit {
IsRecurring: new FormControl(this.postEvent.IsRecurring, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [
Validators.required
]),
Date: new FormControl(new Date(this.postEvent.StartDate).getTime() <= new Date(this.postEvent.EndDate).getTime()? 'ok': null,[
Validators.required
]),
@@ -122,6 +122,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.StartDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
@@ -153,6 +154,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.EndDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
@@ -202,6 +204,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
[disabled]="disabled"
[min]="postEvent.EndDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
@@ -50,6 +50,7 @@ export class NewEventPage implements OnInit {
public stepMinute = 5;
public stepSecond = 5;
public color: ThemePalette = 'primary';
currentDate = new Date();
Form: FormGroup;
validateFrom = false
@@ -279,7 +280,7 @@ export class NewEventPage implements OnInit {
CalendarName: new FormControl(this.postEvent.CalendarName, [
Validators.required
]),
Date: new FormControl(this.dateValid, [
Date: new FormControl(new Date(this.postEvent.StartDate).getTime() <= new Date(this.postEvent.EndDate).getTime()? 'ok': null,[
Validators.required
]),
Categories: new FormControl(this.postEvent.Category, [
@@ -288,6 +289,10 @@ export class NewEventPage implements OnInit {
participantes: new FormControl(this.taskParticipants, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [
Validators.required
]),
})
}
@@ -198,6 +198,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
[disabled]="disabled"
[min]="postEvent.EndDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
@@ -183,7 +183,7 @@ export class EditEventPage implements OnInit {
Categories: new FormControl(this.postEvent.Category, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type, [
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [
Validators.required
]),
participantes: new FormControl(this.taskParticipants, [
@@ -211,6 +211,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
[disabled]="disabled"
[min]="postEvent.EndDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
@@ -265,7 +265,7 @@ export class NewEventPage implements OnInit {
dateEnd: new FormControl(this.postEvent.EndDate, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence, [
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [
Validators.required
]),
participantes: new FormControl(this.taskParticipants, [