diff --git a/CHANGELOG.md b/CHANGELOG.md index 077cc0242..de2a62a0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to * [person] add maritalStatusComment to PersonDocGenNormalizer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/582) * Load relationships without gender in french fixtures * Add command to remove old draft accompanying periods +* [parcours]: If users assings him/herself as referrer and job is not null. Update parcours job (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/578) ### 2021-04-28 diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index 57415565b..c5150b015 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -253,7 +253,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou state.accompanyingCourse.administrativeLocation = value; }, updateReferrer(state, value) { - //console.log('value', value); state.accompanyingCourse.user = value; }, updateJob(state, value) { @@ -775,9 +774,7 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou throw error; }) }, - updateReferrer({ commit }, payload) { - console.log('update referrer', payload); - console.log('payload !== null', payload !== null); + updateReferrer({ commit, state }, payload) { const url = `/api/1.0/person/accompanying-course/${id}.json`; let body = { type: "accompanying_period", user: null }; @@ -788,7 +785,10 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou return makeFetch('PATCH', url, body) .then((response) => { commit('updateReferrer', response.user); - commit('setFilteredReferrersSuggested'); + if (null !== payload.user_job && payload.user_job !== state.accompanyingCourse.job) { + this.dispatch('updateJob', payload.user_job); + } + // commit('setFilteredReferrersSuggested'); // this mutation doesn't exist? }) .catch((error) => { commit('catchError', error); @@ -799,6 +799,8 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou const url = `/api/1.0/person/accompanying-course/${id}.json`; let body = { type: "accompanying_period", job: null }; + console.log('update job', payload); + if (payload !== null) { body = { type: "accompanying_period", job: { id: payload.id, type: payload.type } }; }