From 0c05ae7ab0bb7a5d5481aecefc91e44d87c92298 Mon Sep 17 00:00:00 2001 From: gabaldon Date: Thu, 12 Sep 2024 10:50:29 +0200 Subject: [PATCH 1/2] fix: improve decimals validations when vtt --- .../SendTransaction/CreateDataRequestForm.vue | 15 + .../SendTransaction/SendValueTransferForm.vue | 329 +++++++++--------- src/services/FormValidation.js | 39 +++ src/utils.js | 13 +- 4 files changed, 230 insertions(+), 166 deletions(-) diff --git a/src/components/SendTransaction/CreateDataRequestForm.vue b/src/components/SendTransaction/CreateDataRequestForm.vue index 5ae1da284..83f6ffc3e 100644 --- a/src/components/SendTransaction/CreateDataRequestForm.vue +++ b/src/components/SendTransaction/CreateDataRequestForm.vue @@ -103,6 +103,9 @@ export default { const isGrtThanBalance = (rule, value, callback) => { return formValidation().isGrtThanBalance(rule, value, callback) } + const isDecimalAmountValid = (rule, value, callback) => { + return formValidation.isDecimalAmountValid(rule, value, callback) + } const maxNumber = (rule, value, callback) => { return formValidation().maxNumber(rule, value, callback) } @@ -140,6 +143,10 @@ export default { message: this.$t('create_dr_form_error_required_field'), trigger: 'blur', }, + { + validator: isDecimalAmountValid, + trigger: 'blur', + }, { validator: isNumber, trigger: 'blur' }, { validator: maxNumber, trigger: 'blur' }, { validator: minAmount, trigger: 'submit' }, @@ -152,6 +159,10 @@ export default { message: this.$t('create_dr_form_error_required_field'), trigger: 'blur', }, + { + validator: isDecimalAmountValid, + trigger: 'blur', + }, { validator: isNumber, trigger: 'blur' }, { validator: minCollateralAmount, trigger: 'submit' }, { validator: maxNumber, trigger: 'blur' }, @@ -184,6 +195,10 @@ export default { message: this.$t('create_dr_form_error_required_field'), trigger: 'blur', }, + { + validator: isDecimalAmountValid, + trigger: 'blur', + }, { validator: isGrtThanBalance, trigger: 'blur' }, { validator: isNumber, trigger: 'blur' }, { validator: minAmount, trigger: 'submit' }, diff --git a/src/components/SendTransaction/SendValueTransferForm.vue b/src/components/SendTransaction/SendValueTransferForm.vue index 750542c12..b3355623c 100644 --- a/src/components/SendTransaction/SendValueTransferForm.vue +++ b/src/components/SendTransaction/SendValueTransferForm.vue @@ -1,6 +1,6 @@