From 6e4d3a8a014c545cced45258db6b1d7b0f9d82ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Fri, 21 Aug 2020 22:03:24 +0200 Subject: [PATCH] =?UTF-8?q?MainLayout=20f=C3=BCr=20Freigetr=C3=A4nke=20f?= =?UTF-8?q?=C3=BCr=20den=20Vorstand=20gesetzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Es wurde das MainLayout für die Freigetränke für den Vorstand gesetzt. Dabei wurden free_drink_types hinzugefügt und die Einstellungsseite für die Freigetränke angefangen. Bis jetzt können diese geladen werden. --- src/components/vorstand/FreeDrinkList.vue | 55 ++++++++++++++ .../FreeDrinkList/FreeDrinkListConfig.vue | 76 +++++++++++++++++++ .../FreeDrinkList/FreeDrinkListMain.vue | 15 ++++ .../vorstand/ManagementNavigation.vue | 8 ++ src/plugins/routes.js | 1 + src/router/index.js | 20 +++++ src/store/modules/freeDrinkList.js | 33 ++++++++ 7 files changed, 208 insertions(+) create mode 100644 src/components/vorstand/FreeDrinkList.vue create mode 100644 src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue create mode 100644 src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue diff --git a/src/components/vorstand/FreeDrinkList.vue b/src/components/vorstand/FreeDrinkList.vue new file mode 100644 index 0000000..4c36c83 --- /dev/null +++ b/src/components/vorstand/FreeDrinkList.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue new file mode 100644 index 0000000..c1cedc7 --- /dev/null +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue new file mode 100644 index 0000000..bc04564 --- /dev/null +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/src/components/vorstand/ManagementNavigation.vue b/src/components/vorstand/ManagementNavigation.vue index 6631763..fb61006 100644 --- a/src/components/vorstand/ManagementNavigation.vue +++ b/src/components/vorstand/ManagementNavigation.vue @@ -31,6 +31,14 @@ Dienstarten + + + mdi-beer + + + Freigetränke + + diff --git a/src/plugins/routes.js b/src/plugins/routes.js index 6d9c6e1..953a34a 100644 --- a/src/plugins/routes.js +++ b/src/plugins/routes.js @@ -32,6 +32,7 @@ const url = { freeDrinkListHistory: main + 'freeDrinkListHistory', deleteDrinkListHistory: main + 'deleteDrinkListHistory', freeDrinkListReasons: main + 'freeDrinkListReasons', + freeDrinkTypes: main + 'freeDrinkTypes', vorstand: { sm: { addUser: main + 'sm/addUser', diff --git a/src/router/index.js b/src/router/index.js index 9e2ba9d..b90dbcf 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -28,6 +28,9 @@ import WorkgroupManagement from '@/components/vorstand/WorkgroupManagement' import JobKindManager from '@/components/vorstand/JobKindManager' import JobsRequest from '@/components/user/JobsRequest' import ResetPassword from '@/components/ResetPassword' +import FreeDrinkList from '@/components/vorstand/FreeDrinkList' +import FreeDrinkListMain from '@/components/vorstand/FreeDrinkList/FreeDrinkListMain' +import FreeDrinkListConfig from '@/components/vorstand/FreeDrinkList/FreeDrinkListConfig' Vue.use(VueRouter) @@ -82,6 +85,23 @@ const routes = [ path: 'jobkindmanagement', name: 'jobkindManagement', component: JobKindManager + }, + { + path: 'freeDrinkList', + name: 'freeDrinkList', + component: FreeDrinkList, + children: [ + { + path: 'main', + name: 'freeDrinkListMain', + component: FreeDrinkListMain + }, + { + path: 'config', + name: 'freeDrinkListConfig', + component: FreeDrinkListConfig + } + ] } ] }, diff --git a/src/store/modules/freeDrinkList.js b/src/store/modules/freeDrinkList.js index 338aafb..7d434d5 100644 --- a/src/store/modules/freeDrinkList.js +++ b/src/store/modules/freeDrinkList.js @@ -6,9 +6,11 @@ const state = { free_drink_list_config: [], free_drink_list_history: [], free_drink_list_reasons: [], + free_drink_types: [], free_drink_list_config_loading: false, free_drink_list_history_loading: false, free_drink_list_reasons_loading: false, + free_drink_types_loading: false, snackbar_messages: [] } @@ -55,6 +57,12 @@ const mutations = { }, set_free_drink_list_reasons(state, data) { state.free_drink_list_reasons = data + }, + set_free_drink_types(state, data) { + state.free_drink_types = data + }, + set_free_drink_types_loading(state, loading) { + state.free_drink_types_loading = loading } } @@ -158,6 +166,25 @@ const actions = { } finally { commit('set_free_drink_list_reasons_loading', false) } + }, + async get_free_drink_types({ commit, dispatch, rootState }) { + try { + commit('set_free_drink_types_loading', true) + const response = await axios.get(url.freeDrinkTypes, { + headers: { Token: rootState.login.user.accessToken }, + timeout + }) + commit('set_free_drink_types', 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_types_loading', false) + } } } @@ -234,6 +261,12 @@ const getters = { }, free_drink_list_reasons_loading(state) { return state.free_drink_list_reasons_loading + }, + free_drink_types(state) { + return state.free_drink_types + }, + free_drink_types_loading(state) { + return state.free_drink_types_loading } }