add dropdown item and method for new link copy use case

This commit is contained in:
mahula 2022-07-05 06:42:39 +02:00
parent 1d4f628cb9
commit b7fb51887f

View File

@ -22,6 +22,10 @@
<b-icon icon="clipboard"></b-icon>
{{ $t('gdd_per_link.copy') }}
</b-dropdown-item>
<b-dropdown-item v-if="validLink" class="test-copy-link" @click="copyLinkWithText()">
<b-icon icon="clipboard-plus"></b-icon>
{{ $t('gdd_per_link.copy-with-text') }}
</b-dropdown-item>
<b-dropdown-item
v-if="validLink"
@click="$bvModal.show('modalPopover-' + id)"
@ -99,6 +103,22 @@ export default {
this.toastError(this.$t('gdd_per_link.not-copied'))
})
},
copyLinkWithText() {
navigator.clipboard
.writeText(
`${this.link}\n` +
`${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido.\n` +
`\"${this.memo}\"\n` +
`${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', {date: this.$d(new Date(this.validUntil), 'short')})}`
)
.then(
this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied'))
)
.catch(() => {
this.$bvModal.show('modalPopoverCopyError' + this.id)
this.toastError(this.$t('gdd_per_link.not-copied'))
})
},
deleteLink() {
this.$bvModal.msgBoxConfirm(this.$t('gdd_per_link.delete-the-link')).then(async (value) => {
if (value)