Merge branch 'ocurrence-mobile-tablet' of https://bitbucket.org/equilibriumito/gabinete-digital into developer

This commit is contained in:
Eudes Inácio
2022-06-24 16:13:26 +01:00
5 changed files with 89 additions and 6 deletions
@@ -198,6 +198,8 @@ export class NewEventPage implements OnInit {
}
onSelectedRecurringChanged(ev:any) {
this.calculetedLastOccurrence(ev);
if(ev.length > 1) {
@@ -208,6 +210,45 @@ export class NewEventPage implements OnInit {
}
}
calculetedLastOccurrence(type:number){
console.log(type);
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.postEvent.EndDate);
if (opcao == true) {
time.setDate(time.getDate() + valor);
this.postEvent.EventRecurrence.LastOccurrence = time;
} else {
time = new Date(
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getMinutes()
);
this.postEvent.EventRecurrence.LastOccurrence = time;
}
}
runValidation() {
this.validateFrom = true;