change code, to review from moriz

This commit is contained in:
ogerly 2022-07-15 08:37:33 +02:00
parent 8ad1e2920f
commit dfc20a3254
4 changed files with 26 additions and 16 deletions

View File

@ -15,7 +15,7 @@
<b-form ref="form" @submit.prevent="submit">
<label>{{ $t('time.month') }}</label>
<b-form-datepicker
id="testdate"
id="contribution-date"
v-model="date"
size="lg"
:max="max"
@ -27,7 +27,7 @@
></b-form-datepicker>
<label class="mt-3">{{ $t('contribution.activity') }}</label>
<b-form-textarea
id="testmemo"
id="contribution-memo"
v-model="memo"
rows="3"
max-rows="6"
@ -45,7 +45,7 @@
<label class="mt-3">{{ $t('form.amount') }}</label>
<b-input-group size="lg" prepend="GDD" append=".00">
<b-form-input
id="testamount"
id="contribution-amount"
v-model="amount"
type="number"
min="1"
@ -54,7 +54,7 @@
</b-input-group>
<div class="mt-3 text-right">
<b-button class="test-submit" type="submit" variant="primary" :disabled="disable">
<b-button class="test-submit" type="submit" variant="primary" :disabled="disabled">
{{ $t('contribution.submit') }}
</b-button>
{{date}}, {{amount}}, {{ memo}}
@ -80,8 +80,6 @@ export default {
return {
minlength: 50,
maxlength: 255,
lastMonth: new Date(new Date(new Date().setMonth(new Date().getMonth() - 1))),
min: new Date(new Date(new Date().setMonth(new Date().getMonth() - 1)).setDate(1)),
max: new Date(),
form: {
date: this.date,
@ -98,10 +96,16 @@ export default {
},
},
computed: {
disable() {
lastMonth(){
return new Date(new Date(new Date().setMonth(new Date().getMonth() - 1)))
},
min() {
return new Date(new Date(new Date().setMonth(new Date().getMonth() - 1)).setDate(1))
},
disabled() {
if (
this.form.memo.length < this.minlength ||
this.form.amount === 0 ||
this.form.amount <= 0 ||
this.form.amount > 1000
)
return true
@ -110,16 +114,14 @@ export default {
lastMonthObject() {
// new Date().getMonth === 1 If the current month is January, then one year must be gone back in the previous month
const obj = {
month: new Date(this.lastMonth).toLocaleString(this.$i18n.locale, { month: 'long' }),
year: new Date().getMonth === 1 ? new Date().getFullYear() - 1 : new Date().getFullYear(),
monthAndYear: this.$d(new Date(this.lastMonth), 'monthAndYear'),
creation: this.$store.state.creation[1],
}
return this.$t('contribution.formText.lastMonth', obj)
},
thisMonthObject() {
const obj = {
month: new Date().toLocaleString(this.$i18n.locale, { month: 'long' }),
year: new Date().getFullYear(),
monthAndYear: this.$d(new Date(), 'monthAndYear'),
creation: this.$store.state.creation[2],
}
return this.$t('contribution.formText.thisMonth', obj)

View File

@ -84,6 +84,10 @@ const dateTimeFormats = {
year: {
year: 'numeric',
},
monthAndYear: {
month: 'long',
year: 'numeric',
},
},
de: {
short: {
@ -108,6 +112,10 @@ const dateTimeFormats = {
year: {
year: 'numeric',
},
monthAndYear: {
month: 'long',
year: 'numeric',
},
},
}

View File

@ -35,10 +35,10 @@
"activity": "Tätigkeit",
"formText": {
"h3": "Dein Beitrag zum Gemeinwohl",
"lastMonth": "Für <b>{month} {year}</b> kannst du noch <b>{creation}</b> GDD einreichen.",
"lastMonth": "Für <b>{monthAndYear}</b> kannst du noch <b>{creation}</b> GDD einreichen.",
"text1": "Bring dich mit deinen Talenten in die Gemeinschaft ein! Dein freiwilliges Engagement honorieren wir mit 20 GDD pro Stunde bis maximal 1.000 GDD im Monat.",
"text2": "Beschreibe deine Gemeinwohl-Tätigkeit mit Angabe der Stunden und trage einen Betrag von 20 GDD pro Stunde ein! Nach Bestätigung durch einen Moderator wird der Betrag deinem Konto gutgeschrieben.",
"thisMonth": "Für <b>{month} {year}</b> kannst du noch <b>{creation}</b> GDD einreichen. "
"thisMonth": "Für <b>{monthAndYear}</b> kannst du noch <b>{creation}</b> GDD einreichen. "
},
"noDateSelected": "Kein Datum ausgewählt",
"submit": "Einreichen"

View File

@ -35,10 +35,10 @@
"activity": "Activity",
"formText": {
"h3": "Your contribution to the common good",
"lastMonth": "For <b>{month} {year}</b>, you can still submit <b>{creation}</b> GDD.",
"lastMonth": "For <b>{monthAndYear}</b>, you can still submit <b>{creation}</b> GDD.",
"text1": "Bring your talents to the community! Your voluntary commitment will be rewarded with 20 GDD per hour up to a maximum of 1,000 GDD per month.",
"text2": "Describe your community service activity with hours and enter an amount of 20 GDD per hour! After confirmation by a moderator, the amount will be credited to your account.",
"thisMonth": "For <b>{month} {year}</b>, you can still submit <b>{creation}</b> GDD."
"thisMonth": "For <b>{monthAndYear}</b>, you can still submit <b>{creation}</b> GDD."
},
"noDateSelected": "No date selected",
"submit": "Submit"