diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index cf18dd4f2..500e84e76 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -87,7 +87,7 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue index 931c4ab27..401cf2b7b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue @@ -8,13 +8,13 @@
{{ $t('startDate') }} :
-
{{ $d(evaluation.startDate.datetime, 'short') }}
+
{{ $d(evaluation.startDate, 'short') }}
{{ $t('endDate') }} :
-
{{ $d(evaluation.endDate.datetime, 'short') }}
+
{{ $d(evaluation.endDate, 'short') }}
{{ $t('maxDate') }} :
-
{{ $d(evaluation.maxDate.datetime, 'short') }}
+
{{ $d(evaluation.maxDate, 'short') }}
{{ $t('warningInterval') }} :
{{ evaluation.warningInterval }}
@@ -70,7 +70,7 @@ export default { components: { FormEvaluation }, - props: ['evaluation'], + props: ['evaluation', 'editEvaluation'], i18n, data() { return { @@ -91,7 +91,6 @@ export default { this.editEvaluation = !this.editEvaluation; }, submitForm() { - this.$refs.FormEvaluation.saveEvaluation(); this.toggleEditEvaluation(); } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue index 3e04b4f5b..8cabc92c9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue @@ -139,37 +139,28 @@ export default { }, */ startDate: { - get() { - if (this.evaluation.startDate) { - return this.evaluation.startDate.datetime.split('T')[0]; - } - return null; - }, - set(v) { - this.evaluation.startDate.datetime = `${v}T00:00:00+0100`; - } + get() { + return dateToISO(this.evaluation.startDate); + }, + set(v) { + this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: ISOToDate(v) }); + } }, endDate: { - get() { - if (this.evaluation.endDate) { - return this.evaluation.endDate.datetime.split('T')[0]; - } - return null; - }, - set(v) { - this.evaluation.endDate.datetime = `${v}T00:00:00+0100`; - } + get() { + return dateToISO(this.evaluation.endDate); + }, + set(v) { + this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: ISOToDate(v) }); + } }, maxDate: { - get() { - if (this.evaluation.maxDate) { - return this.evaluation.maxDate.datetime.split('T')[0]; - } - return null; - }, - set(v) { - this.evaluation.maxDate.datetime = `${v}T00:00:00+0100`; - } + get() { + return dateToISO(this.evaluation.maxDate); + }, + set(v) { + this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: ISOToDate(v) }); + } }, warningInterval: { get() { return this.evaluation.warningInterval; }, @@ -203,12 +194,6 @@ export default { }) ; }, - saveEvaluation() { - console.log('save evaluation'); - - console.log('dispatch action: post/patch/put evaluation'); - console.log('commit mutation: update state.mutation'); - } }, mounted() { //this.listAllStatus(); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index f91539a16..71a97ea21 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -165,7 +165,7 @@ const store = createStore({ found.results.push(result); }, - removeResultForGoalPicked(state, { goal, result}) { + removeResultForGoalPicked(state, { goal, result }) { let found = state.goalsPicked.find(g => g.goal.id === goal.id); if (found === undefined) { @@ -177,14 +177,14 @@ const store = createStore({ addEvaluation(state, evaluation) { let e = { type: "accompanying_period_work_evaluation", + key: state.evaluationsPicked.length + 1, evaluation: evaluation, - //startDate, - //endDate, - //maxDate, - //warningInterval - //comment, - //documents, - } + "startDate": null, + "endDate": null, + "maxDate": null, + "warningInterval": null, + "comment": "", + }; state.evaluationsPicked.push(e); console.log('ep', state.evaluationsPicked); }, @@ -192,6 +192,18 @@ const store = createStore({ state.evaluationsPicked = state.evaluationsPicked.filter(e => e.id !== evaluation.id); console.log('ep', state.evaluationsPicked); }, + setEvaluationStartDate(state, {key, date}) { + state.evaluationsPicked.find(e => e.key == key) + .startDate = date; + }, + setEvaluationEndDate(state, {key, date}) { + state.evaluationsPicked.find(e => e.key == key) + .endDate = date; + }, + setEvaluationMaxDate(state, {key, date}) { + state.evaluationsPicked.find(e => e.key == key) + .maxDate = date; + }, setPersonsPickedIds(state, ids) { //console.log('persons ids', ids); state.personsPicked = state.personsReachables