add button to copy shipping contact email to clipboard
This commit is contained in:
parent
d6df034ad0
commit
5a1de437b6
3 changed files with 30 additions and 3 deletions
18
web/src/components/inputs/ClipboardButton.vue
Normal file
18
web/src/components/inputs/ClipboardButton.vue
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<template>
|
||||||
|
<button @click="fillClipboard" class="btn" :title="payload">
|
||||||
|
<slot></slot>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ClipboardButton',
|
||||||
|
props: ['payload'],
|
||||||
|
methods: {
|
||||||
|
fillClipboard() {
|
||||||
|
navigator.clipboard.writeText(this.payload);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -36,7 +36,7 @@ import {
|
||||||
faUser,
|
faUser,
|
||||||
faComments,
|
faComments,
|
||||||
faArchive,
|
faArchive,
|
||||||
faMinus, faHourglass, faExclamation,
|
faMinus, faHourglass, faExclamation, faClipboard,
|
||||||
} from '@fortawesome/free-solid-svg-icons';
|
} from '@fortawesome/free-solid-svg-icons';
|
||||||
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome';
|
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome';
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ import vueDebounce from 'vue-debounce';
|
||||||
|
|
||||||
library.add(faPlus, faCheckCircle, faEdit, faTrash, faCat, faSyncAlt, faSort, faSortUp, faSortDown, faTh, faList,
|
library.add(faPlus, faCheckCircle, faEdit, faTrash, faCat, faSyncAlt, faSort, faSortUp, faSortDown, faTh, faList,
|
||||||
faWindowClose, faCamera, faStop, faPen, faCheck, faTimes, faSave, faEye, faComment, faUser, faComments, faEnvelope,
|
faWindowClose, faCamera, faStop, faPen, faCheck, faTimes, faSave, faEye, faComment, faUser, faComments, faEnvelope,
|
||||||
faArchive, faMinus, faExclamation, faHourglass);
|
faArchive, faMinus, faExclamation, faHourglass, faClipboard);
|
||||||
Vue.component('font-awesome-icon', FontAwesomeIcon);
|
Vue.component('font-awesome-icon', FontAwesomeIcon);
|
||||||
|
|
||||||
sync(store, router);
|
sync(store, router);
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
<button-- class="btn btn-success" @click="markItemReturned({type: 'tickets', id: ticket.id})">Mark
|
<button-- class="btn btn-success" @click="markItemReturned({type: 'tickets', id: ticket.id})">Mark
|
||||||
as returned
|
as returned
|
||||||
</button-->
|
</button-->
|
||||||
|
<ClipboardButton :payload="shippingEmail" class="btn btn-primary">
|
||||||
|
<font-awesome-icon icon="clipboard"/>
|
||||||
|
Copy DHL contact to clipboard
|
||||||
|
</ClipboardButton>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<select class="form-control" v-model="ticket.state">
|
<select class="form-control" v-model="ticket.state">
|
||||||
<option v-for="status in state_options" :value="status.value">{{ status.text }}</option>
|
<option v-for="status in state_options" :value="status.value">{{ status.text }}</option>
|
||||||
|
@ -32,16 +36,21 @@
|
||||||
<script>
|
<script>
|
||||||
import {mapActions, mapState} from 'vuex';
|
import {mapActions, mapState} from 'vuex';
|
||||||
import Timeline from "@/components/Timeline.vue";
|
import Timeline from "@/components/Timeline.vue";
|
||||||
|
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Ticket',
|
name: 'Ticket',
|
||||||
components: {Timeline},
|
components: {ClipboardButton, Timeline},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['tickets', 'state_options']),
|
...mapState(['tickets', 'state_options']),
|
||||||
ticket() {
|
ticket() {
|
||||||
const id = parseInt(this.$route.params.id)
|
const id = parseInt(this.$route.params.id)
|
||||||
const ret = this.tickets.find(ticket => ticket.id === id);
|
const ret = this.tickets.find(ticket => ticket.id === id);
|
||||||
return ret ? ret : {};
|
return ret ? ret : {};
|
||||||
|
},
|
||||||
|
shippingEmail() {
|
||||||
|
const domain = document.location.hostname;
|
||||||
|
return `ticket+${this.ticket.uuid}@${domain}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in a new issue