From cdbbc9f785ea4a5e0a0f1c581a98be22065f9002 Mon Sep 17 00:00:00 2001 From: graham-dds Date: Wed, 11 Sep 2019 15:43:53 -0400 Subject: [PATCH] Add funding validation to clinfields vue component --- js/components/clin_fields.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/components/clin_fields.js b/js/components/clin_fields.js index 3edd7583..5d7469fb 100644 --- a/js/components/clin_fields.js +++ b/js/components/clin_fields.js @@ -252,7 +252,17 @@ export default { }, percentObligated: function() { const percentage = (this.obligatedAmount / this.totalAmount) * 100 - return !!percentage ? `${percentage.toFixed(1)}%` : '0%' + if (!!percentage) { + if (percentage > 0 && percentage < 1) { + return '<1%' + } else if (percentage > 99 && percentage < 100) { + return '>99%' + } else { + return `${percentage.toFixed(0)}%` + } + } else { + return '0%' + } }, removeModalId: function() {