diff --git a/src/app/modals/delegar/delegar.page.ts b/src/app/modals/delegar/delegar.page.ts index e18ed8185..5378e69ee 100644 --- a/src/app/modals/delegar/delegar.page.ts +++ b/src/app/modals/delegar/delegar.page.ts @@ -14,6 +14,7 @@ import { AlertService } from 'src/app/services/alert.service'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { ToastService } from 'src/app/services/toast.service'; +import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page'; @Component({ selector: 'app-delegar', @@ -105,44 +106,66 @@ export class DelegarPage implements OnInit { } } - async addParticipants(){ - console.log('HERE'); + /* async addParticipants() { this.adding = "intervenient"; - if(window.innerWidth <= 800){ + this.contacts = this.taskParticipants; + + if(window.innerWidth <=800) { + + this.showAttendees=false; + const modal = await this.modalController.create({ - component: AddParticipantsModalPage, - componentProps: { - eventPersons: this.eventAttendees + component: AttendeesPageModal, + componentProps: { + adding: this.adding, + taskParticipants: this.taskParticipants, + taskParticipantsCc: this.taskParticipantsCc }, - cssClass: 'book-meeting-modal', + cssClass: 'attendee', backdropDismiss: false }); - + await modal.present(); - - modal.onDidDismiss().then((res) => { - /* this.taskParticipants = res.data; - let newattendees: EventPerson[] = res['data']; - if(newattendees != null){ - newattendees.forEach(newattendee => { - let att = { - "EmailAddress": newattendee.EmailAddress, - "Name": newattendee.Name, - "IsRequired": true - }; - if(this.eventAttendees == null){ - this.eventAttendees = null; - } - this.eventAttendees = att; - console.log(att); - - }); - } */ + + 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; + this.showAttendees=true } + } */ + + async setContact(data:EventPerson[]) { + + if(this.adding == "intervenient"){ + this.taskParticipants = data; + } else if (this.adding == "CC") { + + this.taskParticipantsCc = data; + } + + } + + async setIntervenient(data) { + this.taskParticipants = data; + } + + async setIntervenientCC(data) { + this.taskParticipantsCc = data; + } + + async closeComponent() { + this.showAttendees = false; } async distartExpedientModal(){