release v2.0.0 #4
|
@ -1707,10 +1707,13 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"serialize-javascript": {
|
"serialize-javascript": {
|
||||||
"version": "3.0.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.1.0.tgz",
|
||||||
"integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==",
|
"integrity": "sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"randombytes": "^2.1.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"source-map": {
|
"source-map": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
|
@ -4538,9 +4541,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"elliptic": {
|
"elliptic": {
|
||||||
"version": "6.5.2",
|
"version": "6.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
|
||||||
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
|
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"bn.js": "^4.4.0",
|
"bn.js": "^4.4.0",
|
||||||
|
@ -6842,9 +6845,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.15",
|
"version": "4.17.20",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"lodash.defaultsdeep": {
|
"lodash.defaultsdeep": {
|
||||||
|
@ -11026,9 +11029,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"vuetify": {
|
"vuetify": {
|
||||||
"version": "2.2.29",
|
"version": "2.3.9",
|
||||||
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.2.29.tgz",
|
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.3.9.tgz",
|
||||||
"integrity": "sha512-UI1i8kEdV+s7tNQe2yJJMPlvxGTE8cZfUAXEGV2yO4owHmeybn6p5YzFpJqimoKkfX6ok+zV29+6yIKfkyUDAA=="
|
"integrity": "sha512-E5K9flTvS21tCkHgqDBMl0BY/Rld4SLUaJpQ+sQdL8/2uPcWmWLrdumn4SI8LBFojE0UP1GSaH4zKuxLL36fYg=="
|
||||||
},
|
},
|
||||||
"vuetify-loader": {
|
"vuetify-loader": {
|
||||||
"version": "1.4.4",
|
"version": "1.4.4",
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"vue": "^2.6.10",
|
"vue": "^2.6.10",
|
||||||
"vue-router": "^3.2.0",
|
"vue-router": "^3.2.0",
|
||||||
"vuetify": "^2.2.29",
|
"vuetify": "^2.3.8",
|
||||||
"vuex": "^3.4.0"
|
"vuex": "^3.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -110,27 +110,6 @@
|
||||||
<v-list-item-title class="headline">Verlauf</v-list-item-title>
|
<v-list-item-title class="headline">Verlauf</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-divider />
|
<v-divider />
|
||||||
<!-- <div
|
|
||||||
v-for="message in messages"
|
|
||||||
three-line
|
|
||||||
:key="messages.indexOf(message)"
|
|
||||||
class="history-item"
|
|
||||||
>
|
|
||||||
<v-list-item three-line inactive @click="canceledAmount(message)">
|
|
||||||
<v-list-item-content>
|
|
||||||
<v-list-item-title>{{ now(message.date) }}</v-list-item-title>
|
|
||||||
<v-list-item-subtitle>
|
|
||||||
{{
|
|
||||||
createMessage(message)
|
|
||||||
}}
|
|
||||||
</v-list-item-subtitle>
|
|
||||||
<v-list-item-subtitle class="red--text" v-if="message.canceled">STORNIERT!!!</v-list-item-subtitle>
|
|
||||||
<v-list-item-action-text
|
|
||||||
v-if="isStronoEnabled(message.date) && !message.canceled"
|
|
||||||
>Klicken um zu Stornieren</v-list-item-action-text>
|
|
||||||
</v-list-item-content>
|
|
||||||
</v-list-item>
|
|
||||||
</div> -->
|
|
||||||
<div
|
<div
|
||||||
v-for="freeDrinkHistory in free_drink_list_history"
|
v-for="freeDrinkHistory in free_drink_list_history"
|
||||||
:key="freeDrinkHistory.id"
|
:key="freeDrinkHistory.id"
|
||||||
|
@ -322,7 +301,26 @@ export default {
|
||||||
this.canceledMessage.canceled = true
|
this.canceledMessage.canceled = true
|
||||||
this.update_free_drink_list_history(this.canceledMessage)
|
this.update_free_drink_list_history(this.canceledMessage)
|
||||||
this.cancelCanceled()
|
this.cancelCanceled()
|
||||||
}
|
},
|
||||||
|
acceptStorno() {
|
||||||
|
this.stornoMessage.storno = true
|
||||||
|
this.amount -= this.stornoMessage.amount
|
||||||
|
console.log(this.amount, this.stornoMessage)
|
||||||
|
this.cancelStorno()
|
||||||
|
},
|
||||||
|
stornoAmount(message) {
|
||||||
|
if (!this.isStronoEnabled(message.date) || message.storno) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showConfirmStornoDialog = true
|
||||||
|
this.stornoMessage = message
|
||||||
|
},
|
||||||
|
|
||||||
|
cancelStorno() {
|
||||||
|
this.showConfirmStornoDialog = null
|
||||||
|
this.stornoMessage = null
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('freeDrinkList', [
|
...mapGetters('freeDrinkList', [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-card class="mx-auto" outlined>
|
<v-card class="mx-auto" outlined v-if="!first_loading" :loading="loading">
|
||||||
<v-card-title>
|
<v-card-title>
|
||||||
<div class="title">Freigetränk für Versammlungen/Arbeit</div>
|
<div class="title">Freigetränk für Versammlungen/Arbeit</div>
|
||||||
<v-btn class="menuBtn" @click.stop="isMenuShow = !isMenuShow" icon>
|
<v-btn class="menuBtn" @click.stop="isMenuShow = !isMenuShow" icon>
|
||||||
|
@ -9,95 +9,38 @@
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-row v-if="!loading">
|
<v-row v-if="!first_loading">
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
<v-col
|
||||||
<v-btn
|
v-for="freeDrink in free_drink_list_config_workgroup"
|
||||||
class="drinkBtn"
|
:key="freeDrink.id"
|
||||||
:disabled="locked"
|
cols="6"
|
||||||
:color="color"
|
xs="3"
|
||||||
@click="addAmount(140, 'Bier')"
|
sm="4"
|
||||||
>Bier</v-btn>
|
class="drinkCol"
|
||||||
</v-col>
|
>
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
|
||||||
<v-btn
|
<v-btn
|
||||||
class="drinkBtn"
|
class="drinkBtn"
|
||||||
block
|
block
|
||||||
:disabled="locked"
|
:color="color_fix"
|
||||||
:color="color"
|
@click="addAmount(freeDrink, freeDrinkTypeWorkgroup)"
|
||||||
@click="addAmount(200, 'Cuba')"
|
>{{ freeDrink.label }}</v-btn
|
||||||
>Cuba</v-btn>
|
>
|
||||||
</v-col>
|
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
|
||||||
<v-btn
|
|
||||||
class="drinkBtn"
|
|
||||||
block
|
|
||||||
:disabled="locked"
|
|
||||||
:color="color"
|
|
||||||
@click="addAmount(50, 'Schnaps')"
|
|
||||||
>Schnaps</v-btn>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
|
||||||
<v-btn
|
|
||||||
class="drinkBtn"
|
|
||||||
block
|
|
||||||
:disabled="locked"
|
|
||||||
:color="color"
|
|
||||||
@click="addAmount(200, 'Wein')"
|
|
||||||
>Wein</v-btn>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
|
||||||
<v-btn
|
|
||||||
class="drinkBtn"
|
|
||||||
block
|
|
||||||
:disabled="locked"
|
|
||||||
:color="color"
|
|
||||||
@click="addAmount(200, 'Gin Tonic')"
|
|
||||||
>Gin Tonic</v-btn>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
|
||||||
<v-btn
|
|
||||||
class="drinkBtn"
|
|
||||||
block
|
|
||||||
:disabled="locked"
|
|
||||||
:color="color"
|
|
||||||
@click="addAmount(100, 'Fritz')"
|
|
||||||
>Fritz</v-btn>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
|
||||||
<v-btn
|
|
||||||
class="drinkBtn"
|
|
||||||
block
|
|
||||||
:disabled="locked"
|
|
||||||
:color="color"
|
|
||||||
@click="addAmount(100, 'Saft')"
|
|
||||||
>Saft</v-btn>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="6" xs="3" sm="4" class="drinkCol">
|
|
||||||
<v-btn
|
|
||||||
class="drinkBtn"
|
|
||||||
block
|
|
||||||
:disabled="locked"
|
|
||||||
:color="color"
|
|
||||||
@click="addAmount(30, 'Wasser')"
|
|
||||||
>Wasser</v-btn>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row v-if="!loading">
|
<v-row v-if="!first_loading" class="justify-end">
|
||||||
<v-col cols="8">
|
<v-col cols="3">
|
||||||
<v-text-field
|
<v-list-item>
|
||||||
outlined
|
<v-list-item-content class="text-center">
|
||||||
type="number"
|
<v-list-item-action-text class="title">
|
||||||
label="Benutzerdefinierter Betrag"
|
{{
|
||||||
:disabled="locked"
|
free_drink_list_history_workgroup_without_canceled.length
|
||||||
v-model="customValue"
|
}}
|
||||||
></v-text-field>
|
Getränke
|
||||||
</v-col>
|
</v-list-item-action-text>
|
||||||
<v-col cols="2">
|
</v-list-item-content>
|
||||||
<v-btn fab :color="color" :disabled="locked" @click="addAmount(customValue)">
|
</v-list-item>
|
||||||
<v-icon>{{ plus }}</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
@ -113,52 +56,80 @@
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-divider />
|
<v-divider />
|
||||||
<div
|
<div
|
||||||
v-for="message in messages"
|
v-for="freeDrinkHistory in free_drink_list_history_workgroup"
|
||||||
:key="messages.indexOf(message)"
|
:key="freeDrinkHistory.id"
|
||||||
class="history-item"
|
|
||||||
>
|
>
|
||||||
<!-- <v-list-item three-line inactive @click="stornoAmount(message)"> -->
|
<v-list-item
|
||||||
<v-list-item inactive>
|
three-line
|
||||||
|
inactive
|
||||||
|
@click="canceledAmount(freeDrinkHistory)"
|
||||||
|
>
|
||||||
<v-list-item-content>
|
<v-list-item-content>
|
||||||
<v-list-item-title>{{ now(message.date) }}</v-list-item-title>
|
<v-list-item-title>{{
|
||||||
<v-list-item-action-text>
|
now(freeDrinkHistory.timestamp)
|
||||||
|
}}</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>
|
||||||
|
{{ freeDrinkHistory.free_drink_config.label }} wurde für
|
||||||
{{
|
{{
|
||||||
createMessage(message)
|
(freeDrinkHistory.free_drink_config.price / 100).toFixed(2)
|
||||||
}}
|
}}
|
||||||
</v-list-item-action-text>
|
€ hinzugefügt.
|
||||||
<!-- <v-list-item-subtitle class="red--text" v-if="message.storno">STORNIERT!!!</v-list-item-subtitle>
|
</v-list-item-subtitle>
|
||||||
|
<v-list-item-subtitle
|
||||||
|
class="red--text"
|
||||||
|
v-if="freeDrinkHistory.canceled"
|
||||||
|
>STORNIERT!!!</v-list-item-subtitle
|
||||||
|
>
|
||||||
<v-list-item-action-text
|
<v-list-item-action-text
|
||||||
v-if="isStronoEnabled(message.date) && !message.storno"
|
v-if="
|
||||||
>Klicken um zu Stornieren</v-list-item-action-text>-->
|
isStronoEnabled(freeDrinkHistory.timestamp) &&
|
||||||
|
!freeDrinkHistory.canceled
|
||||||
|
"
|
||||||
|
>Klicken um zu Stornieren</v-list-item-action-text
|
||||||
|
>
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</div>
|
</div>
|
||||||
</v-list-item-group>
|
</v-list-item-group>
|
||||||
</v-navigation-drawer>
|
</v-navigation-drawer>
|
||||||
|
|
||||||
<!-- <v-dialog v-model="showConfirmStornoDialog" max-width="290">
|
<v-dialog v-model="showConfirmCanceledDialog" max-width="290">
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>Willst du wirklich??</v-card-title>
|
<v-card-title>Willst du wirklich??</v-card-title>
|
||||||
<v-card-text v-if="stornoMessage">
|
<v-card-text v-if="canceledMessage">
|
||||||
Willst du wirklich den Betrag
|
{{ canceledMessage.free_drink_type.name }}: Willst du wirklich ein
|
||||||
{{ (stornoMessage.amount / 100).toFixed(2) }}€ von
|
{{ canceledMessage.free_drink_config.label }} im Wert von
|
||||||
den Dienstgetränke stornieren?
|
{{ (canceledMessage.free_drink_config.price / 100).toFixed(2) }} €
|
||||||
|
stornieren?
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn text @click="cancelStorno">Abbrechen</v-btn>
|
<v-btn text @click="cancelCanceled">Abbrechen</v-btn>
|
||||||
<v-btn text @click="acceptStorno">Stornieren</v-btn>
|
<v-btn text @click="acceptCanceled">Stornieren</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-dialog>-->
|
</v-dialog>
|
||||||
|
|
||||||
<v-dialog v-model="showReasonDialog" max-width="290">
|
<v-dialog v-model="showReasonDialog" max-width="290">
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>Willst du wirklich??</v-card-title>
|
<v-card-title>Willst du wirklich??</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-combobox v-model="selectedReason" :items="getReason()" label="Grund fürs Getränk"></v-combobox>
|
<v-combobox
|
||||||
<v-textarea label="Beschreibung" v-model="reasonDescription"></v-textarea>
|
v-model="selectedReason"
|
||||||
<v-text-field type="number" label="Anzahl der Getränke" v-model="drinkCount"></v-text-field>
|
:items="free_drink_list_reasons"
|
||||||
|
item-value="id"
|
||||||
|
item-text="name"
|
||||||
|
label="Grund fürs Getränk"
|
||||||
|
></v-combobox>
|
||||||
|
<v-textarea
|
||||||
|
label="Beschreibung"
|
||||||
|
v-model="reasonDescription"
|
||||||
|
></v-textarea>
|
||||||
|
<v-text-field
|
||||||
|
type="number"
|
||||||
|
label="Anzahl der Getränke"
|
||||||
|
v-model="drinkCount"
|
||||||
|
></v-text-field>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
|
@ -168,37 +139,81 @@
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
|
|
||||||
<v-container v-if="loading">
|
<v-container v-if="first_loading">
|
||||||
<AddAmountSkeleton />
|
<AddAmountSkeleton />
|
||||||
</v-container>
|
</v-container>
|
||||||
|
|
||||||
|
<v-snackbar
|
||||||
|
:color="
|
||||||
|
snackbar_messages.length > 0
|
||||||
|
? snackbar_messages[0].error
|
||||||
|
? 'error'
|
||||||
|
: 'success'
|
||||||
|
: 'success'
|
||||||
|
"
|
||||||
|
bottom
|
||||||
|
:timeout="0"
|
||||||
|
:multi-line="true"
|
||||||
|
:value="
|
||||||
|
snackbar_messages.length > 0 ? snackbar_messages[0].visible : null
|
||||||
|
"
|
||||||
|
vertical
|
||||||
|
>
|
||||||
|
<v-list-item
|
||||||
|
v-for="(message, index) in snackbar_messages"
|
||||||
|
:key="index"
|
||||||
|
:style="
|
||||||
|
message.error
|
||||||
|
? 'background-color: #FF5252;'
|
||||||
|
: 'background-color: #4CAF50;'
|
||||||
|
"
|
||||||
|
v-show="message.visible"
|
||||||
|
>
|
||||||
|
<v-list-item-content>
|
||||||
|
<v-list-item-title style="color: white">
|
||||||
|
{{ createMessage(message) }}
|
||||||
|
</v-list-item-title>
|
||||||
|
</v-list-item-content>
|
||||||
|
<v-list-item-action v-if="message.error">
|
||||||
|
<v-btn icon @click="message.visible = false">
|
||||||
|
<v-icon color="white">
|
||||||
|
mdi-close
|
||||||
|
</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-list-item-action>
|
||||||
|
</v-list-item>
|
||||||
|
</v-snackbar>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
import AddAmountSkeleton from '../Skeleton/AddAmountSkeleton'
|
import AddAmountSkeleton from '../Skeleton/AddAmountSkeleton'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters, mapActions } from 'vuex'
|
||||||
import { mdiPlus, mdiMenu } from '@mdi/js'
|
import { mdiPlus, mdiMenu } from '@mdi/js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FreedrinkUserView',
|
name: 'FreedrinkUserView',
|
||||||
components: { AddAmountSkeleton },
|
components: { AddAmountSkeleton },
|
||||||
created() {
|
created() {
|
||||||
this.loading = false
|
|
||||||
// this.timer = setInterval(() => (this.componentRenderer += 1), 1000)
|
// this.timer = setInterval(() => (this.componentRenderer += 1), 1000)
|
||||||
|
this.get_free_drink_list_config()
|
||||||
|
this.get_free_drink_list_history()
|
||||||
|
this.get_free_drink_list_reasons()
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
plus: mdiPlus,
|
plus: mdiPlus,
|
||||||
menuIcon: mdiMenu,
|
menuIcon: mdiMenu,
|
||||||
loading: true,
|
|
||||||
locked: false,
|
locked: false,
|
||||||
showConfirmStornoDialog: false,
|
showConfirmCanceledDialog: false,
|
||||||
showReasonDialog: false,
|
showReasonDialog: false,
|
||||||
stornoMessage: null,
|
|
||||||
customValue: null,
|
customValue: null,
|
||||||
color: 'green accent-4',
|
color: 'green accent-4',
|
||||||
|
color_fix: 'green accent-4',
|
||||||
messages: [],
|
messages: [],
|
||||||
amount: 0,
|
amount: 0,
|
||||||
|
free_drink: null,
|
||||||
|
free_drink_type_id: null,
|
||||||
selectedDrink: null,
|
selectedDrink: null,
|
||||||
drinkCount: 1,
|
drinkCount: 1,
|
||||||
timer: '',
|
timer: '',
|
||||||
|
@ -206,10 +221,19 @@ export default {
|
||||||
isMenuShow: false,
|
isMenuShow: false,
|
||||||
selectedReason: null,
|
selectedReason: null,
|
||||||
reasonDescription: null,
|
reasonDescription: null,
|
||||||
snackbarTimeout: 3000
|
freeDrinkTypeWorkgroup: 2,
|
||||||
|
snackbarTimeout: 3000,
|
||||||
|
canceledMessage: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions('freeDrinkList', [
|
||||||
|
'get_free_drink_list_config',
|
||||||
|
'get_free_drink_list_history',
|
||||||
|
'get_free_drink_list_reasons',
|
||||||
|
'set_free_drink_list_history',
|
||||||
|
'update_free_drink_list_history'
|
||||||
|
]),
|
||||||
getReason() {
|
getReason() {
|
||||||
const reasonArray = []
|
const reasonArray = []
|
||||||
if (!this.user) {
|
if (!this.user) {
|
||||||
|
@ -233,12 +257,11 @@ export default {
|
||||||
|
|
||||||
return reasonArray
|
return reasonArray
|
||||||
},
|
},
|
||||||
addAmount(amount, drink) {
|
addAmount(free_drink, free_drink_type_id) {
|
||||||
if (amount) {
|
if (free_drink) {
|
||||||
this.showReasonDialog = true
|
this.showReasonDialog = true
|
||||||
this.amount = amount
|
this.free_drink = free_drink
|
||||||
this.selectedDrink = drink
|
this.free_drink_type_id = free_drink_type_id
|
||||||
console.log(this.user)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stornoAmount(message) {
|
stornoAmount(message) {
|
||||||
|
@ -257,10 +280,13 @@ export default {
|
||||||
|
|
||||||
confirmFreeDrink() {
|
confirmFreeDrink() {
|
||||||
if (this.drinkCount >= 0) {
|
if (this.drinkCount >= 0) {
|
||||||
console.log(this.selectedReason)
|
this.set_free_drink_list_history({
|
||||||
console.log(this.reasonDescription)
|
...this.free_drink,
|
||||||
console.log(this.drinkCount)
|
free_drink_type_id: this.free_drink_type_id,
|
||||||
this.generateMessage()
|
free_drink_list_reason_id: this.selectedReason.id,
|
||||||
|
description: this.reasonDescription,
|
||||||
|
count: this.drinkCount
|
||||||
|
})
|
||||||
}
|
}
|
||||||
this.cancelFreedrink()
|
this.cancelFreedrink()
|
||||||
},
|
},
|
||||||
|
@ -271,6 +297,8 @@ export default {
|
||||||
this.selectedReason = null
|
this.selectedReason = null
|
||||||
this.reasonDescription = null
|
this.reasonDescription = null
|
||||||
this.drinkCount = 0
|
this.drinkCount = 0
|
||||||
|
this.free_drink_type_id = null
|
||||||
|
this.free_drink = null
|
||||||
},
|
},
|
||||||
generateMessage() {
|
generateMessage() {
|
||||||
this.messages.push({
|
this.messages.push({
|
||||||
|
@ -285,18 +313,22 @@ export default {
|
||||||
createMessage(message) {
|
createMessage(message) {
|
||||||
var text = ''
|
var text = ''
|
||||||
if (message.error) {
|
if (message.error) {
|
||||||
text = 'ERROR: Freigetränk konnt enicht genommen werden'
|
text =
|
||||||
|
'ERROR: ' +
|
||||||
|
message.free_drink_type.name +
|
||||||
|
': Konnte ' +
|
||||||
|
message.label +
|
||||||
|
' für ' +
|
||||||
|
(message.price / 100).toFixed(2) +
|
||||||
|
'€ nicht hinzufügen.'
|
||||||
} else {
|
} else {
|
||||||
text =
|
text =
|
||||||
this.user.firstname +
|
message.free_drink_type.name +
|
||||||
' hat sich ' +
|
': ' +
|
||||||
message.drinkCount +
|
message.label +
|
||||||
' ' +
|
' wurde für ' +
|
||||||
this.selectedDrink +
|
(message.price / 100).toFixed(2) +
|
||||||
' als Freigetränk im Wert von ' +
|
'€ hinzugefügt.'
|
||||||
(message.drinkCount * message.amount / 100).toFixed(2) +
|
|
||||||
'€ genommen weil ' +
|
|
||||||
message.selectedReason
|
|
||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
},
|
},
|
||||||
|
@ -311,12 +343,39 @@ export default {
|
||||||
this.amount -= this.stornoMessage.amount
|
this.amount -= this.stornoMessage.amount
|
||||||
console.log(this.amount, this.stornoMessage)
|
console.log(this.amount, this.stornoMessage)
|
||||||
this.cancelStorno()
|
this.cancelStorno()
|
||||||
}
|
},
|
||||||
|
acceptCanceled() {
|
||||||
|
this.canceledMessage.canceled = true
|
||||||
|
this.update_free_drink_list_history(this.canceledMessage)
|
||||||
|
this.cancelCanceled()
|
||||||
|
},
|
||||||
|
canceledAmount(historyElement) {
|
||||||
|
if (!this.isStronoEnabled(historyElement.timestamp)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.showConfirmCanceledDialog = true
|
||||||
|
this.canceledMessage = historyElement
|
||||||
|
},
|
||||||
|
|
||||||
|
cancelCanceled() {
|
||||||
|
this.showConfirmCanceledDialog = null
|
||||||
|
this.canceledMessage = null
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
user: 'user/user'
|
user: 'user/user'
|
||||||
}),
|
}),
|
||||||
|
...mapGetters('freeDrinkList', [
|
||||||
|
'free_drink_list_config_workgroup',
|
||||||
|
'free_drink_list_history',
|
||||||
|
'loading',
|
||||||
|
'free_drink_list_reasons',
|
||||||
|
'free_drink_list_reasons_loading',
|
||||||
|
'free_drink_list_history_workgroup_without_canceled',
|
||||||
|
'free_drink_list_history_workgroup',
|
||||||
|
'snackbar_messages'
|
||||||
|
]),
|
||||||
now() {
|
now() {
|
||||||
return now => {
|
return now => {
|
||||||
var actual = new Date()
|
var actual = new Date()
|
||||||
|
@ -371,6 +430,13 @@ export default {
|
||||||
var actual = new Date()
|
var actual = new Date()
|
||||||
return actual - now < 60000
|
return actual - now < 60000
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
first_loading() {
|
||||||
|
return (
|
||||||
|
this.loading &&
|
||||||
|
this.free_drink_list_history.length == 0 &&
|
||||||
|
this.free_drink_list_config_workgroup.length == 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -404,4 +470,3 @@ export default {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ const url = {
|
||||||
freeDrinkListConfig: main + 'freeDrinkListConfig',
|
freeDrinkListConfig: main + 'freeDrinkListConfig',
|
||||||
freeDrinkListHistory: main + 'freeDrinkListHistory',
|
freeDrinkListHistory: main + 'freeDrinkListHistory',
|
||||||
deleteDrinkListHistory: main + 'deleteDrinkListHistory',
|
deleteDrinkListHistory: main + 'deleteDrinkListHistory',
|
||||||
|
freeDrinkListReasons: main + 'freeDrinkListReasons',
|
||||||
vorstand: {
|
vorstand: {
|
||||||
sm: {
|
sm: {
|
||||||
addUser: main + 'sm/addUser',
|
addUser: main + 'sm/addUser',
|
||||||
|
|
|
@ -5,8 +5,10 @@ const timeout = 20000
|
||||||
const state = {
|
const state = {
|
||||||
free_drink_list_config: [],
|
free_drink_list_config: [],
|
||||||
free_drink_list_history: [],
|
free_drink_list_history: [],
|
||||||
|
free_drink_list_reasons: [],
|
||||||
free_drink_list_config_loading: false,
|
free_drink_list_config_loading: false,
|
||||||
free_drink_list_history_loading: false,
|
free_drink_list_history_loading: false,
|
||||||
|
free_drink_list_reasons_loading: false,
|
||||||
snackbar_messages: []
|
snackbar_messages: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +36,9 @@ const mutations = {
|
||||||
set_free_drink_list_history_loading(state, loading) {
|
set_free_drink_list_history_loading(state, loading) {
|
||||||
state.free_drink_list_history_loading = loading
|
state.free_drink_list_history_loading = loading
|
||||||
},
|
},
|
||||||
|
set_free_drink_list_reasons_loading(state, loading) {
|
||||||
|
state.free_drink_list_reasons_loading = loading
|
||||||
|
},
|
||||||
add_snackbar_message(state, { data, error }) {
|
add_snackbar_message(state, { data, error }) {
|
||||||
data.error = error
|
data.error = error
|
||||||
data.visible = true
|
data.visible = true
|
||||||
|
@ -47,6 +52,9 @@ const mutations = {
|
||||||
}, 5000)
|
}, 5000)
|
||||||
console.log(data)
|
console.log(data)
|
||||||
state.snackbar_messages.unshift(data)
|
state.snackbar_messages.unshift(data)
|
||||||
|
},
|
||||||
|
set_free_drink_list_reasons(state, data) {
|
||||||
|
state.free_drink_list_reasons = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,12 +122,12 @@ const actions = {
|
||||||
async update_free_drink_list_history({ commit, dispatch, rootState }, data) {
|
async update_free_drink_list_history({ commit, dispatch, rootState }, data) {
|
||||||
try {
|
try {
|
||||||
commit('set_free_drink_list_history_loading', true)
|
commit('set_free_drink_list_history_loading', true)
|
||||||
await axios.put(
|
const response = await axios.put(
|
||||||
url.freeDrinkListHistory,
|
url.freeDrinkListHistory,
|
||||||
{ ...data },
|
{ ...data },
|
||||||
{ headers: { Token: rootState.login.user.accessToken }, timeout }
|
{ headers: { Token: rootState.login.user.accessToken }, timeout }
|
||||||
)
|
)
|
||||||
commit('set_free_drink_list_history', data)
|
commit('set_free_drink_list_history', response.data)
|
||||||
commit('add_snackbar_message', { data, error: false })
|
commit('add_snackbar_message', { data, error: false })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dispatch('connectionError/addError', null, { root: true })
|
dispatch('connectionError/addError', null, { root: true })
|
||||||
|
@ -131,6 +139,25 @@ const actions = {
|
||||||
} finally {
|
} finally {
|
||||||
commit('set_free_drink_list_history_loading', false)
|
commit('set_free_drink_list_history_loading', false)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
async get_free_drink_list_reasons({ commit, dispatch, rootState }) {
|
||||||
|
try {
|
||||||
|
commit('set_free_drink_list_reasons_loading', true)
|
||||||
|
const response = await axios.get(url.freeDrinkListReasons, {
|
||||||
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +210,16 @@ const getters = {
|
||||||
})
|
})
|
||||||
return credit
|
return credit
|
||||||
},
|
},
|
||||||
|
free_drink_list_history_workgroup_without_canceled(state) {
|
||||||
|
return state.free_drink_list_history.filter(item => {
|
||||||
|
return item.free_drink_type.id == 2 && !item.canceled
|
||||||
|
})
|
||||||
|
},
|
||||||
|
free_drink_list_history_workgroup(state) {
|
||||||
|
return state.free_drink_list_history.filter(item => {
|
||||||
|
return item.free_drink_type.id == 2
|
||||||
|
})
|
||||||
|
},
|
||||||
loading(state) {
|
loading(state) {
|
||||||
return (
|
return (
|
||||||
state.free_drink_list_history_loading ||
|
state.free_drink_list_history_loading ||
|
||||||
|
@ -191,6 +228,12 @@ const getters = {
|
||||||
},
|
},
|
||||||
snackbar_messages(state) {
|
snackbar_messages(state) {
|
||||||
return state.snackbar_messages
|
return state.snackbar_messages
|
||||||
|
},
|
||||||
|
free_drink_list_reasons(state) {
|
||||||
|
return state.free_drink_list_reasons
|
||||||
|
},
|
||||||
|
free_drink_list_reasons_loading(state) {
|
||||||
|
return state.free_drink_list_reasons_loading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue