diff --git a/src/components/baruser/BarFreedrinks.vue b/src/components/baruser/BarFreedrinks.vue index bc47eba..eec219f 100644 --- a/src/components/baruser/BarFreedrinks.vue +++ b/src/components/baruser/BarFreedrinks.vue @@ -90,9 +90,8 @@ {{ - free_drink_list_history_band_without_canceled.length - }} - Getränke + (free_drink_list_history_band_without_canceled_price/100).toFixed(2) + }} € @@ -111,7 +110,7 @@
{ + sum += item.free_drink_config.price + }) + return sum + }, + free_drink_list_history_bar() { + return this.free_drink_list_history.filter(item => { + return item.free_drink_type.id == 1 || item.free_drink_type.id == 3 + }) } }, beforeDestroy() { diff --git a/src/components/user/freedrink/freedrinkUserView.vue b/src/components/user/freedrink/freedrinkUserView.vue index 1a94a5a..487a35e 100644 --- a/src/components/user/freedrink/freedrinkUserView.vue +++ b/src/components/user/freedrink/freedrinkUserView.vue @@ -296,7 +296,7 @@ export default { this.amount = null this.selectedReason = null this.reasonDescription = null - this.drinkCount = 0 + this.drinkCount = 1 this.free_drink_type_id = null this.free_drink = null }, @@ -321,6 +321,8 @@ export default { ' für ' + (message.price / 100).toFixed(2) + '€ nicht hinzufügen.' + } else if (message.canceled) { + text = `${message.free_drink_type.name}: ${message.label} wurde für ${(message.price/100).toFixed(2)}€ storniert.` } else { text = message.free_drink_type.name + diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue index 98848c1..c8548eb 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListBand.vue @@ -46,10 +46,6 @@ name: "FreeDrinkListBand", text: 'Anzahl', value: 'count' }, - { - text: 'User', - value: 'user' - }, { text: 'Preis pro Getränk', value: 'pricepro' @@ -87,29 +83,16 @@ name: "FreeDrinkListBand", let history_of_config = history_of_date.filter(item => { return item.free_drink_config_id == drink_config.id }) - // 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) { + if (history_of_config.length > 0) { retVal.push({ date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`, label: drink_config.label, name: drink_config.drink.name, - user: `${history_of_user[0].user.firstname} ${history_of_user[0].user.lastname}`, - count: history_of_user.length, + count: history_of_config.length, pricepro: (drink_config.price / 100).toFixed(2), - sum: (drink_config.price / 100 * history_of_user.length).toFixed(2) + sum: (drink_config.price / 100 * history_of_config.length).toFixed(2) }) } - }) }) } return retVal diff --git a/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue index 7d35878..f0fd708 100644 --- a/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue +++ b/src/components/vorstand/FreeDrinkList/FreeDrinkListJob.vue @@ -46,10 +46,6 @@ data() { text: 'Anzahl', value: 'count' }, - { - text: 'User', - value: 'user' - }, { text: 'Preis pro Getränk', value: 'pricepro' @@ -87,29 +83,16 @@ computed: { let history_of_config = history_of_date.filter(item => { return item.free_drink_config_id == drink_config.id }) - // 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) { + if (history_of_config.length > 0) { retVal.push({ date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`, label: drink_config.label, name: drink_config.drink.name, - user: `${history_of_user[0].user.firstname} ${history_of_user[0].user.lastname}`, - count: history_of_user.length, + count: history_of_config.length, pricepro: (drink_config.price / 100).toFixed(2), - sum: (drink_config.price / 100 * history_of_user.length).toFixed(2) + sum: (drink_config.price / 100 * history_of_config.length).toFixed(2) }) } - }) }) } return retVal diff --git a/src/plugins/routes.js b/src/plugins/routes.js index 6282c3d..d25a4da 100644 --- a/src/plugins/routes.js +++ b/src/plugins/routes.js @@ -1,8 +1,8 @@ //const main = 'https://192.168.5.128:5000/' -//const main = 'http://localhost:5000/' +const main = 'http://localhost:5000/' //const main = 'http://192.168.5.118:5000/' //const main = 'https://groeger-clan.duckdns.org:5000/' -const main = 'https://flaschengeist.wu5.de:5000/' +//const main = 'https://flaschengeist.wu5.de:5000/' const url = { login: main + 'login', diff --git a/src/store/modules/freeDrinkList.js b/src/store/modules/freeDrinkList.js index f95451b..e9fc998 100644 --- a/src/store/modules/freeDrinkList.js +++ b/src/store/modules/freeDrinkList.js @@ -44,15 +44,16 @@ const mutations = { add_snackbar_message(state, { data, error }) { data.error = error data.visible = true - data.free_drink_type = data.free_drink_types.find(item => { + data.label = data.free_drink_config != null && data.label == null ? data.free_drink_config.label : data.label + data.price = data.free_drink_config != null && data.price == null ? data.free_drink_config.price : data.price + data.free_drink_type = data.free_drink_type == null ? data.free_drink_types.find(item => { return item.id == data.free_drink_type_id - }) + }) : data.free_drink_type data.timer = setTimeout(() => { if (!data.error) { data.visible = false } }, 5000) - console.log(data) state.snackbar_messages.unshift(data) }, set_free_drink_list_reasons(state, data) { @@ -334,7 +335,6 @@ const getters = { }, free_drink_list_config_job(state) { return state.free_drink_list_config.filter(item => { - console.log(item) return item.free_drink_types.find(drink_type => { return drink_type.id == 1 })