MainLayout für Freigetränke für den Vorstand gesetzt

Es wurde das MainLayout für die Freigetränke für den Vorstand gesetzt. Dabei wurden free_drink_types hinzugefügt und die Einstellungsseite für die Freigetränke angefangen. Bis jetzt können diese geladen werden.
This commit is contained in:
Tim Gröger 2020-08-21 22:03:24 +02:00
parent 72e2606ed2
commit 6e4d3a8a01
7 changed files with 208 additions and 0 deletions

View File

@ -0,0 +1,55 @@
<template>
<div>
<v-bottom-navigation v-model="bottom_nav" horizontal>
<v-btn link :to="{ name: 'freeDrinkListMain' }">
<span>Übersicht</span>
</v-btn>
<v-btn>
<span>Liste 1</span>
</v-btn>
<v-btn>
<span>Liste 2</span>
</v-btn>
<v-btn>
<span>Liste 3</span>
</v-btn>
<v-btn link :to="{ name: 'freeDrinkListConfig' }">
<span>Einstellungen</span>
<v-icon>mdi-cogs</v-icon>
</v-btn>
</v-bottom-navigation>
<div>
<router-view />
</div>
</div>
</template>
<script>
import { mapActions } from 'vuex'
export default {
name: 'FreeDrinkList',
data() {
return {
bottom_nav: true
}
},
created() {
this.get_free_drink_list_reasons()
this.get_free_drink_list_config()
this.get_free_drink_list_history()
this.get_free_drink_types()
this.getPriceList()
},
methods: {
...mapActions('freeDrinkList', [
'get_free_drink_list_config',
'get_free_drink_list_history',
'get_free_drink_list_reasons',
'get_free_drink_types'
]),
...mapActions('priceList', ['getPriceList'])
}
}
</script>
<style scoped></style>

View File

@ -0,0 +1,76 @@
<template>
<div>
<v-card tile>
<v-card-title>
Freigetränke
</v-card-title>
<v-card-text>
<v-list>
<v-list-item
v-for="free_drink_config in free_drink_list_config"
:key="free_drink_config.id"
>
<v-text-field
outlined
label="Label"
:value="free_drink_config.label"
/>
<v-autocomplete
outlined
label="Zugeordnetes Getränk"
:items="priceList"
:item-text="item => {return item.name + '/' + (item.price_club/100).toFixed(2) + '€'}"
item-value="id"
:value="free_drink_config.drink"
/>
<v-autocomplete
outlined
label="Freigetränkaufnahme"
multiple
:items="free_drink_types"
item-text="name"
item-value="id"
:value="free_drink_config.free_drink_types"
/>
<v-text-field
outlined
label="Preis in €"
type="number"
:value="(free_drink_config.price / 100).toFixed(2)"
/>
</v-list-item>
</v-list>
</v-card-text>
<v-card-actions>
<v-btn @click="log">
LOG
</v-btn>
</v-card-actions>
</v-card>
<v-card tile>
<v-card-title>Gründe für Freigetränke</v-card-title>
</v-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'FreeDrinkListConfig',
methods: {
log() {
console.log(this.free_drink_list_config)
}
},
computed: {
...mapGetters('freeDrinkList', [
'free_drink_list_config',
'free_drink_list_reasons',
'free_drink_types'
]),
...mapGetters('priceList', ["priceList"])
}
}
</script>
<style scoped></style>

View File

@ -0,0 +1,15 @@
<template>
<div>
Übersicht
</div>
</template>
<script>
export default {
name: "FreeDrinkListMain"
}
</script>
<style scoped>
</style>

View File

@ -31,6 +31,14 @@
Dienstarten
</v-list-item-title>
</v-list-item>
<v-list-item link :to="{name: 'freeDrinkList'}">
<v-list-item-icon>
<v-icon>mdi-beer</v-icon>
</v-list-item-icon>
<v-list-item-title>
Freigetränke
</v-list-item-title>
</v-list-item>
</v-list>
</template>

View File

@ -32,6 +32,7 @@ const url = {
freeDrinkListHistory: main + 'freeDrinkListHistory',
deleteDrinkListHistory: main + 'deleteDrinkListHistory',
freeDrinkListReasons: main + 'freeDrinkListReasons',
freeDrinkTypes: main + 'freeDrinkTypes',
vorstand: {
sm: {
addUser: main + 'sm/addUser',

View File

@ -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
}
]
}
]
},

View File

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