stash
This commit is contained in:
parent
ab88e50d82
commit
da075d162f
2 changed files with 20 additions and 7 deletions
|
@ -20,7 +20,8 @@ const store = createStore({
|
||||||
groups: [],
|
groups: [],
|
||||||
state_options: [],
|
state_options: [],
|
||||||
messageTemplates: [],
|
messageTemplates: [],
|
||||||
messageTemplatesVariables: [],
|
messageTemplateVariables: [],
|
||||||
|
shippingCodes: null,
|
||||||
|
|
||||||
lastEvent: '37C3',
|
lastEvent: '37C3',
|
||||||
lastUsed: {},
|
lastUsed: {},
|
||||||
|
@ -209,6 +210,9 @@ const store = createStore({
|
||||||
setMessageTemplateVariables(state, variables) {
|
setMessageTemplateVariables(state, variables) {
|
||||||
state.messageTemplateVariables = variables;
|
state.messageTemplateVariables = variables;
|
||||||
},
|
},
|
||||||
|
setShippingCodes(state, codes) {
|
||||||
|
state.shippingCodes = codes;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async login({commit}, {username, password, remember}) {
|
async login({commit}, {username, password, remember}) {
|
||||||
|
@ -450,6 +454,12 @@ const store = createStore({
|
||||||
if (data && success) {
|
if (data && success) {
|
||||||
commit('setMessageTemplates', data);
|
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: [
|
plugins: [
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<Table
|
<Table
|
||||||
:columns="['slug', 'name']"
|
:columns="['type', 'code']"
|
||||||
:items="events"
|
:items="shippingCodes"
|
||||||
:keyName="'slug'"
|
:keyName="'code'"
|
||||||
>
|
>
|
||||||
<template #actions="{ item }">
|
<template #actions="{ item }">
|
||||||
<div class="btn-group">
|
<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"/>
|
<font-awesome-icon icon="archive"/>
|
||||||
use
|
use
|
||||||
</button>
|
</button>
|
||||||
|
@ -26,8 +26,11 @@ import Table from '@/components/Table';
|
||||||
export default {
|
export default {
|
||||||
name: 'Shipping',
|
name: 'Shipping',
|
||||||
components: {Table},
|
components: {Table},
|
||||||
computed: mapState(['events']),
|
computed: mapState(['shippingCodes']),
|
||||||
methods: mapActions(['changeEvent']),
|
methods: mapActions(['fetchShippingCodes']),
|
||||||
|
mounted() {
|
||||||
|
this.fetchShippingCodes();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue