2019-12-21 07:20:25 +00:00
|
|
|
<template>
|
2020-01-14 21:01:24 +00:00
|
|
|
<div>
|
2020-01-27 18:56:56 +00:00
|
|
|
<v-progress-linear v-if="loading && users.length !== 0" indeterminate />
|
2020-01-23 22:25:21 +00:00
|
|
|
<v-container>
|
2020-01-27 18:56:56 +00:00
|
|
|
<AddAmountSkeleton v-if="loading && users.length === 0" />
|
2020-01-23 22:25:21 +00:00
|
|
|
</v-container>
|
2020-01-14 21:01:24 +00:00
|
|
|
<div v-for="user in users" :key="users.indexOf(user)">
|
2020-01-14 22:10:09 +00:00
|
|
|
<div v-if="isFiltered(user)">
|
|
|
|
<v-container>
|
2020-01-23 22:25:21 +00:00
|
|
|
<v-card :loading="user.loading">
|
2020-01-14 22:10:09 +00:00
|
|
|
<v-list-item>
|
|
|
|
<v-list-item-title class="title"
|
|
|
|
>{{ user.firstname }} {{ user.lastname }}</v-list-item-title
|
|
|
|
>
|
|
|
|
</v-list-item>
|
|
|
|
<v-card-text>
|
|
|
|
<v-row>
|
|
|
|
<v-col cols="10">
|
|
|
|
<v-row>
|
|
|
|
<v-col>
|
|
|
|
<v-btn
|
|
|
|
class="creditBtn"
|
|
|
|
block
|
|
|
|
@click="
|
|
|
|
addAmount({ username: user.username, amount: 200 })
|
|
|
|
"
|
|
|
|
:color="color"
|
|
|
|
:disabled="user.locked"
|
|
|
|
>2 €</v-btn
|
|
|
|
>
|
|
|
|
</v-col>
|
|
|
|
<v-col>
|
|
|
|
<v-btn
|
|
|
|
class="creditBtn"
|
|
|
|
block
|
|
|
|
@click="
|
|
|
|
addAmount({ username: user.username, amount: 100 })
|
|
|
|
"
|
|
|
|
:color="color"
|
|
|
|
:disabled="user.locked"
|
|
|
|
>1 €</v-btn
|
|
|
|
>
|
|
|
|
</v-col>
|
|
|
|
<v-col>
|
|
|
|
<v-btn
|
|
|
|
class="creditBtn"
|
|
|
|
block
|
|
|
|
@click="
|
|
|
|
addAmount({ username: user.username, amount: 50 })
|
|
|
|
"
|
|
|
|
:color="color"
|
|
|
|
:disabled="user.locked"
|
|
|
|
>0,50 €</v-btn
|
|
|
|
>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
<v-row>
|
|
|
|
<v-col>
|
|
|
|
<v-btn
|
|
|
|
class="creditBtn"
|
|
|
|
block
|
|
|
|
@click="
|
|
|
|
addAmount({ username: user.username, amount: 40 })
|
|
|
|
"
|
|
|
|
:color="color"
|
|
|
|
:disabled="user.locked"
|
|
|
|
>0,40 €</v-btn
|
|
|
|
>
|
|
|
|
</v-col>
|
|
|
|
<v-col>
|
|
|
|
<v-btn
|
|
|
|
class="creditBtn"
|
|
|
|
block
|
|
|
|
@click="
|
|
|
|
addAmount({ username: user.username, amount: 20 })
|
|
|
|
"
|
|
|
|
:color="color"
|
|
|
|
:disabled="user.locked"
|
|
|
|
>0,20 €</v-btn
|
|
|
|
>
|
|
|
|
</v-col>
|
|
|
|
<v-col>
|
|
|
|
<v-btn
|
|
|
|
class="creditBtn"
|
|
|
|
block
|
|
|
|
@click="
|
|
|
|
addAmount({ username: user.username, amount: 10 })
|
|
|
|
"
|
|
|
|
:color="color"
|
|
|
|
:disabled="user.locked"
|
|
|
|
>0,10 €</v-btn
|
|
|
|
>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
</v-col>
|
|
|
|
<v-col align-self="center">
|
|
|
|
<v-row>
|
|
|
|
<v-list-item>
|
|
|
|
<v-list-item-action-text :class="getColor(user.type)"
|
|
|
|
>{{
|
|
|
|
(user.amount / 100).toFixed(2)
|
|
|
|
}}
|
|
|
|
€</v-list-item-action-text
|
|
|
|
>
|
|
|
|
</v-list-item>
|
|
|
|
</v-row>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
<v-alert v-if="user.locked" type="error"
|
|
|
|
>{{ user.firstname }} darf nicht mehr anschreiben.
|
|
|
|
{{ user.firstname }} sollte sich lieber mal beim Finanzer
|
|
|
|
melden.</v-alert
|
|
|
|
>
|
|
|
|
</v-card-text>
|
|
|
|
</v-card>
|
|
|
|
</v-container>
|
|
|
|
</div>
|
2019-12-26 09:31:36 +00:00
|
|
|
</div>
|
2020-01-14 21:01:24 +00:00
|
|
|
</div>
|
2019-12-21 07:20:25 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-01-14 21:01:24 +00:00
|
|
|
import { mapGetters, mapActions } from 'vuex'
|
2020-01-23 22:25:21 +00:00
|
|
|
import AddAmountSkeleton from '../user/Skeleton/AddAmountSkeleton'
|
2019-12-21 12:16:37 +00:00
|
|
|
|
2020-01-14 21:01:24 +00:00
|
|
|
export default {
|
|
|
|
name: 'CreditLists',
|
2020-01-23 22:25:21 +00:00
|
|
|
components: { AddAmountSkeleton },
|
2020-01-14 21:01:24 +00:00
|
|
|
props: {},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
color: 'green accent-4'
|
2019-12-21 07:20:25 +00:00
|
|
|
}
|
2020-01-14 21:01:24 +00:00
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.getUsers()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions({
|
|
|
|
addAmount: 'barUsers/addAmount',
|
|
|
|
getUsers: 'barUsers/getUsers'
|
|
|
|
}),
|
|
|
|
getColor(type) {
|
|
|
|
return type === 'credit' ? 'title green--text' : 'title red--text'
|
2020-01-14 22:10:09 +00:00
|
|
|
},
|
|
|
|
isFiltered(user) {
|
|
|
|
try {
|
|
|
|
return (
|
|
|
|
user.firstname.toLowerCase().includes(this.filter.toLowerCase()) ||
|
|
|
|
user.lastname.toLowerCase().includes(this.filter.toLowerCase())
|
|
|
|
)
|
|
|
|
} catch (e) {
|
|
|
|
return true
|
|
|
|
}
|
2020-01-14 21:01:24 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2020-01-14 22:10:09 +00:00
|
|
|
...mapGetters({
|
|
|
|
users: 'barUsers/users',
|
2020-01-23 22:25:21 +00:00
|
|
|
filter: 'barUsers/filter',
|
|
|
|
loading: 'barUsers/usersLoading'
|
2020-01-14 22:10:09 +00:00
|
|
|
})
|
2020-01-14 21:01:24 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-21 07:20:25 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2020-01-14 21:01:24 +00:00
|
|
|
.creditBtn {
|
|
|
|
margin: 2px;
|
|
|
|
}
|
2019-12-21 07:20:25 +00:00
|
|
|
</style>
|