mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
change form, ,maxlenght 255, add items for list
This commit is contained in:
parent
4cc1642988
commit
a65d680bda
@ -1,15 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container contribution-form">
|
<div class="container contribution-form">
|
||||||
<b-form @submit="submit">
|
<b-form @submit.prevent="submit">
|
||||||
<label>{{ $t('time.month') }}</label>
|
<label>{{ $t('time.month') }}</label>
|
||||||
<b-form-radio-group
|
<b-form-datepicker
|
||||||
v-model="form.selected"
|
v-model="form.date"
|
||||||
:options="options"
|
size="lg"
|
||||||
class="mb-3"
|
:max="max"
|
||||||
value-field="value"
|
:min="min"
|
||||||
text-field="name"
|
class="mb-4"
|
||||||
disabled-field="notEnabled"
|
reset-value=""
|
||||||
></b-form-radio-group>
|
:label-no-date-selected="$t('contribution.noDateSelected')"
|
||||||
|
required
|
||||||
|
></b-form-datepicker>
|
||||||
<label class="mt-3">{{ $t('contribution.activity') }}</label>
|
<label class="mt-3">{{ $t('contribution.activity') }}</label>
|
||||||
<b-form-textarea
|
<b-form-textarea
|
||||||
id="textarea"
|
id="textarea"
|
||||||
@ -19,6 +21,7 @@
|
|||||||
max-rows="6"
|
max-rows="6"
|
||||||
required
|
required
|
||||||
:minlength="minlength"
|
:minlength="minlength"
|
||||||
|
:maxlength="maxlength"
|
||||||
></b-form-textarea>
|
></b-form-textarea>
|
||||||
<div
|
<div
|
||||||
class="text-right"
|
class="text-right"
|
||||||
@ -47,26 +50,19 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
minlength: 50,
|
minlength: 50,
|
||||||
maxlength: 500,
|
maxlength: 255,
|
||||||
|
min: new Date(new Date(new Date().setMonth(new Date().getMonth() - 1)).setDate(1)),
|
||||||
|
max: new Date(),
|
||||||
form: {
|
form: {
|
||||||
selected: this.$moment().format('MMMM'),
|
date: '',
|
||||||
memo: '',
|
memo: '',
|
||||||
|
|
||||||
amount: 0,
|
amount: 0,
|
||||||
},
|
},
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: this.$moment().subtract(1, 'months').format('MMMM'),
|
|
||||||
value: this.$moment().subtract(1, 'months').format('MMMM'),
|
|
||||||
},
|
|
||||||
{ name: this.$moment().format('MMMM'), value: this.$moment().format('MMMM') },
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit(event) {
|
submit() {
|
||||||
event.preventDefault()
|
this.$emit('set-contribution', this.form)
|
||||||
alert(JSON.stringify(this.form))
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@ -34,7 +34,8 @@
|
|||||||
},
|
},
|
||||||
"contribution": {
|
"contribution": {
|
||||||
"activity":"Tätigkeit",
|
"activity":"Tätigkeit",
|
||||||
"submit":"Einreichen"
|
"submit":"Einreichen",
|
||||||
|
"noDateSelected": "Kein Datum ausgewählt"
|
||||||
},
|
},
|
||||||
"contribution-link": {
|
"contribution-link": {
|
||||||
"thanksYouWith": "dankt dir mit"
|
"thanksYouWith": "dankt dir mit"
|
||||||
|
|||||||
@ -34,7 +34,8 @@
|
|||||||
},
|
},
|
||||||
"contribution": {
|
"contribution": {
|
||||||
"activity":"Activity",
|
"activity":"Activity",
|
||||||
"submit":"Submit"
|
"submit":"Submit",
|
||||||
|
"noDateSelected": "No date selected"
|
||||||
},
|
},
|
||||||
"contribution-link": {
|
"contribution-link": {
|
||||||
"thanksYouWith": "thanks you with"
|
"thanksYouWith": "thanks you with"
|
||||||
|
|||||||
@ -3,13 +3,14 @@
|
|||||||
<div>
|
<div>
|
||||||
<b-tabs content-class="mt-3" align="center">
|
<b-tabs content-class="mt-3" align="center">
|
||||||
<b-tab :title="$t('community.writing')" active>
|
<b-tab :title="$t('community.writing')" active>
|
||||||
<contribution-form />
|
<contribution-form @set-contribution="setContribution" />
|
||||||
</b-tab>
|
</b-tab>
|
||||||
<b-tab :title="$t('community.myContributions')">
|
<b-tab :title="$t('community.myContributions')">
|
||||||
<p>{{ $t('community.myContributions') }}</p>
|
<contribution-list :items="items" />
|
||||||
</b-tab>
|
</b-tab>
|
||||||
<b-tab :title="$t('navigation.community')">
|
<b-tab :title="$t('navigation.community')">
|
||||||
<p>{{ $t('navigation.community') }}</p>
|
<contribution-list :items="items" />
|
||||||
|
<contribution-list :items="items" />
|
||||||
</b-tab>
|
</b-tab>
|
||||||
</b-tabs>
|
</b-tabs>
|
||||||
</div>
|
</div>
|
||||||
@ -17,10 +18,63 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import ContributionForm from '@/components/Contributions/ContributionForm.vue'
|
import ContributionForm from '@/components/Contributions/ContributionForm.vue'
|
||||||
|
import ContributionList from '@/components/Contributions/ContributionList.vue'
|
||||||
|
import { createContribution } from '@/graphql/mutations'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Community',
|
name: 'Community',
|
||||||
components: {
|
components: {
|
||||||
ContributionForm,
|
ContributionForm,
|
||||||
|
ContributionList,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
id: '0',
|
||||||
|
date: '07/06/2022',
|
||||||
|
memo: 'sadd sd ad adad asd asd asd ad',
|
||||||
|
amount: 200,
|
||||||
|
status: 'pending',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
date: '06/22/2022',
|
||||||
|
memo: 'sadd sd ad adad asd asd asd ad',
|
||||||
|
amount: 600,
|
||||||
|
status: 'pending',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2',
|
||||||
|
date: '05/04/2022',
|
||||||
|
memo: 'sadd sd ad adad asd asd asd ad',
|
||||||
|
amount: 1200,
|
||||||
|
status: 'pending',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setContribution(data) {
|
||||||
|
// console.log('setContribution', data)
|
||||||
|
this.$apollo
|
||||||
|
.query({
|
||||||
|
fetchPolicy: 'no-cache',
|
||||||
|
query: createContribution,
|
||||||
|
variables: {
|
||||||
|
creationDate: data.date,
|
||||||
|
memo: data.memo,
|
||||||
|
amount: data.amount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
// console.log('result', result.data)
|
||||||
|
this.toastSuccess(result.data)
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.toastError(err.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user