From ce531a15a7279a30cfb59c014f59fd79d9032207 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 22 Jul 2022 11:05:38 +0200 Subject: [PATCH] fix: update Contribution amount problem --- .../Contributions/ContributionForm.vue | 16 ++++++++++------ frontend/src/pages/Community.vue | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 7f329ea46..12917975a 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -13,7 +13,7 @@ - + {{ form.memo.length }} - {{ $t('math.equalTo') }} {{ minlength }} + {{ $t('math.lower') }} {{ minlength }} {{ $t('math.divide') }} {{ maxlength }} @@ -78,6 +78,9 @@ + {{form}}
+ {{id}}
+ {{value}}, {{ updateAmount }}, {{ updateAmount === '' }}
@@ -86,6 +89,7 @@ export default { name: 'ContributionForm', props: { value: { type: Object, required: true }, + updateAmount: { type: String, required: false }, }, data() { return { @@ -152,14 +156,14 @@ export default { }, maxGddLastMonth() { // When edited, the amount is added back on top of the amount - return this.value.id - ? parseInt(this.$store.state.creation[1]) + parseInt(this.value.amount) + return this.value.id && !this.isThisMonth + ? parseInt(this.$store.state.creation[1]) + parseInt(this.updateAmount) : this.$store.state.creation[1] }, maxGddThisMonth() { // When edited, the amount is added back on top of the amount - return this.value.id - ? parseInt(this.$store.state.creation[2]) + parseInt(this.value.amount) + return this.value.id && this.isThisMonth + ? parseInt(this.$store.state.creation[2]) + parseInt(this.updateAmount) : this.$store.state.creation[2] }, }, diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index 2ab9486f9..1cfa84bd9 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -7,6 +7,7 @@ @set-contribution="setContribution" @update-contribution="updateContribution" v-model="form" + :updateAmount="updateAmount" /> @@ -104,6 +105,7 @@ export default { memo: '', amount: '', }, + updateAmount: '', } }, methods: { @@ -238,6 +240,7 @@ export default { this.form.date = item.contributionDate this.form.memo = item.memo this.form.amount = item.amount + this.updateAmount = item.amount this.tabIndex = 0 }, updateTransactions(pagination) {