update: upgrade pouchdb

remove total tab and merge with balance
This commit is contained in:
Julien Calixte
2019-08-25 12:27:01 +02:00
parent a41f199eb9
commit 4ae0e97679
4 changed files with 298 additions and 388 deletions

View File

@@ -1,5 +1,6 @@
<template>
<div class="chart-balance">
<p>{{ $tc('account.total', statOrdered.length, { count: statOrdered.length }) }}</p>
<table class="table is-hoverable is-striped" v-if="stats.length">
<tbody>
<tr v-for="(stat, k) in statOrdered" :key="k">
@@ -13,6 +14,12 @@
<td v-else class="conclude" :class="getColor(stat.balance.amount)"></td>
</tr>
</tbody>
<tfoot>
<tr class="is-selected">
<th scope="row" class="total">total</th>
<th class="numeric" colspan="2">{{ totalCost | money(currency) }}</th>
</tr>
</tfoot>
</table>
<div v-else>Aucune dépense faite</div>
</div>
@@ -43,6 +50,10 @@ export default class ChartBalance extends Vue {
a.balance.amount < b.balance.amount ? 1 : -1
)
}
public get totalCost(): number {
return this.stats.reduce((a: number, b: IStat) => a + b.value, 0)
}
}
</script>

View File

@@ -59,11 +59,6 @@
<awe-icon icon="exchange-alt" />
</a>
</li>
<li :class="{ 'is-active': activeTab === 'total' }">
<a href="#" @click.prevent="toggleTab('total')">
<awe-icon icon="equals" />
</a>
</li>
</ul>
</div>
<transition-group :name="transitionName" tag="div" mode="out-in" v-if="transactions.length">
@@ -108,32 +103,6 @@
<div v-else class="equilibrium">Le compte est à l'équilibre !</div>
</div>
</div>
<div
key="total"
class="total-panel tab-content columns is-center"
v-if="activeTab === 'total'"
>
<div class="column table-container">
<p>{{ $tc('account.total', transactions.length, { count: transactions.length }) }}</p>
<table class="table is-striped is-bordered">
<tbody v-if="isMultiUser">
<tr v-for="(user, k) in totalUserCost" :key="k">
<th scope="row" v-if="user.alias === userAlias">
<em>mes dépenses</em>
</th>
<th scope="row" v-else>{{ user.alias }}</th>
<td class="numeric">{{ user.total | money(account.mainCurrency) }}</td>
</tr>
</tbody>
<tfoot>
<tr class="is-selected">
<th scope="row" class="total">total</th>
<th class="numeric">{{ totalCost | money(account.mainCurrency) }}</th>
</tr>
</tfoot>
</table>
</div>
</div>
</transition-group>
</div>
<fab-button
@@ -439,7 +408,7 @@ export default class AccountItem extends BaseAccount {
@Watch('activeTab')
public onActiveTabChange(newTab: string, oldTab: string): void {
const tabs: string[] = ['transaction', 'tag', 'balance', 'refund', 'total']
const tabs: string[] = ['transaction', 'tag', 'balance', 'refund']
this.transitionName =
tabs.indexOf(newTab) > tabs.indexOf(oldTab) ? 'slide-left' : 'slide-right'
}