diff --git a/src/components/vorstand/FreeDrinkList.vue b/src/components/vorstand/FreeDrinkList.vue
index 546be23..d4189a7 100644
--- a/src/components/vorstand/FreeDrinkList.vue
+++ b/src/components/vorstand/FreeDrinkList.vue
@@ -35,6 +35,7 @@
+
@@ -42,7 +43,7 @@
+
+
\ No newline at end of file
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue
index 71e2d94..84b6f77 100644
--- a/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue
+++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue
@@ -94,7 +94,7 @@ name: "FreeDrinkListWorkgroup",
label: drink_config.label,
name: drink_config.drink.name,
user: `${history_config.user.firstname} ${history_config.user.lastname}`,
- reason: history_config.free_drink_list_reason.name,
+ reason: history_config.free_drink_list_reason ? history_config.free_drink_list_reason.name : null,
description: history_config.description,
pricepro: (drink_config.price / 100).toFixed(2)
})
diff --git a/src/plugins/routes.js b/src/plugins/routes.js
index e974d25..cfa1742 100644
--- a/src/plugins/routes.js
+++ b/src/plugins/routes.js
@@ -33,6 +33,7 @@ const url = {
freeDrinkListHistoryFromTo: main + 'freeDrinkListHistoryFromTo',
deleteDrinkListHistory: main + 'deleteDrinkListHistory',
freeDrinkListReasons: main + 'freeDrinkListReasons',
+ deleteFreeDrinkListReason: main + 'deleteFreeDrinkListReason',
freeDrinkTypes: main + 'freeDrinkTypes',
deleteFreeDrinkListConfig: main + 'deleteFreeDrinkListConfig',
vorstand: {
diff --git a/src/store/modules/freeDrinkList.js b/src/store/modules/freeDrinkList.js
index c46d651..f95451b 100644
--- a/src/store/modules/freeDrinkList.js
+++ b/src/store/modules/freeDrinkList.js
@@ -266,7 +266,66 @@ const actions = {
} finally {
commit('set_free_drink_list_config_loading', false)
}
+ },
+ async set_free_drink_list_reason({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_reasons_loading', true)
+ const response = await axios.post(url.freeDrinkListReasons, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_reasons', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_reasons_loading', false)
+ }
}
+ ,
+ async update_free_drink_list_reason({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_reasons_loading', true)
+ const response = await axios.put(url.freeDrinkListReasons, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_reasons', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_reasons_loading', false)
+ }
+ },
+ async delete_free_drink_list_reason({ commit, dispatch, rootState }, data) {
+ try {
+ commit('set_free_drink_list_reasons_loading', true)
+ const response = await axios.post(url.deleteFreeDrinkListReason, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_reasons', response.data)
+ } catch (e) {
+ dispatch('connectionError/addError', null, { root: true })
+ if (e.message == 'Network Error') {
+ dispatch('connectionError/addError', null, { root: true })
+ }
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ } finally {
+ commit('set_free_drink_list_reasons_loading', false)
+ }
+ }
+
}
const getters = {
@@ -356,6 +415,12 @@ const getters = {
free_drink_types(state) {
return state.free_drink_types
},
+ free_drink_list_history_loading(state) {
+ return state.free_drink_list_history_loading
+ },
+ free_drink_list_config_loading(state) {
+ return state.free_drink_list_config_loading
+ },
free_drink_types_loading(state) {
return state.free_drink_types_loading
},