From d5393d75c541da1dcf8cf3ca77fefd00f46ad756 Mon Sep 17 00:00:00 2001 From: Snowmee Date: Sat, 8 Aug 2020 21:09:16 +0200 Subject: [PATCH 01/11] =?UTF-8?q?Dienstgetr=C3=A4nke=20UI=20ohne=20backend?= =?UTF-8?q?anschluss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/baruser/BarFreedrinks.vue | 349 +++++++++++++++++++++++ src/components/baruser/BarNavigation.vue | 13 +- src/components/baruser/SearchBar.vue | 1 + src/plugins/routes.js | 4 +- src/router/index.js | 6 + src/views/contents/BarFreedrinksView.vue | 24 ++ 6 files changed, 393 insertions(+), 4 deletions(-) create mode 100644 src/components/baruser/BarFreedrinks.vue create mode 100644 src/views/contents/BarFreedrinksView.vue diff --git a/src/components/baruser/BarFreedrinks.vue b/src/components/baruser/BarFreedrinks.vue new file mode 100644 index 0000000..654e841 --- /dev/null +++ b/src/components/baruser/BarFreedrinks.vue @@ -0,0 +1,349 @@ + + + + + diff --git a/src/components/baruser/BarNavigation.vue b/src/components/baruser/BarNavigation.vue index ef58718..c08adc4 100644 --- a/src/components/baruser/BarNavigation.vue +++ b/src/components/baruser/BarNavigation.vue @@ -8,16 +8,25 @@ Geruecht + + + {{ beer }} + + + Freigetränke + + + + From 22c5ebce1b6cf11ce3f582ed1898e15bf4e4e836 Mon Sep 17 00:00:00 2001 From: Snowmee Date: Sat, 8 Aug 2020 23:15:04 +0200 Subject: [PATCH 02/11] add freedrink to user --- src/components/baruser/BarFreedrinks.vue | 7 +- src/components/user/UserNavigation.vue | 30 +- .../user/freedrink/freedrinkUserView.vue | 407 ++++++++++++++++++ src/router/index.js | 6 + 4 files changed, 432 insertions(+), 18 deletions(-) create mode 100644 src/components/user/freedrink/freedrinkUserView.vue diff --git a/src/components/baruser/BarFreedrinks.vue b/src/components/baruser/BarFreedrinks.vue index 654e841..0358179 100644 --- a/src/components/baruser/BarFreedrinks.vue +++ b/src/components/baruser/BarFreedrinks.vue @@ -170,6 +170,7 @@ + + + + diff --git a/src/router/index.js b/src/router/index.js index 2dc6732..9e2ba9d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -17,6 +17,7 @@ import Overview from '../components/finanzer/Overview' import User from '../components/finanzer/User' import ServiceManagement from '../components/vorstand/ServiceManagement' import Config from '@/components/user/Config' +import FreedrinkUserView from '@/components/user/freedrink/freedrinkUserView' import Jobs from '@/components/user/Jobs' import PriceList from '@/components/pricelist/PriceList' import ManagementNavigation from '@/components/vorstand/ManagementNavigation' @@ -94,6 +95,11 @@ const routes = [ name: 'add', component: AddAmount }, + { + path: 'freedrinkUser', + name: 'freedrinkUser', + component: FreedrinkUserView + }, { path: 'overview', name: 'userOverview', From 8ac74c9f64f8f9875661fdb7dd5be108c81b2b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 20 Aug 2020 08:39:38 +0200 Subject: [PATCH 03/11] =?UTF-8?q?Backend=20Connection=20f=C3=BCr=20Freiget?= =?UTF-8?q?r=C3=A4nke=20Band=20und=20Dienste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Es wurde die Verbindung zur Schnittstelle aufgebaut. Freigetränke werden Dynamisch gehalten. --- src/components/baruser/BarFreedrinks.vue | 229 +++++++++++------------ src/plugins/routes.js | 7 +- src/store/index.js | 4 +- src/store/modules/freeDrinkList.js | 155 +++++++++++++++ 4 files changed, 271 insertions(+), 124 deletions(-) create mode 100644 src/store/modules/freeDrinkList.js diff --git a/src/components/baruser/BarFreedrinks.vue b/src/components/baruser/BarFreedrinks.vue index 0358179..8299945 100644 --- a/src/components/baruser/BarFreedrinks.vue +++ b/src/components/baruser/BarFreedrinks.vue @@ -9,106 +9,30 @@ {{ menuIcon }} - - Noch {{ ((limit - amount) / 100).toFixed(2) }} € + + Noch {{ ((limit - free_drink_list_history_job_credit) / 100).toFixed(2) }} € übrig!! - + Bier - - - Cuba - - - Schnaps - - - Wein - - - Gin Tonic - - - Fritz - - - Saft - - - Wasser + class="drinkBtn" + block + :disabled="locked" + :color="color" + @click="addAmount(freeDrink, freeDrinkTypeJob)" + >{{freeDrink.label}} - - - - - - - {{ plus }} - - - + + - {{ (amount / 100).toFixed(2) }} + {{ (free_drink_list_history_job_credit / 100).toFixed(2) }} € @@ -119,6 +43,41 @@ + + +
Bandgetränke
+ + {{ menuIcon }} + +
+ + + + + + {{freeDrink.label}} + + + + + + + + {{ free_drink_list_history_band_without_canceled.length }} Getränke + + + + + + + + +
@@ -127,13 +86,13 @@ Verlauf -
- + {{ now(message.date) }} @@ -141,9 +100,28 @@ createMessage(message) }} - STORNIERT!!! + STORNIERT!!! Klicken um zu Stornieren + + +
--> +
+ + + {{ now(freeDrinkHistory.timestamp) }} + {{ freeDrinkHistory.free_drink_type.name }}: {{ freeDrinkHistory.free_drink_config.label }} wurde für + {{ + (freeDrinkHistory.free_drink_config.price/100).toFixed(2) + }} € hinzugefügt + + STORNIERT!!! + Klicken um zu Stornieren @@ -151,18 +129,16 @@ - + Willst du wirklich?? - - Willst du wirklich den Betrag - {{ (stornoMessage.amount / 100).toFixed(2) }}€ von - den Dienstgetränke stornieren? + + {{canceledMessage.free_drink_type.name}}: Willst du wirklich ein {{canceledMessage.free_drink_config.label}} im Wert von {{(canceledMessage.free_drink_config.price/100).toFixed(2)}} € stornieren? - Abbrechen - Stornieren + Abbrechen + Stornieren @@ -176,58 +152,66 @@ + + 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 } } From a28bbe8e0ae836d81854b21d5feac957e94af554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 22 Aug 2020 18:10:39 +0200 Subject: [PATCH 07/11] better view for freedrinklistconfig --- .../FreeDrinkList/FreeDrinkListConfig.vue | 81 +++++++++++-------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue index c1cedc7..2c3b77c 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue @@ -6,39 +6,56 @@ - - + + + + + + + + + + + + + + + + + + + - - - - + From 8a442d029b5cc54ed38bf4bbe9aed4411cb9492e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sun, 23 Aug 2020 21:16:56 +0200 Subject: [PATCH 08/11] =?UTF-8?q?L=C3=B6schen,=20Modifizieren=20und=20Hinz?= =?UTF-8?q?uf=C3=BCgen=20von=20Freigetr=C3=A4nken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Vorstand kann nun Freigetränke löschen, modifizieren und hinzufügen. --- .../FreeDrinkList/FreeDrinkListConfig.vue | 132 +++++++++++------- .../FreeDrinkListConfigConfigItem.vue | 116 +++++++++++++++ src/plugins/routes.js | 1 + src/store/modules/freeDrinkList.js | 66 +++++++++ 4 files changed, 268 insertions(+), 47 deletions(-) create mode 100644 src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue index 2c3b77c..326e95a 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue @@ -9,83 +9,121 @@ + + + + + - - LOG + + + mdi-plus Gründe für Freigetränke + + + + + Wirklich löschen? + + + Willst du wirklich {{check_model.label}} mit dem Getränk {{check_model.drink.name}} löschen? + Wenn du dies löscht, wird auch der ganze Verlauf gelöscht. Dh. es ist nicht mehr vollständig nachvollziehbar, was getrunken wurde. + + + + Abbrechen + Löschen + + +
diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue new file mode 100644 index 0000000..8f8bd70 --- /dev/null +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue @@ -0,0 +1,116 @@ + + + + + \ 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}) } } 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 09/11] =?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 From 6c5c67f45b03a5c077dbe7432e17482302dca3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Mon, 24 Aug 2020 14:04:21 +0200 Subject: [PATCH 10/11] =?UTF-8?q?Freigetr=C3=A4nke=20Listen=20f=C3=BCr=20D?= =?UTF-8?q?ienst,=20AG=20und=20Band?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Vorstand kann nun die Freigetränkelisten von Diensten, AG's und Bands anschauen. --- src/components/vorstand/FreeDrinkList.vue | 8 +- .../FreeDrinkList/FreeDrinkListBand.vue | 123 ++++++++++++++++++ .../FreeDrinkList/FreeDrinkListConfig.vue | 5 +- .../FreeDrinkListConfigConfigItem.vue | 12 +- .../FreeDrinkList/FreeDrinkListJob.vue | 27 +++- .../FreeDrinkList/FreeDrinkListWorkgroup.vue | 112 ++++++++++++++++ src/router/index.js | 12 ++ 7 files changed, 283 insertions(+), 16 deletions(-) create mode 100644 src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue create mode 100644 src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue diff --git a/src/components/vorstand/FreeDrinkList.vue b/src/components/vorstand/FreeDrinkList.vue index 7335494..546be23 100644 --- a/src/components/vorstand/FreeDrinkList.vue +++ b/src/components/vorstand/FreeDrinkList.vue @@ -7,11 +7,11 @@ Dienstgetränke - - Liste 2 + + AG-Getränke - - Liste 3 + + Bandgetränke Einstellungen diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue new file mode 100644 index 0000000..98848c1 --- /dev/null +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue @@ -0,0 +1,123 @@ + + + + + \ No newline at end of file diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue index 326e95a..e7b4951 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfig.vue @@ -10,6 +10,7 @@ v-for="(free_drink_config, index) in free_drink_list_config"> @@ -27,9 +28,9 @@ - + - + mdi-plus diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue index 8f8bd70..ea797f5 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem.vue @@ -2,15 +2,16 @@
- + - + - + - + diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue index ba66a1f..7d35878 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue @@ -46,6 +46,10 @@ data() { text: 'Anzahl', value: 'count' }, + { + text: 'User', + value: 'user' + }, { text: 'Preis pro Getränk', value: 'pricepro' @@ -62,9 +66,7 @@ computed: { sum() { let sum = 0 this.free_drink_list_history_job_without_canceled.forEach(item => { - if (item.canceled) { - sum += item.free_drink_config.price - } + sum += item.free_drink_config.price }) return sum }, @@ -85,16 +87,29 @@ computed: { let history_of_config = history_of_date.filter(item => { return item.free_drink_config_id == drink_config.id }) - if (history_of_config.length > 0) { + // eslint-disable-next-line no-unused-vars + let users = [] + history_of_config.forEach(history_config => { + if (!users.find(user_id => { return user_id == history_config.user_id})) { + users.push(history_config.user_id) + } + }) + users.forEach(user_id => { + let history_of_user = history_of_config.filter(item => { + return item.user_id == user_id + }) + if (history_of_user.length > 0) { retVal.push({ date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`, label: drink_config.label, name: drink_config.drink.name, - count: history_of_config.length, + user: `${history_of_user[0].user.firstname} ${history_of_user[0].user.lastname}`, + count: history_of_user.length, pricepro: (drink_config.price / 100).toFixed(2), - sum: (drink_config.price / 100 * history_of_config.length).toFixed(2) + sum: (drink_config.price / 100 * history_of_user.length).toFixed(2) }) } + }) }) } return retVal diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue new file mode 100644 index 0000000..71e2d94 --- /dev/null +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup.vue @@ -0,0 +1,112 @@ + + + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 55690e2..4a4a7cb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -32,6 +32,8 @@ 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' +import FreeDrinkListWorkgroup from '@/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup' +import FreeDrinkListBand from '@/components/vorstand/FreeDrinkList/FreeDrinkListBand' Vue.use(VueRouter) @@ -106,6 +108,16 @@ const routes = [ path: 'freeDrinkListJob', name: 'freeDrinkListJob', component: FreeDrinkListJob + }, + { + path: 'freeDrinkListWorkgroup', + name: 'freeDrinkListWorkgroup', + component: FreeDrinkListWorkgroup + }, + { + path: 'freeDrinkListBand', + name: 'freeDrinkListBand', + component: FreeDrinkListBand } ] } From c8a6ab7d351228746a55a5507a5988b27f91f617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Mon, 24 Aug 2020 15:18:21 +0200 Subject: [PATCH 11/11] =?UTF-8?q?Gr=C3=BCnde=20f=C3=BCr=20Freigetr=C3=A4nk?= =?UTF-8?q?e=20k=C3=B6nnen=20erstellt=20und=20gel=C3=B6scht=20werden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Außerdem wurd überall ein Loading balken hinzugefügt. --- src/components/vorstand/FreeDrinkList.vue | 17 +++- .../FreeDrinkList/FreeDrinkListConfig.vue | 88 ++++++++++++++++++- .../FreeDrinkListConfigReasonItem.vue | 70 +++++++++++++++ .../FreeDrinkList/FreeDrinkListWorkgroup.vue | 2 +- src/plugins/routes.js | 1 + src/store/modules/freeDrinkList.js | 65 ++++++++++++++ 6 files changed, 236 insertions(+), 7 deletions(-) create mode 100644 src/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigReasonItem.vue 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 },