mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
124 lines
4.2 KiB
Vue
124 lines
4.2 KiB
Vue
<template>
|
|
<div class="gdd-transaction-list">
|
|
<b-list-group>
|
|
<b-list-group-item
|
|
v-for="item in transactions.slice(0, max)"
|
|
:key="item.id"
|
|
style="background-color: #ebebeba3 !important"
|
|
>
|
|
<div class="d-flex gdd-transaction-list-item" v-b-toggle="'a' + item.date + ''">
|
|
<div style="width: 8%">
|
|
<b-icon :icon="getProperties(item).icon" :class="getProperties(item).class" />
|
|
</div>
|
|
<div class="font1_2em pr-2 text-right" style="width: 32%">
|
|
<span>{{ getProperties(item).operator }}</span>
|
|
{{ $n(item.balance, 'decimal') }}
|
|
</div>
|
|
<div class="font1_2em text-left pl-2" style="width: 55%">
|
|
{{ item.name ? item.name : $t('decay') }}
|
|
<div v-if="item.date" class="text-sm">{{ $d($moment(item.date), 'long') }}</div>
|
|
</div>
|
|
<div class="text-right" style="width: 5%">
|
|
<b-button class="btn-sm">
|
|
<b>i</b>
|
|
</b-button>
|
|
</div>
|
|
</div>
|
|
<b-collapse :id="'a' + item.date + ''" class="mt-2">
|
|
<b-card>
|
|
<b-list-group>
|
|
<b-list-group-item v-if="item.type === 'send'">
|
|
<b-badge class="mr-4" variant="primary" pill>{{ $t('form.receiver') }}</b-badge>
|
|
{{ item.name }}
|
|
</b-list-group-item>
|
|
<b-list-group-item v-else>
|
|
<b-badge class="mr-4" variant="primary" pill>{{ $t('form.sender') }}</b-badge>
|
|
{{ item.name }}
|
|
</b-list-group-item>
|
|
|
|
<b-list-group-item>
|
|
<b-badge class="mr-4" variant="primary" pill>type</b-badge>
|
|
{{ item.type }}
|
|
</b-list-group-item>
|
|
<b-list-group-item>
|
|
<b-badge class="mr-5" variant="primary" pill>id</b-badge>
|
|
{{ item.transaction_id }}
|
|
</b-list-group-item>
|
|
<b-list-group-item>
|
|
<b-badge class="mr-4" variant="primary" pill>{{ $t('form.date') }}</b-badge>
|
|
{{ item.date }}
|
|
</b-list-group-item>
|
|
<b-list-group-item>
|
|
<b-badge class="mr-4" variant="primary" pill>gdd</b-badge>
|
|
{{ item.balance }}
|
|
</b-list-group-item>
|
|
<b-list-group-item>
|
|
<b-badge class="mr-4" variant="primary" pill>{{ $t('form.memo') }}</b-badge>
|
|
{{ item.memo }}
|
|
</b-list-group-item>
|
|
</b-list-group>
|
|
<b-button v-b-toggle="'collapse-1-inner' + item.date" variant="secondary">
|
|
{{ $t('transaction.more') }}
|
|
</b-button>
|
|
<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>
|
|
<div v-if="transactions.length === 0" class="mt-4 text-center">
|
|
<span>{{ $t('transaction.nullTransactions') }}</span>
|
|
</div>
|
|
</b-list-group>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
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',
|
|
props: {
|
|
transactions: { default: () => [] },
|
|
max: { type: Number, default: 1000 },
|
|
timestamp: { type: Number, default: 0 },
|
|
transactionCount: { type: Number, default: 0 },
|
|
},
|
|
watch: {
|
|
timestamp: {
|
|
immediate: true,
|
|
handler: 'updateTransactions',
|
|
},
|
|
},
|
|
methods: {
|
|
updateTransactions() {
|
|
this.$emit('update-transactions')
|
|
},
|
|
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)
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
<style>
|
|
.el-table .cell {
|
|
padding-left: 0px;
|
|
padding-right: 0px;
|
|
}
|
|
</style>
|