+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mdi-delete
+
+
+ mdi-minus
+
+ {$emit('save', model); $emit('delete_free_drink_config'); model = null}"
+ >
+ Save
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/plugins/routes.js b/src/plugins/routes.js
index 953a34a..cef3e5a 100644
--- a/src/plugins/routes.js
+++ b/src/plugins/routes.js
@@ -33,6 +33,7 @@ const url = {
deleteDrinkListHistory: main + 'deleteDrinkListHistory',
freeDrinkListReasons: main + 'freeDrinkListReasons',
freeDrinkTypes: main + 'freeDrinkTypes',
+ deleteFreeDrinkListConfig: main + 'deleteFreeDrinkListConfig',
vorstand: {
sm: {
addUser: main + 'sm/addUser',
diff --git a/src/store/modules/freeDrinkList.js b/src/store/modules/freeDrinkList.js
index 7d434d5..44f9434 100644
--- a/src/store/modules/freeDrinkList.js
+++ b/src/store/modules/freeDrinkList.js
@@ -63,6 +63,12 @@ const mutations = {
},
set_free_drink_types_loading(state, loading) {
state.free_drink_types_loading = loading
+ },
+ set_free_drink_config(state, data) {
+ let config = state.free_drink_list_config.find(item => {
+ return item.id == data.id
+ })
+ Object.assign(config, data)
}
}
@@ -185,6 +191,63 @@ const actions = {
} finally {
commit('set_free_drink_types_loading', false)
}
+ },
+ async set_free_drink_list_config({commit, dispatch, rootState}, data) {
+ try {
+ commit('set_free_drink_list_config_loading', true)
+ const response = await axios.post(url.freeDrinkListConfig, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_config', 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_config_loading', false)
+ }
+ },
+ async update_free_drink_list_config({commit, dispatch, rootState}, data) {
+ try {
+ commit('set_free_drink_list_config_loading', true)
+ const response = await axios.put(url.freeDrinkListConfig, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_config', 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_config_loading', false)
+ }
+ },
+ async delete_free_drink_list_config({commit, dispatch, rootState}, data) {
+ try {
+ commit('set_free_drink_list_config_loading', true)
+ const response = await axios.post(url.deleteFreeDrinkListConfig, {...data},{
+ headers: { Token: rootState.login.user.accessToken },
+ timeout
+ })
+ commit('set_free_drink_list_config', 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_config_loading', false)
+ }
}
}
@@ -267,6 +330,9 @@ const getters = {
},
free_drink_types_loading(state) {
return state.free_drink_types_loading
+ },
+ free_drink_list_config_by_id: (state) => (id) => {
+ return state.free_drink_list_config.find(item => { return item.id == id})
}
}