diff --git a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts index 3a0ea4da1..8f82a2ce5 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts +++ b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts @@ -20,7 +20,7 @@ import { ToastService } from 'src/app/services/toast.service'; }) export class ApproveEventPage implements OnInit { event: Event; - loadedEvent:any; + loadedEvent:any = false loadedEvent1:any; loadedAttachments:any; customDate:any; @@ -51,7 +51,7 @@ export class ApproveEventPage implements OnInit { private animationController: AnimationController, private toastService: ToastService, ) { - + this.activatedRoute.paramMap.subscribe(params => { console.log(params["params"]); 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 b5b0ebb83..b12ffc718 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.ts +++ b/src/app/shared/agenda/approve-event/approve-event.page.ts @@ -52,16 +52,14 @@ export class ApproveEventPage implements OnInit { private iab: InAppBrowser, private animationController: AnimationController, private toastService: ToastService - ) { - // $$$ - + ) { + // Event to approve detailss } ngOnInit() { this.getTask(); this.getAttachments(); - // console.log(this.showAside); } notImplemented() { @@ -85,7 +83,7 @@ export class ApproveEventPage implements OnInit { }) } - async approveTask(serialNumber:string){ + async approveTask(serialNumber:string) { let body = { "serialNumber": serialNumber, "action": "Aprovar" } console.log(body); @@ -108,8 +106,6 @@ export class ApproveEventPage implements OnInit { }); */ } - - async rejectTask(serialNumber:string) { let body = { "serialNumber": serialNumber, "action": "Rejeitar" } @@ -124,13 +120,13 @@ export class ApproveEventPage implements OnInit { } } - - async getAttachments(){ + + async getAttachments() { this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise(); } - viewDocument(sourceId){ + viewDocument(sourceId) { this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{ /* console.log(res); */ const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); @@ -150,7 +146,7 @@ export class ApproveEventPage implements OnInit { return await popover.present(); } - async emendTask(serialNumber:string){ + async emendTask(serialNumber:string) { console.log('Desktop'); const modal = await this.modalController.create({ @@ -193,7 +189,7 @@ export class ApproveEventPage implements OnInit { //this.goBack(); } - goToEventsToApprove(){ + goToEventsToApprove() { let navigationExtras: NavigationExtras = { queryParams: { "eventos": true, @@ -203,32 +199,10 @@ export class ApproveEventPage implements OnInit { } + /** @description edit event to aprove */ async editar(serialNumber: string) { - if(window.innerWidth > 800){ - console.log('DESTOP'); - - this.EditApproveEventDismiss.emit(); - } - else{ - /* const modal = await this.modalController.create({ - component: EditEventToApproveComponent, - componentProps: { - serialNumber: serialNumber, - InstanceId:this.InstanceId - }, - cssClass: 'modal modal-desktop', - // backdropDismiss: false - }); - await modal.present(); - modal.onDidDismiss().then(res => { - this.getTask(); - this.getAttachments(); - }); */ - } + + this.EditApproveEventDismiss.emit(); } - - - - } diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html index 00b8d3014..224242d9f 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html @@ -13,7 +13,7 @@
- +
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 7aa91df30..022a24731 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 @@ -5,15 +5,13 @@ import * as moment from 'moment'; import { Attachment } from 'src/app/models/attachment.model'; import { EventPerson } from 'src/app/models/eventperson.model'; import { SearchDocument } from 'src/app/models/search-document'; -import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page'; import { SearchPage } from 'src/app/pages/search/search.page'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { EventsService } from 'src/app/services/events.service'; import { ProcessesService } from 'src/app/services/processes.service'; import { ToastService } from 'src/app/services/toast.service'; import { Event } from '../../../models/event.model'; -import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; - +import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { @@ -44,7 +42,6 @@ export class EditEventToApprovePage implements OnInit { public stepHour = 1; public stepMinute = 5; public stepSecond = 5; - public dateControlStart = new FormControl(moment("DD MM YYYY hh")); public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); @@ -65,7 +62,6 @@ export class EditEventToApprovePage implements OnInit { @Input() serialNumber: string - loadedAttachments: Attachment[]= [] eventProcess = { @@ -91,10 +87,8 @@ export class EditEventToApprovePage implements OnInit { show = false - postEvent: Event; isRecurring:string; isEventEdited: boolean; - segment:string = "true"; profile:string; eventAttendees: EventPerson[]; @@ -107,7 +101,7 @@ export class EditEventToApprovePage implements OnInit { showAttendees = false; - InstanceId: string + InstanceId: string; @Output() openAttendeesComponent = new EventEmitter(); @Output() clearContact = new EventEmitter(); @@ -115,67 +109,69 @@ export class EditEventToApprovePage implements OnInit { @Output() setIntervenientCC = new EventEmitter(); @Output() closeComponent = new EventEmitter(); + @Input() saveData: any; + constructor( private modalController: ModalController, private eventsService: EventsService, public alertController: AlertController, private attachmentsService: AttachmentsService, private processes:ProcessesService, - private animationController: AnimationController, private toastService: ToastService, ) { - - /* this.serialNumber = this.navParams.get('serialNumber'); */ - this.isEventEdited = false; this.dateControlStart = new FormControl(moment(new Date())); this.dateControlEnd = new FormControl(moment(new Date())); + console.log('saveDatas', this.saveData) + + alert(this.serialNumber) + + // if(!this.restoreTemporaryData()) { + // alert('restore') + + this.eventProcess = this.saveData + + // } + } ngOnInit() { this.getTask(); - console.log(this.serialNumber); } async getTask() { - console.log('this.eventProcess', this.eventProcess); + // this.eventProcess = result - const result = await this.processes.GetTask(this.serialNumber).subscribe( result =>{ - this.eventProcess = result - this.restoreDatepickerData() - console.log(this.eventProcess.workflowInstanceDataFields.Subject) - - // description - let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '') - this.eventProcess.workflowInstanceDataFields.Body = body - this.Location = this.eventProcess.workflowInstanceDataFields.Location + // 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"; + 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.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { + if(e.IsRequired) { + this.taskParticipants.push(e); + } else { + this.taskParticipantsCc.push(e); } - else { - this.isRecurring = "Repete"; - } - - this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { - if(e.IsRequired) { - this.taskParticipants.push(e); - } else { - this.taskParticipantsCc.push(e); - } - }) }) + } close() { - console.log('CLOSE'); - + this.closeComponent.emit(); /* this.setIntervenient.emit([]); this.setIntervenientCC.emit([]); @@ -220,7 +216,6 @@ export class EditEventToApprovePage implements OnInit { ReviewUserComment: '' } - console.log(event); this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ this.toastService.successMessage('Evento editado'); @@ -228,7 +223,6 @@ export class EditEventToApprovePage implements OnInit { this.toastService.badRequest('Evento não editado'); }) - this.loadedAttachments.forEach((document:any)=>{ if(document['action'] == 'add') { delete document.action @@ -248,104 +242,34 @@ export class EditEventToApprovePage implements OnInit { }) - this.modalController.dismiss(); } - /* async openAttendees() { - - if(window.innerWidth <= 1024) { - const modal = await this.modalController.create({ - component: AttendeesPageModal, - componentProps: { - adding: this.adding, - taskParticipants: this.taskParticipants, - taskParticipantsCc: this.taskParticipantsCc - }, - cssClass: 'attendee modal modal-desktop', - backdropDismiss: false - }); - - await modal.present(); - - modal.onDidDismiss().then((data) => { - - if(data){ - data = data['data']; - - const newAttendees: EventPerson[] = data['taskParticipants']; - const newAttendeesCC: EventPerson[] = data['taskParticipantsCc']; - - this.setIntervenient(newAttendees); - this.setIntervenientCC(newAttendeesCC); - } - }); - } else { - this.showAttendees = true - } - } - - setIntervenient(data){ - this.taskParticipants = data; - this.postEvent.Attendees = data; - } - - setIntervenientCC(data) { - this.taskParticipantsCc = data; - } - - addParticipants(){ - this.adding = 'intervenient' - - this.openAttendees(); - } - - addParticipantsCC(){ - - this.adding = 'CC' - this.openAttendees(); - } - - dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){ - this.taskParticipants = taskParticipants; - this.taskParticipantsCc = taskParticipantsCc; - } */ - async addParticipants() { + // async addParticipants() { - //this.saveTemporaryData(); + // //this.saveTemporaryData(); - this.openAttendeesComponent.emit({ - type: "intervenient" - }); + // this.openAttendeesComponent.emit({ + // type: "intervenient" + // }); - this.clearContact.emit(); - } + // this.clearContact.emit(); + // } - async addParticipantsCC() { + // async addParticipantsCC() { - //this.saveTemporaryData(); + // //this.saveTemporaryData(); - this.openAttendeesComponent.emit({ - type: "CC" - }); - - this.clearContact.emit(); - } - - saveTemporaryData() { - - this.getDatepickerData() - - window['temp.path:/home/agenda/edit-event-to-approve.page.ts'] = { - postEvent: this.postEvent, - segment: this.segment - } - } + // this.openAttendeesComponent.emit({ + // type: "CC" + // }); + // this.clearContact.emit(); + // } async getAttachments() { @@ -416,6 +340,36 @@ export class EditEventToApprovePage implements OnInit { } + + saveTemporaryData() { + + this.getDatepickerData() + + window['temp.path:/home/agenda/edit-event.component.ts'] = { + eventProcess: this.eventProcess + } + } + + + restoreTemporaryData(): boolean { + + const restoredData = window['temp.path:/home/agenda/edit-event.component.ts'] + + if(JSON.stringify(restoredData) != "{}" && undefined != restoredData){ + + + + this.eventProcess = restoredData.eventProcess + + this.restoreDatepickerData() + + return true; + } else { + return false; + } + + } + getDatepickerData() { this.eventProcess.workflowInstanceDataFields.StartDate = this.dateStart 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 82437eff7..fa7502004 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -20,7 +20,6 @@ import * as moment from 'moment'; }) export class EditEventPage implements OnInit { - stEvent: Event; isRecurring:string; isEventEdited: boolean; @@ -86,7 +85,6 @@ export class EditEventPage implements OnInit { public stepMinutes = [1, 5, 10, 15, 20, 25]; public stepSeconds = [1, 5, 10, 15, 20, 25]; - constructor( private modalController: ModalController, private eventsService: EventsService, @@ -97,7 +95,6 @@ export class EditEventPage implements OnInit { ngOnInit() { - if(!this.restoreTemporaryData()){ // clear @@ -128,7 +125,7 @@ export class EditEventPage implements OnInit { this.isEventEdited = false; - if(this.postEvent.IsRecurring == false){ + if(this.postEvent.IsRecurring == false) { this.isRecurring = "Não se repete"; } else{ @@ -139,7 +136,6 @@ export class EditEventPage implements OnInit { this.getAttachments(this.postEvent.EventId); this.restoreDatepickerData() - } close() { diff --git a/src/app/shared/agenda/event-list/event-list.page.ts b/src/app/shared/agenda/event-list/event-list.page.ts index 9096aa845..fa7015204 100644 --- a/src/app/shared/agenda/event-list/event-list.page.ts +++ b/src/app/shared/agenda/event-list/event-list.page.ts @@ -15,8 +15,8 @@ export class EventListPage implements OnInit { showLoader: boolean; - eventsPRList: any; - eventsMDGPRList: any; + eventsPRList: any = [] + eventsMDGPRList: any = [] eventPerson: EventPerson; eventBody: EventBody; categories: string[]; @@ -72,7 +72,6 @@ export class EventListPage implements OnInit { return eventSerialNumber == elem.serialNumber }); - console.log(a); this.approveEventDismiss.emit({ "serialNumber": eventSerialNumber,