fix update edit a contributions

This commit is contained in:
ogerly 2023-01-04 16:24:47 +01:00
parent 89bb9e8bef
commit ec2f06f9f6
3 changed files with 19 additions and 28 deletions

View File

@ -1,17 +1,5 @@
<template>
<div class="contribution-form">
<!-- <div class="my-3">
<h3>{{ $t('contribution.formText.yourContribution') }}</h3>
{{ $t('contribution.formText.bringYourTalentsTo') }}
<ul class="my-3">
<li v-html="textForMonth(new Date(minimalDate), maxGddLastMonth)"></li>
<li v-html="textForMonth(new Date(), maxGddThisMonth)"></li>
</ul>
<div class="my-3">
<b>{{ $t('contribution.formText.describeYourCommunity') }}</b>
</div>
</div> -->
<b-form
ref="form"
@submit.prevent="submit"
@ -169,7 +157,7 @@ export default {
this.form.id = null
this.form.date = ''
this.form.memo = ''
this.form.time = 0
this.form.hours = 0.0
this.form.amount = ''
},
// textForMonth(date, availableAmount) {
@ -201,6 +189,11 @@ export default {
return Number(this.validMaxGDD / 20)
},
},
watch: {
value() {
return (this.form = this.value)
},
},
}
</script>
<style>

View File

@ -53,23 +53,9 @@ export default {
this.$emit('input', this.currentValue)
},
value() {
// console.log('value', this.value)
// console.log('currentValue', this.currentValue)
// console.log('value', typeof this.value)
// console.log('currentValue', typeof this.currentValue)
// console.log('!==', this.value !== this.currentValue)
if (this.value !== this.currentValue) this.currentValue = this.value
this.$emit('updateAmount', this.currentValue)
},
},
methods: {
normalizeTime(isValid) {
this.timeFocused = false
if (!isValid) return
this.timeValue = Number(this.currentValue.replace(',', '.'))
this.currentValue = this.timeValue
},
},
}
</script>

View File

@ -77,7 +77,7 @@ export default {
id: null,
date: '',
memo: '',
time: 0,
hours: 0,
amount: '',
},
updateAmount: '',
@ -96,6 +96,17 @@ export default {
this.hashLink = to.hash
this.closeAllOpenCollapse()
},
tabIndex(num) {
if (num !== 0) {
this.form = {
id: null,
date: '',
memo: '',
hours: 0,
amount: '0.0',
}
}
},
},
computed: {
minimalDate() {
@ -278,6 +289,7 @@ export default {
this.form.date = item.contributionDate
this.form.memo = item.memo
this.form.amount = item.amount
this.form.hours = item.amount / 20
this.updateAmount = item.amount
this.$router.push({ path: '#edit' })
this.tabIndex = 0