From e3bafd79c1b416258282dc6aed1564296ea84b42 Mon Sep 17 00:00:00 2001 From: Jonathan Foucher <jfoucher@gmail.com> Date: Thu, 8 Sep 2022 14:32:16 +0200 Subject: [PATCH] Save nextLevel to expectedLevel when changing date or person name --- .../Single/Components/Step4/MeasureActionForm.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/js/components/Evaluations/Single/Components/Step4/MeasureActionForm.vue b/resources/js/components/Evaluations/Single/Components/Step4/MeasureActionForm.vue index 13144963..4e5c0b30 100644 --- a/resources/js/components/Evaluations/Single/Components/Step4/MeasureActionForm.vue +++ b/resources/js/components/Evaluations/Single/Components/Step4/MeasureActionForm.vue @@ -99,8 +99,10 @@ export default { }, set(newValue) { const evaluation = { ...this.evaluation } - - evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, end_date : moment(newValue.startDate).format('YYYY-MM-DD') }) : m) + if (!this.expected_level && this.nextLevel) { + this.expected_level = this.nextLevel; + } + evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, end_date : moment(newValue.startDate).format('YYYY-MM-DD'), expected_level : parseInt(this.expected_level, 10) }) : m) this.$store.commit('updateEvaluation', evaluation) } }, @@ -110,8 +112,10 @@ export default { }, set(newValue) { const evaluation = { ...this.evaluation } - - evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, manager : newValue }) : m) + if (!this.expected_level && this.nextLevel) { + this.expected_level = this.nextLevel; + } + evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, manager : newValue, expected_level : parseInt(this.expected_level, 10) }) : m) this.$store.commit('updateEvaluation', evaluation) } }, -- GitLab