Attendees Modal done

This commit is contained in:
Paulo Pinto
2020-08-26 16:07:29 +01:00
parent e8e47b8680
commit 306c0ecd19
4 changed files with 55 additions and 31 deletions
@@ -12,9 +12,8 @@ import { AttendeeModalPage } from '../attendee-modal/attendee-modal.page';
export class AttendeesPage implements OnInit {
eventAttendees: EventPerson[];
segment:string = "required";
segment:string = "true";
shouldShowCancel:boolean = true;
showAttendees: EventPerson[];
searchCountryString = ''; // initialize your searchCountryString string empty
@@ -24,18 +23,6 @@ export class AttendeesPage implements OnInit {
ngOnInit() {
this.loadAttendees();
}
onSegmentChange(){
this.loadAttendees();
}
loadAttendees(){
let isrequired: boolean = (this.segment == "required");
this.showAttendees = this.eventAttendees.filter(function(person) {
return person.IsRequired == isrequired;
});
}
save(){
@@ -45,6 +32,15 @@ export class AttendeesPage implements OnInit {
close(){
this.modalCtrl.dismiss(null);
}
removeAttendee(attendee: EventPerson)
{
let index: number = this.eventAttendees.findIndex((att) => {
return att.EmailAddress == attendee.EmailAddress
});
this.eventAttendees.splice(index, 1);
}
async addAttendees()
{
@@ -68,10 +64,13 @@ export class AttendeesPage implements OnInit {
let att = {
"EmailAddress": newattendee.EmailAddress,
"Name": newattendee.Name,
"IsRequired": (this.segment == "required")
"IsRequired": (this.segment == "true")
};
if (this.eventAttendees == null)
{
this.eventAttendees = new Array();
}
this.eventAttendees.push(att);
this.showAttendees.push(att);
});
}
});