Merge branch 'feature/pricelist' into develop

This commit is contained in:
Tim Gröger 2020-03-01 20:10:32 +01:00
commit 174bef1fce
13 changed files with 924 additions and 89 deletions

View File

@ -1,25 +1,31 @@
<template>
<v-app-bar app clipped-left clipped-right hide-on-scroll color="blue accent-4" class="elevation-4" dark>
<v-btn icon>
<v-btn icon to="/">
<v-img src="@/assets/logo-big.png" contain height="40"></v-img>
</v-btn>
<v-toolbar-title>Flaschengeist</v-toolbar-title>
<v-spacer />
<v-btn icon v-if="isFinanzer">
<v-btn icon v-if="isFinanzer" disabled>
<v-icon>{{attach_money}}</v-icon>
</v-btn>
<v-btn icon v-if="isBar">
<v-btn icon v-if="isGastro" disabled>
<v-icon>{{gastro}}</v-icon>
</v-btn>
<v-btn icon v-if="isBar" disabled>
<v-icon>{{local_bar}}</v-icon>
</v-btn>
<v-btn icon v-if="isUser">
<v-btn icon v-if="isUser" disabled>
<v-icon>{{person}}</v-icon>
</v-btn>
<v-btn icon to="/pricelist">
<v-icon>{{list}}</v-icon>
</v-btn>
</v-app-bar>
</template>
<script>
import { mapActions, mapGetters } from 'vuex'
import { mdiCurrencyEur, mdiGlassCocktail, mdiAccount } from '@mdi/js'
import { mdiCurrencyEur, mdiGlassCocktail, mdiAccount, mdiFileMultiple, mdiFoodForkDrink } from '@mdi/js'
export default {
name: 'TitleBar',
@ -27,11 +33,13 @@ export default {
return {
attach_money: mdiCurrencyEur,
local_bar: mdiGlassCocktail,
person: mdiAccount
person: mdiAccount,
list: mdiFileMultiple,
gastro: mdiFoodForkDrink
}
},
computed: {
...mapGetters(['isBar', 'isFinanzer', 'isUser', 'isLoggedIn'])
...mapGetters(['isBar', 'isFinanzer', 'isUser', 'isLoggedIn', 'isGastro'])
},
methods: {
...mapActions(['logout'])

View File

@ -7,12 +7,6 @@
</v-list-item-icon>
<v-list-item-title>Gesamtübersicht</v-list-item-title>
</v-list-item>
<v-list-item link to="/main/finanzer/servicemanagement">
<v-list-item-icon>
<v-icon>{{work}}</v-icon>
</v-list-item-icon>
<v-list-item-title>Dienstverwaltung</v-list-item-title>
</v-list-item>
</v-list>
<v-divider />
<v-list>
@ -34,25 +28,18 @@
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import {mdiHome, mdiBriefcase} from '@mdi/js'
import { mapGetters } from 'vuex'
import {mdiHome} from '@mdi/js'
export default {
name: 'FinanzerNavigation',
data () {
return {
home: mdiHome,
work: mdiBriefcase
home: mdiHome
}
},
methods: {
...mapActions({
addUser: 'finanzerUsers/addUser'
})
},
computed: {
...mapGetters({
users: 'finanzerUsers/users',
allUsers: 'finanzerUsers/allUsers',
loading: 'finanzerUsers/usersLoading'
})
}

View File

@ -0,0 +1,28 @@
<template>
<v-list>
<v-list-item class="title" link to="/main/gastro/pricelist">
<v-list-item-icon>
<v-icon>{{list}}</v-icon>
</v-list-item-icon>
<v-list-item-title>
Preisliste
</v-list-item-title>
</v-list-item>
</v-list>
</template>
<script>
import { mdiFileMultiple } from '@mdi/js'
export default {
name: "GastroNavigation",
data() {
return {
list: mdiFileMultiple
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,492 @@
<template>
<div>
<v-data-table :headers="headers" :items="priceList" :search="search">
<template v-slot:top>
<v-toolbar flat color="white">
<v-toolbar-title>Preisliste</v-toolbar-title>
<v-spacer></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-dialog v-model="dialog" v-if="isGastro">
<template v-slot:activator="{ on }">
<v-btn
fab
x-small
color="primary"
class="mb-2"
v-on="on"
style="margin: 5px"
>
<v-icon>{{ plus }}</v-icon>
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="headline">{{ formTitle }}</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12" sm="6" md="4">
<v-text-field
v-model="editedItem.name"
label="Name"
outlined
></v-text-field>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-autocomplete
return-object
v-model="editedItem.type"
label="Kategorie"
item-text="name"
item-value="id"
:items="types"
outlined
:search-input.sync="searchType"
no-data-text="Kategorie nicht vorhanden."
>
<template v-slot:append-item>
<v-list-item v-if="!inType(searchType)">
<v-list-item-title>
{{ searchType }}
</v-list-item-title>
<v-btn
dark
x-small
color="blue darken-1"
@click="addType()"
:disabled="inType(searchType)"
fab
>
<v-icon>
{{ plus }}
</v-icon>
</v-btn>
</v-list-item>
</template>
</v-autocomplete>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-text-field
v-model="editedItem.price"
label="Preis in €"
outlined
></v-text-field>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-text-field
v-model="editedItem.price_big"
label="Preis groß in €"
outlined
></v-text-field>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-text-field
v-model="editedItem.price_club"
label="Preis Club in €"
outlined
></v-text-field>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-text-field
v-model="editedItem.price_club_big"
label="Preis Club groß in €"
outlined
></v-text-field>
</v-col>
<v-col col="12" sm="6" md="4">
<v-text-field
v-model="editedItem.premium"
label="Aufpreis in €"
outlined
/>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-text-field
v-model="editedItem.premium_club"
label="Aufpreis Club in €"
outlined
/>
</v-col>
<v-col cols="12" sm="6" md="4">
<v-text-field
v-model="editedItem.price_extern_club"
label="Preis extern Club in €"
outlined
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="close"
>Abbrechen</v-btn
>
<v-btn color="blue darken-1" text @click="save"
>Speichern</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
</v-toolbar>
</template>
<template v-slot:item.type="{ item }">
{{ computeType(item.type) }}
</template>
<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>
<template v-slot:item.action="{ item }">
<v-icon small class="mr-2" @click="editItem(item)">
{{ editIcon }}
</v-icon>
<v-icon small @click="deleteItem(item)">
{{ deleteIcon }}
</v-icon>
</template>
</v-data-table>
<v-card tile v-if="isGastro">
<v-card-title>
Kategorien
<v-spacer />
<v-btn fab x-small @click="dialogType = true" color="primary">
<v-icon>{{ plus }}</v-icon>
</v-btn>
</v-card-title>
<v-card-text>
<div tile v-for="type in types" :key="type.id">
<v-card tile>
<v-card-text class="black--text">
<v-row class="ml-3 mr-3">
{{ type.name }}
<v-spacer />
<v-btn icon @click="editType(type)">
<v-icon>
{{ editIcon }}
</v-icon>
</v-btn>
<v-btn icon @click="deleteType(type)">
<v-icon>
{{ deleteIcon }}
</v-icon>
</v-btn>
</v-row>
</v-card-text>
</v-card>
</div>
</v-card-text>
<v-dialog v-model="dialogType">
<v-card>
<v-card-title>
{{ dialogTypeTitle }}
</v-card-title>
<v-card-text>
<v-container>
<v-text-field
v-model="editedType.name"
outlined
label="Name der Kategorie"
/>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text color="blue darken-1" @click="closeType()">
Abbrechen
</v-btn>
<v-btn
text
color="blue darken-1"
@click="saveType()"
:disabled="inType(editedType.name)"
>
Speichern
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-card>
</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import { mdiMagnify, mdiPlus, mdiPencil, mdiDelete } from '@mdi/js'
export default {
name: 'PriceList',
data() {
return {
editIcon: mdiPencil,
deleteIcon: mdiDelete,
searchIcon: mdiMagnify,
plus: mdiPlus,
searchType: null,
search: null,
dialog: null,
dialogType: null,
editedIndex: -1,
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'
}
],
editedItem: {
name: null,
type: { id: -1, name: null },
price: null,
price_big: null,
price_club: null,
price_club_big: null,
premium: null,
premium_club: null,
price_extern_club: null
},
defaultItem: {
name: null,
type: { id: -1, name: null },
price: null,
price_big: null,
price_club: null,
price_club_big: null,
premium: null,
premium_club: null,
price_extern_club: null
},
editedType: {
id: -1,
name: null
},
defaultType: {
id: -1,
name: null
}
}
},
methods: {
...mapActions({
getPriceList: 'priceList/getPriceList',
getTypes: 'priceList/getTypes',
setDrink: 'priceList/setDrink',
updateDrink: 'priceList/updateDrink',
deleteDrink: 'priceList/deleteDrink',
setDrinkType: 'priceList/setDrinkType',
updateDrinkType: 'priceList/updateDrinkType',
deleteDrinkType: 'priceList/deleteDrinkType'
}),
editType(item) {
console.log(item)
this.editedType = Object.assign({}, item)
this.dialogType = true
},
closeType() {
this.dialogType = false
setTimeout(() => {
this.editedType = Object.assign({}, this.defaultType)
}, 300)
},
saveType() {
this.editedType.id === -1
? this.setDrinkType(this.editedType)
: this.updateDrinkType(this.editedType)
this.closeType()
},
deleteType(item) {
confirm('Bist du sicher, dass die diese Kategorie entfernen wills?') &&
this.deleteDrinkType({ id: item.id })
},
addType() {
this.setDrinkType({ name: this.searchType })
},
close() {
this.dialog = false
setTimeout(() => {
this.editedItem = Object.assign({}, this.defaultItem)
this.editedIndex = -1
}, 300)
},
editItem(item) {
this.editedIndex = item.id
console.log('item', item)
this.editedItem = Object.assign({}, item)
for (let i in this.editedItem) {
this.editedItem[i] = isNaN(this.editedItem[i])
? this.editedItem[i]
: this.editedItem[i] == null || this.editedItem[i] == 0
? null
: (this.editedItem[i] / 100).toFixed(2)
}
console.log(this.editedItem)
this.editedItem.type = Object.assign(
{},
this.types.find(a => a.id == item.type)
)
this.dialog = true
},
deleteItem(item) {
confirm('Bist du sicher, dass die dieses Getränk entfernen wills?') &&
this.deleteDrink({ id: item.id })
},
save() {
console.log(this.editedItem)
console.log(this.editedIndex)
console.log(!isNaN(this.editedItem.price_extern_club))
var drink = {
id: this.editedIndex,
name: this.editedItem.name,
type: this.editedItem.type.id,
price: !isNaN(this.editedItem.price)
? this.editedItem.price * 100
: null,
price_big: !isNaN(this.editedItem.price_big)
? this.editedItem.price_big * 100
: null,
price_club: !isNaN(this.editedItem.price_club)
? this.editedItem.price_club * 100
: null,
price_club_big: !isNaN(this.editedItem.price_club_big)
? this.editedItem.price_club_big * 100
: null,
premium: !isNaN(this.editedItem.premium)
? this.editedItem.premium * 100
: null,
premium_club: !isNaN(this.editedItem.premium_club)
? this.editedItem.premium_club * 100
: null,
price_extern_club: !isNaN(this.editedItem.price_extern_club)
? this.editedItem.price_extern_club * 100
: null
}
console.log(drink)
drink.id === -1 ? this.setDrink(drink) : this.updateDrink(drink)
this.editedItem = Object.assign({}, this.defaultItem)
this.close()
}
},
computed: {
...mapGetters({
priceList: 'priceList/priceList',
types: 'priceList/types',
isGastro: 'isGastro'
}),
formTitle() {
return this.editedIndex === -1 ? 'Neues Getränk' : 'Bearbeite Getränk'
},
inType() {
return text => {
return !!this.types.find(a => {
if (a.name === null || text === null) {
return true
} else {
return a.name.toLowerCase() === text.toLowerCase()
}
})
}
},
dialogTypeTitle() {
return this.editedType.id === -1
? 'Neue Kategorie'
: 'Bearbeite Kategorie'
},
computeType() {
return id => {
return this.types.find(a => {
return a.id === id
}).name
}
}
},
created() {
this.getPriceList()
if (this.isGastro) {
this.headers.push({
text: 'Aktion',
value: 'action',
sortable: false,
filterable: false
})
this.getTypes()
}
},
watch: {
dialog(val) {
val || this.close()
}
}
}
</script>
<style scoped></style>

View File

@ -0,0 +1,26 @@
<template>
<v-list>
<v-list-item link to="/main/management/servicemanagement">
<v-list-item-icon>
<v-icon>{{ work }}</v-icon>
</v-list-item-icon>
<v-list-item-title>
Dienstverwaltung
</v-list-item-title>
</v-list-item>
</v-list>
</template>
<script>
import { mdiBriefcase } from '@mdi/js'
export default {
name: 'ManagementNavigation',
data() {
return {
work: mdiBriefcase
}
}
}
</script>
<style scoped></style>

View File

@ -1,51 +1,49 @@
<template>
<div>
<v-content>
<v-toolbar>
<v-toolbar-title>
Dienstverwaltung
</v-toolbar-title>
<v-spacer />
<v-toolbar-items>
<v-btn text icon @click="changeMonth(-1)">
<v-icon>{{ keyboard_arrow_left }}</v-icon>
</v-btn>
<v-list-item>
<v-list-item-title class="title"
>{{ monthArray[date.getMonth()] }}
{{ date.getFullYear() }}</v-list-item-title
>
</v-list-item>
<v-btn text icon @click="changeMonth(1)">
<v-icon>{{ keyboard_arrow_right }}</v-icon>
</v-btn>
</v-toolbar-items>
<v-spacer />
<v-toolbar-items>
<v-btn text @click="lockDays(true)">Monat sperren</v-btn>
<v-btn text @click="lockDays(false)">Monat freigeben</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-card v-for="week in month" :key="month.indexOf(week)" tile flat>
<v-card-title class="subtitle-1 font-weight-bold">
Woche vom {{ week.startDate.getDate() }}.{{
week.startDate.getMonth() + 1
}}.{{ week.startDate.getFullYear() }} bis
{{ week.endDate.getDate() }}.{{ week.endDate.getMonth() + 1 }}.{{
week.endDate.getFullYear()
}}
</v-card-title>
<v-card-text>
<v-row justify="start" align="start">
<div v-for="day in week.days" :key="day.id">
<v-col>
<Day v-bind:day="day" />
</v-col>
</div>
</v-row>
</v-card-text>
</v-card>
</v-content>
<v-toolbar>
<v-toolbar-title>
Dienstverwaltung
</v-toolbar-title>
<v-spacer />
<v-toolbar-items>
<v-btn text icon @click="changeMonth(-1)">
<v-icon>{{ keyboard_arrow_left }}</v-icon>
</v-btn>
<v-list-item>
<v-list-item-title class="title"
>{{ monthArray[date.getMonth()] }}
{{ date.getFullYear() }}</v-list-item-title
>
</v-list-item>
<v-btn text icon @click="changeMonth(1)">
<v-icon>{{ keyboard_arrow_right }}</v-icon>
</v-btn>
</v-toolbar-items>
<v-spacer />
<v-toolbar-items>
<v-btn text @click="lockDays(true)">Monat sperren</v-btn>
<v-btn text @click="lockDays(false)">Monat freigeben</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-card v-for="week in month" :key="month.indexOf(week)" tile flat>
<v-card-title class="subtitle-1 font-weight-bold">
Woche vom {{ week.startDate.getDate() }}.{{
week.startDate.getMonth() + 1
}}.{{ week.startDate.getFullYear() }} bis
{{ week.endDate.getDate() }}.{{ week.endDate.getMonth() + 1 }}.{{
week.endDate.getFullYear()
}}
</v-card-title>
<v-card-text>
<v-row justify="start" align="start">
<div v-for="day in week.days" :key="day.id">
<v-col>
<Day v-bind:day="day" />
</v-col>
</div>
</v-row>
</v-card-text>
</v-card>
</div>
</template>
@ -100,7 +98,12 @@ export default {
for (var week in this.month) {
for (var dayint in this.month[week].days) {
var day = this.month[week].days[dayint]
this.lockDay({year: day.date.getFullYear(), month: day.date.getMonth() + 1, day: day.date.getDate(), locked: value})
this.lockDay({
year: day.date.getFullYear(),
month: day.date.getMonth() + 1,
day: day.date.getDate(),
locked: value
})
}
}
}

View File

@ -1,10 +1,12 @@
//const main = 'https://192.168.5.128:5000/'
const main = 'http://localhost:5000/'
//const main = 'http://192.168.5.118:5000/'
//const main = 'http://localhost:5000/'
const main = 'http://192.168.5.118:5000/'
//const main = 'https://groeger-clan.duckdns.org:5000/'
const url = {
login: main + 'login',
pricelist: main + 'pricelist',
getTypes: main + 'drinkTypes',
getFinanzerMain: main + 'getFinanzerMain',
bar: main + 'bar',
barGetUser: main + 'barGetUser',
@ -42,6 +44,14 @@ const url = {
},
barU: {
storno: main + 'bar/storno'
},
gastro: {
setDrink: main + 'gastro/setDrink',
updateDrink: main + 'gastro/updateDrink',
deleteDrink: main + 'gastro/deleteDrink',
setType: main + 'gastro/setDrinkType',
updateType: main + 'gastro/updateDrinkType',
deleteType: main + 'gastro/deleteDrinkType'
}
}

View File

@ -18,10 +18,19 @@ import ServiceManagement from '../components/vorstand/ServiceManagement'
import Config from '@/components/user/Config'
import Jobs from '@/components/user/Jobs'
import JobRequests from '@/components/user/JobRequests'
import PriceList from '@/components/pricelist/PriceList'
import ManagementNavigation from "@/components/vorstand/ManagementNavigation";
import GastroNavigation from "@/components/gastro/GastroNavigation";
import PriceListView from "@/views/contents/PriceListView";
Vue.use(VueRouter)
const routes = [
{
path: '/pricelist',
name: 'priceListNoLogin',
component: PriceListView
},
{
path: '/login',
name: 'login',
@ -32,10 +41,21 @@ const routes = [
name: 'main',
component: MainView,
children: [
{
path: 'management',
name: 'management',
components: { nav: ManagementNavigation, default: BarView},
children: [
{
path: 'servicemanagement',
component: ServiceManagement
}
]
},
{
path: 'user',
name: 'user',
components: { userNav: UserNavigation, default: UserView },
components: { nav: UserNavigation, default: UserView },
children: [
{
path: 'add',
@ -67,7 +87,7 @@ const routes = [
{
path: 'bar',
name: 'bar',
components: { userNav: BarNavigation, default: BarView },
components: { nav: BarNavigation, default: BarView },
children: [
{
path: 'geruecht',
@ -79,7 +99,7 @@ const routes = [
{
path: 'finanzer',
name: 'finanzer',
components: { default: FinanzerView, finanzerNav: FinanzerNavigation },
components: { default: FinanzerView, nav: FinanzerNavigation },
children: [
{
path: 'overview',
@ -90,10 +110,18 @@ const routes = [
name: 'activeUser',
props: true,
component: User
},
}
]
},
{
path: 'gastro',
name: 'gastro',
components: { nav: GastroNavigation, default: BarView},
children: [
{
path: 'servicemanagement',
component: ServiceManagement
path: 'pricelist',
name: 'gastroPricelist',
component: PriceList
}
]
}
@ -138,7 +166,7 @@ router.beforeEach((to, from, next) => {
if (to.fullPath === '/login') {
if (store.state.login.user.accessToken) {
if (store.state.login.user.group.includes('moneymaster')) {
next('/main/finanzer')
next('/main/finanzer/overview')
} else if (store.state.login.user.group.includes('bar')) {
next('/main/bar/geruecht')
} else if (store.state.login.user.group.includes('user')) {

View File

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

View File

@ -115,27 +115,41 @@ const getters = {
},
isBar: state => {
try {
return state.user.group.includes('bar') ? true : false
return state.user.group.includes('bar')
} catch (e) {
return false
}
},
isFinanzer: state => {
try {
return state.user.group.includes('moneymaster') ? true : false
return state.user.group.includes('moneymaster')
} catch (e) {
return false
}
},
isUser: state => {
try {
return state.user.group.includes('user') ? true : false
return state.user.group.includes('user')
} catch (e) {
return false
}
},
isGastro: state => {
try {
return state.user.group.includes('gastro')
} catch (e) {
return false
}
},
isManagement: state => {
try {
return state.user.group.includes('management') || state.user.group.includes('gastro') || state.user.group.includes('moneymaster')
} catch (e) {
return false
}
},
isLoggedIn: state => {
return state.user.accessToken ? true : false
return state.user.accessToken
},
user: state => {
return state.user

View File

@ -0,0 +1,202 @@
import url from '@/plugins/routes'
import axios from 'axios'
const state = {
priceList: [],
types: []
}
const mutations = {
setPriceList: (state, priceList) => {
state.priceList = priceList
},
setTypes: (state, types) => {
state.types = types
state.types.sort((a, b) => {
const low = b.name.toLowerCase()
const high = a.name.toLowerCase()
if (high < low) return -1
if (high > low) return 1
return 0
})
},
updatePriceList: (state, drink) => {
var a = state.priceList.find(b => {
return b.id === drink.id
})
if (a) {
a.name = drink.name
a.type = drink.type
a.price = drink.price
a.price_big = drink.price_big
a.price_club = drink.price_club
a.price_club_big = drink.price_club_big
a.premium = drink.premium
a.premium_club = drink.premium_club
a.price_extern_club = drink.price_extern_club
} else {
state.priceList.push({
id: drink.id,
name: drink.name,
type: drink.type,
price: drink.price,
price_big: drink.price_big,
price_club: drink.price_club,
price_club_big: drink.price_club_big,
premium: drink.premium,
premium_club: drink.premium_club,
price_extern_club: drink.price_extern_club
})
}
},
deleteDrinkPrice: (state, data) => {
var index = state.priceList.indexOf(
state.priceList.find(a => {
return a.id === data.id
})
)
state.priceList.splice(index, 1)
},
updateDrinkType: (state, type) => {
var a = state.types.find(b => {
return b.id === type.id
})
if (a) {
a.name = type.name
} else {
state.types.push({
...type
})
}
state.types.sort((a, b) => {
const low = b.name.toLowerCase()
const high = a.name.toLowerCase()
if (high < low) return -1
if (high > low) return 1
return 0
})
},
deleteDrinkType: (state, type) => {
var index = state.types.indexOf(
state.types.find(a => {
return a.id === type.id
})
)
state.types.splice(index, 1)
}
}
const actions = {
async getPriceList({ commit }) {
try {
const response = await axios.get(url.pricelist)
commit('setPriceList', response.data)
} catch (e) {
console.log(e)
}
},
async getTypes({ commit, dispatch }) {
try {
const response = await axios.get(url.getTypes)
commit('setTypes', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async setDrink({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.gastro.setDrink,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updatePriceList', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async updateDrink({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.gastro.updateDrink,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updatePriceList', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async deleteDrink({ commit, rootState, dispatch }, data) {
try {
await axios.post(
url.gastro.deleteDrink,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('deleteDrinkPrice', data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async setDrinkType({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.gastro.setType,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateDrinkType', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async updateDrinkType({ commit, rootState, dispatch }, data) {
try {
const response = await axios.post(
url.gastro.updateType,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateDrinkType', response.data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
async deleteDrinkType({ commit, rootState, dispatch }, data) {
try {
await axios.post(
url.gastro.deleteType,
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('deleteDrinkType', data)
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
}
}
const getters = {
priceList: state => {
return state.priceList
},
types: state => {
return state.types
}
}
export default {
namespaced: true,
state,
mutations,
actions,
getters
}

View File

@ -24,6 +24,22 @@
Bar
</v-list-item-title>
</v-list-item>
<v-list-item v-if="isManagement" class="title" link to="/main/management/servicemanagement">
<v-list-item-icon>
<v-icon>{{king}}</v-icon>
</v-list-item-icon>
<v-list-item-title>
Vorstand
</v-list-item-title>
</v-list-item>
<v-list-item v-if="isGastro" class="title" link to="/main/gastro/pricelist">
<v-list-item-icon>
<v-icon>{{gastro}}</v-icon>
</v-list-item-icon>
<v-list-item-title>
Gastro
</v-list-item-title>
</v-list-item>
<v-list-item v-if="isFinanzer" class="title" link to="/main/finanzer/overview">
<v-list-item-icon>
<v-icon>{{attach_money}}</v-icon>
@ -32,9 +48,7 @@
</v-list-item>
</v-list>
<v-divider />
<router-view name="finanzerNav" />
<router-view name="userNav"/>
<router-view name="barNav"/>
<router-view name="nav" />
<template v-slot:append>
<v-list>
<v-list-item>
@ -54,7 +68,7 @@
<script>
import { mapActions, mapGetters } from 'vuex'
import {mdiAccount, mdiCurrencyEur, mdiExitToApp, mdiGlassCocktail} from '@mdi/js'
import {mdiAccount, mdiCurrencyEur, mdiExitToApp, mdiGlassCocktail, mdiChessKing, mdiFoodForkDrink} from '@mdi/js'
export default {
name: 'MainView',
data () {
@ -62,7 +76,9 @@ export default {
person: mdiAccount,
attach_money: mdiCurrencyEur,
exit_to_app: mdiExitToApp,
glass_cocktail: mdiGlassCocktail
glass_cocktail: mdiGlassCocktail,
king: mdiChessKing,
gastro: mdiFoodForkDrink
}
},
components: { },
@ -79,6 +95,8 @@ export default {
isBar: 'isBar',
isUser: 'isUser',
isFinanzer: 'isFinanzer',
isGastro: 'isGastro',
isManagement: 'isManagement',
isLoggedIn: 'isLoggedIn',
user: 'user'
})

View File

@ -0,0 +1,17 @@
<template>
<v-content>
<PriceList />
</v-content>
</template>
<script>
import PriceList from "@/components/pricelist/PriceList";
export default {
name: "PriceListView",
components: {PriceList}
}
</script>
<style scoped>
</style>