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

View File

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