Merge branch 'feature/drinkList' into develop

This commit is contained in:
Tim Gröger 2020-09-02 08:45:32 +02:00
commit f23be34a77
6 changed files with 32 additions and 51 deletions

View File

@ -90,9 +90,8 @@
<v-list-item-content class="text-center">
<v-list-item-action-text class="title">
{{
free_drink_list_history_band_without_canceled.length
}}
Getränke
(free_drink_list_history_band_without_canceled_price/100).toFixed(2)
}}
</v-list-item-action-text>
</v-list-item-content>
</v-list-item>
@ -111,7 +110,7 @@
</v-list-item>
<v-divider />
<div
v-for="freeDrinkHistory in free_drink_list_history"
v-for="freeDrinkHistory in free_drink_list_history_bar"
:key="freeDrinkHistory.id"
>
<v-list-item
@ -286,6 +285,8 @@ export default {
'ERROR: ' + message.free_drink_type.name +': Konnte ' + message.label + ' 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 + ': ' + message.label + ' wurde für ' + (message.price / 100).toFixed(2) + '€ hinzugefügt.'
}
@ -398,6 +399,18 @@ export default {
this.free_drink_list_config_band.length == 0 &&
this.free_drink_list_config_job.length == 0
)
},
free_drink_list_history_band_without_canceled_price() {
let sum = 0
this.free_drink_list_history_band_without_canceled.forEach(item => {
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() {

View File

@ -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 +

View File

@ -46,10 +46,6 @@ name: "FreeDrinkListBand",
text: 'Anzahl',
value: 'count'
},
{
text: 'User',
value: 'user'
},
{
text: 'Preis pro Getränk',
value: 'pricepro'
@ -87,30 +83,17 @@ 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
}

View File

@ -46,10 +46,6 @@ data() {
text: 'Anzahl',
value: 'count'
},
{
text: 'User',
value: 'user'
},
{
text: 'Preis pro Getränk',
value: 'pricepro'
@ -87,30 +83,17 @@ 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
}

View File

@ -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',

View File

@ -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
})