release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
7 changed files with 283 additions and 16 deletions
Showing only changes of commit 6c5c67f45b - Show all commits

View File

@ -7,11 +7,11 @@
<v-btn link :to="{name: 'freeDrinkListJob'}"> <v-btn link :to="{name: 'freeDrinkListJob'}">
<span>Dienstgetränke</span> <span>Dienstgetränke</span>
</v-btn> </v-btn>
<v-btn> <v-btn link :to="{name: 'freeDrinkListWorkgroup'}">
<span>Liste 2</span> <span>AG-Getränke</span>
</v-btn> </v-btn>
<v-btn> <v-btn link :to="{name: 'freeDrinkListBand'}">
<span>Liste 3</span> <span>Bandgetränke</span>
</v-btn> </v-btn>
<v-btn link :to="{ name: 'freeDrinkListConfig' }"> <v-btn link :to="{ name: 'freeDrinkListConfig' }">
<span>Einstellungen</span> <span>Einstellungen</span>

View File

@ -0,0 +1,123 @@
<template>
<div>
<v-row justify="space-around">
<v-card>
<v-card-title class="text-center">
Anzahl Freigetränke
</v-card-title>
<v-card-text class="text-h2 text-center">
{{free_drink_list_history_band_without_canceled.length}}
</v-card-text>
</v-card>
<v-card>
<v-card-title class="text-center">
Summe Freigetränke
</v-card-title>
<v-card-text class="text-h2 text-center">
{{ (sum/100).toFixed(2)}}
</v-card-text>
</v-card>
</v-row>
<v-data-table :headers="header" :items="table"/>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: "FreeDrinkListBand",
data() {
return {
header: [
{
text: 'Datum',
value: 'date'
},
{
text: 'Label Freigetränk',
value: 'label'
},
{
text: 'Freigetränk',
value: 'name'
},
{
text: 'Anzahl',
value: 'count'
},
{
text: 'User',
value: 'user'
},
{
text: 'Preis pro Getränk',
value: 'pricepro'
},
{
text: 'Preis gesamt',
value: 'sum'
}
]
}
},
computed: {
...mapGetters('freeDrinkList', ['free_drink_list_history_band_without_canceled', 'free_drink_list_config']),
sum() {
let sum = 0
this.free_drink_list_history_band_without_canceled.forEach(item => {
sum += item.free_drink_config.price
})
return sum
},
table() {
if (this.free_drink_list_history_band_without_canceled.length == 0) {
return []
}
let retVal = []
const date_month = this.free_drink_list_history_band_without_canceled[0].timestamp
let days = new Date(date_month.getFullYear(), date_month.getMonth() + 1, 0).getDate()
for (let day = 1; day <= days; day++) {
let from = new Date(date_month.getFullYear(), date_month.getMonth(), day)
let to = new Date(date_month.getFullYear(), date_month.getMonth(), day + 1)
let history_of_date = this.free_drink_list_history_band_without_canceled.filter(item => {
return item.timestamp >= from && item.timestamp <= to && !item.canceled
})
this.free_drink_list_config.forEach(drink_config => {
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) {
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,
pricepro: (drink_config.price / 100).toFixed(2),
sum: (drink_config.price / 100 * history_of_user.length).toFixed(2)
})
}
})
})
}
return retVal
}
}
}
</script>
<style scoped>
</style>

View File

@ -10,6 +10,7 @@
v-for="(free_drink_config, index) in free_drink_list_config"> v-for="(free_drink_config, index) in free_drink_list_config">
<v-list-item <v-list-item
:key="free_drink_config.label" :key="free_drink_config.label"
dense
> >
<v-list-item-content> <v-list-item-content>
<FreeDrinkListConfigConfigItem :free_drink_config="free_drink_config" @save="save" @delete_free_drink_list_config="delete_free_drink_config" /> <FreeDrinkListConfigConfigItem :free_drink_config="free_drink_config" @save="save" @delete_free_drink_list_config="delete_free_drink_config" />
@ -27,9 +28,9 @@
</v-list-item> </v-list-item>
</v-list> </v-list>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions dense>
<v-spacer /> <v-spacer />
<v-btn fab color="success" @click="new_free_drink_list_config=true" v-if="!new_free_drink_list_config"> <v-btn fab small color="success" @click="new_free_drink_list_config=true" v-if="!new_free_drink_list_config">
<v-icon>mdi-plus</v-icon> <v-icon>mdi-plus</v-icon>
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>

View File

@ -2,15 +2,16 @@
<div> <div>
<v-form :ref="free_drink_config.id"> <v-form :ref="free_drink_config.id">
<v-row> <v-row>
<v-col> <v-col cols="12" sm="6" md="3">
<v-text-field <v-text-field
outlined outlined
label="Label" label="Label"
:value="free_drink_config.label" :value="free_drink_config.label"
@change="set_model($event, 'label')" @change="set_model($event, 'label')"
dense
/> />
</v-col> </v-col>
<v-col> <v-col cols="12" sm="6" md="3">
<v-autocomplete <v-autocomplete
outlined outlined
label="Zugeordnetes Getränk" label="Zugeordnetes Getränk"
@ -20,9 +21,10 @@
:value="free_drink_config.drink" :value="free_drink_config.drink"
@change="set_model($event, 'drink')" @change="set_model($event, 'drink')"
return-object return-object
dense
/> />
</v-col> </v-col>
<v-col> <v-col cols="12" sm="6" md="3">
<v-autocomplete <v-autocomplete
outlined outlined
label="Freigetränkaufnahme" label="Freigetränkaufnahme"
@ -33,15 +35,17 @@
:value="free_drink_config.free_drink_types" :value="free_drink_config.free_drink_types"
return-object return-object
@change="set_model($event, 'free_drink_types')" @change="set_model($event, 'free_drink_types')"
dense
/> />
</v-col> </v-col>
<v-col> <v-col cols="12" sm="6" md="3">
<v-text-field <v-text-field
outlined outlined
label="Preis in €" label="Preis in €"
type="number" type="number"
:value="(free_drink_config.price/100).toFixed(2)" :value="(free_drink_config.price/100).toFixed(2)"
@change="set_model(Math.round($event*100), 'price')" @change="set_model(Math.round($event*100), 'price')"
dense
/> />
</v-col> </v-col>
</v-row> </v-row>

View File

@ -46,6 +46,10 @@ data() {
text: 'Anzahl', text: 'Anzahl',
value: 'count' value: 'count'
}, },
{
text: 'User',
value: 'user'
},
{ {
text: 'Preis pro Getränk', text: 'Preis pro Getränk',
value: 'pricepro' value: 'pricepro'
@ -62,9 +66,7 @@ computed: {
sum() { sum() {
let sum = 0 let sum = 0
this.free_drink_list_history_job_without_canceled.forEach(item => { 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 return sum
}, },
@ -85,16 +87,29 @@ computed: {
let history_of_config = history_of_date.filter(item => { let history_of_config = history_of_date.filter(item => {
return item.free_drink_config_id == drink_config.id 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({ retVal.push({
date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`, date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`,
label: drink_config.label, label: drink_config.label,
name: drink_config.drink.name, 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), 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 return retVal

View File

@ -0,0 +1,112 @@
<template>
<div>
<v-row justify="space-around">
<v-card>
<v-card-title class="text-center">
Anzahl Freigetränke
</v-card-title>
<v-card-text class="text-h2 text-center">
{{free_drink_list_history_workgroup_without_canceled.length}}
</v-card-text>
</v-card>
<v-card>
<v-card-title class="text-center">
Summe Freigetränke
</v-card-title>
<v-card-text class="text-h2 text-center">
{{ (sum/100).toFixed(2)}}
</v-card-text>
</v-card>
</v-row>
<v-data-table :headers="header" :items="table"/>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: "FreeDrinkListWorkgroup",
data() {
return {
header: [
{
text: 'Datum',
value: 'date'
},
{
text: 'Label Freigetränk',
value: 'label'
},
{
text: 'Freigetränk',
value: 'name'
},
{
text: 'User',
value: 'user'
},
{
text: 'Preis',
value: 'pricepro'
},
{
text: 'Grund',
value: 'reason'
},
{
text: 'Beschreibung',
value: 'description'
}
]
}
},
computed: {
...mapGetters('freeDrinkList', ['free_drink_list_history_workgroup_without_canceled', 'free_drink_list_config']),
sum() {
let sum = 0
this.free_drink_list_history_workgroup_without_canceled.forEach(item => {
sum += item.free_drink_config.price
})
return sum
},
table() {
if (this.free_drink_list_history_workgroup_without_canceled.length == 0) {
return []
}
let retVal = []
const date_month = this.free_drink_list_history_workgroup_without_canceled[0].timestamp
let days = new Date(date_month.getFullYear(), date_month.getMonth() + 1, 0).getDate()
for (let day = 1; day <= days; day++) {
let from = new Date(date_month.getFullYear(), date_month.getMonth(), day)
let to = new Date(date_month.getFullYear(), date_month.getMonth(), day + 1)
let history_of_date = this.free_drink_list_history_workgroup_without_canceled.filter(item => {
return item.timestamp >= from && item.timestamp <= to && !item.canceled
})
this.free_drink_list_config.forEach(drink_config => {
let history_of_config = history_of_date.filter(item => {
return item.free_drink_config_id == drink_config.id
})
console.log(history_of_config)
history_of_config.forEach(history_config => {
retVal.push({
date: `${from.getDate()}.${from.getMonth() + 1}.${from.getFullYear()}`,
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,
description: history_config.description,
pricepro: (drink_config.price / 100).toFixed(2)
})
})
})
}
return retVal
}
}
}
</script>
<style scoped>
</style>

View File

@ -32,6 +32,8 @@ import FreeDrinkList from '@/components/vorstand/FreeDrinkList'
import FreeDrinkListMain from '@/components/vorstand/FreeDrinkList/FreeDrinkListMain' import FreeDrinkListMain from '@/components/vorstand/FreeDrinkList/FreeDrinkListMain'
import FreeDrinkListConfig from '@/components/vorstand/FreeDrinkList/FreeDrinkListConfig' import FreeDrinkListConfig from '@/components/vorstand/FreeDrinkList/FreeDrinkListConfig'
import FreeDrinkListJob from '@/components/vorstand/FreeDrinkList/FreeDrinkListJob' import FreeDrinkListJob from '@/components/vorstand/FreeDrinkList/FreeDrinkListJob'
import FreeDrinkListWorkgroup from '@/components/vorstand/FreeDrinkList/FreeDrinkListWorkgroup'
import FreeDrinkListBand from '@/components/vorstand/FreeDrinkList/FreeDrinkListBand'
Vue.use(VueRouter) Vue.use(VueRouter)
@ -106,6 +108,16 @@ const routes = [
path: 'freeDrinkListJob', path: 'freeDrinkListJob',
name: 'freeDrinkListJob', name: 'freeDrinkListJob',
component: FreeDrinkListJob component: FreeDrinkListJob
},
{
path: 'freeDrinkListWorkgroup',
name: 'freeDrinkListWorkgroup',
component: FreeDrinkListWorkgroup
},
{
path: 'freeDrinkListBand',
name: 'freeDrinkListBand',
component: FreeDrinkListBand
} }
] ]
} }