Improve attendess

This commit is contained in:
Peter Maquiran
2021-04-08 13:39:48 +01:00
parent 2b60d175c7
commit afc4f68cdd
9 changed files with 99 additions and 63 deletions
@@ -22,25 +22,25 @@ export class EditEventComponent implements OnInit {
eventAttendees: EventPerson[];
minDate: string;
@Input() taskParticipants: EventPerson[];
@Input() taskParticipantsCc: any = [];
@Input() profile:string;
@Input() selectedSegment: string;
@Input() postEvent: any;
@Output() clearContact = new EventEmitter<any>();
@Output() openAttendeesComponent = new EventEmitter<any>();
@Output() closeComponent = new EventEmitter<any>();
@Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>();
@Output() clearPostEvent = new EventEmitter<any>();
constructor(
private modalController: ModalController,
private eventsService: EventsService,
public alertController: AlertController,
)
{
) {
}
@@ -48,8 +48,18 @@ export class EditEventComponent implements OnInit {
if(this.postEvent){
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
}
console.log(this.postEvent);
// attendees list
if(this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e =>{
if(e.IsRequired){
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
}
})
}
this.isEventEdited = false;
if(this.postEvent.IsRecurring == false){
@@ -61,32 +71,45 @@ export class EditEventComponent implements OnInit {
}
close(){
console.log('!!!!!!!!!!!!!!!!! close')
this.closeComponent.emit();
this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]);
this.clearContact.emit();
}
save(){
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
async save(){
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc)
await this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento actualizado',
buttons: ['OK']
});
await alert.present();
});
this.clearPostEvent.emit();
this.closeComponent.emit();
this.clearContact.emit();
this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]);
this.close();
}
async openAttendees() {
async addParticipants() {
this.openAttendeesComponent.emit({
type: "intervenient"
});
this.clearContact.emit();
}
async addParticipantsCc() {
this.openAttendeesComponent.emit({
type: "CC"
});
this.openAttendeesComponent.emit();
this.clearContact.emit();
}