mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
GDD filter
This commit is contained in:
parent
690e8a817e
commit
53611ba51e
@ -13,9 +13,9 @@
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>
|
||||
{{ $n(Number(balance) - Number(decay.decay), 'decimal') }}
|
||||
GDD − {{ $n(Number(decay.decay) * -1, 'decimal') }} GDD =
|
||||
<b>{{ $n(Number(balance), 'decimal') }} GDD</b>
|
||||
{{ (Number(balance) - Number(decay.decay)) | GDD }}
|
||||
{{ decay.decay | GDD }} =
|
||||
<b>{{ balance | GDD }}</b>
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>− {{ $n(decay.decay * -1, 'decimal') }}</div>
|
||||
<div>{{ decay.decay | GDD }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<hr class="mt-2 mb-2" />
|
||||
@ -37,8 +37,7 @@
|
||||
<div v-if="typeId === 'RECEIVE'">{{ $t('decay.received') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="typeId === 'SEND'">− {{ $n(amount * -1, 'decimal') }}</div>
|
||||
<div v-if="typeId === 'RECEIVE'">{{ $n(amount, 'decimal') }}</div>
|
||||
<div>{{ amount | GDD }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Decay-->
|
||||
@ -47,7 +46,7 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>− {{ $n(decay.decay * -1, 'decimal') }}</div>
|
||||
<div>{{ decay.decay | GDD }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Total-->
|
||||
@ -56,15 +55,7 @@
|
||||
<div>{{ $t('decay.total') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="typeId === 'SEND'">
|
||||
<b>− {{ $n((Number(amount) + Number(decay.decay)) * -1, 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="typeId === 'RECEIVE'">
|
||||
<b>{{ $n(Number(amount) + Number(decay.decay), 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="typeId === 'CREATION'">
|
||||
<b>{{ $n(Number(amount) + Number(decay.decay), 'decimal') }}</b>
|
||||
</div>
|
||||
<b>{{ (Number(amount) + Number(decay.decay)) | GDD }}</b>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>− {{ $n(decay.decay * -1, 'decimal') }}</div>
|
||||
<div>{{ decay.decay | GDD }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<hr class="mt-2 mb-2" />
|
||||
@ -58,8 +58,7 @@
|
||||
<div v-if="typeId === 'RECEIVE'">{{ $t('decay.received') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="typeId === 'SEND'">− {{ $n(amount * -1, 'decimal') }}</div>
|
||||
<div v-if="typeId === 'RECEIVE'">{{ $n(amount, 'decimal') }}</div>
|
||||
<div>{{ amount | GDD }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Decay-->
|
||||
@ -68,7 +67,7 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>− {{ $n(decay.decay * -1, 'decimal') }}</div>
|
||||
<div>{{ decay.decay | GDD }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Total-->
|
||||
@ -77,15 +76,7 @@
|
||||
<div>{{ $t('decay.total') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="typeId === 'SEND'">
|
||||
<b>− {{ $n((Number(amount) + Number(decay.decay)) * -1, 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="typeId === 'RECEIVE'">
|
||||
<b>{{ $n(Number(amount) + Number(decay.decay), 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="typeId === 'CREATION'">
|
||||
<b>{{ $n(Number(amount) + Number(decay.decay), 'decimal') }}</b>
|
||||
</div>
|
||||
<b>{{ (Number(amount) + Number(decay.decay)) | GDD }}</b>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
|
||||
@ -7,7 +7,6 @@ const mocks = {
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
},
|
||||
$n: jest.fn((n) => n),
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
}
|
||||
|
||||
@ -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">
|
||||
{{ amount | amount }}
|
||||
{{ amount | GDD }}
|
||||
</span>
|
||||
</div>
|
||||
</b-col>
|
||||
|
||||
@ -7,7 +7,6 @@ const mocks = {
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
},
|
||||
$n: jest.fn((n) => n),
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ const mocks = {
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
},
|
||||
$n: jest.fn((n) => n),
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
}
|
||||
|
||||
@ -26,9 +26,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">
|
||||
{{ amount | amount }}
|
||||
{{ amount | GDD }}
|
||||
</span>
|
||||
</div>
|
||||
</b-col>
|
||||
|
||||
@ -7,7 +7,6 @@ const mocks = {
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
},
|
||||
$n: jest.fn((n) => n),
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<b-col cols="5">
|
||||
<div class="text-right">
|
||||
<span class="gdd-transaction-list-item-amount">
|
||||
{{ amount | amount }}
|
||||
{{ amount | GDD }}
|
||||
</span>
|
||||
</div>
|
||||
</b-col>
|
||||
@ -78,7 +78,7 @@
|
||||
<b-collapse class="pb-4 pt-5" v-model="visible">
|
||||
<decay-information-before-startblock v-if="decay.start === null" />
|
||||
<decay-information-decay-startblock
|
||||
v-else-if="true"
|
||||
v-else-if="isStartBlock"
|
||||
:amount="amount"
|
||||
:decay="decay"
|
||||
:typeId="typeId"
|
||||
|
||||
@ -2,10 +2,17 @@ let i18n
|
||||
|
||||
export const loadFilters = (_i18n) => {
|
||||
i18n = _i18n
|
||||
return { amount }
|
||||
return { amount, GDD }
|
||||
}
|
||||
|
||||
const amount = (value) => {
|
||||
if (!value) return ''
|
||||
return i18n.n(value.toString(), 'decimal').replace('-', '− ')
|
||||
}
|
||||
|
||||
const GDD = (value) => {
|
||||
if (!value) return ''
|
||||
value = amount(value)
|
||||
if (!value.match(/^− /)) value = '+ ' + value
|
||||
return value + ' GDD'
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ Vue.config.productionTip = false
|
||||
Vue.mixin(toasters)
|
||||
const filters = loadFilters(i18n)
|
||||
Vue.filter('amount', filters.amount)
|
||||
Vue.filter('GDD', filters.GDD)
|
||||
|
||||
loadAllRules(i18n)
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ global.localVue.mixin(toasters)
|
||||
|
||||
const filters = loadFilters(i18nMock)
|
||||
global.localVue.filter('amount', filters.amount)
|
||||
global.localVue.filter('GDD', filters.GDD)
|
||||
|
||||
// Filter the warnings for portal vue
|
||||
// https://github.com/BeniRupp/bug_portal-vue-target-already-exists
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user