+
-
-
- {{ now(message.date) }}
- {{ message.message }}
- Klicken um zurückzusetzen
-
-
+
+
+
+
+ {{ now(message.date) }}
+ {{ message.message }}
+ Klicken um zu Stornieren
+
+
+
+
@@ -181,16 +201,20 @@ export default {
props: {},
data() {
return {
- color: 'green accent-4'
+ color: 'green accent-4',
+ menu: true,
+ dialog: false
}
},
created() {
+ this.menu = this.menu_from_store
this.getUsers()
},
methods: {
...mapActions({
addAmount: 'barUsers/addAmount',
- getUsers: 'barUsers/getUsers'
+ getUsers: 'barUsers/getUsers',
+ deactivate: 'barUsers/deactivateMenu'
}),
getColor(type) {
return type === 'credit' ? 'title green--text' : 'title red--text'
@@ -204,6 +228,13 @@ export default {
} catch (e) {
return true
}
+ },
+ storno(message) {
+ if (!message.error) {
+ console.log(message)
+ message.storno = true
+ if (!this.under5minutes(message.date)) this.dialog = true
+ }
}
},
computed: {
@@ -212,7 +243,7 @@ export default {
filter: 'barUsers/filter',
loading: 'barUsers/usersLoading',
messages: 'barUsers/messages',
- menu: 'barUsers/menu'
+ menu_from_store: 'barUsers/menu'
}),
under5minutes() {
return now => {
@@ -267,6 +298,17 @@ export default {
)
}
}
+ },
+ watch: {
+ menu(newValue) {
+ console.log('menu', newValue)
+ if (!newValue) this.deactivate()
+ },
+ menu_from_store(newValue) {
+ console.log('for menu_from_store', newValue, this.menu)
+ if (newValue) this.menu = this.menu_from_store
+ console.log('after menu_from_store', newValue, this.menu)
+ }
}
}
diff --git a/src/store/modules/barUsers.js b/src/store/modules/barUsers.js
index 7539831..0744c48 100644
--- a/src/store/modules/barUsers.js
+++ b/src/store/modules/barUsers.js
@@ -97,7 +97,9 @@ const mutations = {
state.message.unshift({
message: message,
error: data.error,
+ storno: false,
visible: true,
+ amount: data.amount,
date: new Date()
})
console.log(state.message)