diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts index 1034261b4..a9678402e 100644 --- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts @@ -7,7 +7,6 @@ import { Participant } from 'src/app/models/participant.model'; import { Folder } from 'src/app/models/folder.model'; import { AuthService } from 'src/app/services/auth.service'; import { ProcessesService } from 'src/app/services/processes.service'; -import { StorageService } from 'src/app/services/storage.service'; import { AddParticipantsCcModalPage } from '../add-participants-cc-modal/add-participants-cc-modal.page'; import { AddParticipantsModalPage } from '../add-participants-modal/add-participants-modal.page'; import { environment } from 'src/environments/environment'; @@ -40,10 +39,11 @@ export class ExpedientTaskModalPage implements OnInit { dispatchFolder: Folder; participants: Participant[]; - contacts: EventPerson[] = []; + contacts= []; // trigger hide and show for attendee component showAttendees= false; + adding: "intervenient" | "CC" constructor( private modalController: ModalController, @@ -78,17 +78,8 @@ export class ExpedientTaskModalPage implements OnInit { ngOnInit() { this.taskDate = new Date(this.task.taskStartDate); - /* this.authService.userData$.subscribe((res:any)=>{ - console.log(res); - }); - console.log(this.user); */ - /* console.log(this.task) */ - - /* console.log(this.task.serialNumber); */ - this.getAttachments(); - /* console.log(this.getSubjectType()); */ - + this.getAttachments(); } close(){ @@ -159,63 +150,78 @@ export class ExpedientTaskModalPage implements OnInit { } async addParticipants(){ - const modal = await this.modalController.create({ - component: AddParticipantsModalPage, - componentProps: { - eventPersons: this.participants - }, - cssClass: 'add-participants-modal', - 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 = { - 'UserEmail': newattendee.EmailAddress, - 'UserType': 'I', - }; - if(this.participants == null){ - this.participants = new Array(); - } - this.participants.push(att); + + this.adding = "intervenient"; + this.contacts = this.taskParticipants; + + if(window.innerWidth <=1024){ + const modal = await this.modalController.create({ + component: AddParticipantsModalPage, + componentProps: { + eventPersons: this.participants + }, + cssClass: 'add-participants-modal', + backdropDismiss: false }); - } - this.postData.UsersSelected = this.participants; - console.log(this.postData); - }); + await modal.present(); + modal.onDidDismiss().then((res) => { + this.taskParticipants = res.data; + let newattendees: EventPerson[] = res['data']; + if(newattendees!= null){ + newattendees.forEach(newattendee => { + let att = { + 'UserEmail': newattendee.EmailAddress, + 'UserType': 'I', + }; + if(this.participants == null){ + this.participants = new Array(); + } + this.participants.push(att); + }); + } + this.postData.UsersSelected = this.participants; + console.log(this.postData); + }); + } else { + + } } async addParticipantsCc(){ - const modal = await this.modalController.create({ - component: AddParticipantsCcModalPage, - componentProps: { - eventPersons: this.participants - }, - cssClass: 'add-participants-cc-modal', - backdropDismiss: false - }); - await modal.present(); - modal.onDidDismiss().then((res) => { - this.taskParticipantsCc = res.data; - let newattendees: EventPerson[] = res['data']; - if(newattendees!= null){ - newattendees.forEach(newattendee => { - let att = { - 'UserEmail': newattendee.EmailAddress, - 'UserType': 'CC', - }; - if(this.participants == null){ - this.participants = new Array(); - } - this.participants.push(att); + + this.adding = "CC"; + this.contacts = this.taskParticipantsCc; + + if(window.innerWidth <=1024){ + const modal = await this.modalController.create({ + component: AddParticipantsCcModalPage, + componentProps: { + eventPersons: this.participants + }, + cssClass: 'add-participants-cc-modal', + backdropDismiss: false }); - } - this.postData.UsersSelected = this.participants; - console.log(this.postData); - }); + await modal.present(); + modal.onDidDismiss().then((res) => { + this.taskParticipantsCc = res.data; + let newattendees: EventPerson[] = res['data']; + if(newattendees!= null){ + newattendees.forEach(newattendee => { + let att = { + 'UserEmail': newattendee.EmailAddress, + 'UserType': 'CC', + }; + if(this.participants == null){ + this.participants = new Array(); + } + this.participants.push(att); + }); + } + this.postData.UsersSelected = this.participants; + console.log(this.postData); + }); + } + } async distartExpedientModal(){ @@ -236,7 +242,17 @@ export class ExpedientTaskModalPage implements OnInit { } async setContact(data:EventPerson[]){ - this.contacts = data; + + if(this.adding == "intervenient"){ + console.log('intervenient') + this.contacts = data; + this.taskParticipants = data; + } else if (this.adding == "CC") { + + console.log('CCCC') + this.taskParticipantsCc = data; + } + } async closeComponent(){ diff --git a/src/app/shared/agenda/new-event/new-event.component.html b/src/app/shared/agenda/new-event/new-event.component.html index f4cd0dfdc..ba1953a6c 100644 --- a/src/app/shared/agenda/new-event/new-event.component.html +++ b/src/app/shared/agenda/new-event/new-event.component.html @@ -134,7 +134,7 @@