💬 (Money) Add withPadEnd parameter
This commit is contained in:
@@ -13,7 +13,9 @@
|
|||||||
<div v-if="account.isPublic">
|
<div v-if="account.isPublic">
|
||||||
<awe-icon icon="users" />
|
<awe-icon icon="users" />
|
||||||
</div>
|
</div>
|
||||||
<div class="numeric">{{ totalCost | moneypad(account.mainCurrency) }}</div>
|
<div class="numeric">
|
||||||
|
{{ totalCost | moneypad(account.mainCurrency, false) }}
|
||||||
|
</div>
|
||||||
{{ account.users && account.users.map((u) => u.alias).join(', ') }}
|
{{ account.users && account.users.map((u) => u.alias).join(', ') }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="account-transaction-list" v-if="account">
|
<div class="account-transaction-list" v-if="account">
|
||||||
<div class="field has-addons has-addons-centered is-narrow" v-if="showFilter">
|
<div
|
||||||
|
class="field has-addons has-addons-centered is-narrow"
|
||||||
|
v-if="showFilter"
|
||||||
|
>
|
||||||
<div class="control" v-show="filteredBy">
|
<div class="control" v-show="filteredBy">
|
||||||
<button type="submit" class="button" @click="filteredBy = ''">
|
<button type="submit" class="button" @click="filteredBy = ''">
|
||||||
<awe-icon icon="times" />
|
<awe-icon icon="times" />
|
||||||
@@ -10,7 +13,12 @@
|
|||||||
<div class="select is-fullwidth">
|
<div class="select is-fullwidth">
|
||||||
<select v-model="filteredBy">
|
<select v-model="filteredBy">
|
||||||
<option value>Tout le monde</option>
|
<option value>Tout le monde</option>
|
||||||
<option v-for="(user, k) in account.users" :key="k" :value="user.alias">{{ user.alias }}</option>
|
<option
|
||||||
|
v-for="(user, k) in account.users"
|
||||||
|
:key="k"
|
||||||
|
:value="user.alias"
|
||||||
|
>{{ user.alias }}</option
|
||||||
|
>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,18 +48,26 @@
|
|||||||
<td class="multiline">
|
<td class="multiline">
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name: 'transaction', params: { id: transaction._id } }"
|
:to="{ name: 'transaction', params: { id: transaction._id } }"
|
||||||
>{{ transaction.name }}</router-link>
|
>{{ transaction.name }}</router-link
|
||||||
|
>
|
||||||
<br />
|
<br />
|
||||||
<span class="date">{{ transaction.date | date }}</span>
|
<span class="date">{{ transaction.date | date }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="pay-by">{{ transaction.payBy }}</td>
|
<td class="pay-by">{{ transaction.payBy }}</td>
|
||||||
<td class="numeric">{{ transaction.amount | moneypad(transaction.mainCurrency) }}</td>
|
<td class="numeric">
|
||||||
|
{{
|
||||||
|
transaction.amount
|
||||||
|
| moneypad(transaction.mainCurrency, hasMultipleCurrencies)
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot v-if="foot">
|
<tfoot v-if="foot">
|
||||||
<tr class="is-selected">
|
<tr class="is-selected">
|
||||||
<td colspan="2" class="total">total</td>
|
<td colspan="2" class="total">total</td>
|
||||||
<td class="numeric">{{ total | moneypad(account.mainCurrency) }}</td>
|
<td class="numeric">
|
||||||
|
{{ total | moneypad(account.mainCurrency) }}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -104,6 +120,10 @@ export default class AccountTransactionList extends Vue {
|
|||||||
public get showFilter(): boolean {
|
public get showFilter(): boolean {
|
||||||
return this.filter && this.isMultiUser
|
return this.filter && this.isMultiUser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get hasMultipleCurrencies(): boolean {
|
||||||
|
return (this.account && this.account.currencies.length > 1) || false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,18 @@ export const money = (
|
|||||||
|
|
||||||
export const moneypad = (
|
export const moneypad = (
|
||||||
value: number,
|
value: number,
|
||||||
currency: ICurrency | null | undefined
|
currency?: ICurrency | null,
|
||||||
|
withPadEnd: boolean = true
|
||||||
): string => {
|
): string => {
|
||||||
const m = money(value, currency)
|
const m = money(value, currency)
|
||||||
const s: string[] = m.split('\xa0')
|
const s: string[] = m.split('\xa0')
|
||||||
const cur: string | undefined = s.pop()
|
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') => {
|
export const date = (value: string, country: string = 'fr-FR') => {
|
||||||
|
|||||||
Reference in New Issue
Block a user