@@ -40,18 +48,26 @@
{{ transaction.name }}
+ >{{ transaction.name }}
{{ transaction.date | date }}
|
{{ transaction.payBy }} |
-
{{ transaction.amount | moneypad(transaction.mainCurrency) }} |
+
+ {{
+ transaction.amount
+ | moneypad(transaction.mainCurrency, hasMultipleCurrencies)
+ }}
+ |
| total |
- {{ total | moneypad(account.mainCurrency) }} |
+
+ {{ total | moneypad(account.mainCurrency) }}
+ |
@@ -104,6 +120,10 @@ export default class AccountTransactionList extends Vue {
public get showFilter(): boolean {
return this.filter && this.isMultiUser
}
+
+ public get hasMultipleCurrencies(): boolean {
+ return (this.account && this.account.currencies.length > 1) || false
+ }
}
diff --git a/src/utils/filters.ts b/src/utils/filters.ts
index edafe89..dcce30b 100644
--- a/src/utils/filters.ts
+++ b/src/utils/filters.ts
@@ -18,13 +18,18 @@ export const money = (
export const moneypad = (
value: number,
- currency: ICurrency | null | undefined
+ currency?: ICurrency | null,
+ withPadEnd: boolean = true
): string => {
const m = money(value, currency)
const s: string[] = m.split('\xa0')
const cur: string | undefined = s.pop()
- return `${s.join('\xa0')}\xa0${(cur || '').padEnd(3, '\xa0')}`
+ const result = `${s.join('\xa0')}\xa0${cur || ''}`
+ if (withPadEnd) {
+ return result.padEnd(3, '\xa0')
+ }
+ return result
}
export const date = (value: string, country: string = 'fr-FR') => {