mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
add a list of suggested persons on activity
This commit is contained in:
parent
2a3f869882
commit
d6135641c5
@ -10,6 +10,14 @@
|
|||||||
</persons-bloc>
|
</persons-bloc>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="getContext === 'accompanyingCourse' && filterSuggestedPersons.length > 0">
|
||||||
|
<ul>
|
||||||
|
<li v-for="p in filterSuggestedPersons" @click="addNewPerson(p)">
|
||||||
|
{{ p.text }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<add-persons
|
<add-persons
|
||||||
buttonTitle="activity.add_persons"
|
buttonTitle="activity.add_persons"
|
||||||
modalTitle="activity.add_persons"
|
modalTitle="activity.add_persons"
|
||||||
@ -23,7 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex';
|
import { mapState, mapGetters } from 'vuex';
|
||||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||||
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
|
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
|
||||||
|
|
||||||
@ -79,6 +87,9 @@ export default {
|
|||||||
users: state => state.activity.users,
|
users: state => state.activity.users,
|
||||||
accompanyingCourse: state => state.activity.accompanyingPeriod
|
accompanyingCourse: state => state.activity.accompanyingPeriod
|
||||||
}),
|
}),
|
||||||
|
...mapGetters([
|
||||||
|
'filterSuggestedPersons'
|
||||||
|
]),
|
||||||
getContext() {
|
getContext() {
|
||||||
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
|
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
|
||||||
},
|
},
|
||||||
@ -161,7 +172,11 @@ 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();
|
||||||
}
|
},
|
||||||
|
addNewPerson(person) {
|
||||||
|
this.$store.dispatch('addPersonsInvolved', { result: person, type: 'person' });
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -25,8 +25,18 @@ const store = createStore({
|
|||||||
socialIssuesOther: [],
|
socialIssuesOther: [],
|
||||||
socialActionsList: [],
|
socialActionsList: [],
|
||||||
},
|
},
|
||||||
|
getters: {
|
||||||
|
filterSuggestedPersons(state) {
|
||||||
|
if (typeof(state.activity.accompanyingPeriod) === 'undefined') {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
let existingPersonIds = state.activity.persons.map(p => p.id);
|
||||||
|
return state.activity.accompanyingPeriod.participations.filter(p => p.endDate === null)
|
||||||
|
.map(p => p.person)
|
||||||
|
.filter(p => !existingPersonIds.includes(p.id))
|
||||||
|
}
|
||||||
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
||||||
// SocialIssueAcc
|
// SocialIssueAcc
|
||||||
addIssueInList(state, issue) {
|
addIssueInList(state, issue) {
|
||||||
//console.log('add issue list', issue.id);
|
//console.log('add issue list', issue.id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user