fixed bug ##290

in der SearchBar.vue werden nun auch die schulden der user angezeigt.
Sollte ein User gelocked sein, wird ein Hinweiszeichen gegeben.
This commit is contained in:
Tim Gröger 2020-06-19 20:58:27 +02:00
parent 22b4e83c8d
commit c86f1afd4c
2 changed files with 26 additions and 2 deletions

View File

@ -187,7 +187,7 @@
</v-col>
</v-row>
<v-row>
<v-col class="hidden-sm-and-down" cols="8">
<v-col class="hidden-sm-and-down" cols="80">
<v-alert v-if="user.locked" type="error"
>{{ user.firstname }} darf nicht mehr anschreiben.
{{ user.firstname }} sollte sich lieber mal beim Finanzer

View File

@ -19,6 +19,16 @@
<template v-slot:prepend-inner>
<v-icon>{{ search_person }}</v-icon>
</template>
<template v-slot:item="data">
<v-list-item-icon v-if="getLocked(data.item)">
<v-icon>mdi-alert</v-icon>
</v-list-item-icon>
<v-list-item-content>
{{data.item.fullName}}
<v-spacer/>
{{(getCredit(data.item)/100).toFixed(2)}}
</v-list-item-content>
</template>
</v-autocomplete>
<v-btn text @click="addUser">Hinzufügen</v-btn>
<v-btn v-if="!locked" text @click="lock">Sperren</v-btn>
@ -46,7 +56,7 @@
<script>
import { mapGetters, mapActions } from 'vuex'
import { mdiAccountSearch, mdiMenu } from '@mdi/js'
import { mdiAccountSearch, mdiMenu, mdiAlert } from '@mdi/js'
export default {
name: 'SearchBar',
@ -57,6 +67,7 @@ export default {
filter: '',
search_person: mdiAccountSearch,
menuIcon: mdiMenu,
alert: mdiAlert,
overlay: false,
password: ''
}
@ -87,11 +98,24 @@ export default {
this.unlock(this.password)
this.password = ''
this.overlay = false
},
getCredit(user) {
let retUser = this.users.find(item => {
return item.username === user.username
})
return retUser ? retUser.amount : 0
},
getLocked(user) {
let retUser = this.users.find(item => {
return item.username === user.username
})
return retUser ? retUser.locked : false
}
},
computed: {
...mapGetters({
allUsers: 'barUsers/allUsers',
users: 'barUsers/users',
loading: 'barUsers/allUsersLoading',
menu: 'barUsers/menu',
locked: 'barUsers/locked'