add emit and props for update formular

This commit is contained in:
ogerly 2022-05-31 13:31:47 +02:00
parent 1a7d08f66a
commit 64430f6b28
3 changed files with 39 additions and 13 deletions

View File

@ -12,7 +12,7 @@
+ New Automatic Creations
</b-button>
<b-collapse id="newContribution" class="mt-2">
<b-collapse v-model="visible" id="newContribution" class="mt-2">
<b-card>
<p class="h2 ml-5">Automatic Creations</p>
<automatic-creation-form :automaticContributionData="automaticContributionData" />
@ -31,11 +31,15 @@
</div>
</template>
<script>
import AutomaticCreationForm from './AutomaticCreationForm.vue'
import AutomaticCreationForm, { updateForm } from './AutomaticCreationForm.vue'
import AutomaticCreationList from './AutomaticCreationList.vue'
export default {
name: 'AutomaticCreation',
components: {
AutomaticCreationForm,
AutomaticCreationList,
},
props: {
items: {
type: Array,
@ -44,17 +48,16 @@ export default {
},
data: function () {
return {
visible: false,
automaticContributionData: {},
}
},
components: {
AutomaticCreationForm,
AutomaticCreationList,
},
methods: {
editAutomaticContributionData(data) {
console.log('start methodes editAutomaticContributionData')
console.log(typeof(data))
console.log(typeof data)
if (!this.visible) this.$root.$emit('bv::toggle::collapse', 'newContribution')
this.automaticContributionData = data
},
},

View File

@ -1,7 +1,9 @@
<template>
<div>
{{ this.automaticContributionData }}
<b-form class="m-5" @submit="onSubmit">
<div v-if="updateData" class="text-light bg-info p-3">
{{ updateData }}
</div>
<b-form class="m-5" @submit="onSubmit" @reset="onReset">
<!-- Date -->
<b-row>
<b-col>
@ -109,14 +111,15 @@ export default {
props: {
automaticContributionData: {
type: Object,
default: () => {},
default() {
return {}
},
},
},
data() {
return {
form: {
name:
this.automaticContributionData.Name === '' ? null : this.automaticContributionData.Name,
name: null,
text: null,
amount: null,
startDate: null,
@ -150,6 +153,26 @@ export default {
if (this.form.endDate === null) return this.toastError('No end Date')
alert(JSON.stringify(this.form))
},
onReset(event) {
event.preventDefault()
this.form.name = null
this.form.text = null
this.form.amount = null
this.form.startDate = null
this.form.endDate = null
this.form.cycle = null
this.form.repetition = null
this.form.maxAmount = null
this.updateData = {}
},
updateForm() {
alert('updateForm')
},
},
computed: {
updateData() {
return this.automaticContributionData
},
},
}
</script>

View File

@ -81,7 +81,7 @@ export default {
},
editAutomaticCreations(row) {
this.$emit('editAutomaticContributionData', row.item)
this.$root.$emit('bv::toggle::collapse', 'newContribution')
},
showAutomaticCreations(row) {