diff --git a/admin/src/components/ContributionLink/ContributionLink.spec.js b/admin/src/components/ContributionLink/ContributionLink.spec.js index 9818e8b93..b72a0347c 100644 --- a/admin/src/components/ContributionLink/ContributionLink.spec.js +++ b/admin/src/components/ContributionLink/ContributionLink.spec.js @@ -46,5 +46,10 @@ describe('ContributionLink', () => { wrapper.vm.editContributionLinkData() expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() }) + + it('emits toggle::collapse close Contribution-Form ', async () => { + wrapper.vm.closeContributionForm() + expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + }) }) }) diff --git a/admin/src/components/ContributionLink/ContributionLink.vue b/admin/src/components/ContributionLink/ContributionLink.vue index a2d171d56..c8963d3ab 100644 --- a/admin/src/components/ContributionLink/ContributionLink.vue +++ b/admin/src/components/ContributionLink/ContributionLink.vue @@ -8,7 +8,11 @@ header-class="text-center" class="mt-5" > - + {{ $t('math.plus') }} {{ $t('contributionLink.newContributionLink') }} @@ -19,6 +23,7 @@ :contributionLinkData="contributionLinkData" :editContributionLink="editContributionLink" @get-contribution-links="$emit('get-contribution-links')" + @closeContributionForm="closeContributionForm" /> @@ -63,8 +68,17 @@ export default { } }, methods: { + closeContributionForm() { + if (this.visible) { + this.$root.$emit('bv::toggle::collapse', 'newContribution') + this.editContributionLink = false + this.contributionLinkData = {} + } + }, editContributionLinkData(data) { - if (!this.visible) this.$root.$emit('bv::toggle::collapse', 'newContribution') + if (!this.visible) { + this.$root.$emit('bv::toggle::collapse', 'newContribution') + } this.contributionLinkData = data this.editContributionLink = true }, diff --git a/admin/src/components/ContributionLink/ContributionLinkForm.vue b/admin/src/components/ContributionLink/ContributionLinkForm.vue index 05f5dac8b..85b9a3e95 100644 --- a/admin/src/components/ContributionLink/ContributionLinkForm.vue +++ b/admin/src/components/ContributionLink/ContributionLinkForm.vue @@ -6,6 +6,7 @@ {{ $t('contributionLink.clear') }} + + {{ $t('contributionLink.close') }} + @@ -203,14 +208,7 @@ export default { }, watch: { contributionLinkData() { - this.form.name = this.contributionLinkData.name - this.form.memo = this.contributionLinkData.memo - this.form.amount = this.contributionLinkData.amount - this.form.validFrom = this.contributionLinkData.validFrom - this.form.validTo = this.contributionLinkData.validTo - this.form.cycle = this.contributionLinkData.cycle - this.form.maxPerCycle = this.contributionLinkData.maxPerCycle - this.form.maxAmountPerMonth = this.contributionLinkData.maxAmountPerMonth + this.form = this.contributionLinkData }, }, } diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index ffe1cab24..c012e3171 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -5,6 +5,7 @@ "amount": "Betrag", "changeSaved": "Änderungen gespeichert", "clear": "Löschen", + "close": "Schließen", "contributionLinks": "Beitragslinks", "create": "Anlegen", "cycle": "Zyklus", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index b32efe97e..9bff733c5 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -5,6 +5,7 @@ "amount": "Amount", "changeSaved": "Changes saved", "clear": "Clear", + "close": "Close", "contributionLinks": "Contribution Links", "create": "Create", "cycle": "Cycle",