finished ##172

This commit is contained in:
Tim Gröger 2020-02-27 21:54:28 +01:00
parent 5d8befdaec
commit e0697b2a6d
5 changed files with 172 additions and 1 deletions

View File

@ -0,0 +1,125 @@
<template>
<v-content>
<v-container>
<v-card>
<v-card-title>
Preisliste
<v-spacer />
<v-text-field
v-model="search"
label="Suche Getränk"
single-line
hide-details
>
<template v-slot:append>
<v-icon>{{searchIcon}}</v-icon>
</template>
</v-text-field>
</v-card-title>
<v-data-table :headers="headers" :items="priceList" :search="search">
<template v-slot:item.price="{ item }">
{{ item.price ? (item.price / 100).toFixed(2) : '' }}
</template>
<template v-slot:item.price_big="{ item }">
{{ item.price_big ? (item.price_big / 100).toFixed(2) : '' }}
</template>
<template v-slot:item.price_club="{ item }">
{{
item.name.toLowerCase() == 'long island ice tea'.toLowerCase()
? 'Ein Klubmitglied bestellt keinen Long Island Icetea'
: item.price_club
? (item.price_club / 100).toFixed(2)
: ''
}}
</template>
<template v-slot:item.price_club_big="{ item }">
{{
item.price_club_big ? (item.price_club_big / 100).toFixed(2) : ''
}}
</template>
<template v-slot:item.premium="{ item }">
{{ item.premium ? (item.premium / 100).toFixed(2) : '' }}
</template>
<template v-slot:item.premium_club="{ item }">
{{ item.premium_club ? (item.premium_club / 100).toFixed(2) : '' }}
</template>
<template v-slot:item.price_extern_club="{ item }">
{{
item.price_extern_club
? (item.price_extern_club / 100).toFixed(2)
: ''
}}
</template>
</v-data-table>
</v-card>
</v-container>
</v-content>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import { mdiMagnify } from '@mdi/js'
export default {
name: 'PriceList',
data() {
return {
searchIcon: mdiMagnify,
search: null,
headers: [
{
text: 'Name',
value: 'name'
},
{
text: 'Kategorie',
value: 'type'
},
{
text: 'Preis in €',
value: 'price'
},
{
text: 'Preis groß in €',
value: 'price_big'
},
{
text: 'Preis Club in €',
value: 'price_club'
},
{
text: 'Preis groß Club in €',
value: 'price_club_big'
},
{
text: 'Aufpreis in €',
value: 'premium'
},
{
text: 'Aufpreis Club in €',
value: 'premium_club'
},
{
text: 'Preis Club extern in €',
value: 'price_extern_club'
}
],
items: []
}
},
methods: {
...mapActions({
getPriceList: 'priceList/getPriceList'
})
},
computed: {
...mapGetters({
priceList: 'priceList/priceList'
})
},
created() {
this.getPriceList()
}
}
</script>
<style scoped></style>

View File

@ -5,6 +5,7 @@ const main = 'http://localhost:5000/'
const url = { const url = {
login: main + 'login', login: main + 'login',
pricelist: main + 'pricelist',
getFinanzerMain: main + 'getFinanzerMain', getFinanzerMain: main + 'getFinanzerMain',
bar: main + 'bar', bar: main + 'bar',
barGetUser: main + 'barGetUser', barGetUser: main + 'barGetUser',

View File

@ -18,10 +18,16 @@ import ServiceManagement from '../components/vorstand/ServiceManagement'
import Config from '@/components/user/Config' import Config from '@/components/user/Config'
import Jobs from '@/components/user/Jobs' import Jobs from '@/components/user/Jobs'
import JobRequests from '@/components/user/JobRequests' import JobRequests from '@/components/user/JobRequests'
import PriceList from "@/components/pricelist/PriceList";
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [ const routes = [
{
path: '/pricelist',
name: 'priceListNoLogin',
component: PriceList
},
{ {
path: '/login', path: '/login',
name: 'login', name: 'login',

View File

@ -7,6 +7,7 @@ import user from '@/store/modules/user'
import sm from '@/store/modules/serviceManagement' import sm from '@/store/modules/serviceManagement'
import jobs from '@/store/modules/jobs' import jobs from '@/store/modules/jobs'
import requestJobs from '@/store/modules/jobRequests' import requestJobs from '@/store/modules/jobRequests'
import priceList from '@/store/modules/pricelist'
Vue.use(Vuex) Vue.use(Vuex)
@ -18,6 +19,7 @@ export default new Vuex.Store({
user, user,
sm, sm,
jobs, jobs,
requestJobs requestJobs,
priceList
} }
}) })

View File

@ -0,0 +1,37 @@
import url from '@/plugins/routes'
import axios from 'axios'
const state = {
priceList: []
}
const mutations = {
setPriceList: (state, priceList) => {
state.priceList = priceList
}
}
const actions = {
async getPriceList({ commit }) {
try {
const response = await axios.get(url.pricelist)
commit('setPriceList', response.data)
} catch (e) {
console.log(e)
}
}
}
const getters = {
priceList: state => {
return state.priceList
}
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}