show open creation in contribution form

This commit is contained in:
ogerly 2022-07-13 08:40:49 +02:00
parent e5e594c3a2
commit 0ddd732da6
3 changed files with 34 additions and 6 deletions

View File

@ -4,8 +4,8 @@
<h3>{{ $t('contribution.formText.h3') }}</h3> <h3>{{ $t('contribution.formText.h3') }}</h3>
{{ $t('contribution.formText.text1') }} {{ $t('contribution.formText.text1') }}
<ul class="my-3"> <ul class="my-3">
<li>{{ $t('contribution.formText.lastMonth') }}</li> <li v-html="$t('contribution.formText.lastMonth', lastMonthObject)"></li>
<li>{{ $t('contribution.formText.thisMonth') }}</li> <li v-html="$t('contribution.formText.thisMonth', thisMonthObject)"></li>
</ul> </ul>
<div class="my-3"> <div class="my-3">
@ -64,12 +64,18 @@
</div> </div>
</template> </template>
<script> <script>
/*
* data.lastMonth = The date set back by one month.
* data.min = The date is reset by one month to the 1st of the previous month.
*
*/
export default { export default {
name: 'ContributionForm', name: 'ContributionForm',
data() { data() {
return { return {
minlength: 50, minlength: 50,
maxlength: 255, 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)), min: new Date(new Date(new Date().setMonth(new Date().getMonth() - 1)).setDate(1)),
max: new Date(), max: new Date(),
form: { form: {
@ -96,6 +102,28 @@ export default {
return true return true
return false return false
}, },
lastMonthObject(){
// If the current month is January then the current year must be counted back by -1.
if (new Date().getMonth === 1) {
return {
month: new Date(this.lastMonth).toLocaleString(this.$i18n.locale, { month: "long" }),
year: new Date().getFullYear() - 1,
creation: this.$store.state.creation[1]
}
}
return {
month: new Date(this.lastMonth).toLocaleString(this.$i18n.locale, { month: "long" }),
year: new Date().getFullYear(),
creation: this.$store.state.creation[1]
}
},
thisMonthObject() {
return {
month: new Date().toLocaleString(this.$i18n.locale, { month: "long" }),
year: new Date().getFullYear(),
creation: this.$store.state.creation[2]
}
}
}, },
} }
</script> </script>

View File

@ -35,10 +35,10 @@
"activity": "Tätigkeit", "activity": "Tätigkeit",
"formText": { "formText": {
"h3": "Dein Beitrag zum Gemeinwohl", "h3": "Dein Beitrag zum Gemeinwohl",
"lastMonth": "Für Juni 2022 kannst du noch 200 GDD einreichen .", "lastMonth": "Für <b>{month} {year}</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.", "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.", "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 Juli 2022 kannst du noch 500 GDD einreichen. " "thisMonth": "Für <b>{month} {year}</b> kannst du noch <b>{creation}</b> GDD einreichen. "
}, },
"noDateSelected": "Kein Datum ausgewählt", "noDateSelected": "Kein Datum ausgewählt",
"submit": "Einreichen" "submit": "Einreichen"

View File

@ -35,10 +35,10 @@
"activity": "Activity", "activity": "Activity",
"formText": { "formText": {
"h3": "Your contribution to the common good", "h3": "Your contribution to the common good",
"lastMonth": "For June 2022, you can still submit 200 GDD.", "lastMonth": "For <b>{month} {year}</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.", "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.", "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 July 2022, you can still submit 500 GDD." "thisMonth": "For <b>{month} {year}</b>, you can still submit <b>{creation}</b> GDD."
}, },
"noDateSelected": "No date selected", "noDateSelected": "No date selected",
"submit": "Submit" "submit": "Submit"