From d0fa28db2afcd910b124c962b5b8da508f2e2e24 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 10 Aug 2021 10:07:20 +0200 Subject: [PATCH] display evaluations for action --- .../components/NewEvaluation.vue | 49 ++++++++++++++++++- .../vuejs/AccompanyingCourseWorkEdit/store.js | 23 +++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/NewEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/NewEvaluation.vue index af3146cfa..20c702f41 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/NewEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/NewEvaluation.vue @@ -1,10 +1,57 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index e8ed4c6bb..01628b363 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -115,6 +115,10 @@ const store = createStore({ state.resultsForGoal.push(r); } }, + setEvaluationsForAction(state, results) { + console.log('set evaluations for action', results); + state.evaluationsForAction = results; + }, addResultPicked(state, result) { state.resultsPicked.push(result); }, @@ -257,6 +261,24 @@ const store = createStore({ commit('setResultsForAction', data.results); }); }, + getReachablesEvaluationsForAction({ getters, commit }) { + console.log('getReachablesEvaluationsForAction'); + let + socialActionId = getters.socialAction.id, + url = `/api/1.0/person/social-work/evaluation/by-social-action/${socialActionId}.json` + ; + window.fetch(url) + .then(response => { + if (response.ok) { + return response.json(); + } + throw { m: 'Error while retriving evaluations for social action', s: response.status, b: response.body }; + }) + .then(data => { + console.log('data retrived', data); + commit('setEvaluationsForAction', data.results); + }); + }, submit({ getters, state, commit }) { let payload = getters.buildPayload, @@ -300,6 +322,7 @@ const store = createStore({ initAsync({ dispatch }) { dispatch('getReachablesResultsForAction'); dispatch('getReachablesGoalsForAction'); + dispatch('getReachablesEvaluationsForAction'); }, } });