From 68ab32d1d1f38130587138363afbc80314469673 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Thu, 21 Feb 2019 17:05:09 -0500 Subject: [PATCH] Fix template and component so LOA values are posted through the form --- js/components/forms/ko_review.js | 12 +++++++++--- templates/portfolios/task_orders/review.html | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/js/components/forms/ko_review.js b/js/components/forms/ko_review.js index 3963431b..5efdb3cf 100644 --- a/js/components/forms/ko_review.js +++ b/js/components/forms/ko_review.js @@ -2,12 +2,15 @@ import textinput from '../text_input' import DateSelector from '../date_selector' import uploadinput from '../upload_input' import inputValidations from '../../lib/input_validations' +import FormMixin from '../../mixins/form' const createLOA = number => ({ number }) export default { name: 'ko-review', + mixins: [FormMixin], + components: { textinput, DateSelector, @@ -23,15 +26,18 @@ export default { }, data: function() { - const { loa } = this.initialData - const loas = - typeof loa === 'array' && loa.length > 0 ? this.initialValue : [''] + const loa_list = this.initialData['loa'] + const loas = (loa_list.length > 0 ? loa_list : ['']).map(createLOA) return { loas, } }, + mounted: function() { + this.$root.$on('onLOAAdded', this.addLOA) + }, + methods: { addLOA: function(event) { this.loas.push(createLOA('')) diff --git a/templates/portfolios/task_orders/review.html b/templates/portfolios/task_orders/review.html index a1c5d5fa..6336ade1 100644 --- a/templates/portfolios/task_orders/review.html +++ b/templates/portfolios/task_orders/review.html @@ -101,8 +101,8 @@ - - + +