mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
getTransaction function
This commit is contained in:
parent
0e3bb34a4a
commit
4da05a6235
@ -3,7 +3,7 @@
|
||||
<b-list-group>
|
||||
<b-list-group-item
|
||||
v-for="(item) in transactions"
|
||||
v-bind:key="item.id"
|
||||
v-bind:key="item.transaction_id"
|
||||
style="background-color: #ebebeba3 !important"
|
||||
>
|
||||
<div class="d-flex gdd-transaction-list-item" v-b-toggle="'a' + item.date + ''" >
|
||||
@ -18,8 +18,8 @@
|
||||
{{ item.name ? item.name : $t('decay') }}
|
||||
<div v-if="item.date" class="text-sm">{{ $d($moment(item.date), 'long') }}</div>
|
||||
<!-- <p>{{ item.decay }}</p> -->
|
||||
<p>{{ getDuration(item.id)}} GDD</p>
|
||||
<p>{{ getDuration(item.decay)}} GDD</p>
|
||||
<p>{{ getTransaction(item.transaction_id)}} GDD</p>
|
||||
<p>{{ getTransaction(item.transaction_id).decay}} GDD</p>
|
||||
</div>
|
||||
<div class="text-right" style="width: 5%">
|
||||
<b-button class="btn-sm">
|
||||
@ -29,29 +29,29 @@
|
||||
</div>
|
||||
<b-collapse :id="'a' + item.date + ''" class="mt-2">
|
||||
<b-card>
|
||||
<b-card-title>
|
||||
<div class="display-4"> {{ item.type === "receive" ? "empfangen:" : "gesendet:" }}</div>
|
||||
</b-card-title>
|
||||
<b-card-body>
|
||||
|
||||
<b-card-title>
|
||||
<div class="display-4"> {{ item.type === "receive" ? "empfangen:" : "gesendet:" }}</div>
|
||||
</b-card-title>
|
||||
<b-card-body>
|
||||
|
||||
<p class="display-2"> {{ $n(item.balance, 'decimal') }} GDD</p>
|
||||
|
||||
<div> <div>am: </div><span class="display-4">{{ $d($moment(item.date), 'long') }}</span></div>
|
||||
<div><div >an:</div> <span class="display-4">{{ item.name }}</span></div>
|
||||
<div class="display-5"> {{ item.type === "receive" ? "Nachricht vom Absender:" : "Nachricht an Empfänger:" }}</div>
|
||||
<div class="display-5"> {{ item.type === "receive" ? "Nachricht vom Absender:" : "Nachricht an Empfänger:" }}</div>
|
||||
<div class="display-4">{{ item.memo }}</div>
|
||||
<hr>
|
||||
|
||||
<div>Seit deiner letzten Transaction sind </div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<p> {{ $moment.unix(getDecay(item.decay)).format('D.MM.YYYY - HH:mm:ss') }}</p>
|
||||
<p> {{ $moment.unix(getDecay(item.decay)).format('D.MM.YYYY - HH:mm:ss') }}</p> -->
|
||||
<div>{{ }} vergangen.</div>
|
||||
<br>
|
||||
<!-- <div>{{ getDecay(item.id).balance }} Vergänglichkeit.</div> -->
|
||||
<div v-if="getTransaction(item.transaction_id).decay">Seit deiner letzten Transaction sind </div>
|
||||
|
||||
|
||||
|
||||
{{ getTransaction(item.transaction_id).decay ? getTransaction(item.transaction_id).decay.balance : 'missing' }}
|
||||
<!-- <p> {{ $moment.unix(getTransaction(item.transaction_id).descay_start).format('D.MM.YYYY - HH:mm:ss') }}</p>
|
||||
<p> {{ $moment.unix(getTransaction(item.transaction_id).decay_end).format('D.MM.YYYY - HH:mm:ss') }}</p> -->
|
||||
<div>{{ }} vergangen.</div>
|
||||
<br>
|
||||
<!-- <div>{{ getTransaction(item.id).balance }} Vergänglichkeit.</div> -->
|
||||
</b-card-body>
|
||||
|
||||
<b-button v-b-toggle="'collapse-1-inner' + item.date" variant="secondary">
|
||||
@ -60,7 +60,7 @@
|
||||
<b-collapse :id="'collapse-1-inner' + item.date" class="mt-2">
|
||||
<b-card>{{ item }}</b-card>
|
||||
</b-collapse>
|
||||
|
||||
|
||||
</b-card>
|
||||
</b-collapse>
|
||||
</b-list-group-item>
|
||||
@ -83,87 +83,85 @@
|
||||
<script>
|
||||
import PaginationButtons from '../../../components/PaginationButtons'
|
||||
|
||||
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: '-' },
|
||||
}
|
||||
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: '-' },
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'gdd-transaction-list',
|
||||
components: {
|
||||
PaginationButtons,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentPage: 1,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
transactions: { default: () => [] },
|
||||
pageSize: { type: Number, default: 25 },
|
||||
timestamp: { type: Number, default: 0 },
|
||||
transactionCount: { type: Number, default: 0 },
|
||||
showPagination: { type: Boolean, default: false },
|
||||
},
|
||||
watch: {
|
||||
timestamp: {
|
||||
immediate: true,
|
||||
handler: 'updateTransactions',
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
hasNext() {
|
||||
return this.currentPage * this.pageSize < this.transactionCount
|
||||
},
|
||||
hasPrevious() {
|
||||
return this.currentPage > 1
|
||||
},
|
||||
totalPages() {
|
||||
return Math.ceil(this.transactionCount / this.pageSize)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getDuration(decay) {
|
||||
console.log(">>>>>>>>>>>>>>>>>>>>getDuration")
|
||||
//console.log("this.transactions.find(t => t.decay === decay)>", this.transactions.find(t => t.id === id))
|
||||
return this.transactions.find(t => t.decay === decay)
|
||||
},
|
||||
|
||||
updateTransactions() {
|
||||
this.$emit('update-transactions', {
|
||||
firstPage: this.currentPage,
|
||||
items: this.pageSize,
|
||||
})
|
||||
},
|
||||
getProperties(item) {
|
||||
const type = iconsByType[item.type]
|
||||
if (type)
|
||||
return {
|
||||
icon: type.icon,
|
||||
class: type.classes + ' m-mb-1 font2em',
|
||||
operator: type.operator,
|
||||
}
|
||||
this.throwError('no icon to given type')
|
||||
},
|
||||
throwError(msg) {
|
||||
throw new Error(msg)
|
||||
},
|
||||
showNext() {
|
||||
this.currentPage++
|
||||
this.updateTransactions()
|
||||
},
|
||||
showPrevious() {
|
||||
this.currentPage--
|
||||
this.updateTransactions()
|
||||
},
|
||||
},
|
||||
}
|
||||
export default {
|
||||
name: 'gdd-transaction-list',
|
||||
components: {
|
||||
PaginationButtons,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentPage: 1,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
transactions: { default: () => [] },
|
||||
pageSize: { type: Number, default: 25 },
|
||||
timestamp: { type: Number, default: 0 },
|
||||
transactionCount: { type: Number, default: 0 },
|
||||
showPagination: { type: Boolean, default: false },
|
||||
},
|
||||
watch: {
|
||||
timestamp: {
|
||||
immediate: true,
|
||||
handler: 'updateTransactions',
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
hasNext() {
|
||||
return this.currentPage * this.pageSize < this.transactionCount
|
||||
},
|
||||
hasPrevious() {
|
||||
return this.currentPage > 1
|
||||
},
|
||||
totalPages() {
|
||||
return Math.ceil(this.transactionCount / this.pageSize)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getTransaction(id) {
|
||||
return this.transactions.find(t => t.transaction_id === id)
|
||||
},
|
||||
|
||||
updateTransactions() {
|
||||
this.$emit('update-transactions', {
|
||||
firstPage: this.currentPage,
|
||||
items: this.pageSize,
|
||||
})
|
||||
},
|
||||
getProperties(item) {
|
||||
const type = iconsByType[item.type]
|
||||
if (type)
|
||||
return {
|
||||
icon: type.icon,
|
||||
class: type.classes + ' m-mb-1 font2em',
|
||||
operator: type.operator,
|
||||
}
|
||||
this.throwError('no icon to given type')
|
||||
},
|
||||
throwError(msg) {
|
||||
throw new Error(msg)
|
||||
},
|
||||
showNext() {
|
||||
this.currentPage++
|
||||
this.updateTransactions()
|
||||
},
|
||||
showPrevious() {
|
||||
this.currentPage--
|
||||
this.updateTransactions()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.el-table .cell {
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
.el-table .cell {
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user