diff --git a/js/components/clin_fields.js b/js/components/clin_fields.js index 4516b31f..56223b54 100644 --- a/js/components/clin_fields.js +++ b/js/components/clin_fields.js @@ -62,6 +62,7 @@ export default { popValid: popValidation, showPopError: showPopValidation, clinNumber: clinNumber, + showClin: true, } }, @@ -77,7 +78,7 @@ export default { }) emitEvent('field-mount', this, { optional: false, - name: POP, + name: POP + "-" + this.clinIndex, valid: this.checkPopValid(), }) }, @@ -103,7 +104,7 @@ export default { } emitEvent('field-change', this, { - name: POP, + name: POP + "-" + this.clinIndex, valid: this.checkPopValid(), }) }, @@ -127,6 +128,13 @@ export default { } } }, + + removeClin: function() { + this.showClin = false + emitEvent('remove-clin', this, { + clinIndex: this.clinIndex, + }) + }, }, computed: { diff --git a/js/components/forms/to_form.js b/js/components/forms/to_form.js index ef6b051b..d8d6eae7 100644 --- a/js/components/forms/to_form.js +++ b/js/components/forms/to_form.js @@ -56,6 +56,7 @@ export default { mounted: function() { this.$root.$on('clin-change', this.calculateClinAmounts) + this.$root.$on('remove-clin', this.handleRemoveClin) }, methods: { @@ -64,10 +65,9 @@ export default { ++this.clinIndex }, - removeClin: function(clinIndex) { - if (this.clins > 0) { - console.log('removed CLIN') - } + handleRemoveClin: function(event) { + --this.clinIndex + console.log('removed clin') }, calculateClinAmounts: function(event) { diff --git a/templates/task_orders/step_3.html b/templates/task_orders/step_3.html index 4b887084..2e548df1 100644 --- a/templates/task_orders/step_3.html +++ b/templates/task_orders/step_3.html @@ -26,13 +26,13 @@ v-bind:initial-clin-type="'JEDI_CLIN_1'" {% endif %} inline-template> -