flaschengeist-frontend/src/components/user/AddAmount.vue

137 lines
3.6 KiB
Vue
Raw Normal View History

2020-01-17 00:01:10 +00:00
<template>
2020-01-23 22:25:21 +00:00
<v-container >
<AddAmountSkeleton v-if="loading" />
<v-card v-if="!loading">
2020-01-17 00:01:10 +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(200)"
:color="color"
:disabled="user.locked"
>2 </v-btn
>
</v-col>
<v-col>
<v-btn
class="creditBtn"
block
@click="addAmount(100)"
:color="color"
:disabled="user.locked"
>1 </v-btn
>
</v-col>
<v-col>
<v-btn
class="creditBtn"
block
@click="addAmount(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(40)"
:color="color"
:disabled="user.locked"
>0,40 </v-btn
>
</v-col>
<v-col>
<v-btn
class="creditBtn"
block
@click="addAmount(20)"
:color="color"
:disabled="user.locked"
>0,20 </v-btn
>
</v-col>
<v-col>
<v-btn
class="creditBtn"
block
@click="addAmount(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(getAllSum())"
>{{
(getAllSum() / 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>
</template>
<script>
import {mapGetters, mapActions} from 'vuex'
2020-01-23 22:25:21 +00:00
import AddAmountSkeleton from './Skeleton/AddAmountSkeleton'
2020-01-17 00:01:10 +00:00
export default {
name: 'AddAmount',
2020-01-23 22:25:21 +00:00
components: { AddAmountSkeleton },
2020-01-17 00:01:10 +00:00
data() {
return {
color: 'green accent-4'
}
},
methods: {
...mapActions({
addAmount: 'user/addAmount'
}),
getColor(value) {
return value >= 0 ? 'title green--text' : 'title red--text'
},
getAllSum() {
console.log("getAllSum", this.user)
if (this.user)
return this.user.creditList[this.year][2].sum + this.user.creditList[this.year][1].last
return 0
}
},
computed: {
...mapGetters({
user: 'user/user',
2020-01-23 22:25:21 +00:00
year: 'user/year',
loading: 'user/loading'
2020-01-17 00:01:10 +00:00
}),
}
}
</script>
<style scoped></style>