mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
activity vue corrections
This commit is contained in:
parent
9ab032c943
commit
abede56d68
@ -36,23 +36,27 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
personsBlocs: [
|
personsBlocs: [
|
||||||
{ key: 'personsAssociated', title: 'activity.bloc_persons_associated',
|
{ key: 'personsAssociated',
|
||||||
|
title: 'activity.bloc_persons_associated',
|
||||||
persons: []
|
persons: []
|
||||||
},
|
},
|
||||||
{ key: 'personsNotAssociated', title: 'activity.bloc_persons_not_associated',
|
{ key: 'personsNotAssociated',
|
||||||
|
title: 'activity.bloc_persons_not_associated',
|
||||||
persons: []
|
persons: []
|
||||||
},
|
},
|
||||||
{ key: 'thirdparty', title: 'activity.bloc_thirdparty',
|
{ key: 'thirdparty',
|
||||||
|
title: 'activity.bloc_thirdparty',
|
||||||
persons: []
|
persons: []
|
||||||
},
|
},
|
||||||
{ key: 'users', title: 'activity.bloc_users',
|
{ key: 'users',
|
||||||
|
title: 'activity.bloc_users',
|
||||||
persons: []
|
persons: []
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
addPersons: {
|
addPersons: {
|
||||||
key: 'activity',
|
key: 'activity',
|
||||||
options: {
|
options: {
|
||||||
type: ['person', 'thirdparty'], // TODO 'user'
|
type: ['person', 'thirdparty'], // TODO add 'user'
|
||||||
priority: null,
|
priority: null,
|
||||||
uniq: false,
|
uniq: false,
|
||||||
}
|
}
|
||||||
@ -67,6 +71,9 @@ export default {
|
|||||||
accompanyingCourse: state => state.activity.accompanyingPeriod
|
accompanyingCourse: state => state.activity.accompanyingPeriod
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addNewPersons({ selected, modal }) {
|
addNewPersons({ selected, modal }) {
|
||||||
console.log('@@@ CLICK button addNewPersons', selected);
|
console.log('@@@ CLICK button addNewPersons', selected);
|
||||||
@ -76,29 +83,29 @@ export default {
|
|||||||
);
|
);
|
||||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||||
modal.showModal = false;
|
modal.showModal = false;
|
||||||
|
|
||||||
this.setPersonsInBloc();
|
this.setPersonsInBloc();
|
||||||
},
|
},
|
||||||
setPersonsInBloc() {
|
setPersonsInBloc() {
|
||||||
let participations = this.getCourseParticipations();
|
|
||||||
let personsAssociated = [];
|
let personsAssociated = [];
|
||||||
let personsNotAssociated = this.persons;
|
let personsNotAssociated = this.persons;
|
||||||
|
let participations = this.getCourseParticipations();
|
||||||
this.persons.forEach(person => {
|
this.persons.forEach(person => {
|
||||||
participations.forEach(participation => {
|
participations.forEach(participation => {
|
||||||
if (person.id === participation.id) {
|
if (person.id === participation.id) {
|
||||||
|
console.log(person.id);
|
||||||
personsAssociated.push(person);
|
personsAssociated.push(person);
|
||||||
personsNotAssociated = personsNotAssociated.filter(p => p !== person);
|
personsNotAssociated = personsNotAssociated.filter(p => p !== person);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.personsBlocs.forEach(bloc => {
|
this.personsBlocs.forEach(bloc => {
|
||||||
switch (bloc.key) {
|
switch (bloc.key) {
|
||||||
case 'personsAssociated':
|
case 'personsAssociated':
|
||||||
|
console.log('personsAssociated', personsAssociated);
|
||||||
bloc.persons = personsAssociated;
|
bloc.persons = personsAssociated;
|
||||||
break;
|
break;
|
||||||
case 'personsNotAssociated':
|
case 'personsNotAssociated':
|
||||||
|
console.log('personsNotAssociated', personsNotAssociated);
|
||||||
bloc.persons = personsNotAssociated;
|
bloc.persons = personsNotAssociated;
|
||||||
break;
|
break;
|
||||||
case 'thirdparty':
|
case 'thirdparty':
|
||||||
@ -113,7 +120,7 @@ export default {
|
|||||||
getCourseParticipations() {
|
getCourseParticipations() {
|
||||||
let participations = [];
|
let participations = [];
|
||||||
this.accompanyingCourse.participations.forEach(participation => {
|
this.accompanyingCourse.participations.forEach(participation => {
|
||||||
if (participation.endDate) {
|
if (!participation.endDate) {
|
||||||
participations.push(participation.person);
|
participations.push(participation.person);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user