This commit is contained in:
j3d1 2024-06-18 16:43:23 +02:00
parent 59988aa6c0
commit 98cbf0fc73
4 changed files with 2 additions and 176 deletions

View file

@ -1,91 +0,0 @@
<template>
<div class="timeline-item-description">
<i class="avatar | small">
<font-awesome-icon icon="user"/>
</i>
<span><a href="#">$USER</a> has claimed sipping code
<ClipboardButton class="btn btn-primary badge badge-pill" title="Copy shipping code to clipboard" :payload="item.code">{{ item.code }}
<font-awesome-icon icon="clipboard"/>
</ClipboardButton> of type <span class="badge badge-pill badge-secondary">{{ item.code_type }}</span> for this ticket at <time
:datetime="timestamp">{{ timestamp }}</time>
</span>
</div>
</template>
<script>
import {mapState} from "vuex";
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
export default {
name: 'TimelineShippingCode',
components: {ClipboardButton},
props: {
'item': {
type: Object,
required: true
}
},
computed: {
...mapState(['state_options']),
'timestamp': function () {
return new Date(this.item.timestamp).toLocaleString();
},
}
};
</script>
<style scoped>
a {
color: inherit;
}
.timeline-item-description {
display: flex;
padding-top: 6px;
gap: 8px;
color: var(--gray);
img {
flex-shrink: 0;
}
a {
/*color: var(--c-grey-500);*/
font-weight: 500;
text-decoration: none;
&:hover,
&:focus {
outline: 0; /* Don't actually do this */
color: var(--info);
}
}
}
.avatar {
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
overflow: hidden;
aspect-ratio: 1 / 1;
flex-shrink: 0;
width: 40px;
height: 40px;
&.small {
width: 28px;
height: 28px;
}
img {
object-fit: cover;
}
}
</style>

View file

@ -20,7 +20,7 @@ const store = createStore({
groups: [],
state_options: [],
messageTemplates: [],
messageTemplatesVariables: [],
messageTemplateVariables: [],
shippingVouchers: [],
lastEvent: '37C3',
@ -60,15 +60,6 @@ const store = createStore({
'10kg-eu': '10kg Paket (EU)',
},
test: ['foo', 'bar', 'baz'],
shippingCodeTypes: {
'2kg-de': '2kg Paket (DE)',
'5kg-de': '5kg Paket (DE)',
'10kg-de': '10kg Paket (DE)',
'2kg-eu': '2kg Paket (EU)',
'5kg-eu': '5kg Paket (EU)',
'10kg-eu': '10kg Paket (EU)',
}
},
getters: {
route: state => router.currentRoute.value,
@ -479,6 +470,7 @@ const store = createStore({
dispatch('fetchMessageTemplates');
}
},
async fetchShippingVouchers({commit, state}) {
if (!state.user.token) return;
if (state.fetchedData.shippingVouchers > Date.now() - 1000 * 60 * 60 * 24) return;
@ -489,7 +481,6 @@ const store = createStore({
},
async createShippingVoucher({dispatch, state}, code) {
const {data, success} = await http.post('/2/shipping_vouchers/', code, state.user.token);
if (data && success) {
state.fetchedData.shippingVouchers = 0;
dispatch('fetchShippingVouchers');
}
@ -504,14 +495,6 @@ const store = createStore({
state.fetchedData.shippingVouchers = 0;
state.fetchedData.tickets = 0;
await Promise.all([dispatch('loadTickets'), dispatch('fetchShippingVouchers')]);
}
},
async createShippingCode({dispatch, state}, code) {
const {data, success} = await http.post('/2/shipping_codes/', code, state.user.token);
if (data && success) {
dispatch('fetchShippingCodes');
}
}
},
plugins: [
persistentStatePlugin({ // TODO change remember to some kind of enable field