release v2.0.0 #4

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

View File

@ -35,6 +35,7 @@
</v-toolbar-items>
<v-spacer/>
</v-toolbar>
<v-progress-linear indeterminate v-if="loading" />
<div>
<router-view />
</div>
@ -42,7 +43,7 @@
</template>
<script>
import { mapActions } from 'vuex'
import { mapActions, mapGetters } from 'vuex'
export default {
name: 'FreeDrinkList',
data() {
@ -88,7 +89,7 @@ export default {
'get_free_drink_list_config',
'get_free_drink_list_history_from_to',
'get_free_drink_list_reasons',
'get_free_drink_types'
'get_free_drink_types',
]),
...mapActions('priceList', ['getPriceList']),
change_month(payload) {
@ -96,11 +97,23 @@ export default {
}
},
computed: {
...mapGetters('freeDrinkList', [
'free_drink_list_config_loading',
'free_drink_list_history_loading',
'free_drink_list_reasons_loading',
'free_drink_types_loading'
]),
...mapGetters('priceList', [
'priceListLoading'
]),
to_date() {
return new Date(this.date.getFullYear(), this.date.getMonth()+1,1)
},
from_date() {
return new Date(this.date.getFullYear(), this.date.getMonth(), 1)
},
loading() {
return this.free_drink_types_loading || this.free_drink_list_reasons_loading || this.free_drink_list_history_loading || this.free_drink_list_config_loading || this.priceListLoading
}
},
watch: {

View File

@ -37,6 +37,36 @@
</v-card>
<v-card tile>
<v-card-title>Gründe für Freigetränke</v-card-title>
<v-card-text>
<v-list>
<template
v-for="(free_drink_reason, index) in free_drink_list_reasons">
<v-list-item
:key="free_drink_reason.name"
dense
>
<v-list-item-content>
<FreeDrinkListConfigReasonItem :free_drink_reason="free_drink_reason" @save="save_reason" @delete_free_drink_list_reason="delete_free_drink_reason" />
</v-list-item-content>
</v-list-item>
<v-divider
v-if="(index + 1 < free_drink_list_reasons.length) || new_free_drink_list_reason"
:key="index"
/>
</template>
<v-list-item v-if="new_free_drink_list_reason">
<v-list-item-content>
<FreeDrinkListConfigReasonItem :free_drink_reason="default_model_reason" @save="save_reason" @delete_free_drink_reason="new_free_drink_list_reason=false"/>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card-text>
<v-card-actions dense>
<v-spacer />
<v-btn fab small color="success" @click="new_free_drink_list_reason=true" v-if="!new_free_drink_list_reason">
<v-icon>mdi-plus</v-icon>
</v-btn>
</v-card-actions>
</v-card>
<v-dialog v-model="check_delete_free_drink_list_config" max-width="400">
@ -55,6 +85,23 @@
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="check_delete_free_drink_list_reason" max-width="400">
<v-card>
<v-card-title>
Wirklich löschen?
</v-card-title>
<v-card-text>
Willst du wirklich den Grund <span class="font-weight-black">{{check_model_reason.name}}</span> löschen?
Wenn du dies löscht, wird auch der im Verlauf alle dieser Gründe gelöscht.. Dh. es ist nicht mehr vollständig nachvollziehbar, aus welchem Grund ein Freigetränk rausgegeben wurde.
</v-card-text>
<v-card-actions>
<v-spacer/>
<v-btn @click="cancel_delete_reason()">Abbrechen</v-btn>
<v-btn @click="accept_delete_reason()" color="error">Löschen</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
@ -62,12 +109,15 @@
import { mapGetters, mapActions} from 'vuex'
import FreeDrinkListConfigConfigItem
from '@/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigConfigItem'
import FreeDrinkListConfigReasonItem
from '@/components/vorstand/FreeDrinkList/FreeDrinkListConfigComponents/FreeDrinkListConfigReasonItem'
export default {
name: 'FreeDrinkListConfig',
components: { FreeDrinkListConfigConfigItem },
components: { FreeDrinkListConfigConfigItem, FreeDrinkListConfigReasonItem },
data() {
return {
new_free_drink_list_config: false,
new_free_drink_list_reason: false,
default_model: {
id: -1,
label: null,
@ -83,11 +133,22 @@ export default {
label: null,
drink: {name: null}
},
check_delete_free_drink_list_config: false
check_delete_free_drink_list_config: false,
check_delete_free_drink_list_reason: false,
default_model_reason: {
id: -1,
name: null
},
check_model_reason: {
name: null
},
default_check_model_reason: {
name: null
}
}
},
methods: {
...mapActions('freeDrinkList', ['set_free_drink_list_config', 'delete_free_drink_list_config', 'update_free_drink_list_config']),
...mapActions('freeDrinkList', ['set_free_drink_list_config', 'delete_free_drink_list_config', 'update_free_drink_list_config', 'set_free_drink_list_reason', 'update_free_drink_list_reason', 'delete_free_drink_list_reason']),
log() {
console.log(this.free_drink_list_config)
},
@ -118,7 +179,26 @@ export default {
} else {
this.set_free_drink_list_config(free_drink_config)
}
}
},
delete_free_drink_reason(free_drink_reason) {
Object.assign(this.check_model_reason, free_drink_reason)
this.check_delete_free_drink_list_reason = true
},
save_reason(free_drink_reason) {
if (free_drink_reason.id > 0) {
this.update_free_drink_list_reason(free_drink_reason)
} else {
this.set_free_drink_list_reason(free_drink_reason)
}
},
cancel_delete_reason() {
this.check_delete_free_drink_list_reason = false
this.check_model_reason = Object.assign({}, this.default_check_model_reason)
},
accept_delete_reason() {
this.delete_free_drink_list_reason(this.check_model_reason)
this.cancel_delete_reason()
},
},
computed: {
...mapGetters('freeDrinkList', [

View File

@ -0,0 +1,70 @@
<template>
<div>
<v-row>
<v-col>
<v-text-field
outlined
label="Name"
:value="free_drink_reason.name"
@change="set_model($event)"
dense />
</v-col>
</v-row>
<v-row justify="end">
<v-btn
v-if="free_drink_reason.id > 0"
icon
class="mr-3"
@click="$emit('delete_free_drink_list_reason', free_drink_reason)">
<v-icon>mdi-delete</v-icon>
</v-btn>
<v-btn
v-else
fab
color="error"
x-small
class="mr-4"
@click="$emit('delete_free_drink_reason')"
>
<v-icon>mdi-minus</v-icon>
</v-btn>
<v-btn
v-if="!is_same || free_drink_reason.id < 0"
class="mr-3"
color="success"
@click="() => {$emit('save', model); $emit('delete_free_drink_reason'); model = null}"
>
Save
</v-btn>
</v-row>
</div>
</template>
<script>
export default {
name: "FreeDrinkListConfigReason",
props: ['free_drink_reason'],
data() {
return {
model: null
}
},
methods: {
set_model(event) {
if (!this.model) {
this.model = Object.assign({}, this.free_drink_reason)
}
this.model.name = event
}
},
computed: {
is_same() {
return this.model ? JSON.stringify(this.model) == JSON.stringify(this.free_drink_reason): true
}
}
}
</script>
<style scoped>
</style>

View File

@ -94,7 +94,7 @@ name: "FreeDrinkListWorkgroup",
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,
reason: history_config.free_drink_list_reason ? history_config.free_drink_list_reason.name : null,
description: history_config.description,
pricepro: (drink_config.price / 100).toFixed(2)
})

View File

@ -33,6 +33,7 @@ const url = {
freeDrinkListHistoryFromTo: main + 'freeDrinkListHistoryFromTo',
deleteDrinkListHistory: main + 'deleteDrinkListHistory',
freeDrinkListReasons: main + 'freeDrinkListReasons',
deleteFreeDrinkListReason: main + 'deleteFreeDrinkListReason',
freeDrinkTypes: main + 'freeDrinkTypes',
deleteFreeDrinkListConfig: main + 'deleteFreeDrinkListConfig',
vorstand: {

View File

@ -266,7 +266,66 @@ const actions = {
} finally {
commit('set_free_drink_list_config_loading', false)
}
},
async set_free_drink_list_reason({ commit, dispatch, rootState }, data) {
try {
commit('set_free_drink_list_reasons_loading', true)
const response = await axios.post(url.freeDrinkListReasons, {...data},{
headers: { Token: rootState.login.user.accessToken },
timeout
})
commit('set_free_drink_list_reasons', 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_list_reasons_loading', false)
}
}
,
async update_free_drink_list_reason({ commit, dispatch, rootState }, data) {
try {
commit('set_free_drink_list_reasons_loading', true)
const response = await axios.put(url.freeDrinkListReasons, {...data},{
headers: { Token: rootState.login.user.accessToken },
timeout
})
commit('set_free_drink_list_reasons', 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_list_reasons_loading', false)
}
},
async delete_free_drink_list_reason({ commit, dispatch, rootState }, data) {
try {
commit('set_free_drink_list_reasons_loading', true)
const response = await axios.post(url.deleteFreeDrinkListReason, {...data},{
headers: { Token: rootState.login.user.accessToken },
timeout
})
commit('set_free_drink_list_reasons', 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_list_reasons_loading', false)
}
}
}
const getters = {
@ -356,6 +415,12 @@ const getters = {
free_drink_types(state) {
return state.free_drink_types
},
free_drink_list_history_loading(state) {
return state.free_drink_list_history_loading
},
free_drink_list_config_loading(state) {
return state.free_drink_list_config_loading
},
free_drink_types_loading(state) {
return state.free_drink_types_loading
},