mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
restoring the transaction list
This commit is contained in:
parent
e35275cd55
commit
289ca9115a
@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="decayinformation">
|
||||
<span v-if="decaytyp === 'short'">
|
||||
{{ decay ? ' − ' + $n(decay.balance, 'decimal') : '' }}
|
||||
{{ decay ? $n(decay.decay, 'decimal') : '' }}
|
||||
</span>
|
||||
|
||||
<div v-if="decaytyp === 'new' || decaytyp === 'decayLastTransaction'">
|
||||
<div class="d-flex" v-if="!decay.decayStartBlock">
|
||||
<div class="d-flex">
|
||||
<div style="width: 100%" class="text-center pb-3">
|
||||
<b-icon icon="droplet-half" height="12" class="mb-2" />
|
||||
<b>{{ $t('decay.calculation_decay') }}</b>
|
||||
@ -14,16 +14,13 @@
|
||||
|
||||
<b-row>
|
||||
<b-col cols="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>{{ $t('decay.last_transaction') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="decay.decayStartBlock > 0">
|
||||
<div class="display-4">{{ $t('decay.Starting_block_decay') }}</div>
|
||||
<div>{{ $t('decay.decay_introduced') }} :</div>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="decay.decayStart">
|
||||
{{ $d(new Date(decay.decayStart * 1000), 'long') }}
|
||||
<span v-if="decay.start">
|
||||
{{ $d(new Date(decay.start), 'long') }}
|
||||
{{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
</span>
|
||||
</div>
|
||||
@ -31,10 +28,10 @@
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col cols="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>{{ $t('decay.past_time') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="decay.decayStartBlock > 0">{{ $t('decay.since_introduction') }}</div>
|
||||
<span v-if="duration">
|
||||
<span v-if="duration.years > 0">{{ duration.years }} {{ $t('decay.year') }},</span>
|
||||
<span v-if="duration.months > 0">{{ duration.months }} {{ $t('decay.months') }},</span>
|
||||
@ -56,11 +53,10 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="decaytyp === 'new'">- {{ $n(decay.balance, 'decimal') }}</div>
|
||||
<div v-if="decaytyp === 'new'">- {{ $n(decay.decay, 'decimal') }}</div>
|
||||
<div v-if="decaytyp === 'decayLastTransaction'">
|
||||
{{ $n(decay.balance + gddbalance, 'decimal') }} GDD -
|
||||
{{ $n(decay.balance, 'decimal') }} GDD =
|
||||
<b>{{ $n(gddbalance, 'decimal') }} GDD</b>
|
||||
{{ $n(decay.decay + amount, 'decimal') }} GDD - {{ $n(decay.decay, 'decimal') }} GDD =
|
||||
<b>{{ $n(amount, 'decimal') }} GDD</b>
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -73,12 +69,12 @@
|
||||
<!-- Type-->
|
||||
<b-row v-if="decaytyp === 'new'">
|
||||
<b-col cols="6" class="text-right">
|
||||
<div v-if="type === 'send'">{{ $t('decay.sent') }}</div>
|
||||
<div v-if="type === 'receive'">{{ $t('decay.received') }}</div>
|
||||
<div v-if="typeId === 'SEND'">{{ $t('decay.sent') }}</div>
|
||||
<div v-if="typeId === 'RECEIVE'">{{ $t('decay.received') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="type === 'send'">− {{ $n(balance, 'decimal') }}</div>
|
||||
<div v-if="type === 'receive'">+ {{ $n(balance, 'decimal') }}</div>
|
||||
<div v-if="typeId === 'SEND'">{{ $n(amount, 'decimal') }}</div>
|
||||
<div v-if="typeId === 'RECEIVE'">{{ $n(amount, 'decimal') }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Decay-->
|
||||
@ -87,7 +83,7 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>− {{ $n(decay.balance, 'decimal') }}</div>
|
||||
<div>{{ $n(decay.decay, 'decimal') }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Total-->
|
||||
@ -96,14 +92,14 @@
|
||||
<div>{{ $t('decay.total') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="type === 'send'">
|
||||
<b>− {{ $n(balance + decay.balance, 'decimal') }}</b>
|
||||
<div v-if="typeId === 'SEND'">
|
||||
<b>{{ $n(amount + decay.decay, 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="type === 'receive'">
|
||||
<b>{{ $n(balance - decay.balance, 'decimal') }}</b>
|
||||
<div v-if="typeId === 'RECEIVE'">
|
||||
<b>{{ $n(amount - decay.decay, 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="type === 'creation'">
|
||||
<b>− {{ $n(balance - decay.balance, 'decimal') }}</b>
|
||||
<div v-if="typeId === 'CREATION'">
|
||||
<b>{{ $n(amount - decay.decay, 'decimal') }}</b>
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -114,21 +110,19 @@
|
||||
export default {
|
||||
name: 'DecayInformation',
|
||||
props: {
|
||||
gddbalance: { type: Number },
|
||||
balance: { type: Number },
|
||||
type: { type: String, default: '' },
|
||||
amount: { type: String, default: '0' },
|
||||
typeId: { type: String, default: '' },
|
||||
decay: {
|
||||
balance: '',
|
||||
decayDuration: '',
|
||||
decayStart: 0,
|
||||
decayEnd: 0,
|
||||
decayStartBlock: 0,
|
||||
decay: '',
|
||||
start: 0,
|
||||
end: 0,
|
||||
duration: '',
|
||||
},
|
||||
decaytyp: { type: String, default: '' },
|
||||
},
|
||||
computed: {
|
||||
duration() {
|
||||
return this.$moment.duration((this.decay.decayEnd - this.decay.decayStart) * 1000)._data
|
||||
return this.$moment.duration((this.decay.end - this.decay.start) * 1000)._data
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
:transactions="transactions"
|
||||
:transactionCount="transactionCount"
|
||||
:pending="pending"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
@update-balance="updateBalance"
|
||||
@update-transactions="updateTransactions"
|
||||
></router-view>
|
||||
@ -60,6 +61,7 @@ export default {
|
||||
transactionCount: 0,
|
||||
pending: true,
|
||||
visible: false,
|
||||
decayStartBlock: new Date(),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -92,11 +94,13 @@ export default {
|
||||
const {
|
||||
data: { transactionList },
|
||||
} = result
|
||||
this.GdtBalance = transactionList.gdtSum === null ? null : Number(transactionList.gdtSum)
|
||||
this.GdtBalance =
|
||||
transactionList.balanceGDT === null ? null : Number(transactionList.balanceGDT)
|
||||
this.transactions = transactionList.transactions
|
||||
this.balance = Number(transactionList.decay)
|
||||
this.bookedBalance = Number(transactionList.balance)
|
||||
this.balance = Number(transactionList.balance)
|
||||
// this.bookedBalance = Number(transactionList.balance)
|
||||
this.transactionCount = transactionList.count
|
||||
this.decayStartBlock = new Date(transactionList.decayStartBlock)
|
||||
this.pending = false
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
</b-col>
|
||||
</b-row>
|
||||
<gdd-transaction-list
|
||||
:gddbalance="balance"
|
||||
:transactions="transactions"
|
||||
:pageSize="5"
|
||||
:timestamp="timestamp"
|
||||
:decayStartBlock="decayStartBlock"
|
||||
:transaction-count="transactionCount"
|
||||
@update-transactions="updateTransactions"
|
||||
/>
|
||||
@ -46,6 +46,7 @@ export default {
|
||||
props: {
|
||||
balance: { type: Number, default: 0 },
|
||||
GdtBalance: { type: Number, default: 0 },
|
||||
decayStartBlock: { type: Date },
|
||||
transactions: {
|
||||
default: () => [],
|
||||
},
|
||||
|
||||
@ -11,33 +11,22 @@
|
||||
<b-icon icon="exclamation-triangle" class="mr-2" variant="danger"></b-icon>
|
||||
<small>{{ $t('error.empty-transactionlist') }}</small>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-for="{
|
||||
decay,
|
||||
transactionId,
|
||||
type,
|
||||
date,
|
||||
balance,
|
||||
name,
|
||||
memo,
|
||||
firstTransaction,
|
||||
decayDuration,
|
||||
decayEnd,
|
||||
decayStart,
|
||||
} in transactions"
|
||||
:key="transactionId"
|
||||
:style="type === 'decay' ? 'background-color:#f1e0ae3d' : ''"
|
||||
v-for="{ amount, balanceDate, decay, id, linkedUser, memo, typeId } in transactions"
|
||||
:key="id"
|
||||
:style="typeId === 'DECAY' ? 'background-color:#f1e0ae3d' : ''"
|
||||
>
|
||||
<div
|
||||
class="list-group-item gdd-transaction-list-item"
|
||||
:class="getCollapseState(transactionId) ? 'bg-secondary' : ''"
|
||||
v-b-toggle="'decay-' + transactionId"
|
||||
:class="getCollapseState(id) ? 'bg-secondary' : ''"
|
||||
v-b-toggle="'decay-' + id"
|
||||
>
|
||||
<!-- Collaps Button -->
|
||||
<div class="text-right" style="width: 95%; position: absolute">
|
||||
<b-icon
|
||||
:icon="getCollapseState(transactionId) ? 'caret-up-square' : 'caret-down-square'"
|
||||
:class="getCollapseState(transactionId) ? 'text-black' : 'text-muted'"
|
||||
:icon="getCollapseState(id) ? 'caret-up-square' : 'caret-down-square'"
|
||||
:class="getCollapseState(id) ? 'text-black' : 'text-muted'"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
@ -45,7 +34,7 @@
|
||||
<!-- ICON -->
|
||||
<b-col cols="1">
|
||||
<div class="gdd-transaction-list-item-icon">
|
||||
<b-icon :icon="getProperties(type).icon" :class="getProperties(type).class" />
|
||||
<b-icon :icon="getProperties(typeId).icon" :class="getProperties(typeId).class" />
|
||||
</div>
|
||||
</b-col>
|
||||
|
||||
@ -55,22 +44,22 @@
|
||||
<b-col cols="5">
|
||||
<div class="text-right">
|
||||
<span class="gdd-transaction-list-item-operator">
|
||||
{{ getProperties(type).operator }}
|
||||
{{ getProperties(typeId).operator }}
|
||||
</span>
|
||||
<span class="gdd-transaction-list-item-amount">
|
||||
{{ $n(balance, 'decimal') }}
|
||||
{{ $n(amount, 'decimal') }}
|
||||
</span>
|
||||
</div>
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
<div class="gdd-transaction-list-item-name">
|
||||
{{ type !== 'decay' ? name : $t('decay.decay_since_last_transaction') }}
|
||||
{{ typeId !== 'DECAY' ? (linkedUser.firstName + linkedUser.lastName ) : $t('decay.decay_since_last_transaction') }}
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
<!-- Nachricht -->
|
||||
<b-row v-if="type !== 'decay'">
|
||||
<b-row v-if="typeId !== 'DECAY'">
|
||||
<b-col cols="5">
|
||||
<div class="text-right">{{ $t('form.memo') }}</div>
|
||||
</b-col>
|
||||
@ -80,22 +69,28 @@
|
||||
</b-row>
|
||||
|
||||
<!-- Datum -->
|
||||
<b-row v-if="type !== 'decay'">
|
||||
<b-row v-if="typeId !== 'DECAY'">
|
||||
<b-col cols="5">
|
||||
<div class="text-right">{{ $t('form.date') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
<div class="gdd-transaction-list-item-date">
|
||||
{{ $d(new Date(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
{{ $d(new Date(balanceDate), 'long') }}
|
||||
{{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
<!-- Decay -->
|
||||
<b-row v-if="decay && !decay.decayStartBlock">
|
||||
<b-row v-if="decay">
|
||||
<b-col cols="5">
|
||||
<div class="text-right">
|
||||
<b-icon v-if="type != 'decay'" icon="droplet-half" height="15" class="mb-1" />
|
||||
<b-icon
|
||||
v-if="typeId != 'DECAY'"
|
||||
icon="droplet-half"
|
||||
height="15"
|
||||
class="mb-1"
|
||||
/>
|
||||
</div>
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
@ -104,10 +99,15 @@
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row v-if="decay && decay.decayStartBlock">
|
||||
<!-- <b-row v-if="decay && decayStartBlock">
|
||||
<b-col cols="5">
|
||||
<div class="text-right">
|
||||
<b-icon v-if="type != 'decay'" icon="droplet-half" height="15" class="mb-1" />
|
||||
<b-icon
|
||||
v-if="typeId != 'decay'"
|
||||
icon="droplet-half"
|
||||
height="15"
|
||||
class="mb-1"
|
||||
/>
|
||||
</div>
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
@ -115,48 +115,41 @@
|
||||
<b>{{ $t('decay.Starting_block_decay') }}</b>
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-row> -->
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
|
||||
<!-- Collaps Start -->
|
||||
<!-- v-if="
|
||||
(type != 'decay' && decay) ||
|
||||
firstTransaction ||
|
||||
(!firstTransaction && decay === null)
|
||||
" -->
|
||||
<b-collapse class="pb-4" :id="'decay-' + transactionId">
|
||||
<b-collapse class="pb-4" :id="'decay-' + id">
|
||||
<div class="pt-4 pb-4 bg-white border border-muted">
|
||||
<decay-information
|
||||
v-if="decay"
|
||||
v-if="decay.start !== null"
|
||||
decaytyp="new"
|
||||
:balance="balance"
|
||||
:amount="amount"
|
||||
:decay="decay"
|
||||
:type="type"
|
||||
:typeId="typeId"
|
||||
/>
|
||||
<div v-if="firstTransaction" class="mt-3 mb-3 text-center">
|
||||
|
||||
<!-- if decay.start === null - Wenn kein decay angegeben dan ist es die erste Transaktion-->
|
||||
<div v-if="decay.start === null" class="mt-3 mb-3 text-center">
|
||||
<b>{{ $t('decay.first_transaction') }}</b>
|
||||
</div>
|
||||
|
||||
<!-- if balanceDate < decayStartBlock - Wenn die transaktion vor dem einführen der dacay function liegt. -->
|
||||
<div
|
||||
v-if="type !== 'decay' && !firstTransaction && decay === null"
|
||||
v-if="new Date(balanceDate).getTime() < new Date(decayStartBlock).getTime()"
|
||||
class="mt-3 mb-3 text-center"
|
||||
>
|
||||
<b>{{ $t('decay.befor_startblock_transaction') }}</b>
|
||||
</div>
|
||||
<div v-if="type === 'decay'" class="mt-3 mb-3">
|
||||
|
||||
<div v-if="typeId === 'DECAY'" class="mt-3 mb-3">
|
||||
<decay-information
|
||||
decaytyp="decayLastTransaction"
|
||||
:gddbalance="gddbalance"
|
||||
:balance="balance"
|
||||
:decay="{
|
||||
balance: balance,
|
||||
decayStart: parseInt(decayStart),
|
||||
decayEnd: parseInt(decayEnd),
|
||||
decayDuration: parseInt(decayDuration),
|
||||
}"
|
||||
:type="type"
|
||||
:amount="amount"
|
||||
:decay="decay"
|
||||
:typeId="typeId"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -183,10 +176,10 @@ import PaginationButtons from '../../../components/PaginationButtons'
|
||||
import DecayInformation from '../../../components/DecayInformation'
|
||||
|
||||
const iconsByType = {
|
||||
send: { icon: 'arrow-left-circle', classes: 'text-danger', operator: '−' },
|
||||
receive: { icon: 'arrow-right-circle', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
creation: { icon: 'gift', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
decay: { icon: 'droplet-half', classes: 'gradido-global-color-gray', operator: '−' },
|
||||
SEND: { icon: 'arrow-left-circle', classes: 'text-danger', operator: '−' },
|
||||
RECEIVE: { icon: 'arrow-right-circle', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
CREATION: { icon: 'gift', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
DECAY: { icon: 'droplet-half', classes: 'gradido-global-color-gray', operator: '−' },
|
||||
}
|
||||
|
||||
export default {
|
||||
@ -202,7 +195,7 @@ export default {
|
||||
}
|
||||
},
|
||||
props: {
|
||||
gddbalance: { type: Number },
|
||||
decayStartBlock: { type: Date },
|
||||
transactions: { default: () => [] },
|
||||
pageSize: { type: Number, default: 25 },
|
||||
timestamp: { type: Number, default: 0 },
|
||||
@ -230,8 +223,8 @@ export default {
|
||||
throwError(msg) {
|
||||
throw new Error(msg)
|
||||
},
|
||||
getCollapseState(transactionId) {
|
||||
return this.collapseStatus.includes('decay-' + transactionId)
|
||||
getCollapseState(id) {
|
||||
return this.collapseStatus.includes('decay-' + id)
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
<p class="tab-tex">{{ $t('transaction.gdd-text') }}</p>
|
||||
|
||||
<gdd-transaction-list
|
||||
:gddbalance="balance"
|
||||
:timestamp="timestamp"
|
||||
:transactionCount="transactionCount"
|
||||
:transactions="transactions"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user