Improve add atendees for agenda

This commit is contained in:
Peter Maquiran
2021-04-08 20:11:25 +01:00
parent 64cc4cf79b
commit 74cd2bc26f
5 changed files with 23 additions and 11 deletions
+5 -4
View File
@@ -10,7 +10,7 @@ import { AlertService } from 'src/app/services/alert.service';
import { momentG } from 'src/plugin/momentG'; import { momentG } from 'src/plugin/momentG';
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { EventPerson } from 'src/app/models/eventperson.model'; import { EventPerson } from 'src/app/models/eventperson.model';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
// showTimeline // showTimeline
import { setHours, setMinutes } from 'date-fns'; import { setHours, setMinutes } from 'date-fns';
@@ -1045,12 +1045,12 @@ export class AgendaPage implements OnInit {
} }
async setIntervenient(data) { async setIntervenient(data) {
this.taskParticipants = data; this.taskParticipants = removeDuplicate(data)
} }
async setIntervenientCC(data) { async setIntervenientCC(data) {
this.taskParticipantsCc = data; this.taskParticipantsCc = removeDuplicate(data)
} }
// Emitters // Emitters
@@ -1063,4 +1063,5 @@ export class AgendaPage implements OnInit {
this.postEvent = false; this.postEvent = false;
} }
} }
@@ -5,7 +5,7 @@ import { EventPerson } from 'src/app/models/eventperson.model';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { Event } from 'src/app/models/event.model'; import { Event } from 'src/app/models/event.model';
import { AlertController } from '@ionic/angular'; import { AlertController } from '@ionic/angular';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
@Component({ @Component({
selector: 'app-edit-event', selector: 'app-edit-event',
templateUrl: './edit-event.component.html', templateUrl: './edit-event.component.html',
@@ -41,7 +41,7 @@ export class EditEventComponent implements OnInit {
private eventsService: EventsService, private eventsService: EventsService,
public alertController: AlertController, public alertController: AlertController,
) { ) {
} }
ngOnInit() { ngOnInit() {
@@ -52,13 +52,16 @@ export class EditEventComponent implements OnInit {
// attendees list // attendees list
if(this.postEvent.Attendees != null) { if(this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e =>{ this.postEvent.Attendees.forEach(e =>{
if(e.IsRequired){ if(e.IsRequired) {
this.taskParticipants.push(e); this.taskParticipants.push(e);
} else { } else {
this.taskParticipantsCc.push(e); this.taskParticipantsCc.push(e);
} }
}) })
} }
this.taskParticipants = removeDuplicate(this.taskParticipants);
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
this.isEventEdited = false; this.isEventEdited = false;
@@ -79,7 +82,7 @@ export class EditEventComponent implements OnInit {
async save(){ async save(){
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc) this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
await this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => { await this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
const alert = await this.alertController.create({ const alert = await this.alertController.create({
-1
View File
@@ -87,7 +87,6 @@
</div> </div>
</div> </div>
</div> </div>
</ion-toolbar> </ion-toolbar>
-2
View File
@@ -41,8 +41,6 @@ export class HeaderPage implements OnInit {
async openSearch() { async openSearch() {
alert('alert');
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: SearchPage, component: SearchPage,
cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop', cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop',
+11
View File
@@ -0,0 +1,11 @@
function removeDuplicate(data){
return [...new Set(data.map(JSON.stringify))].map(JSON.parse)
}
module.exports = {
removeDuplicate: removeDuplicate
};