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 c7df52414..007e5038e 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 @@ -95,8 +95,6 @@ export class EditEventToApprovePage implements OnInit { taskParticipantsCc: any = []; adding: "intervenient" | "CC" = "intervenient"; - Location = '' - showAttendees = false; InstanceId: string; @@ -123,53 +121,59 @@ export class EditEventToApprovePage implements OnInit { ngOnInit() { - if(!this.restoreTemporaryData()){ - alert('restore!!') + if(this.restoreTemporaryData()){ + this.setOtherData() + } else { + this.getTask(); + } - this.getTask(); - - // console.log(this.serialNumber); } async getTask() { - // console.log('this.eventProcess', this.eventProcess); - const result = await this.processes.GetTask(this.serialNumber).subscribe( result =>{ - this.eventProcess = result - - this.restoreDatepickerData() - - console.log(this.eventProcess.workflowInstanceDataFields.Subject) + this.processes.GetTask(this.serialNumber).subscribe( result =>{ + this.eventProcess = result + + this.restoreDatepickerData() // description let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '') this.eventProcess.workflowInstanceDataFields.Body = body - this.Location = this.eventProcess.workflowInstanceDataFields.Location this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId this.getAttachments() - - if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) { - this.isRecurring = "Não se repete"; - } - else { - this.isRecurring = "Repete"; - } + + this.setOtherData() - if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) { - this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { - if(e.IsRequired) { - this.taskParticipants.push(e); - } else { - this.taskParticipantsCc.push(e); - } - }) - } - + this.saveTemporaryData() }) } + setOtherData() { + + if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) { + this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { + if(e.IsRequired) { + this.taskParticipants.push(e); + } else { + this.taskParticipantsCc.push(e); + } + }) + } + + if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) { + this.isRecurring = "Não se repete"; + } + else { + this.isRecurring = "Repete"; + } + + this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId + + this.getAttachments() + } + close() { window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {} @@ -182,11 +186,11 @@ export class EditEventToApprovePage implements OnInit { //this.deleteTemporaryData(); } - save() { + save() { // set dates to eventProcess object this.getDatepickerData() - this.taskParticipantsCc.forEach(e=>{ + this.taskParticipantsCc.forEach( e => { e.IsRequired = false }) @@ -289,8 +293,6 @@ export class EditEventToApprovePage implements OnInit { async addParticipantsCC() { - // //this.saveTemporaryData(); - this.openAttendeesComponent.emit({ type: "CC" }); @@ -325,9 +327,6 @@ export class EditEventToApprovePage implements OnInit { } - // this.clearContact.emit(); - // } - async getAttachments() { let result: any = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();