fix vue errors

This commit is contained in:
Moriz Wahl 2021-07-08 17:08:39 +02:00
parent 956686b7aa
commit e70acd13d7
2 changed files with 35 additions and 37 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div v-if="decay"> <div>
<span v-if="decaytyp === 'short'"> <span v-if="decaytyp === 'short'">
<small>{{ decay ? ' ' + decay.balance + ' ' + decay_start_block_text_short : '' }}</small> <small>{{ decay ? ' ' + decay.balance + ' ' + decayStartBlockTextShort : '' }}</small>
</span> </span>
<div v-if="decaytyp === 'new'"> <div v-if="decaytyp === 'new'">
@ -66,7 +66,7 @@ export default {
decay_end: 0, decay_end: 0,
decay_start_block: 0, decay_start_block: 0,
}, },
decaytyp: '', decaytyp: { type: String, default: '' },
}, },
data() { data() {
return { return {
@ -74,11 +74,15 @@ export default {
b: 0, b: 0,
duration: {}, duration: {},
diff: {}, diff: {},
decay_start_block_text_short: this.decay.decay_start_block
? ' - Startblock Decay am: ' + this.$d(this.$moment.unix(this.decay.decay_start_block))
: '',
} }
}, },
computed: {
decayStartBlockTextShort() {
return this.decay.decay_start_block
? ' - Startblock Decay am: ' + this.$d(this.$moment.unix(this.decay.decay_start_block))
: ''
},
},
methods: { methods: {
getDuration(start, end) { getDuration(start, end) {
this.a = new Date(start) this.a = new Date(start)

View File

@ -2,42 +2,39 @@
<div class="gdd-transaction-list"> <div class="gdd-transaction-list">
<b-list-group> <b-list-group>
<b-list-group-item <b-list-group-item
v-for="item in transactions" v-for="{ decay, transaction_id, type, date, balance, name, memo } in transactions"
v-bind:key="item.transaction_id" :key="transaction_id"
:style="item.type === 'decay' ? 'background-color:#f1e0ae3d' : ''" :style="type === 'decay' ? 'background-color:#f1e0ae3d' : ''"
> >
<!-- ROW Start --> <!-- ROW Start -->
<div class="d-flex gdd-transaction-list-item" v-b-toggle="'a' + item.date + ''"> <div class="d-flex gdd-transaction-list-item" v-b-toggle="'a' + date + ''">
<!-- ICON --> <!-- ICON -->
<div style="width: 8%"> <div style="width: 8%">
<b-icon :icon="getProperties(item).icon" :class="getProperties(item).class" /> <b-icon :icon="getProperties(type).icon" :class="getProperties(type).class" />
</div> </div>
<!-- Text Links --> <!-- Text Links -->
<div class="font1_2em pr-2 text-right" style="width: 32%"> <div class="font1_2em pr-2 text-right" style="width: 32%">
<span>{{ getProperties(item).operator }}</span> <span>{{ getProperties(type).operator }}</span>
<small v-if="item.type === 'decay'">{{ $n(item.balance, 'decimal') }}</small> <small v-if="type === 'decay'">{{ $n(balance, 'decimal') }}</small>
<span v-else>{{ $n(item.balance, 'decimal') }}</span> <span v-else>{{ $n(balance, 'decimal') }}</span>
<div v-if="getTransaction(item.transaction_id).decay"> <div v-if="decay">
<br /> <br />
<b-icon v-if="item.type != 'decay'" icon="droplet-half" height="15" class="mb-3" /> <b-icon v-if="type != 'decay'" icon="droplet-half" height="15" class="mb-3" />
</div> </div>
</div> </div>
<!-- Text Rechts --> <!-- Text Rechts -->
<div class="font1_2em text-left pl-2" style="width: 55%"> <div class="font1_2em text-left pl-2" style="width: 55%">
{{ item.name ? item.name : '' }} {{ name ? name : '' }}
<span v-if="item.type === 'decay'"> <span v-if="type === 'decay'">
<small>{{ $t('decay.decay_since_last_transaction') }}</small> <small>{{ $t('decay.decay_since_last_transaction') }}</small>
</span> </span>
<div v-if="item.date" class="text-sm">{{ $d($moment(item.date), 'long') }}</div> <div v-if="date" class="text-sm">{{ $d($moment(date), 'long') }}</div>
<decay-information <decay-information v-if="decay" decaytyp="short" :decay="decay" />
decaytyp="short"
:decay="getTransaction(item.transaction_id).decay"
/>
</div> </div>
<!-- Collaps Toggle Button --> <!-- Collaps Toggle Button -->
<div v-if="item.type != 'decay'" class="text-right" style="width: 5%"> <div v-if="type != 'decay'" class="text-right" style="width: 5%">
<b-button class="btn-sm"> <b-button class="btn-sm">
<b>i</b> <b>i</b>
</b-button> </b-button>
@ -45,29 +42,29 @@
</div> </div>
<!-- ROW End --> <!-- ROW End -->
<!-- Collaps Start --> <!-- Collaps Start -->
<b-collapse v-if="item.type != 'decay'" :id="'a' + item.date + ''"> <b-collapse v-if="type != 'decay'" :id="'a' + date + ''">
<b-list-group v-if="item.type === 'receive' || item.type === 'send'"> <b-list-group v-if="type === 'receive' || type === 'send'">
<b-list-group-item style="border: 0px; background-color: #f1f1f1"> <b-list-group-item style="border: 0px; background-color: #f1f1f1">
<div class="d-flex"> <div class="d-flex">
<div style="width: 40%" class="text-right pr-3 mr-2"> <div style="width: 40%" class="text-right pr-3 mr-2">
{{ item.type === 'receive' ? 'von:' : 'an:' }} {{ type === 'receive' ? 'von:' : 'an:' }}
</div> </div>
<div style="width: 60%"> <div style="width: 60%">
{{ item.name }} {{ name }}
<b-avatar class="mr-3"></b-avatar> <b-avatar class="mr-3"></b-avatar>
</div> </div>
</div> </div>
<div class="d-flex"> <div class="d-flex">
<div style="width: 40%" class="text-right pr-3 mr-2"> <div style="width: 40%" class="text-right pr-3 mr-2">
{{ item.type === 'receive' ? 'Nachricht:' : 'Nachricht:' }} {{ type === 'receive' ? 'Nachricht:' : 'Nachricht:' }}
</div> </div>
<div style="width: 60%"> <div style="width: 60%">
{{ item.memo }} {{ memo }}
</div> </div>
</div> </div>
</b-list-group-item> </b-list-group-item>
</b-list-group> </b-list-group>
<b-list-group v-if="item.type === 'creation'"> <b-list-group v-if="type === 'creation'">
<b-list-group-item style="border: 0px"> <b-list-group-item style="border: 0px">
<div class="d-flex"> <div class="d-flex">
<div style="width: 40%" class="text-right pr-3 mr-2">Schöpfung</div> <div style="width: 40%" class="text-right pr-3 mr-2">Schöpfung</div>
@ -75,7 +72,7 @@
</div> </div>
</b-list-group-item> </b-list-group-item>
</b-list-group> </b-list-group>
<decay-information decaytyp="new" :decay="getTransaction(item.transaction_id).decay" /> <decay-information v-if="decay" decaytyp="new" :decay="decay" />
</b-collapse> </b-collapse>
<!-- Collaps End --> <!-- Collaps End -->
</b-list-group-item> </b-list-group-item>
@ -143,17 +140,14 @@ export default {
}, },
}, },
methods: { methods: {
getTransaction(id) {
return this.transactions.find((t) => t.transaction_id === id)
},
updateTransactions() { updateTransactions() {
this.$emit('update-transactions', { this.$emit('update-transactions', {
firstPage: this.currentPage, firstPage: this.currentPage,
items: this.pageSize, items: this.pageSize,
}) })
}, },
getProperties(item) { getProperties(givenType) {
const type = iconsByType[item.type] const type = iconsByType[givenType]
if (type) if (type)
return { return {
icon: type.icon, icon: type.icon,