release v2.0.0 #4
|
@ -7,11 +7,11 @@
|
|||
<v-btn link :to="{name: 'freeDrinkListJob'}">
|
||||
<span>Dienstgetränke</span>
|
||||
</v-btn>
|
||||
<v-btn>
|
||||
<span>Liste 2</span>
|
||||
<v-btn link :to="{name: 'freeDrinkListWorkgroup'}">
|
||||
<span>AG-Getränke</span>
|
||||
</v-btn>
|
||||
<v-btn>
|
||||
<span>Liste 3</span>
|
||||
<v-btn link :to="{name: 'freeDrinkListBand'}">
|
||||
<span>Bandgetränke</span>
|
||||
</v-btn>
|
||||
<v-btn link :to="{ name: 'freeDrinkListConfig' }">
|
||||
<span>Einstellungen</span>
|
||||
|
|
|
@ -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>
|
|
@ -10,6 +10,7 @@
|
|||
v-for="(free_drink_config, index) in free_drink_list_config">
|
||||
<v-list-item
|
||||
:key="free_drink_config.label"
|
||||
dense
|
||||
>
|
||||
<v-list-item-content>
|
||||
<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>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-card-actions dense>
|
||||
<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-btn>
|
||||
</v-card-actions>
|
||||
|
|
|
@ -2,15 +2,16 @@
|
|||
<div>
|
||||
<v-form :ref="free_drink_config.id">
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-col cols="12" sm="6" md="3">
|
||||
<v-text-field
|
||||
outlined
|
||||
label="Label"
|
||||
:value="free_drink_config.label"
|
||||
@change="set_model($event, 'label')"
|
||||
dense
|
||||
/>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-col cols="12" sm="6" md="3">
|
||||
<v-autocomplete
|
||||
outlined
|
||||
label="Zugeordnetes Getränk"
|
||||
|
@ -20,9 +21,10 @@
|
|||
:value="free_drink_config.drink"
|
||||
@change="set_model($event, 'drink')"
|
||||
return-object
|
||||
dense
|
||||
/>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-col cols="12" sm="6" md="3">
|
||||
<v-autocomplete
|
||||
outlined
|
||||
label="Freigetränkaufnahme"
|
||||
|
@ -33,15 +35,17 @@
|
|||
:value="free_drink_config.free_drink_types"
|
||||
return-object
|
||||
@change="set_model($event, 'free_drink_types')"
|
||||
dense
|
||||
/>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-col cols="12" sm="6" md="3">
|
||||
<v-text-field
|
||||
outlined
|
||||
label="Preis in €"
|
||||
type="number"
|
||||
:value="(free_drink_config.price/100).toFixed(2)"
|
||||
@change="set_model(Math.round($event*100), 'price')"
|
||||
dense
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
})
|
||||
return sum
|
||||
},
|
||||
|
@ -85,17 +87,30 @@ 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
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue