mirror of
https://github.com/IT4Change/gradido.git
synced 2026-01-15 09:24:38 +00:00
seperate confirm send GDD per link, add function sendTransactionPerLink()
This commit is contained in:
parent
18534f3179
commit
6cc6c3476a
@ -9,11 +9,13 @@
|
||||
<transaction-confirmation
|
||||
:balance="balance"
|
||||
:transactions="transactions"
|
||||
:selected="transactionData.selected"
|
||||
:email="transactionData.email"
|
||||
:amount="transactionData.amount"
|
||||
:memo="transactionData.memo"
|
||||
:loading="loading"
|
||||
@send-transaction="sendTransaction"
|
||||
@send-transaction-per-link="sendTransactionPerLink"
|
||||
@on-reset="onReset"
|
||||
></transaction-confirmation>
|
||||
</template>
|
||||
@ -34,7 +36,7 @@ import GddSend from './SendOverview/GddSend.vue'
|
||||
import TransactionForm from './SendOverview/GddSend/TransactionForm.vue'
|
||||
import TransactionConfirmation from './SendOverview/GddSend/TransactionConfirmation.vue'
|
||||
import TransactionResult from './SendOverview/GddSend/TransactionResult.vue'
|
||||
import { sendCoins } from '../../graphql/mutations.js'
|
||||
import { sendCoins, sendCoinsPerLink } from '../../graphql/mutations.js'
|
||||
|
||||
const EMPTY_TRANSACTION_DATA = {
|
||||
email: '',
|
||||
@ -76,10 +78,6 @@ export default {
|
||||
this.transactionData = { ...data }
|
||||
this.currentTransactionStep = 1
|
||||
},
|
||||
setTransactionPerLink(data) {
|
||||
this.transactionData = { ...data }
|
||||
this.currentTransactionStep = 1
|
||||
},
|
||||
async sendTransaction() {
|
||||
this.loading = true
|
||||
this.error = false
|
||||
@ -99,6 +97,26 @@ export default {
|
||||
this.currentTransactionStep = 2
|
||||
this.loading = false
|
||||
},
|
||||
async sendTransactionPerLink() {
|
||||
alert('sendTransactionPerLink: TODO : lege sendCoinsPerLink als mutation an!')
|
||||
this.loading = true
|
||||
this.error = false
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: sendCoinsPerLink,
|
||||
variables: this.transactionData,
|
||||
})
|
||||
.then(() => {
|
||||
this.error = false
|
||||
this.$emit('update-balance', this.transactionData.amount)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.errorResult = err.message
|
||||
this.error = true
|
||||
})
|
||||
this.currentTransactionStep = 2
|
||||
this.loading = false
|
||||
},
|
||||
onReset() {
|
||||
this.currentTransactionStep = 0
|
||||
},
|
||||
|
||||
@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-row>
|
||||
<b-row v-if="selected === 'gift'">
|
||||
<b-alert class="mb-3 mt-3" show variant="muted">
|
||||
<h2 class="alert-heading">{{ $t('gdd_per_link.header') }}</h2>
|
||||
|
||||
<div>
|
||||
Du verschenkst:
|
||||
<h1>{{ $n(amount, 'decimal') }} GDD</h1>
|
||||
</div>
|
||||
</b-alert>
|
||||
</b-row>
|
||||
<b-row v-else>
|
||||
<b-col>
|
||||
<div class="display-4 pb-4">{{ $t('form.send_check') }}</div>
|
||||
<b-list-group class="">
|
||||
@ -43,13 +53,24 @@
|
||||
<b-col class="text-right">
|
||||
<strong>{{ $t('form.your_amount') }}</strong>
|
||||
</b-col>
|
||||
<b-col class="text-right borderbottom">
|
||||
<b-col class="text-right">
|
||||
<strong>- {{ $n(amount, 'decimal') }}</strong>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row class="pr-3">
|
||||
<b-col class="text-right">
|
||||
<strong>Vergänglichkeit für 14 Tage</strong>
|
||||
</b-col>
|
||||
<b-col class="text-right borderbottom">
|
||||
<strong>- {{ $n(amount * 0.028, 'decimal') }}</strong>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row class="pr-3">
|
||||
<b-col class="text-right">{{ $t('form.new_balance') }}</b-col>
|
||||
<b-col class="text-right">~ {{ $n(balance - amount, 'decimal') }}</b-col>
|
||||
<b-col v-if="selected === 'gift'" class="text-right">
|
||||
~ {{ $n(balance - amount - amount * 0.028, 'decimal') }}
|
||||
</b-col>
|
||||
<b-col v-else class="text-right">~ {{ $n(balance - amount, 'decimal') }}</b-col>
|
||||
</b-row>
|
||||
</b-container>
|
||||
|
||||
@ -58,11 +79,39 @@
|
||||
<b-button @click="$emit('on-reset')">{{ $t('form.cancel') }}</b-button>
|
||||
</b-col>
|
||||
<b-col class="text-right">
|
||||
<b-button variant="success" :disabled="loading" @click="$emit('send-transaction')">
|
||||
{{ $t('form.send_now') }}
|
||||
<b-button
|
||||
variant="success"
|
||||
:disabled="loading"
|
||||
@click="
|
||||
selected === 'send' ? $emit('send-transaction') : $emit('send-transaction-per-link')
|
||||
"
|
||||
>
|
||||
{{ selected === 'send' ? $t('form.send_now') : $t('form.generate_now') }}
|
||||
</b-button>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
<b-alert class="mt-3" show v-show="selected === 'gift'" variant="muted">
|
||||
<h2 class="alert-heading">{{ $t('gdd_per_link.header') }}</h2>
|
||||
|
||||
<p>
|
||||
-
|
||||
<b>{{ $t('gdd_per_link.sentence_2') }}</b>
|
||||
</p>
|
||||
<p>
|
||||
-
|
||||
<b>{{ $t('gdd_per_link.sentence_3') }}</b>
|
||||
</p>
|
||||
<p>
|
||||
-
|
||||
<b>{{ $t('gdd_per_link.sentence_4') }}</b>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<p class="mb-0">
|
||||
{{ $t('gdd_per_link.sentence_5') }}
|
||||
</p>
|
||||
</b-alert>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -74,6 +123,7 @@ export default {
|
||||
amount: { type: Number, default: 0 },
|
||||
memo: { type: String, default: '' },
|
||||
loading: { type: Boolean, default: false },
|
||||
selected: { type: String, required: false },
|
||||
transactions: {
|
||||
default: () => [],
|
||||
},
|
||||
|
||||
@ -22,30 +22,11 @@
|
||||
</b-form-radio>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<div class="mb-3 mt-3">({{ selected }})</div>
|
||||
|
||||
<b-alert class="mb-3 mt-3" v-show="selected === 'gift'" show variant="muted">
|
||||
<b-alert class="mt-3" v-show="selected === 'gift'" show variant="muted">
|
||||
<h2 class="alert-heading">{{ $t('gdd_per_link.header') }}</h2>
|
||||
<p>
|
||||
{{ $t('gdd_per_link.sentence_1') }}
|
||||
</p>
|
||||
<p>
|
||||
-
|
||||
<b>{{ $t('gdd_per_link.sentence_2') }}</b>
|
||||
</p>
|
||||
<p>
|
||||
-
|
||||
<b>{{ $t('gdd_per_link.sentence_3') }}</b>
|
||||
</p>
|
||||
<p>
|
||||
-
|
||||
<b>{{ $t('gdd_per_link.sentence_4') }}</b>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<p class="mb-0">
|
||||
{{ $t('gdd_per_link.sentence_5') }}
|
||||
</p>
|
||||
</b-alert>
|
||||
|
||||
<div>
|
||||
@ -53,13 +34,13 @@
|
||||
v-show="selected === 'send'"
|
||||
name="Email"
|
||||
:rules="{
|
||||
required: true,
|
||||
required: selected === 'send' ? true : false,
|
||||
email: true,
|
||||
is_not: $store.state.email,
|
||||
}"
|
||||
v-slot="{ errors }"
|
||||
>
|
||||
<label class="input-1" for="input-1">{{ $t('form.recipient') }}</label>
|
||||
<label class="input-1 mt-5" for="input-1">{{ $t('form.recipient') }}</label>
|
||||
<b-input-group
|
||||
id="input-group-1"
|
||||
class="border border-default"
|
||||
@ -153,7 +134,6 @@
|
||||
</b-col>
|
||||
</validation-provider>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div v-if="!!isBalanceDisabled" class="text-danger">
|
||||
{{ $t('form.no_gdd_available') }}
|
||||
@ -209,23 +189,8 @@ export default {
|
||||
methods: {
|
||||
onSubmit() {
|
||||
this.normalizeAmount(true)
|
||||
switch (this.selected) {
|
||||
case 'send':
|
||||
this.$emit('set-transaction', {
|
||||
email: this.form.email,
|
||||
amount: this.form.amountValue,
|
||||
memo: this.form.memo,
|
||||
})
|
||||
break
|
||||
case 'gift':
|
||||
this.$emit('set-transaction-per-link', {
|
||||
selected: this.selected,
|
||||
amount: this.form.amountValue,
|
||||
memo: this.form.memo,
|
||||
})
|
||||
break
|
||||
}
|
||||
this.$emit('set-transaction', {
|
||||
selected: this.selected,
|
||||
email: this.form.email,
|
||||
amount: this.form.amountValue,
|
||||
memo: this.form.memo,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user