From 0fcbbe23c211da919dbb6824762e9d4d2d2802bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sun, 23 Aug 2020 23:18:36 +0200 Subject: [PATCH] =?UTF-8?q?Overview=20f=C3=BCr=20Freigetr=C3=A4nke?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit es gibt nun eine Gesamtübersicht aller Freigetränke für einen bestimmten Monat. Für Dienstgetränke funktioniert es schon auch ist aber noch nicht vollständig. --- src/components/vorstand/FreeDrinkList.vue | 82 ++++++++- .../FreeDrinkList/FreeDrinkListJob.vue | 108 ++++++++++++ .../FreeDrinkList/FreeDrinkListMain.vue | 155 +++++++++++++++++- src/plugins/routes.js | 1 + src/router/index.js | 6 + src/store/modules/freeDrinkList.js | 28 ++++ 6 files changed, 372 insertions(+), 8 deletions(-) create mode 100644 src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue diff --git a/src/components/vorstand/FreeDrinkList.vue b/src/components/vorstand/FreeDrinkList.vue index 4c36c83..7335494 100644 --- a/src/components/vorstand/FreeDrinkList.vue +++ b/src/components/vorstand/FreeDrinkList.vue @@ -4,8 +4,8 @@ Übersicht - - Liste 1 + + Dienstgetränke Liste 2 @@ -18,6 +18,23 @@ mdi-cogs + + + + + mdi-chevron-left + + + + {{month[date.getMonth()]}} {{date.getFullYear()}} + + + + mdi-chevron-right + + + +
@@ -30,24 +47,77 @@ export default { name: 'FreeDrinkList', data() { return { - bottom_nav: true + bottom_nav: true, + date: new Date(), + month: [ + 'Januar', + 'Februar', + 'März', + 'April', + 'Mai', + 'Juni', + 'Juli', + 'August', + 'September', + 'Oktober', + 'November', + 'Dezember' + ] } }, created() { this.get_free_drink_list_reasons() this.get_free_drink_list_config() - this.get_free_drink_list_history() + this.get_free_drink_list_history_from_to({ + from_date: { + year: this.from_date.getFullYear(), + month: this.from_date.getMonth() + 1, + day: 1 + }, + to_date: { + year: this.to_date.getFullYear(), + month: this.to_date.getMonth() + 1, + day: 1 + } + }) this.get_free_drink_types() this.getPriceList() }, methods: { ...mapActions('freeDrinkList', [ 'get_free_drink_list_config', - 'get_free_drink_list_history', + 'get_free_drink_list_history_from_to', 'get_free_drink_list_reasons', 'get_free_drink_types' ]), - ...mapActions('priceList', ['getPriceList']) + ...mapActions('priceList', ['getPriceList']), + change_month(payload) { + this.date = new Date(this.date.getFullYear(), this.date.getMonth() + payload, 1) + } + }, + computed: { + to_date() { + return new Date(this.date.getFullYear(), this.date.getMonth()+1,1) + }, + from_date() { + return new Date(this.date.getFullYear(), this.date.getMonth(), 1) + } + }, + watch: { + date() { + this.get_free_drink_list_history_from_to({ + from_date: { + year: this.from_date.getFullYear(), + month: this.from_date.getMonth() + 1, + day: 1 + }, + to_date: { + year: this.to_date.getFullYear(), + month: this.to_date.getMonth() + 1, + day: 1 + } + }) + } } } diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue new file mode 100644 index 0000000..ba66a1f --- /dev/null +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue @@ -0,0 +1,108 @@ + + + + + \ No newline at end of file diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue index bc04564..f5f8801 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListMain.vue @@ -1,12 +1,163 @@ diff --git a/src/plugins/routes.js b/src/plugins/routes.js index cef3e5a..e974d25 100644 --- a/src/plugins/routes.js +++ b/src/plugins/routes.js @@ -30,6 +30,7 @@ const url = { resetPassword: main + 'passwordReset', freeDrinkListConfig: main + 'freeDrinkListConfig', freeDrinkListHistory: main + 'freeDrinkListHistory', + freeDrinkListHistoryFromTo: main + 'freeDrinkListHistoryFromTo', deleteDrinkListHistory: main + 'deleteDrinkListHistory', freeDrinkListReasons: main + 'freeDrinkListReasons', freeDrinkTypes: main + 'freeDrinkTypes', diff --git a/src/router/index.js b/src/router/index.js index b90dbcf..55690e2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -31,6 +31,7 @@ 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' +import FreeDrinkListJob from '@/components/vorstand/FreeDrinkList/FreeDrinkListJob' Vue.use(VueRouter) @@ -100,6 +101,11 @@ const routes = [ path: 'config', name: 'freeDrinkListConfig', component: FreeDrinkListConfig + }, + { + path: 'freeDrinkListJob', + name: 'freeDrinkListJob', + component: FreeDrinkListJob } ] } diff --git a/src/store/modules/freeDrinkList.js b/src/store/modules/freeDrinkList.js index 44f9434..c46d651 100644 --- a/src/store/modules/freeDrinkList.js +++ b/src/store/modules/freeDrinkList.js @@ -109,6 +109,24 @@ const actions = { commit('set_free_drink_list_history_loading', false) } }, + async get_free_drink_list_history_from_to({ commit, dispatch, rootState }, data) { + try { + commit('set_free_drink_list_history_loading', true) + const response = await axios.post(url.freeDrinkListHistoryFromTo, {...data},{ + headers: { Token: rootState.login.user.accessToken }, + timeout + }) + commit('set_free_drink_list_history', response.data) + } catch (e) { + 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_history_loading', false) + } + }, async set_free_drink_list_history({ commit, dispatch, rootState }, data) { try { commit('set_free_drink_list_history_loading', true) @@ -280,6 +298,11 @@ const getters = { free_drink_list_history(state) { return state.free_drink_list_history }, + free_drink_list_history_without_canceled(state) { + return state.free_drink_list_history.filter(item => { + return !item.canceled + }) + }, free_drink_list_history_band(state) { return state.free_drink_list_history.filter(item => { return item.free_drink_type.id == 3 @@ -290,6 +313,11 @@ const getters = { return item.free_drink_type.id == 3 && !item.canceled }) }, + free_drink_list_history_job_without_canceled(state) { + return state.free_drink_list_history.filter(item => { + return item.free_drink_type.id == 1 && !item.canceled + }) + }, free_drink_list_history_job_credit(state) { let jobDrinks = state.free_drink_list_history.filter(item => { return item.free_drink_type.id == 1 && !item.canceled