Feature: [update accompanying course] do not show "locate to person" button if the person is already locating the course

This commit is contained in:
Julien Fastré 2023-03-22 11:05:52 +01:00
parent 204c28d373
commit 99cdf0ebaf
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 12 additions and 2 deletions

View File

@ -19,7 +19,7 @@
<div class="item-row separator">
<ul class="record_actions">
<button-location
v-if="hasCurrentHouseholdAddress"
v-if="hasCurrentHouseholdAddress && !isPersonLocatingCourse(participation.person)"
v-bind:person="participation.person">
</button-location>
<li v-if="participation.person.current_household_id">
@ -109,9 +109,12 @@ export default {
},
getCurrentHouseholdUrl() {
return `/fr/person/household/${this.participation.person.current_household_id}/summary?returnPath=${this.getAccompanyingCourseReturnPath}`
}
},
},
methods: {
isPersonLocatingCourse(person) {
return this.$store.getters.isPersonLocatingCourse(person);
},
saveFormOnTheFly(payload) {
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
payload.target = 'participation';

View File

@ -49,6 +49,13 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
postFirstPinnedCommentResponse: null,
},
getters: {
isPersonLocatingCourse: (state) => (person) => {
if (state.accompanyingCourse.locationStatus !== 'person') {
return false;
}
return state.accompanyingCourse.personLocation.id === person.id;
},
isParticipationValid(state) {
return state.accompanyingCourse.participations.length > 0;
},