change data for database createContributionLink

This commit is contained in:
ogerly 2022-06-15 07:32:26 +02:00
parent 60ab6f6b35
commit f4783165cc
11 changed files with 92 additions and 92 deletions

View File

@ -39,7 +39,7 @@ module.exports = {
{
src: './src',
extensions: ['.js', '.vue'],
ignores: ['contributionLink.options.repetition.null'],
ignores: ['contributionLink.options.maxPerCycle.null'],
enableFix: false,
},
],

View File

@ -36,24 +36,24 @@ describe('ContributionLinkForm', () => {
name: 'name',
memo: 'memo',
amount: 100,
startDate: 'startDate',
endDate: 'endDate',
cycle: 'once',
repetition: '1',
maxAmount: 100,
validFrom: 'validFrom',
validTo: 'validTo',
cycle: 'ONCE',
maxPerCycle: '1',
maxAmountPerMonth: 100,
},
})
wrapper.vm.onReset()
})
expect(wrapper.vm.form).toEqual({
amount: null,
cycle: 'once',
endDate: null,
maxAmount: null,
cycle: 'ONCE',
validTo: null,
maxAmountPerMonth: null,
memo: null,
name: null,
repetition: null,
startDate: null,
maxPerCycle: null,
validFrom: null,
})
})

View File

@ -7,9 +7,9 @@
<!-- Date -->
<b-row>
<b-col>
<b-form-group :label="$t('contributionLink.startDate')">
<b-form-group :label="$t('contributionLink.validFrom')">
<b-form-datepicker
v-model="form.startDate"
v-model="form.validFrom"
size="lg"
:min="min"
class="mb-4"
@ -20,11 +20,11 @@
</b-form-group>
</b-col>
<b-col>
<b-form-group :label="$t('contributionLink.endDate')">
<b-form-group :label="$t('contributionLink.validTo')">
<b-form-datepicker
v-model="form.endDate"
v-model="form.validTo"
size="lg"
:min="form.startDate ? form.startDate : min"
:min="form.validFrom ? form.validFrom : min"
class="mb-4"
reset-value=""
:label-no-date-selected="$t('contributionLink.noDateSelected')"
@ -68,7 +68,7 @@
<b-row class="mb-4">
<b-col>
<!-- Cycle -->
<label for="cycle-repetition">{{ $t('contributionLink.cycle') }}</label>
<label for="cycle">{{ $t('contributionLink.cycle') }}</label>
<b-form-select
v-model="form.cycle"
:options="cycle"
@ -78,11 +78,11 @@
></b-form-select>
</b-col>
<b-col>
<!-- Repetition -->
<label for="cycle-repetition">{{ $t('contributionLink.repetition') }}</label>
<!-- maxPerCycle -->
<label for="maxPerCycle">{{ $t('contributionLink.maxPerCycle') }}</label>
<b-form-select
v-model="form.repetition"
:options="repetition"
v-model="form.maxPerCycle"
:options="maxPerCycle"
:disabled="disabled"
class="mb-3"
size="lg"
@ -90,10 +90,10 @@
</b-col>
</b-row>
<!-- Max amount -->
<!-- maxAmountPerMonth -->
<b-form-group :label="$t('contributionLink.maximumAmount')">
<b-form-input
v-model="form.maxAmount"
v-model="form.maxAmountPerMonth"
size="lg"
:disabled="disabled"
type="number"
@ -128,23 +128,23 @@ export default {
name: null,
memo: null,
amount: null,
startDate: null,
endDate: null,
cycle: 'once',
repetition: null,
maxAmount: null,
validFrom: null,
validTo: null,
cycle: 'ONCE',
maxPerCycle: '1',
maxAmountPerMonth: 0,
},
min: new Date(),
cycle: [
{ value: 'once', text: this.$t('contributionLink.options.cycle.once') },
{ value: 'ONCE', text: this.$t('contributionLink.options.cycle.once') },
{ value: 'hourly', text: this.$t('contributionLink.options.cycle.hourly') },
{ value: 'daily', text: this.$t('contributionLink.options.cycle.daily') },
{ value: 'weekly', text: this.$t('contributionLink.options.cycle.weekly') },
{ value: 'monthly', text: this.$t('contributionLink.options.cycle.monthly') },
{ value: 'yearly', text: this.$t('contributionLink.options.cycle.yearly') },
],
repetition: [
{ value: null, text: this.$t('contributionLink.options.repetition.null') },
maxPerCycle: [
{ value: null, text: this.$t('contributionLink.options.maxPerCycle.null') },
{ value: '1', text: '1 x' },
{ value: '2', text: '2 x' },
{ value: '3', text: '3 x' },
@ -155,22 +155,22 @@ export default {
},
methods: {
onSubmit() {
if (this.form.startDate === null)
if (this.form.validFrom === null)
return this.toastError(this.$t('contributionLink.noStartDate'))
if (this.form.endDate === null) return this.toastError(this.$t('contributionLink.noEndDate'))
if (this.form.validTo === null) return this.toastError(this.$t('contributionLink.noEndDate'))
alert(JSON.stringify(this.form))
this.$apollo
.mutate({
mutation: createContributionLink,
variables: {
startDate: this.form.startDate,
endDate: this.form.endDate,
validFrom: this.form.validFrom,
validTo: this.form.validTo,
name: this.form.name,
amount: this.form.amount,
memo: this.form.memo,
cycle: this.form.cycle,
repetition: this.form.repetition,
maxAmount: this.form.maxAmount,
maxPerCycle: this.form.maxPerCycle,
maxAmountPerMonth: this.form.maxAmountPerMonth,
},
})
.then((result) => {
@ -183,8 +183,8 @@ export default {
},
onReset() {
this.$refs.contributionLinkForm.reset()
this.form.startDate = null
this.form.endDate = null
this.form.validFrom = null
this.form.validTo = null
},
},
computed: {
@ -192,7 +192,7 @@ export default {
return this.contributionLinkData
},
disabled() {
if (this.form.cycle === 'once') return true
if (this.form.cycle === 'ONCE') return true
return false
},
},
@ -201,11 +201,11 @@ export default {
this.form.name = this.contributionLinkData.name
this.form.memo = this.contributionLinkData.memo
this.form.amount = this.contributionLinkData.amount
this.form.startDate = this.contributionLinkData.startDate
this.form.endDate = this.contributionLinkData.endDate
this.form.validFrom = this.contributionLinkData.validFrom
this.form.validTo = this.contributionLinkData.validTo
this.form.cycle = this.contributionLinkData.cycle
this.form.repetition = this.contributionLinkData.repetition
this.form.maxAmount = this.contributionLinkData.maxAmount
this.form.maxPerCycle = this.contributionLinkData.maxPerCycle
this.form.maxAmountPerMonth = this.contributionLinkData.maxAmountPerMonth
},
},
}

View File

@ -21,11 +21,11 @@ const propsData = {
name: 'Meditation',
memo: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut l',
amount: '200',
startDate: '2022-04-01',
endDate: '2022-08-01',
validFrom: '2022-04-01',
validTo: '2022-08-01',
cycle: 'täglich',
repetition: '3',
maxAmount: 0,
maxPerCycle: '3',
maxAmountPerMonth: 0,
link: 'https://localhost/redeem/CL-1a2345678',
},
],
@ -130,11 +130,11 @@ describe('ContributionLinkList', () => {
name: 'Meditation',
memo: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut l',
amount: '200',
startDate: '2022-04-01',
endDate: '2022-08-01',
validFrom: '2022-04-01',
validTo: '2022-08-01',
cycle: 'täglich',
repetition: '3',
maxAmount: 0,
maxPerCycle: '3',
maxAmountPerMonth: 0,
link: 'https://localhost/redeem/CL-1a2345678',
},
],

View File

@ -57,10 +57,10 @@ export default {
'name',
'memo',
'amount',
'cycle',
'repetition',
{ key: 'startDate', label: 'Start' },
{ key: 'endDate', label: 'Ende' },
{ key: 'cycle', label: 'Zyklus' },
{ key: 'maxPerCycle', label: 'Wiederholung' },
{ key: 'validFrom', label: 'Start' },
{ key: 'validTo', label: 'Ende' },
'delete',
'edit',
'show',

View File

@ -2,24 +2,24 @@ import gql from 'graphql-tag'
export const createContributionLink = gql`
mutation (
$startDate: String!
$endDate: String!
$validFrom: String!
$validTo: String!
$name: String!
$amount: Decimal!
$memo: String!
$cycle: String
$repetition: String
$maxAmount: Decimal
$maxPerCycle: String
$maxAmountPerMonth: Decimal
) {
createContributionLink(
startDate: $startDate
endDate: $endDate
validFrom: $validFrom
validTo: $validTo
name: $name
amount: $amount
memo: $memo
cycle: $cycle
repetition: $repetition
maxAmount: $maxAmount
maxPerCycle: $maxPerCycle
maxAmountPerMonth: $maxAmountPerMonth
) {
link
}

View File

@ -4,14 +4,14 @@ export const listContributionLinks = gql`
query {
listContributionLinks {
id
startDate
endDate
validFrom
validTo
name
memo
amount
cycle
repetition
maxAmount
maxPerCycle
maxAmountPerMonth
link
}
}

View File

@ -4,14 +4,14 @@ export const showContributionLink = gql`
query ($id: Int!) {
showContributionLink {
id
startDate
endDate
validFrom
validTo
name
memo
amount
cycle
repetition
maxAmount
maxPerCycle
maxAmountPerMonth
code
}
}

View File

@ -7,7 +7,7 @@
"contributionLinks": "Beitragslinks",
"create": "Anlegen",
"cycle": "Zyklus",
"endDate": "Enddatum",
"validTo": "Enddatum",
"maximumAmount": "maximaler Betrag",
"memo": "Nachricht",
"name": "Name",
@ -25,12 +25,12 @@
"weekly": "wöchentlich",
"yearly": "jährlich"
},
"repetition": {
"maxPerCycle": {
"null": "Bitte wähle eine Wiederholung"
}
},
"repetition": "Wiederholung",
"startDate": "Startdatum"
"maxPerCycle": "Wiederholung",
"validFrom": "Startdatum"
},
"creation": "Schöpfung",
"creationList": "Schöpfungsliste",

View File

@ -7,7 +7,7 @@
"contributionLinks": "Contribution Links",
"create": "Create",
"cycle": "Cycle",
"endDate": "End-Date",
"validTo": "End-Date",
"maximumAmount": "Maximum amount",
"memo": "Memo",
"name": "Name",
@ -25,12 +25,12 @@
"weekly": "weekly",
"yearly": "yearly"
},
"repetition": {
"maxPerCycle": {
"null": "please select a repetition"
}
},
"repetition": "Repetition",
"startDate": "Start-date"
"maxPerCycle": "Repetition",
"validFrom": "Start-date"
},
"creation": "Creation",
"creationList": "Creation list",

View File

@ -76,11 +76,11 @@ export default {
name: 'Meditation',
memo: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut l',
amount: '200',
startDate: '2022-04-01',
endDate: '2022-08-01',
validFrom: '2022-04-01',
validTo: '2022-08-01',
cycle: 'täglich',
repetition: '3',
maxAmount: 0,
maxPerCycle: '3',
maxAmountPerMonth: 0,
link: 'https://localhost/redeem/CL-1a2345678',
},
{
@ -88,11 +88,11 @@ export default {
name: 'Teamarbeit',
memo: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt',
amount: '300',
startDate: '2022-04-01',
endDate: '2022-12-01',
validFrom: '2022-04-01',
validTo: '2022-12-01',
cycle: 'monatlich',
repetition: '2',
maxAmount: 0,
maxPerCycle: '2',
maxAmountPerMonth: 0,
link: 'https://localhost/redeem/CL-1b2345678',
},
{
@ -100,11 +100,11 @@ export default {
name: 'Documenta Kassel 2022',
memo: 'New Account Register by Documenta Kassel, Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt',
amount: '400',
startDate: '2022-06-18',
endDate: '2022-10-01',
validFrom: '2022-06-18',
validTo: '2022-10-01',
cycle: 'null',
repetition: '1',
maxAmount: 0,
maxPerCycle: '1',
maxAmountPerMonth: 0,
link: 'https://localhost/redeem/CL-1c2345678',
},
]