diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index a10c5b4ca..d0db1206a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -32,13 +32,13 @@ export default { PersonsAssociated, Requestor, SocialIssue, - Referrer, + //Referrer, //fait foirer socialissues Resources, Comment, Confirm, }, computed: mapState([ - 'accompanyingCourse' + 'accompanyingCourse', 'socialIssueOptions' ]) }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js index 8b7a4ad6b..d2f102e10 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js @@ -146,6 +146,25 @@ const postResource = (id, payload, method) => { }); }; +/* +* +*/ +const postSocialIssue = (id, body, method) => { + //console.log('api body and method', body, method); + const url = `/api/1.0/person/accompanying-course/${id}/socialissue.json`; + return fetch(url, { + method: method, + headers: { + 'Content-Type': 'application/json;charset=utf-8' + }, + body: JSON.stringify(body) + }) + .then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); +}; + export { getAccompanyingCourse, patchAccompanyingCourse, @@ -154,4 +173,5 @@ export { postParticipation, postRequestor, postResource, + postSocialIssue }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner.vue index ce64fca10..3a26cad93 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner.vue @@ -45,20 +45,26 @@ -
{{ $t('social_issue.title') }}
-
_
-
_
+
+ + +
+ + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue index a756727d8..af283d55e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/SocialIssue.vue @@ -3,19 +3,22 @@

{{ $t('social_issue.title') }}

- + + :close-on-select="false" + :allow-empty="true" + :show-labels="false" + track-by="id" + label="text" + :multiple="true" + :searchable="false" + :placeholder="$t('social_issue.label')" + @update:model-value="updateSocialIssues" + :model-value="value" + :options="options" + >
@@ -23,31 +26,67 @@ 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 0f7a4f188..20baabc8d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -5,7 +5,8 @@ import { getAccompanyingCourse, confirmAccompanyingCourse, postParticipation, postRequestor, - postResource } from '../api'; + postResource, + postSocialIssue } from '../api'; const debug = process.env.NODE_ENV !== 'production'; const id = window.accompanyingCourseId; @@ -76,6 +77,9 @@ let initPromise = getAccompanyingCourse(id) postFirstComment(state, comment) { console.log('### mutation: postFirstComment', comment); state.accompanyingCourse.initialComment = comment; + }, + updateSocialIssues(state, value) { + state.accompanyingCourse.socialIssues = value; }, confirmAccompanyingCourse(state, response) { //console.log('### mutation: confirmAccompanyingCourse: response', response); @@ -145,7 +149,7 @@ let initPromise = getAccompanyingCourse(id) })).catch((error) => { commit('catchError', error) }); }, toggleIntensity({ commit }, payload) { - console.log(payload); + //console.log(payload); patchAccompanyingCourse(id, { type: "accompanying_period", intensity: payload }) .then(course => new Promise((resolve, reject) => { commit('toggleIntensity', course.intensity); @@ -167,16 +171,24 @@ let initPromise = getAccompanyingCourse(id) })).catch((error) => { commit('catchError', error) }); }, postFirstComment({ commit }, payload) { - console.log('## action: postFirstComment: payload', payload); + //console.log('## action: postFirstComment: payload', payload); patchAccompanyingCourse(id, { type: "accompanying_period", initialComment: payload }) .then(course => new Promise((resolve, reject) => { commit('postFirstComment', course.initialComment); resolve(); })).catch((error) => { commit('catchError', error) }); }, - + updateSocialIssues({ commit }, { payload, body, method }) { + //console.log('## action: payload', { payload, body, method }); + postSocialIssue(id, body, method) + .then(response => new Promise((resolve, reject) => { + console.log('response', response); + commit('updateSocialIssues', payload); + resolve(); + })).catch((error) => { commit('catchError', error) }); + }, confirmAccompanyingCourse({ commit }) { - console.log('## action: confirmAccompanyingCourse'); + //console.log('## action: confirmAccompanyingCourse'); confirmAccompanyingCourse(id) .then(response => new Promise((resolve, reject) => { commit('confirmAccompanyingCourse', response);