This commit is contained in:
j3d1 2024-06-15 17:39:41 +02:00
parent ab88e50d82
commit da075d162f
2 changed files with 20 additions and 7 deletions

View file

@ -20,7 +20,8 @@ const store = createStore({
groups: [],
state_options: [],
messageTemplates: [],
messageTemplatesVariables: [],
messageTemplateVariables: [],
shippingCodes: null,
lastEvent: '37C3',
lastUsed: {},
@ -209,6 +210,9 @@ const store = createStore({
setMessageTemplateVariables(state, variables) {
state.messageTemplateVariables = variables;
},
setShippingCodes(state, codes) {
state.shippingCodes = codes;
},
},
actions: {
async login({commit}, {username, password, remember}) {
@ -450,6 +454,12 @@ const store = createStore({
if (data && success) {
commit('setMessageTemplates', data);
}
},
async fetchShippingCodes({commit, state}) {
const {data, success} = await http.get('/2/shipping_codes/', state.user.token);
if (data && success) {
commit('setShippingCodes', data);
}
}
},
plugins: [

View file

@ -1,12 +1,12 @@
<template>
<Table
:columns="['slug', 'name']"
:items="events"
:keyName="'slug'"
:columns="['type', 'code']"
:items="shippingCodes"
:keyName="'code'"
>
<template #actions="{ item }">
<div class="btn-group">
<button class="btn btn-secondary" @click.stop="changeEvent(item)">
<button class="btn btn-secondary" @click.stop="alert(item)">
<font-awesome-icon icon="archive"/>
use
</button>
@ -26,8 +26,11 @@ import Table from '@/components/Table';
export default {
name: 'Shipping',
components: {Table},
computed: mapState(['events']),
methods: mapActions(['changeEvent']),
computed: mapState(['shippingCodes']),
methods: mapActions(['fetchShippingCodes']),
mounted() {
this.fetchShippingCodes();
},
};
</script>