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) %} -
-
- {{ OptionsInput(fields.jedi_clin_type) }} - {{ TextInput(fields.number) }} - {{ DatePicker(fields.start_date) }} - {{ DatePicker(fields.end_date) }} - {{ TextInput(fields.obligated_amount, validation='dollars') }} +{% macro LOAInput() %} +
+ +
+ + + + + + + + + +
+
+ + +{% endmacro %} + +{% macro CLINFields(fields, index) %} + +
+
+ {{ OptionsInput(fields.jedi_clin_type) }} + {{ TextInput(fields.number) }} + + {% for loa in fields.loas %} + {{ TextInput(loa) }} + {% endfor %} + + {{ LOAInput() }} + {{ DatePicker(fields.start_date) }} + {{ DatePicker(fields.end_date) }} + {{ TextInput(fields.obligated_amount, validation='dollars') }} +
+
{% endmacro %} {% block portfolio_content %} @@ -44,7 +96,7 @@
{{ TextInput(form.number, validation='taskOrderNumber') }} {% for clin in form.clins %} - {{ CLINFields(clin) }} + {{ CLINFields(clin, index=loop.index - 1) }} {% endfor %}

@@ -98,6 +150,8 @@
+ {{ LOAInput() }} +