mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add fucntionality to copy link and text after creating a transaction link
This commit is contained in:
parent
c69b20e5fb
commit
80eaf1c8ea
@ -3,6 +3,9 @@
|
|||||||
<b-input-group v-if="canCopyLink" size="lg" class="mb-3" prepend="Link">
|
<b-input-group v-if="canCopyLink" size="lg" class="mb-3" prepend="Link">
|
||||||
<b-form-input :value="link" type="text" readonly></b-form-input>
|
<b-form-input :value="link" type="text" readonly></b-form-input>
|
||||||
<b-input-group-append>
|
<b-input-group-append>
|
||||||
|
<b-button size="sm" text="Button" variant="primary" @click="copyLinkWithText">
|
||||||
|
{{ $t('gdd_per_link.copy-with-text') }}
|
||||||
|
</b-button>
|
||||||
<b-button size="sm" text="Button" variant="primary" @click="CopyLink">
|
<b-button size="sm" text="Button" variant="primary" @click="CopyLink">
|
||||||
{{ $t('gdd_per_link.copy') }}
|
{{ $t('gdd_per_link.copy') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
@ -22,6 +25,8 @@ export default {
|
|||||||
name: 'ClipboardCopy',
|
name: 'ClipboardCopy',
|
||||||
props: {
|
props: {
|
||||||
link: { type: String, required: true },
|
link: { type: String, required: true },
|
||||||
|
amount: { type: Number, required: true },
|
||||||
|
memo: { type: String, required: true },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -40,6 +45,21 @@ export default {
|
|||||||
this.toastError(this.$t('gdd_per_link.not-copied'))
|
this.toastError(this.$t('gdd_per_link.not-copied'))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
copyLinkWithText() {
|
||||||
|
navigator.clipboard
|
||||||
|
.writeText(
|
||||||
|
`${this.link}
|
||||||
|
${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido.
|
||||||
|
"${this.memo}"`,
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied'))
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.canCopyLink = false
|
||||||
|
this.toastError(this.$t('gdd_per_link.not-copied'))
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -3,7 +3,12 @@
|
|||||||
<b-col>
|
<b-col>
|
||||||
<b-card class="p-0 gradido-custom-background">
|
<b-card class="p-0 gradido-custom-background">
|
||||||
<div class="h3 mb-4">{{ $t('gdd_per_link.created') }}</div>
|
<div class="h3 mb-4">{{ $t('gdd_per_link.created') }}</div>
|
||||||
<clipboard-copy :link="link" @show-qr-code-button="showQrCodeButton" />
|
<clipboard-copy
|
||||||
|
:link="link"
|
||||||
|
:amount="amount"
|
||||||
|
:memo="memo"
|
||||||
|
@show-qr-code-button="showQrCodeButton"
|
||||||
|
></clipboard-copy>
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<figure-qr-code v-if="showQrcode" :link="link" />
|
<figure-qr-code v-if="showQrcode" :link="link" />
|
||||||
@ -27,10 +32,9 @@ export default {
|
|||||||
FigureQrCode,
|
FigureQrCode,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
link: {
|
link: { type: String, required: true },
|
||||||
type: String,
|
amount: { type: Number, required: true },
|
||||||
required: true,
|
memo: { type: String, required: true },
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -41,7 +41,12 @@
|
|||||||
></transaction-result-send-error>
|
></transaction-result-send-error>
|
||||||
</template>
|
</template>
|
||||||
<template #transactionResultLink>
|
<template #transactionResultLink>
|
||||||
<transaction-result-link :link="link" @on-reset="onReset"></transaction-result-link>
|
<transaction-result-link
|
||||||
|
:link="link"
|
||||||
|
:amount="amount"
|
||||||
|
:memo="memo"
|
||||||
|
@on-reset="onReset"
|
||||||
|
></transaction-result-link>
|
||||||
</template>
|
</template>
|
||||||
</gdd-send>
|
</gdd-send>
|
||||||
<hr />
|
<hr />
|
||||||
@ -145,6 +150,8 @@ export default {
|
|||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.$emit('set-tunneled-email', null)
|
this.$emit('set-tunneled-email', null)
|
||||||
this.link = result.data.createTransactionLink.link
|
this.link = result.data.createTransactionLink.link
|
||||||
|
this.amount = this.transactionData.amount
|
||||||
|
this.memo = this.transactionData.memo
|
||||||
this.transactionData = { ...EMPTY_TRANSACTION_DATA }
|
this.transactionData = { ...EMPTY_TRANSACTION_DATA }
|
||||||
this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink
|
this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink
|
||||||
this.updateTransactions({})
|
this.updateTransactions({})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user