commit all

This commit is contained in:
Peter Maquiran
2021-04-05 15:10:28 +01:00
parent 3727e73c1d
commit 016c006edc
7 changed files with 771 additions and 30 deletions
@@ -6,9 +6,9 @@
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
</ion-header>
<ion-content class="height-100 ">
<ion-content class="height-100 overflow-y-auto">
<ion-item-group class="d-flex flex-column height-100">
<ion-item-group class="d-flex flex-column height-100 ">
<ion-list lines="none" class="flex-grow-1 overflow-y-auto height-100" >
<ion-item-sliding class="px-20">
<div *ngFor="let attendee of contacts;">
@@ -26,10 +26,27 @@
</ion-item-sliding>
</ion-list>
<hr/>
<div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="selectedContact.length >= 1">Destinatário</div>
<ion-list lines="none" *ngIf="selectedContact.length >= 1" 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-list lines="none" *ngIf="taskParticipants.length >= 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
<ion-item-sliding class="px-20">
<ion-item *ngFor="let attendee of selectedContact;" class="d-flex">
<ion-item *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>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</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" >
<ion-item-sliding class="px-20">
<ion-item *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>
@@ -2,6 +2,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { ContactsService } from 'src/app/services/contacts.service';
import { EventPerson } from 'src/app/models/eventperson.model';
import { el } from 'date-fns/locale';
@Component({
selector: 'app-attendee-modal',
@@ -16,33 +17,43 @@ export class AttendeeModalPage implements OnInit {
selectedContact: EventPerson[] =[];
eventPersons: EventPerson[];
@Input() taskParticipants = [];
@Input() taskParticipantsCc= [];
@Input() eventAttendees: EventPerson[];
constructor(private modalCtrl: ModalController, private contactsService: ContactsService) { }
@Output() closeComponent = new EventEmitter<any>();
@Output() setContact = new EventEmitter<any>();
@Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>();
currentPath = window.location.pathname;
@Input() adding: "intervenient" | "CC";
ngOnInit() {
this.fetchContacts("");
this.selectedContact = this.eventAttendees;
this.taskParticipants = this.taskParticipants
this.taskParticipantsCc = this.taskParticipantsCc;
}
ngOnChanges(){
console.log('change !!!')
}
ngOnChanges(event){}
save(){
// set data to agenda component
this.setContact.emit(this.selectedContact);
this.setIntervenient.emit(this.taskParticipants);
this.setIntervenientCC.emit(this.taskParticipantsCc);
this.closeComponent.emit();
}
setContactWithClose(){
if(this.currentPath == '/home/gabinete-digital'){
this.setContact.emit(this.selectedContact);
this.setIntervenient.emit(this.taskParticipants);
this.setIntervenientCC.emit(this.taskParticipantsCc);
}
}
@@ -58,37 +69,75 @@ export class AttendeeModalPage implements OnInit {
filterSearchList(itm: EventPerson): boolean {
const result = this.selectedContact.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index;
return contact;
}
});
return undefined == result;
if(this.adding == "intervenient"){
const result = this.taskParticipants.find((contact, index)=>{
if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){
index = index;
return contact;
}
});
return undefined == result;
} 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){
this.selectedContact = this.selectedContact.filter((contact, index) =>{
if(this.adding == "intervenient"){
if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){
return contact;
}
return false;
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;
});
}
// run only in gabinete digital
this.setContactWithClose();
}
async selectContact(itm: EventPerson){
this.selectedContact.push(itm);
if(this.adding == "intervenient"){
this.taskParticipants.push(itm);
} else if (this.adding == "CC") {
this.taskParticipantsCc.push(itm);
}
// run only in gabinete digital
this.setContactWithClose();
}