2020-01-17 00:01:10 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<v-toolbar>
|
|
|
|
<v-toolbar-title>Gesamtübersicht</v-toolbar-title>
|
|
|
|
<v-spacer />
|
|
|
|
<v-toolbar-items>
|
|
|
|
<v-text-field
|
|
|
|
v-model="filter"
|
|
|
|
style="margin-top: 3px"
|
|
|
|
append-icon="search"
|
|
|
|
outlined
|
2020-01-23 22:25:21 +00:00
|
|
|
type="number"
|
2020-01-17 00:01:10 +00:00
|
|
|
:rules="[isNumber]"
|
|
|
|
></v-text-field>
|
|
|
|
</v-toolbar-items>
|
|
|
|
</v-toolbar>
|
2020-01-23 22:25:21 +00:00
|
|
|
<CreditOverviewSkeleton v-if="loading" />
|
2020-01-17 00:01:10 +00:00
|
|
|
<div v-for="year in years" :key="years.indexOf(year)">
|
|
|
|
<v-card style="margin-top: 3px" v-if="isFiltered(year)">
|
|
|
|
<v-card-title>{{ year }}</v-card-title>
|
|
|
|
<Table v-bind:user="user" v-bind:year="year" />
|
|
|
|
<v-container fluid>
|
|
|
|
<v-col>
|
|
|
|
<v-row>
|
|
|
|
<v-col>
|
|
|
|
<v-label>Vorjahr:</v-label>
|
|
|
|
</v-col>
|
|
|
|
<v-col>
|
|
|
|
<v-chip
|
|
|
|
outlined
|
|
|
|
:text-color="getLastColor(user.creditList[year][1].last)"
|
|
|
|
>{{ (user.creditList[year][1].last / 100).toFixed(2) }}
|
|
|
|
</v-chip>
|
|
|
|
</v-col>
|
|
|
|
<v-col>
|
|
|
|
<v-label>Gesamt:</v-label>
|
|
|
|
</v-col>
|
|
|
|
<v-col>
|
|
|
|
<v-chip
|
|
|
|
outlined
|
|
|
|
x-large
|
|
|
|
:text-color="
|
|
|
|
getLastColor(
|
|
|
|
getAllSum(
|
|
|
|
user.creditList[year][2].sum,
|
|
|
|
user.creditList[year][1].last
|
|
|
|
)
|
|
|
|
)
|
|
|
|
"
|
|
|
|
>
|
|
|
|
{{
|
|
|
|
(
|
|
|
|
getAllSum(
|
|
|
|
user.creditList[year][2].sum,
|
|
|
|
user.creditList[year][1].last
|
|
|
|
) / 100
|
|
|
|
).toFixed(2)
|
|
|
|
}}
|
|
|
|
</v-chip>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
</v-col>
|
|
|
|
</v-container>
|
|
|
|
</v-card>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
import Table from '../finanzer/Table'
|
2020-01-23 22:25:21 +00:00
|
|
|
import CreditOverviewSkeleton from './Skeleton/CreditOverviewSkeleton'
|
2020-01-17 00:01:10 +00:00
|
|
|
export default {
|
|
|
|
name: 'CreditOverview',
|
2020-01-23 22:25:21 +00:00
|
|
|
components: { CreditOverviewSkeleton, Table },
|
2020-01-17 00:01:10 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isNumber: value => Number.isInteger(parseInt(value === '' ? 0 : value)) || "Muss eine Zahl sein.",
|
|
|
|
filter: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getLastColor(value) {
|
|
|
|
return value < 0 ? 'red' : 'green'
|
|
|
|
},
|
|
|
|
getAllSum(sum, lastYear) {
|
|
|
|
return lastYear + sum
|
|
|
|
},
|
|
|
|
isFiltered(value) {
|
|
|
|
return value.toString().includes(this.filter)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
2020-01-23 22:25:21 +00:00
|
|
|
user: 'user/user',
|
|
|
|
loading: 'user/loading'
|
2020-01-17 00:01:10 +00:00
|
|
|
}),
|
|
|
|
years() {
|
|
|
|
let years = []
|
|
|
|
if (this.user) {
|
|
|
|
for (let year in this.user.creditList) {
|
|
|
|
years.unshift(parseInt(year))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return years
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|