diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.ts b/src/app/pages/gabinete-digital/event-list/event-list.page.ts index 6ed678863..a24365d5f 100644 --- a/src/app/pages/gabinete-digital/event-list/event-list.page.ts +++ b/src/app/pages/gabinete-digital/event-list/event-list.page.ts @@ -41,12 +41,12 @@ export class EventListPage implements OnInit { } - // this.LoadToApproveEvents(); + this.LoadToApproveEvents(); this.router.events.forEach((event) => { if(event instanceof NavigationEnd && event.url == this.router.url) { - // this.LoadToApproveEvents(); + this.LoadToApproveEvents(); } }); diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index bb96dc2e5..b2791351e 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -123,14 +123,14 @@
- + + +
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index 12d23f4de..a2d758010 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { ProcessesService } from 'src/app/services/processes.service'; import { AlertService } from 'src/app/services/alert.service'; -import { EventsService } from 'src/app/services/events.service'; import { ModalController } from '@ionic/angular'; import { EventListPage } from './event-list/event-list.page'; import { ExpedientePage } from './expediente/expediente.page'; @@ -59,16 +58,22 @@ export class GabineteDigitalPage implements OnInit { }; this.activatedRoute.queryParams.subscribe(params => { - if(params["show"]){ - // this.openExpedientListPage(); + if(params["show"]) { + this.openExpedientListPage(); + this.selectedElement='Correspondence' } - else if(params["events"]){ - // this.openEventsToApprovePage("MDGPR"); + else if(params["events"]) { + this.openEventsToApprovePage("MDGPR"); + this.selectedElement='approval' + + } else { + this.openEventsToApprovePage('MDGPR'); + this.selectedElement='approval' } }); - - } + + } closeAllDesktopComponent(){ this.desktopComponent = { @@ -83,11 +88,11 @@ export class GabineteDigitalPage implements OnInit { this.router.events.forEach((event) => { if(event instanceof NavigationEnd && event.url == this.router.url) { - //this.LoadCounts(); + this.LoadCounts(); } }); - // this.LoadCounts(); + this.LoadCounts(); /* this.eventService.getAllMdEvents.subscribe(res=>{ console.log(res); diff --git a/src/app/services/attachments.service.ts b/src/app/services/attachments.service.ts index 2f281bbf3..1d0992d31 100644 --- a/src/app/services/attachments.service.ts +++ b/src/app/services/attachments.service.ts @@ -74,7 +74,7 @@ export class AttachmentsService { return this.http.post(`${geturl}`, body, options); } - deleteEventAttachmentById(attachmentId) { + deleteEventAttachmentById(attachmentId) { let geturl = environment.apiURL + `Attachments/Delete?attachmentId=${attachmentId}`; diff --git a/src/app/shared/agenda/edit-event/edit-event.component.ts b/src/app/shared/agenda/edit-event/edit-event.component.ts index b6c24c673..fb4932087 100644 --- a/src/app/shared/agenda/edit-event/edit-event.component.ts +++ b/src/app/shared/agenda/edit-event/edit-event.component.ts @@ -54,6 +54,7 @@ export class EditEventComponent implements OnInit { ngOnInit() { if(!this.restoreTemporaryData()){ + // clear if(this.postEvent){ if( this.postEvent.Body){ @@ -118,7 +119,11 @@ export class EditEventComponent implements OnInit { header: 'Evento actualizado', buttons: ['OK'] }); - await alert.present(); + + + setTimeout(()=>{ + alert.dismiss(); + }, 1500); }); diff --git a/src/app/shared/agenda/event-list/event-list.component.ts b/src/app/shared/agenda/event-list/event-list.component.ts index c5ef3efe1..ba845ab01 100644 --- a/src/app/shared/agenda/event-list/event-list.component.ts +++ b/src/app/shared/agenda/event-list/event-list.component.ts @@ -44,11 +44,11 @@ export class EventListComponent implements OnInit { this.profile = 'PR' } - // this.LoadToApproveEvents(); + this.LoadToApproveEvents(); this.router.events.forEach((event) => { if(event instanceof NavigationEnd && event.url == this.router.url) { - // this.LoadToApproveEvents(); + this.LoadToApproveEvents(); } }); } diff --git a/src/app/shared/agenda/new-event/new-event.component.ts b/src/app/shared/agenda/new-event/new-event.component.ts index 4f0152386..b2468a3a9 100644 --- a/src/app/shared/agenda/new-event/new-event.component.ts +++ b/src/app/shared/agenda/new-event/new-event.component.ts @@ -29,7 +29,7 @@ export class NewEventPage implements OnInit { @Output() setIntervenient = new EventEmitter(); @Output() setIntervenientCC = new EventEmitter(); - @Input() postEvent: Event; + postEvent: Event; @Output() onAddEvent = new EventEmitter(); @Output() openAttendeesComponent = new EventEmitter(); @Output() clearContact = new EventEmitter(); @@ -47,8 +47,9 @@ export class NewEventPage implements OnInit { ) {} ngOnInit() { - + if(!this.restoreTemporaryData()){ + // clear this.postEvent = new Event(); this.eventBody = { BodyType : "1", Text : ""}; @@ -124,7 +125,6 @@ export class NewEventPage implements OnInit { this.setIntervenientCC.emit(this.taskParticipantsCc); } - } async getDoc(){ @@ -154,14 +154,12 @@ export class NewEventPage implements OnInit { this.setIntervenientCC.emit([]); } - - async save(){ this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); - if(this.documents.length >= 0){ + if(this.documents.length >= 0) { this.postEvent.HasAttachments = true; } @@ -184,8 +182,14 @@ export class NewEventPage implements OnInit { }; }); - DocumentToSave.forEach((attachments) => { - this.attachmentsService.setEventAttachmentById(attachments).subscribe(); + DocumentToSave.forEach((attachments, i) => { + this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{ + + if(DocumentToSave.length == (i+1)){ + this.close(); + } + }); + }); }); @@ -196,7 +200,7 @@ export class NewEventPage implements OnInit { const eventId: string = id; - const toDocumentTosSave: EventAttachment[] = this.documents.map((e) => { + const DocumentToSave: EventAttachment[] = this.documents.map((e) => { return { SourceTitle: e.Assunto, ParentId: eventId, @@ -209,12 +213,21 @@ export class NewEventPage implements OnInit { }; }); - toDocumentTosSave.forEach((attachments) => { - this.attachmentsService.setEventAttachmentById(attachments); + DocumentToSave.forEach((attachments, i) => { + this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{ + + if(DocumentToSave.length == (i+1)){ + this.close(); + } + }); + }); }); } + + + this.close(); } removeAttachment(index: number){ diff --git a/src/app/shared/event/attendee-modal/attendee-modal.page.html b/src/app/shared/event/attendee-modal/attendee-modal.page.html index b84c22a6e..223498086 100644 --- a/src/app/shared/event/attendee-modal/attendee-modal.page.html +++ b/src/app/shared/event/attendee-modal/attendee-modal.page.html @@ -30,10 +30,10 @@
- -
Destinatário
+ +
Destinatário
- +
@@ -47,11 +47,11 @@
- -
Destinatário
+ +
Destinatário
- +
diff --git a/src/app/shared/event/attendee-modal/attendee-modal.page.ts b/src/app/shared/event/attendee-modal/attendee-modal.page.ts index cafc69fd9..0fecef51e 100644 --- a/src/app/shared/event/attendee-modal/attendee-modal.page.ts +++ b/src/app/shared/event/attendee-modal/attendee-modal.page.ts @@ -15,20 +15,29 @@ export class AttendeeModalPage implements OnInit { showLoader: boolean = false; eventPersons: EventPerson[]; - @Input() taskParticipants:EventPerson[] = []; - @Input() taskParticipantsCc:EventPerson[] = []; - - constructor( - private modalCtrl: ModalController, - private contactsService: ContactsService ) { - - } @Output() closeComponent = new EventEmitter(); @Output() setIntervenient = new EventEmitter(); @Output() setIntervenientCC = new EventEmitter(); @Output() dynamicSetIntervenient = new EventEmitter(); + + + @Input() taskParticipants:EventPerson[] = []; + @Input() taskParticipantsCc:EventPerson[] = []; + + LtaskParticipants: EventPerson[] = []; + LtaskParticipantsCc: EventPerson[] = []; + + constructor( + private modalCtrl: ModalController, + private contactsService: ContactsService ) { + + this.LtaskParticipants = this.taskParticipants; + this.LtaskParticipantsCc = this.taskParticipantsCc; + + } + currentPath = window.location.pathname; @Input() adding: "intervenient" | "CC"; @@ -37,12 +46,12 @@ export class AttendeeModalPage implements OnInit { this.fetchContacts(""); - if(this.taskParticipants == null || this.taskParticipants == undefined) { - this.taskParticipants = []; + if(this.LtaskParticipants == null || this.LtaskParticipants == undefined) { + this.LtaskParticipants = []; } - if(this.taskParticipantsCc == null || this.taskParticipantsCc == undefined) { - this.taskParticipantsCc = []; + if(this.LtaskParticipantsCc == null || this.LtaskParticipantsCc == undefined) { + this.LtaskParticipantsCc = []; } } @@ -52,23 +61,26 @@ export class AttendeeModalPage implements OnInit { } save(){ - this.setIntervenient.emit(this.taskParticipants); - this.setIntervenientCC.emit(this.taskParticipantsCc); + this.setIntervenient.emit(this.LtaskParticipants); + this.setIntervenientCC.emit(this.LtaskParticipantsCc); this.closeComponent.emit(); } - setContactWithClose(){ - if(this.currentPath == '/home/gabinete-digital'){ - this.setIntervenient.emit(this.taskParticipants); - this.setIntervenientCC.emit(this.taskParticipantsCc); + setContactWithClose() { + + if(this.currentPath == '/home/gabinete-digital') { + console.log('set!!!!! ') + this.setIntervenient.emit(this.LtaskParticipants); + this.setIntervenientCC.emit(this.LtaskParticipantsCc); } - console.log('data', this.taskParticipants, this.taskParticipantsCc ); + /* console.log('data', this.LtaskParticipants, this.LtaskParticipantsCc ); */ this.dynamicSetIntervenient.emit({ - taskParticipants: this.taskParticipants, - taskParticipantsCc: this.taskParticipantsCc + LtaskParticipants: this.LtaskParticipants, + LtaskParticipantsCc: this.LtaskParticipantsCc }) + } async selectContact(itm: EventPerson){ @@ -76,12 +88,12 @@ export class AttendeeModalPage implements OnInit { if(this.adding == "intervenient") { itm.IsRequired = true; - this.taskParticipants.push(itm); + this.LtaskParticipants.push(itm); } else if (this.adding == "CC") { itm.IsRequired = false; - this.taskParticipantsCc.push(itm); + this.LtaskParticipantsCc.push(itm); } else { // alert('bug') } @@ -101,7 +113,7 @@ export class AttendeeModalPage implements OnInit { filterSearchList(itm: EventPerson): boolean { - const result1 = this.taskParticipants.find((contact, index)=>{ + const result1 = this.LtaskParticipants.find((contact, index)=>{ if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){ index = index; @@ -115,7 +127,7 @@ export class AttendeeModalPage implements OnInit { } - const result2 = this.taskParticipantsCc.find((contact, index)=>{ + const result2 = this.LtaskParticipantsCc.find((contact, index)=>{ if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){ index = index; @@ -137,7 +149,7 @@ export class AttendeeModalPage implements OnInit { if(this.adding == "intervenient"){ - this.taskParticipants = this.taskParticipants.filter((contact, index) =>{ + this.LtaskParticipants = this.LtaskParticipants.filter((contact, index) =>{ if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){ return contact; @@ -148,7 +160,7 @@ export class AttendeeModalPage implements OnInit { } else if (this.adding == "CC") { - this.taskParticipantsCc = this.taskParticipantsCc.filter((contact, index) =>{ + this.LtaskParticipantsCc = this.LtaskParticipantsCc.filter((contact, index) =>{ if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){ return contact;