Improve add event and edit event

This commit is contained in:
Peter Maquiran
2021-04-07 11:52:28 +01:00
parent 9718a9f98d
commit b7b5533260
9 changed files with 277 additions and 140 deletions
+2 -5
View File
@@ -112,7 +112,6 @@ export class AgendaPage implements OnInit {
// this will make toggle add event and. // this will make toggle add event and.
showEventEditOrOpen: "edit" | "add" | "" = "" showEventEditOrOpen: "edit" | "add" | "" = ""
prEventList: Event[]; prEventList: Event[];
mdEventList: Event[] mdEventList: Event[]
@@ -894,7 +893,8 @@ export class AgendaPage implements OnInit {
const modal = await this.modalCtrl.create({ const modal = await this.modalCtrl.create({
component: ViewEventPage, component: ViewEventPage,
componentProps:{ componentProps:{
eventId: eventId eventId: eventId,
adding: this.adding
}, },
cssClass: 'modal modal-desktop', cssClass: 'modal modal-desktop',
backdropDismiss: false backdropDismiss: false
@@ -986,7 +986,6 @@ export class AgendaPage implements OnInit {
} }
async AproveEventEditEvent(data){ async AproveEventEditEvent(data){
console.log(data)
this.postEvent =data; this.postEvent =data;
this.mobileComponent.transparentEventToApprove= true; this.mobileComponent.transparentEventToApprove= true;
this.mobileComponent.showAddNewEvent = true; this.mobileComponent.showAddNewEvent = true;
@@ -998,8 +997,6 @@ export class AgendaPage implements OnInit {
if(Array.isArray(data)){ if(Array.isArray(data)){
if(data.length >= 1){ if(data.length >= 1){
console.log('save!!!',data.length);
console.log(data);
this.contacts = data ; this.contacts = data ;
} }
} }
@@ -34,10 +34,9 @@ export class ApproveEventModalPage implements OnInit {
private popoverController: PopoverController, private popoverController: PopoverController,
private menu: MenuController, private menu: MenuController,
private alertService: AlertService, private alertService: AlertService,
) ) {
{
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
} }
ngOnInit() { ngOnInit() {
this.getTask(); this.getTask();
@@ -72,7 +71,6 @@ export class ApproveEventModalPage implements OnInit {
} }
approveTask(serialNumber:string){ approveTask(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Aprovar" } let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
this.processes.PostTaskAction(body); this.processes.PostTaskAction(body);
this.alertService.presentAlert('Operação realizada com sucesso!'); this.alertService.presentAlert('Operação realizada com sucesso!');
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
@@ -80,7 +78,6 @@ export class ApproveEventModalPage implements OnInit {
} }
emendTask(serialNumber:string){ emendTask(serialNumber:string){
/* console.log('Emendar'); */
this.menu.close(); this.menu.close();
this.openEmendMessageModal(serialNumber); this.openEmendMessageModal(serialNumber);
this.modalController.dismiss(null); this.modalController.dismiss(null);
@@ -89,7 +86,6 @@ export class ApproveEventModalPage implements OnInit {
rejectTask(serialNumber:string){ rejectTask(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Rejeitar" } let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
this.processes.PostTaskAction(body); this.processes.PostTaskAction(body);
this.alertService.presentAlert('Operação realizada com sucesso!'); this.alertService.presentAlert('Operação realizada com sucesso!');
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
@@ -134,7 +130,6 @@ export class ApproveEventModalPage implements OnInit {
"ReviewerComments": res.data, "ReviewerComments": res.data,
} }
} }
console.log(body);
this.processes.PostTaskAction(body); this.processes.PostTaskAction(body);
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
this.alertService.presentAlert('Operação realizada com sucesso!'); this.alertService.presentAlert('Operação realizada com sucesso!');
@@ -144,7 +144,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="!taskParticipants" class="list-people-title">Adicionar intervenientes</ion-label> <ion-label *ngIf="taskParticipants.length == 0" class="list-people-title">Adicionar intervenientes</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -164,7 +164,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="!taskParticipantsCc" class="list-people-title">Adicionar intervenientes</ion-label> <ion-label *ngIf="taskParticipantsCc.length == 0" class="list-people-title">Adicionar intervenientes</ion-label>
<ion-label *ngFor="let participant of taskParticipantsCc">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipantsCc">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -224,7 +224,7 @@
[taskParticipants]="taskParticipants" [taskParticipants]="taskParticipants"
[taskParticipantsCc]="taskParticipantsCc" [taskParticipantsCc]="taskParticipantsCc"
[adding]="adding" [adding]="adding"
(dynamicSetIntervenient)="dynamicSetIntervenient($event)"
></app-attendee-modal> ></app-attendee-modal>
</div> </div>
@@ -71,9 +71,11 @@ export class EditEventPage implements OnInit {
}; };
} }
close(){ close(){
this.modalController.dismiss(); this.modalController.dismiss();
} }
save(){ save(){
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => { this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
@@ -90,13 +92,13 @@ export class EditEventPage implements OnInit {
async openAttendees() { async openAttendees() {
this.adding = 'intervenient';
if(window.innerWidth <= 1024) { if(window.innerWidth <= 1024) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AttendeesPage, component: AttendeesPage,
componentProps: { componentProps: {
eventAttendees: this.postEvent.Attendees adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
}, },
cssClass: 'attendee', cssClass: 'attendee',
backdropDismiss: false backdropDismiss: false
@@ -105,41 +107,39 @@ export class EditEventPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{ if(data){
let newattendees: EventPerson[] = data['data']; data = data['data'];
this.setIntervenient(newattendees);
const newAttendees: EventPerson[] = data['taskParticipants'];
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
this.setIntervenient(newAttendees);
this.setIntervenientCC(newAttendeesCC);
} }
}); });
} }
} }
async dynamicSetIntervenient(data){ setIntervenient(data){
this.taskParticipants = data['taskParticipants'];
this.taskParticipantsCc = data['taskParticipantsCc'];
}
async setIntervenient(data){
this.taskParticipants = data; this.taskParticipants = data;
this.postEvent.Attendees = data; this.postEvent.Attendees = data;
} }
async setIntervenientCC(data){ setIntervenientCC(data){
this.taskParticipantsCc = data; this.taskParticipantsCc = data;
} }
async addParticipants(){ addParticipants(){
this.adding = 'intervenient' this.adding = 'intervenient'
this.openAttendees(); this.openAttendees();
} }
async addParticipantsCC(){ addParticipantsCC(){
this.adding = 'CC' this.adding = 'CC'
this.openAttendees(); this.openAttendees();
} }
async closeComponent(){}
} }
@@ -15,7 +15,6 @@
<div class="ion-item-container"> <div class="ion-item-container">
<ion-input placeholder="Assunto" [(ngModel)]="postEvent.Subject"></ion-input> <ion-input placeholder="Assunto" [(ngModel)]="postEvent.Subject"></ion-input>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -130,22 +129,30 @@
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon>
</div> </div>
<div (click)="openAttendees()" class="ion-input-class-no-height"> <div class="ion-input-class-no-height">
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label class="list-people-title">Adicionar participantes</ion-label> <ion-label *ngIf="taskParticipants.length == 0" class="list-people-title">Adicionar interveniente</ion-label>
<ion-label hidden >Text</ion-label> <div class="list-people">
</ion-list> <ion-item lines="none">
<ion-list>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
</div>
</ion-list>
</ion-item> </ion-item>
</div> </div>
<div class="add-people"> <div (click)="addParticipants()" class="add-people">
<ion-icon slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- HIDDEN -->
<div hidden class="container-div"> <div hidden class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -155,12 +162,19 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label class="list-people-title">Com conhecimento</ion-label> <ion-label class="list-people-title">Com conhecimento</ion-label>
<ion-label hidden >Text</ion-label> <div class="list-people">
</ion-list> <ion-item lines="none">
<ion-list>
<ion-label *ngIf="!taskParticipants" class="list-people-title">Adicionar intervenientes</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
</div>
</ion-list>
</ion-item> </ion-item>
</div> </div>
<div class="add-people"> <div (click)="addParticipantsCC()" class="add-people">
<ion-icon slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
</div> </div>
</div> </div>
@@ -11,6 +11,7 @@ import { AttendeesPage } from '../../events/attendees/attendees.page';
templateUrl: './new-event.page.html', templateUrl: './new-event.page.html',
styleUrls: ['./new-event.page.scss'], styleUrls: ['./new-event.page.scss'],
}) })
export class NewEventPage implements OnInit { export class NewEventPage implements OnInit {
postEvent: Event; postEvent: Event;
eventBody: EventBody; eventBody: EventBody;
@@ -21,6 +22,11 @@ export class NewEventPage implements OnInit {
selectedDate: Date; selectedDate: Date;
minDate: string; minDate: string;
adding: "intervenient" | "CC";
taskParticipants: any = [];
taskParticipantsCc: any = [];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private navParams: NavParams, private navParams: NavParams,
@@ -28,7 +34,7 @@ export class NewEventPage implements OnInit {
) { ) {
this.postEvent = new Event(); this.postEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""}; this.eventBody = { BodyType : "1", Text : ""};
this.postEvent.Body = this.eventBody; this.postEvent.Body = this.eventBody;
this.profile = this.navParams.get('profile'); this.profile = this.navParams.get('profile');
this.selectedSegment = this.navParams.get('segment'); this.selectedSegment = this.navParams.get('segment');
@@ -88,21 +94,19 @@ export class NewEventPage implements OnInit {
}; };
} }
window.onresize = (event) => { window.onresize = (event) => {
// if not mobile remove all component // if not mobile remove all component
if( window.innerWidth >= 1024){ if( window.innerWidth >= 1024){
this.modalController.dismiss(); this.modalController.dismiss();
} }
}; };
} }
close(){ close(){
this.modalController.dismiss(); this.modalController.dismiss();
} }
save(){ save(){
console.log(this.postEvent); /* console.log(this.postEvent);
console.log(this.profile); console.log(this.profile); */
if(this.profile=='mdgpr'){ if(this.profile=='mdgpr'){
@@ -114,12 +118,13 @@ export class NewEventPage implements OnInit {
this.modalController.dismiss(this.postEvent); this.modalController.dismiss(this.postEvent);
} }
async openAttendees() async openAttendees() {
{
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AttendeesPage, component: AttendeesPage,
componentProps: { componentProps: {
eventAttendees: this.postEvent.Attendees eventAttendees: this.postEvent.Attendees,
adding: this.adding,
taskParticipants: this.taskParticipants
}, },
cssClass: 'attendee', cssClass: 'attendee',
backdropDismiss: false backdropDismiss: false
@@ -128,12 +133,36 @@ export class NewEventPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{ if(data){
let newattendees: EventPerson[] = data['data']; data = data['data'];
this.postEvent.Attendees = newattendees;
const newAttendees: EventPerson[] = data['taskParticipants'];
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
this.setIntervenient(newAttendees);
this.setIntervenientCC(newAttendeesCC);
} }
}); });
} }
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();
}
} }
@@ -1,55 +1,84 @@
<ion-header class="ion-no-border"> <ion-header class="ion-no-border px-20">
<ion-toolbar> <ion-toolbar class="px-10">
<ion-title>Participantes</ion-title> <ion-title class="pa-0">Adicionar intervenientes</ion-title>
</ion-toolbar>
<ion-toolbar>
<ion-segment [(ngModel)]="segment">
<ion-segment-button value="true">
Intervenientes
</ion-segment-button>
<ion-segment-button value="false">
Com Conhecimento
</ion-segment-button>
</ion-segment>
</ion-toolbar> </ion-toolbar>
<ion-searchbar class="attendee-search-bar" (ionChange)="onChange($event)" placeholder="Insira email para adicionar destinatário"></ion-searchbar><!-- [(ngModel)]="searchCountryString" -->
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
</ion-header> </ion-header>
<ion-content>
<ion-item-group> <ion-content class="height-100 overflow-y-auto">
<ion-button class="btn-ok-no-width" fill="clear" color="#fff" shape="round" (click)="addAttendees()" expand="block">
<ion-label>Adicionar participantes</ion-label> <ion-item-group class="d-flex flex-column height-100 ">
</ion-button> <ion-list lines="none" class="flex-grow-1 overflow-y-auto height-100" >
</ion-item-group> <ion-item-sliding class="px-20">
<ion-item-group [ngSwitch]="segment" *ngFor="let attendee of eventAttendees"> <div *ngFor="let attendee of contacts;">
<ion-list *ngSwitchCase="attendee.IsRequired.toString()"> <ion-item lines="none" (click)="selectContact(attendee)" *ngIf="filterSearchList(attendee)" >
<ion-item-sliding> <div class="pr-10">
<ion-item-options side="end"> <ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
<ion-item-option color="danger" (click)="removeAttendee(attendee)">Apagar</ion-item-option> </div>
</ion-item-options> <ion-label>
<ion-item lines="none"> <h3>{{ attendee.Name }}</h3>
<ion-icon slot="start" name="person"></ion-icon> <p>{{ attendee.EmailAddress }}</p>
</ion-label>
</ion-item>
</div>
</ion-item-sliding>
</ion-list>
<hr/>
<ion-list lines="none" *ngIf="taskParticipants.length >= 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
<div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="taskParticipants.length >= 1 || taskParticipantsCc.length >= 1" > Destinatário</div>
<ion-item-sliding class="px-20">
<ion-item lines="none" *ngFor="let attendee of taskParticipants;" class="d-flex">
<div class="pr-10">
<ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
</div>
<ion-label> <ion-label>
<h3>{{ attendee.Name }}</h3> <h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p> <p>{{ attendee.EmailAddress }}</p>
</ion-label> </ion-label>
<div style="color:red" (click)="remove(attendee)">
X
</div>
</ion-item>
</ion-item-sliding>
</ion-list>
<ion-list lines="none" *ngIf="taskParticipantsCc.length >= 1 && adding == 'CC' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
<div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="taskParticipants.length >= 1 || taskParticipantsCc.length >= 1" > Destinatário</div>
<ion-item-sliding class="px-20">
<ion-item lines="none" *ngFor="let attendee of taskParticipantsCc;" class="d-flex">
<div class="pr-10">
<ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
</div>
<ion-label>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</ion-label>
<div style="color:red" (click)="remove(attendee)">
X
</div>
</ion-item> </ion-item>
</ion-item-sliding> </ion-item-sliding>
</ion-list> </ion-list>
</ion-item-group> </ion-item-group>
</ion-content> </ion-content>
<!-- Hide footer in gabinete-digital -->
<ion-footer class="ion-no-border"> <ion-footer class="ion-no-border" *ngIf="currentPath != '/home/gabinete-digital' ">
<ion-toolbar class="btn-div"> <ion-toolbar class="width-100 d-flex justify-space-between px-20">
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-button class="btn-cancel" fill="clear" color="#061b52" (click)="close()"> <ion-button class="btn-cancel" fill="clear" color="#061b52" (click)="close()">
<ion-label>Cancelar</ion-label> <ion-label>Cancelar</ion-label>
<ion-icon name="close" slot="start"></ion-icon> <ion-icon name="close" slot="start"></ion-icon>
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
<ion-title></ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-button class="btn-ok" fill="clear" color="#fff" (click)="save()"> <ion-button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<ion-label>OK</ion-label> <ion-label>Gravar</ion-label>
<ion-icon name="checkmark" slot="start"></ion-icon> <ion-icon name="checkmark" slot="start"></ion-icon>
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
+120 -47
View File
@@ -1,8 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { EventPerson } from 'src/app/models/eventperson.model'; import { EventPerson } from 'src/app/models/eventperson.model';
import { EventsService } from 'src/app/services/events.service'; import { ModalController, NavParams } from '@ionic/angular';
import { ModalController, NavController } from '@ionic/angular'; import { ContactsService } from 'src/app/services/contacts.service';
import { AttendeeModalPage } from '../attendee-modal/attendee-modal.page';
@Component({ @Component({
selector: 'app-attendees', selector: 'app-attendees',
@@ -11,69 +10,143 @@ import { AttendeeModalPage } from '../attendee-modal/attendee-modal.page';
}) })
export class AttendeesPage implements OnInit { export class AttendeesPage implements OnInit {
eventAttendees: EventPerson[]; // Defined by the API
segment:string = "true"; contacts: EventPerson[];
shouldShowCancel:boolean = true; showLoader: boolean = false;
selectedContact: EventPerson[] =[];
eventPersons: EventPerson[];
adding: "intervenient" | "CC";
currentPath = window.location.pathname;
searchCountryString = ''; // initialize your searchCountryString string empty taskParticipants:EventPerson[] = [];
taskParticipantsCc:EventPerson[] = [];
constructor(private eventService: EventsService, private modalCtrl: ModalController,
private navCtrl: NavController) {
}
constructor(
private modalCtrl: ModalController,
private contactsService: ContactsService,
private navParams: NavParams,
private modalController: ModalController) {
this.adding = this.navParams.get('adding');
this.taskParticipants = this.navParams.get('taskParticipants');
this.taskParticipantsCc = this.navParams.get('taskParticipantsCc');
}
ngOnInit() { ngOnInit() {
this.fetchContacts("");
if(this.taskParticipants == null || this.taskParticipants == undefined){
this.taskParticipants = [];
}
if(this.taskParticipantsCc == null || this.taskParticipantsCc == undefined){
this.taskParticipantsCc = [];
}
} }
ngOnChanges(event){}
save(){ save(){
this.modalCtrl.dismiss(this.eventAttendees);
this.modalController.dismiss({
'taskParticipants': this.taskParticipants,
'taskParticipantsCc': this.taskParticipantsCc
});
} }
close(){ close(){
this.modalCtrl.dismiss(null); this.modalController.dismiss(false);
} }
removeAttendee(attendee: EventPerson) onChange(evt: any) {
{ this.fetchContacts(evt.detail.value);
let index: number = this.eventAttendees.findIndex((att) => {
return att.EmailAddress == attendee.EmailAddress
});
this.eventAttendees.splice(index, 1);
} }
async addAttendees() filterSearchList(itm: EventPerson): boolean {
{
const modal = await this.modalCtrl.create({
component: AttendeeModalPage,
componentProps: {
eventPersons: this.eventAttendees
},
cssClass: 'attendee-modal',
backdropDismiss: false
});
await modal.present(); if(this.adding == "intervenient"){
const result = this.taskParticipants.find((contact, index)=>{
modal.onDidDismiss().then((data) => { if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
let newattendees: EventPerson[] = data['data']; index = index;
return contact;
}
});
return undefined == result;
if (newattendees != null) } else if (this.adding == "CC") {
const result = this.taskParticipantsCc.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index;
return contact;
}
});
return undefined == result;
}
}
remove(itm: EventPerson){
if(this.adding == "intervenient"){
this.taskParticipants = this.taskParticipants.filter((contact, index) =>{
if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){
return contact;
}
return false;
});
} else if (this.adding == "CC") {
this.taskParticipantsCc = this.taskParticipantsCc.filter((contact, index) =>{
if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){
return contact;
}
return false;
});
}
}
async selectContact(itm: EventPerson){
if(this.adding == "intervenient"){
this.taskParticipants.push(itm);
} else if (this.adding == "CC") {
this.taskParticipantsCc.push(itm);
}
}
async fetchContacts(filter: string) {
this.showLoader = true;
this.contactsService.getContacts(filter).subscribe(result =>
{ {
newattendees.forEach(newattendee => { if (this.eventPersons != null)
let att = { {
"EmailAddress": newattendee.EmailAddress, this.eventPersons.forEach(attendee => {
"Name": newattendee.Name, const index: number = result.findIndex((cont) => {
"IsRequired": (this.segment == "true") return cont.EmailAddress == attendee.EmailAddress
}; });
if (this.eventAttendees == null)
{ result.splice(index, 1);
this.eventAttendees = new Array(); });
} }
this.eventAttendees.push(att);
}); this.contacts = result;
this.showLoader = false;
} }
}); );
} }
} }