feat: Use Vue Filter for Amounts

This commit is contained in:
Moriz Wahl 2022-03-08 04:21:47 +01:00
parent 034828a6f8
commit 09de529443
7 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="decayinformation-short">
<span> {{ decay ? $n(Number(decay.decay) * -1, 'decimal') : '' }}</span>
<span v-if="decay.decay">{{ decay.decay | amount}}</span>
</div>
</template>
<script>

View File

@ -25,7 +25,7 @@
<div class="text-right">
<span class="gdd-transaction-list-item-operator">+</span>
<span class="gdd-transaction-list-item-amount">
{{ $n(amount, 'decimal') }}
{{ amount | amount }}
</span>
</div>
</b-col>

View File

@ -23,9 +23,8 @@
<b-row>
<b-col cols="5">
<div class="text-right">
<span class="gdd-transaction-list-item-operator"></span>
<span class="gdd-transaction-list-item-amount">
{{ $n(Number(amount) * -1, 'decimal') }}
{{ amount | amount }}
</span>
</div>
</b-col>

View File

@ -28,7 +28,7 @@
<div class="text-right">
<span class="gdd-transaction-list-item-operator">+</span>
<span class="gdd-transaction-list-item-amount">
{{ $n(amount, 'decimal') }}
{{ amount | amount }}
</span>
</div>
</b-col>

View File

@ -23,9 +23,8 @@
<b-row>
<b-col cols="5">
<div class="text-right">
<span class="gdd-transaction-list-item-operator"></span>
<span class="gdd-transaction-list-item-amount">
{{ $n(Number(amount) * -1, 'decimal') }}
{{ amount | amount }}
</span>
</div>
</b-col>

View File

@ -0,0 +1,6 @@
import i18n from '@/i18n.js'
export const amount = (value) => {
if (!value) return ''
return i18n.n(value.toString(), 'decimal').replace('-', ' ')
}

View File

@ -4,6 +4,7 @@ import App from './App.vue'
import i18n from './i18n.js'
import { loadAllRules } from './validation-rules'
import { toasters } from './mixins/toaster'
import { amount } from './filters/amount'
import 'regenerator-runtime'
@ -20,6 +21,7 @@ Vue.use(DashboardPlugin)
Vue.config.productionTip = false
Vue.mixin(toasters)
Vue.filter('amount', amount)
loadAllRules(i18n)