mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
Improve save for edit and create event in agenda
This commit is contained in:
@@ -4,6 +4,8 @@ import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { Event } from 'src/app/models/event.model';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-event',
|
||||
@@ -13,7 +15,6 @@ import { ModalController } from '@ionic/angular';
|
||||
|
||||
export class NewEventPage implements OnInit {
|
||||
|
||||
postEvent: Event;
|
||||
eventBody: EventBody;
|
||||
segment:string = "true";
|
||||
|
||||
@@ -27,6 +28,7 @@ export class NewEventPage implements OnInit {
|
||||
@Output() setIntervenient = new EventEmitter<any>();
|
||||
@Output() setIntervenientCC = new EventEmitter<any>();
|
||||
|
||||
@Input() postEvent: Event;
|
||||
@Output() onAddEvent = new EventEmitter<any>();
|
||||
@Output() openAttendeesComponent = new EventEmitter<any>();
|
||||
@Output() clearContact = new EventEmitter<any>();
|
||||
@@ -99,7 +101,24 @@ export class NewEventPage implements OnInit {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(this.postEvent.Attendees != null) {
|
||||
this.postEvent.Attendees.forEach(e =>{
|
||||
if(e.IsRequired) {
|
||||
this.taskParticipants.push(e);
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
this.taskParticipants = removeDuplicate(this.taskParticipants);
|
||||
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
|
||||
|
||||
this.setIntervenient.emit(this.taskParticipants);
|
||||
this.setIntervenientCC.emit(this.taskParticipantsCc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,11 +129,13 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
this.cloneAllmobileComponent.emit();
|
||||
this.clearContact.emit();
|
||||
this.setIntervenient.emit([]);
|
||||
this.setIntervenientCC.emit([]);
|
||||
}
|
||||
|
||||
save(){
|
||||
|
||||
this.postEvent.Attendees = this.taskParticipants;
|
||||
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
|
||||
if(this.profile=='mdgpr') {
|
||||
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe();
|
||||
|
||||
Reference in New Issue
Block a user