diff --git a/js/components/clin_fields.js b/js/components/clin_fields.js index df52dd9d..d96ac828 100644 --- a/js/components/clin_fields.js +++ b/js/components/clin_fields.js @@ -1,4 +1,5 @@ import DateSelector from './date_selector' +import optionsinput from './options_input' import textinput from './text_input' export default { @@ -6,14 +7,36 @@ export default { components: { DateSelector, + optionsinput, textinput, }, props: { initialClinIndex: Number, + initialLoaCount: { + type: Number, + default: 0, + }, }, data: function() { - return { clinIndex: this.initialClinIndex } + const loas = this.initialLoaCount == 0 ? 1 : 0 + const indexOffset = this.initialLoaCount + + return { + clinIndex: this.initialClinIndex, + indexOffset: this.initialLoaCount, + loas: loas, + } + }, + + methods: { + addLoa: function(event) { + ++this.loas + }, + + loaIndex: function(index) { + return index + this.indexOffset - 1 + }, }, } diff --git a/js/components/forms/to_form.js b/js/components/forms/to_form.js index 5255fbb9..55999949 100644 --- a/js/components/forms/to_form.js +++ b/js/components/forms/to_form.js @@ -34,8 +34,8 @@ export default { methods: { addClin: function(event) { - this.clins = this.clins + 1 - this.clinIndex = this.clinIndex + 1 + ++this.clins + ++this.clinIndex }, }, } diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index 09256b35..a0dc0b04 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -7,15 +7,67 @@ {% from 'components/text_input.html' import TextInput %} {% from 'components/upload_input.html' import UploadInput %} -{% macro CLINFields(fields) %} -