fixed bug ##291

es werden erst das anzuschreibende gesammelt. wenn es 5 Sekunden keine neue eingabe zu dem user gab, wird der befehl zum anschreiben durchgeführt.
This commit is contained in:
Tim Gröger 2020-06-10 13:49:48 +02:00
parent 1ca0abd36d
commit fd9784cfe3
2 changed files with 50 additions and 54 deletions

View File

@ -91,13 +91,7 @@
<v-btn
class="creditBtn"
block
@click="
addAmount({
username: user.username,
amount: 200,
user: user
})
"
@click="addingAmount(user, 200)"
:color="color"
:disabled="user.locked"
>2
@ -107,13 +101,7 @@
<v-btn
class="creditBtn"
block
@click="
addAmount({
username: user.username,
amount: 100,
user: user
})
"
@click="addingAmount(user, 100)"
:color="color"
:disabled="user.locked"
>1
@ -123,13 +111,7 @@
<v-btn
class="creditBtn"
block
@click="
addAmount({
username: user.username,
amount: 50,
user: user
})
"
@click="addingAmount(user, 50)"
:color="color"
:disabled="user.locked"
>0,50
@ -139,13 +121,7 @@
<v-btn
class="creditBtn"
block
@click="
addAmount({
username: user.username,
amount: 40,
user: user
})
"
@click="addingAmount(user, 40)"
:color="color"
:disabled="user.locked"
>0,40
@ -155,13 +131,7 @@
<v-btn
class="creditBtn"
block
@click="
addAmount({
username: user.username,
amount: 20,
user: user
})
"
@click="addingAmount(user, 20)"
:color="color"
:disabled="user.locked"
>0,20
@ -171,13 +141,7 @@
<v-btn
class="creditBtn"
block
@click="
addAmount({
username: user.username,
amount: 10,
user: user
})
"
@click="addingAmount(user, 10)"
:color="color"
:disabled="user.locked"
>0,10
@ -213,8 +177,10 @@
(user.amount / 100).toFixed(2)
}}
</v-list-item-action-text
>
</v-list-item-action-text>
<v-list-item-action-text v-if="user.toSetAmount">
- {{(user.toSetAmount / 100).toFixed(2)}}
</v-list-item-action-text>
</v-list-item-content>
</v-list-item>
</v-row>
@ -298,6 +264,18 @@ export default {
deactivate: 'barUsers/deactivateMenu',
commitStorno: 'barUsers/storno'
}),
addingAmount(user, amount) {
clearTimeout(user.timeout)
user.toSetAmount = user.toSetAmount ? user.toSetAmount + amount : amount
user.timeout = setTimeout(() => {
this.addAmount({username: user.username,
amount: user.toSetAmount,
user})
setTimeout(() => {
user.toSetAmount = null
}, 300)
}, 5000)
},
forceRender() {
this.componentRenderer += 1
},

View File

@ -84,7 +84,7 @@
<v-btn
class="creditBtn"
block
@click="addAmount(200)"
@click="addingAmount(200)"
:color="color"
:disabled="user.locked"
>2 </v-btn
@ -94,7 +94,7 @@
<v-btn
class="creditBtn"
block
@click="addAmount(100)"
@click="addingAmount(100)"
:color="color"
:disabled="user.locked"
>1 </v-btn
@ -104,7 +104,7 @@
<v-btn
class="creditBtn"
block
@click="addAmount(50)"
@click="addingAmount(50)"
:color="color"
:disabled="user.locked"
>0,50 </v-btn
@ -114,7 +114,7 @@
<v-btn
class="creditBtn"
block
@click="addAmount(40)"
@click="addingAmount(40)"
:color="color"
:disabled="user.locked"
>0,40 </v-btn
@ -124,7 +124,7 @@
<v-btn
class="creditBtn"
block
@click="addAmount(20)"
@click="addingAmount(20)"
:color="color"
:disabled="user.locked"
>0,20 </v-btn
@ -134,7 +134,7 @@
<v-btn
class="creditBtn"
block
@click="addAmount(10)"
@click="addingAmount(10)"
:color="color"
:disabled="user.locked"
>0,10 </v-btn
@ -164,12 +164,18 @@
<v-col align-self="center">
<v-row>
<v-list-item>
<v-list-item-content class="text-center">
<v-list-item-action-text :class="getColor(getAllSum())"
>{{
(getAllSum() / 100).toFixed(2)
}}
</v-list-item-action-text
</v-list-item-action-text
>
<v-list-item-action-text v-if="toSetAmount">
- {{(toSetAmount / 100).toFixed(2)}}
</v-list-item-action-text>
</v-list-item-content>
</v-list-item>
</v-row>
</v-col>
@ -228,6 +234,8 @@ export default {
close: mdiClose,
checkValidate: false,
stornoMessage: null,
timeout: null,
toSetAmount: null
}
},
created() {
@ -238,6 +246,16 @@ export default {
addAmount: 'user/addAmount',
commitStorno: 'user/storno'
}),
addingAmount(amount) {
clearTimeout(this.timeout)
this.toSetAmount = this.toSetAmount ? this.toSetAmount + amount : amount
this.timeout = setTimeout(() => {
this.addAmount(this.toSetAmount)
setTimeout(() => {
this.toSetAmount = null
}, 300)
}, 5000)
},
forceRender() {
this.componentRenderer += 1
},