Fix template and component so LOA values are posted through the form
This commit is contained in:
@@ -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(''))
|
||||
|
Reference in New Issue
Block a user