From 3a2f27f519fbdd0b5e865674c96d66042e9ed436 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 8 Aug 2022 16:57:14 +0200 Subject: [PATCH] refactor amount to string in ContributionForm, fix thousand error --- .../components/Contributions/ContributionForm.vue | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 03fc08a92..5fad059fb 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -51,13 +51,11 @@ - + @@ -106,10 +104,10 @@ export default { }, methods: { numberFormat(value) { - return (this.form.amount = value.replace(/\.|,/, '')) + return value.replace(/\D/g, '') }, submit() { - this.numberFormat(this.form.amount) + this.form.amount = this.numberFormat(this.form.amount) if (this.form.id) { this.$emit('update-contribution', this.form) } else { @@ -137,8 +135,8 @@ export default { if ( this.form.date === '' || this.form.memo.length < this.minlength || - this.form.amount <= 0 || - this.form.amount > 1000 || + parseInt(this.form.amount) <= 0 || + parseInt(this.form.amount) > 1000 || (this.isThisMonth && parseInt(this.form.amount) > parseInt(this.maxGddThisMonth)) || (!this.isThisMonth && parseInt(this.form.amount) > parseInt(this.maxGddLastMonth)) )