diff --git a/js/components/clin_fields.js b/js/components/clin_fields.js new file mode 100644 index 00000000..df3d3b83 --- /dev/null +++ b/js/components/clin_fields.js @@ -0,0 +1,92 @@ +import DateSelector from './date_selector' +import optionsinput from './options_input' +import textinput from './text_input' + +export default { + name: 'clin-fields', + + components: { + DateSelector, + optionsinput, + textinput, + }, + + props: { + clinIndex: String, + }, + // get clin index from props and pass into template + template: ` +
+ + +
+ + + +
+
+ +
Start Date +
+
+
+ +
+ + +
+
+ + +
+
+ + +
+ +
+

+

+
+
+ +
End Date +
+
+
+ +
+ + +
+
+ + +
+
+ + +
+ +
+

+

+
+
+ + + +
+
`, +} diff --git a/js/components/forms/to_form.js b/js/components/forms/to_form.js new file mode 100644 index 00000000..5d19d982 --- /dev/null +++ b/js/components/forms/to_form.js @@ -0,0 +1,40 @@ +import ClinFields from '../clin_fields' +import DateSelector from '../date_selector' +import FormMixin from '../../mixins/form' +import optionsinput from '../options_input' +import textinput from '../text_input' + +export default { + name: 'to-form', + + mixins: [FormMixin], + + components: { + ClinFields, + DateSelector, + optionsinput, + textinput, + }, + + props: { + initialClinCount: String, + }, + + data: function() { + const clins = this.initialClinCount == 0 ? [''] : [] + + return { + clins, + clinCount: this.initalClinCount - 1, + } + // pass initialCLINIndex in props and add one each time a clin is added... + // this way we can keep track of the clin id for the html name/id/etc + }, + + methods: { + addClin: function(event) { + this.clins.push('') + this.clinCount = this.clinCount + 1 + }, + }, +} diff --git a/js/index.js b/js/index.js index 9446814f..2f167883 100644 --- a/js/index.js +++ b/js/index.js @@ -41,6 +41,8 @@ import DeleteConfirmation from './components/delete_confirmation' import NewEnvironment from './components/forms/new_environment' import EnvironmentRole from './components/environment_role' import SemiCollapsibleText from './components/semi_collapsible_text' +import ToForm from './components/forms/to_form' +import ClinFields from './components/clin_fields' Vue.config.productionTip = false @@ -83,6 +85,8 @@ const app = new Vue({ NewEnvironment, EnvironmentRole, SemiCollapsibleText, + ToForm, + ClinFields, }, mounted: function() { diff --git a/templates/task_orders/edit.html b/templates/task_orders/edit.html index e8a5b6a6..169a4263 100644 --- a/templates/task_orders/edit.html +++ b/templates/task_orders/edit.html @@ -1,19 +1,31 @@ {% extends "portfolios/base.html" %} +{% from 'components/date_picker.html' import DatePicker %} {% from 'components/save_button.html' import SaveButton %} +{% from 'components/options_input.html' import OptionsInput %} {% 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) }} +
+{% endmacro %} + {% block portfolio_content %}
{% include "fragments/flash.html" %} - + {% if task_order_id %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id, task_order_id=task_order_id) %} {% else %} {% set action = url_for("task_orders.update", portfolio_id=portfolio.id) %} {% endif %} -
+ {{ form.csrf_token }} Add Funding @@ -29,8 +41,24 @@


{{ TextInput(form.number, validation='taskOrderNumber') }} + {% for clin in form.clins %} + {{ CLINFields(clin) }} + {% endfor %} +
+ + + + + + + +
+ + {{ UploadInput(form.pdf) }}
-
+
{% endblock %}