From 08c8475ac13c4ccedff69576f0f3160c521d209e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sun, 16 Feb 2020 20:35:13 +0100 Subject: [PATCH] add history --- src/components/baruser/CreditLists.vue | 123 +++++++++++++++++++++++-- src/components/baruser/SearchBar.vue | 21 ++++- src/main.js | 2 +- src/plugins/routes.js | 4 +- src/router/index.js | 4 +- src/store/modules/barUsers.js | 57 +++++++++++- 6 files changed, 192 insertions(+), 19 deletions(-) diff --git a/src/components/baruser/CreditLists.vue b/src/components/baruser/CreditLists.vue index 099cd79..0de77bc 100644 --- a/src/components/baruser/CreditLists.vue +++ b/src/components/baruser/CreditLists.vue @@ -4,6 +4,23 @@ + + + + + {{ now(message.date) }} + {{ message.message }} + Klicken um zurückzusetzen + + + +
@@ -22,7 +39,11 @@ class="creditBtn" block @click=" - addAmount({ username: user.username, amount: 200 }) + addAmount({ + username: user.username, + amount: 200, + user: user + }) " :color="color" :disabled="user.locked" @@ -34,7 +55,11 @@ class="creditBtn" block @click=" - addAmount({ username: user.username, amount: 100 }) + addAmount({ + username: user.username, + amount: 100, + user: user + }) " :color="color" :disabled="user.locked" @@ -46,7 +71,11 @@ class="creditBtn" block @click=" - addAmount({ username: user.username, amount: 50 }) + addAmount({ + username: user.username, + amount: 50, + user: user + }) " :color="color" :disabled="user.locked" @@ -60,7 +89,11 @@ class="creditBtn" block @click=" - addAmount({ username: user.username, amount: 40 }) + addAmount({ + username: user.username, + amount: 40, + user: user + }) " :color="color" :disabled="user.locked" @@ -72,7 +105,11 @@ class="creditBtn" block @click=" - addAmount({ username: user.username, amount: 20 }) + addAmount({ + username: user.username, + amount: 20, + user: user + }) " :color="color" :disabled="user.locked" @@ -84,7 +121,11 @@ class="creditBtn" block @click=" - addAmount({ username: user.username, amount: 10 }) + addAmount({ + username: user.username, + amount: 10, + user: user + }) " :color="color" :disabled="user.locked" @@ -113,6 +154,17 @@ > + + {{ message.message }} +
@@ -158,8 +210,63 @@ export default { ...mapGetters({ users: 'barUsers/users', filter: 'barUsers/filter', - loading: 'barUsers/usersLoading' - }) + loading: 'barUsers/usersLoading', + messages: 'barUsers/messages', + menu: 'barUsers/menu' + }), + under5minutes() { + return now => { + var actual = new Date() + var zero = new Date(0) + var date = new Date(actual - now) + if ( + date.getFullYear() === zero.getFullYear() && + date.getMonth() === zero.getMonth() && + date.getDate() === zero.getDate() + ) { + if (date.getMinutes() < 6) { + return true + } + } + return false + } + }, + now() { + return now => { + var actual = new Date() + var zero = new Date(0) + var date = new Date(actual - now) + console.log(date) + if (date.getFullYear() === zero.getFullYear()) { + if (date.getMonth() === zero.getMonth()) { + if (date.getDate() === zero.getDate()) { + if (date.getHours() === zero.getDate()) { + if (date.getMinutes() < 1) { + return 'vor ' + date.getSeconds() + ' Sekunden' + } else if (date.getMinutes() < 10) { + return 'vor ' + date.getMinutes() + ' Minuten' + } else { + return now.getHours() + ':' + now.getMinutes() + } + } else { + return now.getHours() + ':' + now.getMinutes() + } + } + } + } + return ( + now.getDate() + + '.' + + now.getMonth() + + '.' + + now.getFullYear() + + ' ' + + now.getHours() + + ':' + + now.getMinutes() + ) + } + } } } diff --git a/src/components/baruser/SearchBar.vue b/src/components/baruser/SearchBar.vue index 20bacee..b37ece2 100644 --- a/src/components/baruser/SearchBar.vue +++ b/src/components/baruser/SearchBar.vue @@ -16,10 +16,13 @@ :search-input.sync="filter" > Hinzufügen + + {{ menuIcon }} + @@ -27,7 +30,7 @@