diff --git a/src/app/shared/agenda/approve-event/approve-event.page.html b/src/app/shared/agenda/approve-event/approve-event.page.html index e3f5efea6..3ebb71116 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.html +++ b/src/app/shared/agenda/approve-event/approve-event.page.html @@ -66,9 +66,14 @@

{{customDate}}

das {{loadedEvent.workflowInstanceDataFields.StartDate | date: 'HH:mm'}} às {{loadedEvent.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}

-

{{loadedEvent.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ loadedEvent.workflowInstanceDataFields.StartDate | date: 'dd/M/yy'}}

-

(Não se repete)

-

Repete

+

{{loadedEvent.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ loadedEvent.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}}

+

+ Diário + Semanal + Mensal + Anual + (Não se repete) +

diff --git a/src/app/shared/agenda/approve-event/approve-event.page.ts b/src/app/shared/agenda/approve-event/approve-event.page.ts index 6c36d15cc..443d71d60 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.ts +++ b/src/app/shared/agenda/approve-event/approve-event.page.ts @@ -71,6 +71,7 @@ export class ApproveEventPage implements OnInit { this.processes.GetTask(this.serialNumber).subscribe(res => { this.loadedEvent = res; + console.log(this.loadedEvent); this.today = new Date(res.workflowInstanceDataFields.StartDate); // this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts index 7fa166360..c1f5bffcd 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts @@ -179,6 +179,9 @@ export class EditEventToApprovePage implements OnInit { } onSelectedRecurringChanged(ev:any) { + + this.calculetedLastOccurrence(ev); + if(ev.length > 1) { this.eventProcess.workflowInstanceDataFields.OccurrenceType = ev.filter(data => data != '-1'); @@ -188,6 +191,45 @@ export class EditEventToApprovePage 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.eventProcess.workflowInstanceDataFields.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; + } + + } + setOtherData() { if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) { this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { @@ -291,6 +333,8 @@ export class EditEventToApprovePage implements OnInit { } }) + console.log(this.eventProcess); + const event: EventToApproveEdit = { SerialNumber: this.eventProcess.serialNumber, Body: this.eventProcess.workflowInstanceDataFields.Body, diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index 25e0db208..34b210462 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -119,14 +119,6 @@ export class EditEventPage implements OnInit { this.setIntervenient.emit(this.taskParticipants); this.setIntervenientCC.emit(this.taskParticipantsCc); - this.isEventEdited = false; - - if(this.postEvent.IsRecurring == false) { - this.isRecurring = "Não se repete"; - } - else{ - this.isRecurring = "Repete"; - } } this.initCalendarName = this.postEvent.CalendarName; @@ -137,6 +129,8 @@ export class EditEventPage implements OnInit { this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString(); + this.postEvent.EventRecurrence.LastOccurrence = this.currentDate; + setTimeout(() => { this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString(); @@ -226,6 +220,8 @@ export class EditEventPage implements OnInit { } onSelectedRecurringChanged(ev:any){ + + this.calculetedLastOccurrence(ev); if(ev.length > 1){ @@ -236,6 +232,45 @@ export class EditEventPage 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; + } + + } + async save() { diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index f4fa0b50a..b9819c308 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -365,6 +365,8 @@ export class NewEventPage implements OnInit { onSelectedRecurringChanged(ev:any){ + this.calculetedLastOccurrence(ev); + if(ev.length > 1){ this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1'); @@ -374,8 +376,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; + } + + } + async save() { this.injectValidation() diff --git a/src/app/shared/agenda/view-event/view-event.page.html b/src/app/shared/agenda/view-event/view-event.page.html index 834cf7de3..185e14d62 100644 --- a/src/app/shared/agenda/view-event/view-event.page.html +++ b/src/app/shared/agenda/view-event/view-event.page.html @@ -53,13 +53,12 @@

{{customDate}}

das {{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}

{{loadedEvent.StartDate | date: 'd/M/yy' }} - {{ loadedEvent.StartDate | date: 'dd/M/yy'}}

-

(Não se repete)

-

+

Diário Semanal Mensal Anual - Nunca + (Não se repete)

diff --git a/src/app/shared/agenda/view-event/view-event.page.ts b/src/app/shared/agenda/view-event/view-event.page.ts index 8cf67a75b..8855a1897 100644 --- a/src/app/shared/agenda/view-event/view-event.page.ts +++ b/src/app/shared/agenda/view-event/view-event.page.ts @@ -105,6 +105,7 @@ export class ViewEventPage implements OnInit { this.eventsService.getEvent(this.eventId).subscribe(res => { this.loadedEvent = res; + console.log(this.loadedEvent); this.today = new Date(res.StartDate); this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); }, (error)=> {