flaschengeist-frontend/src/components/baruser/CreditLists.vue

108 lines
4.6 KiB
Vue
Raw Normal View History

2019-12-21 07:20:25 +00:00
<template>
<div>
<div v-for="user in users" :key="users.indexOf(user)">
<v-container>
<v-card>
<v-list-item>
2019-12-21 11:22:21 +00:00
<v-list-item-title class="title">{{user.firstname}} {{user.lastname}}</v-list-item-title>
</v-list-item>
<v-card-text>
2019-12-21 11:22:21 +00:00
<v-row>
<v-col cols="10">
<v-row>
<v-col>
2020-01-14 18:57:45 +00:00
<v-btn class="creditBtn" block @click="addAmount({username: user.username, amount: 200})"
:color="color" :disabled="user.locked">2
</v-btn>
</v-col>
<v-col>
2020-01-14 18:57:45 +00:00
<v-btn class="creditBtn" block @click="addAmount({username: user.username, amount: 100})"
:color="color" :disabled="user.locked">1
</v-btn>
</v-col>
<v-col>
2020-01-14 18:57:45 +00:00
<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>
2020-01-14 18:57:45 +00:00
<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>
2020-01-14 18:57:45 +00:00
<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>
2020-01-14 18:57:45 +00:00
<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>
2019-12-21 11:22:21 +00:00
<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>
2019-12-21 11:22:21 +00:00
</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>
</div>
2019-12-21 07:20:25 +00:00
</template>
<script>
2020-01-14 18:57:45 +00:00
import { mapGetters, mapActions } from 'vuex';
2019-12-21 12:16:37 +00:00
2019-12-21 07:20:25 +00:00
export default {
2019-12-21 11:22:21 +00:00
name: "CreditLists",
props: {
},
data () {
return {
2020-01-14 18:57:45 +00:00
color: 'green accent-4',
2019-12-21 11:22:21 +00:00
}
},
created() {
2020-01-14 18:57:45 +00:00
this.getUsers()
// eslint-disable-next-line no-console
console.log(this.users)
},
2019-12-21 11:22:21 +00:00
methods: {
2020-01-14 18:57:45 +00:00
...mapActions({
addAmount: 'barUsers/addAmount',
getUsers: 'barUsers/getUsers'
}),
2019-12-21 12:16:37 +00:00
getColor(type) {
return type === 'credit' ? 'title green--text' : 'title red--text'
2019-12-21 11:22:21 +00:00
}
2019-12-21 12:16:37 +00:00
},
computed: {
2020-01-14 18:57:45 +00:00
...mapGetters({users: 'barUsers/users'})
2019-12-21 11:22:21 +00:00
}
2019-12-21 07:20:25 +00:00
}
</script>
<style scoped>
.creditBtn {
margin: 2px;
}
2019-12-21 07:20:25 +00:00
</style>