2024-01-20 23:51:47 +00:00
|
|
|
<template>
|
|
|
|
<li class="mb-1 fw-semibold">
|
|
|
|
<div class="d-flex align-items-center">
|
|
|
|
<i class="fas fa-fw fa-credit-card me-1" /> {{ header }}
|
2024-01-27 12:43:40 +00:00
|
|
|
<span :class="classFromNumber(sum, ['ms-auto'])">
|
2024-01-20 23:51:47 +00:00
|
|
|
{{ formatNumber(sum) }} €
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 ps-3 small">
|
|
|
|
<li>
|
|
|
|
<router-link
|
|
|
|
v-for="acc in accounts"
|
|
|
|
:key="acc.id"
|
|
|
|
class="d-flex align-items-center text-white text-decoration-none"
|
|
|
|
:to="{ name: 'account-transactions', params: { accountId: acc.id }}"
|
|
|
|
>
|
|
|
|
{{ acc.name }}
|
2024-01-27 12:43:40 +00:00
|
|
|
<span :class="classFromNumber(acc.balance, ['ms-auto'])">
|
2024-01-20 23:51:47 +00:00
|
|
|
{{ formatNumber(acc.balance) }} €
|
|
|
|
</span>
|
|
|
|
</router-link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-01-27 12:43:40 +00:00
|
|
|
import { classFromNumber, formatNumber } from '../helpers'
|
2024-01-20 23:51:47 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
sum() {
|
|
|
|
return this.accounts.reduce((sum, acc) => sum + acc.balance, 0)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2024-01-27 12:43:40 +00:00
|
|
|
classFromNumber,
|
2024-01-20 23:51:47 +00:00
|
|
|
formatNumber,
|
|
|
|
},
|
|
|
|
|
|
|
|
name: 'AccountingAppAccountSidebarAccountList',
|
|
|
|
|
|
|
|
props: {
|
|
|
|
accounts: {
|
|
|
|
required: true,
|
|
|
|
type: Array,
|
|
|
|
},
|
|
|
|
|
|
|
|
header: {
|
|
|
|
required: true,
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|