Merge branch 'bugfix/event-approve-mobile-date' into develop

This commit is contained in:
gilson.manuel
2022-07-11 16:55:58 +01:00
2 changed files with 48 additions and 4 deletions
@@ -111,6 +111,7 @@
placeholder="Choose a date"
[(ngModel)]="startDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
@@ -138,6 +139,7 @@
placeholder="Choose a date"
[(ngModel)]="endDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
@@ -196,6 +198,7 @@
placeholder="Choose a date"
[(ngModel)]="eventProcess.workflowInstanceDataFields.LastOccurrence"
[disabled]="disabled"
[min]="endDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
@@ -51,6 +51,7 @@ export class EditEventToApproveComponent implements OnInit {
public stepSecond = 5;
recurringTypes: any;
selectedRecurringType: any;
currentDate = new Date()
showLoader = false
@@ -181,14 +182,54 @@ export class EditEventToApproveComponent implements OnInit {
}
onSelectedRecurringChanged(ev:any){
/*
this.calculetedLastOccurrence(ev);
if(ev.length > 1){
this.selectedRecurringType = ev.filter(data => data != '-1');
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
}
if(ev.length == 0){
this.selectedRecurringType = "-1";
} */
this.postEvent.EventRecurrence.Type = "-1";
}
}
calculetedLastOccurrence(type:number){
var valor;
var opcao: boolean;
if (type == 0) {
valor = 7;
opcao = true;
} else if(type == 1){
valor = 30;
opcao = true;
} else if(type == 2){
valor = 1;
opcao = false;
}else if(type == 3){
valor = 5;
opcao = false;
}
this.defineLastOccurrence(valor, opcao);
}
defineLastOccurrence(valor:number, opcao:boolean){
var time = new Date(this.endDate);
if (opcao == true) {
time.setDate(time.getDate() + valor);
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
} else {
time = new Date(
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getMinutes()
);
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
}
}
openLastOccurrence() {