Fix template and component so LOA values are posted through the form

This commit is contained in:
leigh-mil
2019-02-21 17:05:09 -05:00
parent f9b379c2f1
commit 68ab32d1d1
2 changed files with 11 additions and 5 deletions

View File

@@ -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(''))