diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue index 26b9d1164..b848a1428 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue @@ -80,16 +80,26 @@ export default { this.setPersonsInBloc(); }, setPersonsInBloc() { - this.courseParticipations(); - console.log('setPersonsInBloc'); + let participations = this.getCourseParticipations(); + let personsAssociated = []; + let personsNotAssociated = this.persons; + + this.persons.forEach(person => { + participations.forEach(participation => { + if (person.id === participation.id) { + personsAssociated.push(person); + personsNotAssociated = personsNotAssociated.filter(p => p !== person); + } + }); + }); + this.personsBlocs.forEach(bloc => { - switch (bloc.key) { case 'personsAssociated': - bloc.persons = this.persons; + bloc.persons = personsAssociated; break; case 'personsNotAssociated': - //bloc.persons = this.persons; + bloc.persons = personsNotAssociated; break; case 'thirdparty': bloc.persons = this.thirdParties; @@ -100,12 +110,14 @@ export default { } }); }, - courseParticipations() { + getCourseParticipations() { + let participations = []; this.accompanyingCourse.participations.forEach(participation => { if (participation.endDate) { - console.log('usager du parcours', participation.person.text); + participations.push(participation.person); } }); + return participations; } } }