Merge pull request #815 from gradido/636-Display-of-Decay-in-Transaction-Details

decay calculation is calculated
This commit is contained in:
Alexander Friedland 2021-09-24 13:23:18 +02:00 committed by GitHub
commit d5ee9c96fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 13 deletions

View File

@ -19,11 +19,11 @@
</div> </div>
</div> </div>
<div class="d-flex"> <b-row>
<div style="width: 40%" class="text-right pr-3 mr-2"> <b-col col="6" class="text-right">
<div v-if="!decay.decayStartBlock">{{ $t('decay.last_transaction') }}</div> <div v-if="!decay.decayStartBlock">{{ $t('decay.last_transaction') }}</div>
</div> </b-col>
<div style="width: 60%"> <b-col col="6">
<div v-if="decay.decayStartBlock > 0"> <div v-if="decay.decayStartBlock > 0">
<div class="display-4">{{ $t('decay.Starting_block_decay') }}</div> <div class="display-4">{{ $t('decay.Starting_block_decay') }}</div>
<div> <div>
@ -32,19 +32,19 @@
</div> </div>
</div> </div>
<div> <div>
<span v-if="!decay.decayStart"> <span v-if="decay.decayStart">
{{ $d($moment.unix(decay.decayStart), 'long') }} {{ $d($moment.unix(decay.decayStart), 'long') }}
{{ $i18n.locale === 'de' ? 'Uhr' : '' }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
</span> </span>
</div> </div>
</div> </b-col>
</div> </b-row>
<div class="d-flex"> <b-row>
<div style="width: 40%" class="text-right pr-3 mr-2"> <b-col col="6" class="text-right">
<div v-if="!decay.decayStartBlock">{{ $t('decay.past_time') }}</div> <div v-if="!decay.decayStartBlock">{{ $t('decay.past_time') }}</div>
</div> </b-col>
<div style="width: 60%"> <b-col col="6">
<div v-if="decay.decayStartBlock > 0">{{ $t('decay.since_introduction') }}</div> <div v-if="decay.decayStartBlock > 0">{{ $t('decay.since_introduction') }}</div>
<span v-if="duration"> <span v-if="duration">
<span v-if="duration.years > 0">{{ duration.years }} {{ $t('decay.year') }},</span> <span v-if="duration.years > 0">{{ duration.years }} {{ $t('decay.year') }},</span>
@ -60,7 +60,59 @@
{{ duration.seconds }} {{ $t('decay.seconds') }} {{ duration.seconds }} {{ $t('decay.seconds') }}
</span> </span>
</span> </span>
</div> </b-col>
</b-row>
<div v-if="decay.balance > 0">
<!-- Decay-->
<b-row>
<b-col col="6" class="text-right">
<div>{{ $t('decay.decay') }}</div>
</b-col>
<b-col col="6">
<div>- {{ decay.balance }}</div>
</b-col>
</b-row>
<hr class="mt-2 mb-2" />
<b-row>
<b-col class="text-center pt-3 pb-2">
<b>{{ $t('decay.calculation_total') }}</b>
</b-col>
</b-row>
<!-- Type-->
<b-row>
<b-col col="6" class="text-right">
<div v-if="type === 'send'">{{ $t('decay.sent') }}</div>
<div v-if="type === 'receive'">{{ $t('decay.received') }}</div>
</b-col>
<b-col col="6">
<div v-if="type === 'send'">- {{ balance }}</div>
<div v-if="type === 'receive'">+ {{ balance }}</div>
</b-col>
</b-row>
<!-- Decay-->
<b-row>
<b-col col="6" class="text-right">
<div>{{ $t('decay.decay') }}</div>
</b-col>
<b-col col="6">
<div>- {{ decay.balance }}</div>
</b-col>
</b-row>
<!-- Total-->
<b-row>
<b-col col="6" class="text-right">
<div>{{ $t('decay.total') }}</div>
</b-col>
<b-col col="6">
<div v-if="type === 'send'">
<b>- {{ parseInt(balance) + decay.balance }}</b>
</div>
<div v-if="type === 'receive'">
<b>{{ parseInt(balance) - decay.balance }}</b>
</div>
</b-col>
</b-row>
</div> </div>
</b-list-group-item> </b-list-group-item>
</b-list-group> </b-list-group>
@ -71,6 +123,8 @@
export default { export default {
name: 'DecayInformation', name: 'DecayInformation',
props: { props: {
balance: { type: Number },
type: { type: String, default: '' },
decay: { decay: {
balance: '', balance: '',
decayDuration: '', decayDuration: '',

View File

@ -12,6 +12,7 @@
}, },
"decay": { "decay": {
"calculation_decay": "Berechnung der Vergänglichkeit", "calculation_decay": "Berechnung der Vergänglichkeit",
"calculation_total": "Berechnung der Gesamtsumme",
"created": "Geschöpft", "created": "Geschöpft",
"days": "Tage", "days": "Tage",
"decay": "Vergänglichkeit", "decay": "Vergänglichkeit",
@ -31,6 +32,7 @@
"since_introduction": "seit Einführung der Vergänglichkeit", "since_introduction": "seit Einführung der Vergänglichkeit",
"Starting_block_decay": "Startblock Vergänglichkeit", "Starting_block_decay": "Startblock Vergänglichkeit",
"toCommunity": "An die Gemeinschaft", "toCommunity": "An die Gemeinschaft",
"total": "Gesamt",
"year": "Jahre" "year": "Jahre"
}, },
"error": { "error": {

View File

@ -12,6 +12,7 @@
}, },
"decay": { "decay": {
"calculation_decay": "Calculation of Decay", "calculation_decay": "Calculation of Decay",
"calculation_total": "Calculation of the grand total",
"created": "Created", "created": "Created",
"days": "Days", "days": "Days",
"decay": "Decay", "decay": "Decay",
@ -31,6 +32,7 @@
"since_introduction": "Since the introduction of Decay", "since_introduction": "Since the introduction of Decay",
"Starting_block_decay": "Starting Block Decay", "Starting_block_decay": "Starting Block Decay",
"toCommunity": "To the community", "toCommunity": "To the community",
"total": "Total",
"year": "Years" "year": "Years"
}, },
"error": { "error": {

View File

@ -76,7 +76,13 @@
<b-collapse v-if="type != 'decay'" class="pb-4" :id="'a' + date + ''"> <b-collapse v-if="type != 'decay'" class="pb-4" :id="'a' + date + ''">
<div style="border: 0px; background-color: #f1f1f1" class="p-2 pb-4 mb-4"> <div style="border: 0px; background-color: #f1f1f1" class="p-2 pb-4 mb-4">
<decay-information v-if="decay" decaytyp="new" :decay="decay" /> <decay-information
v-if="decay"
decaytyp="new"
:balance="balance"
:decay="decay"
:type="type"
/>
</div> </div>
</b-collapse> </b-collapse>