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

105 lines
4.2 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>
<v-btn class="creditBtn" block @click="addAmount(user.username, 200)"
:color="color" :disabled="user.locked">2
</v-btn>
</v-col>
<v-col>
<v-btn class="creditBtn" block @click="addAmount(user.username, 100)"
:color="color" :disabled="user.locked">1
</v-btn>
</v-col>
<v-col>
<v-btn class="creditBtn" block @click="addAmount(user.username, 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(user.username, 40)"
:color="color" :disabled="user.locked">
0,40
</v-btn>
</v-col>
<v-col>
<v-btn class="creditBtn" block @click="addAmount(user.username, 20)"
:color="color" :disabled="user.locked">
0,20
</v-btn>
</v-col>
<v-col>
<v-btn class="creditBtn" block @click="addAmount(user.username, 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">Gesperrt</v-alert>
</v-card-text>
</v-card>
</v-container>
</div>
</div>
2019-12-21 07:20:25 +00:00
</template>
<script>
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: {
users: Array
},
data () {
return {
color: 'green accent-4'
}
},
created() {
// eslint-disable-next-line no-console
console.log(this.users)
},
2019-12-21 11:22:21 +00:00
methods: {
addAmount(username, amount) {
this.$emit("add:amount", username, amount)
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: {
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>