mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
123 lines
3.1 KiB
Vue
123 lines
3.1 KiB
Vue
<template>
|
|
<div class="pb-4">
|
|
<b-tabs v-model="tabIndex" content-class="" justified>
|
|
<b-tab :title="`Gradido (${$n(balance, 'decimal')} GDD)`" class="px-4">
|
|
<p class="tab-tex">{{ $t('transaction.gdd-text') }}</p>
|
|
|
|
<gdd-transaction-list
|
|
:timestamp="timestamp"
|
|
:transactionCount="transactionCount"
|
|
:transactionLinkCount="transactionLinkCount"
|
|
:transactions="transactions"
|
|
:show-pagination="true"
|
|
@update-transactions="updateTransactions"
|
|
v-on="$listeners"
|
|
/>
|
|
</b-tab>
|
|
|
|
<b-tab :title="titleGdt" class="px-4" @click="updateGdt()">
|
|
<b-row class="mb-3">
|
|
<b-col>{{ $t('transaction.gdt-text') }}</b-col>
|
|
<b-col class="text-right">{{ `${$n(GdtBalance, 'decimal')} GDT` }}</b-col>
|
|
</b-row>
|
|
<gdt-transaction-list
|
|
v-model="currentPage"
|
|
:transactionsGdt="transactionsGdt"
|
|
:transactionGdtCount="transactionGdtCount"
|
|
:pageSize="pageSize"
|
|
/>
|
|
</b-tab>
|
|
</b-tabs>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import GddTransactionList from '@/components/GddTransactionList.vue'
|
|
import GdtTransactionList from '@/components/GdtTransactionList.vue'
|
|
import { listGDTEntriesQuery } from '@/graphql/queries'
|
|
|
|
export default {
|
|
name: 'Transactions',
|
|
components: {
|
|
GddTransactionList,
|
|
GdtTransactionList,
|
|
},
|
|
props: {
|
|
balance: { type: Number, default: 0 },
|
|
GdtBalance: { type: Number, default: 0 },
|
|
transactions: {
|
|
default: () => [],
|
|
},
|
|
transactionCount: { type: Number, default: 0 },
|
|
transactionLinkCount: { type: Number, default: 0 },
|
|
},
|
|
data() {
|
|
return {
|
|
timestamp: Date.now(),
|
|
transactionsGdt: [],
|
|
transactionGdtCount: 0,
|
|
currentPage: 1,
|
|
pageSize: 25,
|
|
tabIndex: 0,
|
|
}
|
|
},
|
|
methods: {
|
|
async updateGdt() {
|
|
this.$apollo
|
|
.query({
|
|
query: listGDTEntriesQuery,
|
|
variables: {
|
|
currentPage: this.currentPage,
|
|
pageSize: this.pageSize,
|
|
},
|
|
})
|
|
.then((result) => {
|
|
const {
|
|
data: { listGDTEntries },
|
|
} = result
|
|
this.transactionsGdt = listGDTEntries.gdtEntries
|
|
this.transactionGdtCount = listGDTEntries.count
|
|
window.scrollTo(0, 0)
|
|
})
|
|
.catch((error) => {
|
|
this.transactionGdtCount = -1
|
|
this.toastError(error.message)
|
|
})
|
|
},
|
|
updateTransactions(pagination) {
|
|
this.$emit('update-transactions', pagination)
|
|
},
|
|
},
|
|
computed: {
|
|
titleGdt(boolean) {
|
|
if (this.tabIndex === 1)
|
|
return `${this.$t('gdt.gdt')} (${this.$n(this.GdtBalance, 'decimal')} GDT)`
|
|
return this.$t('gdt.gdt')
|
|
},
|
|
},
|
|
watch: {
|
|
currentPage() {
|
|
this.updateGdt()
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
<style>
|
|
.nav-tabs > li > a {
|
|
padding-top: 14px;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.nav-tabs .nav-link {
|
|
background-color: rgba(204, 204, 204, 0.185);
|
|
}
|
|
.nav-tabs .nav-link.active {
|
|
background-color: rgb(248 249 254);
|
|
}
|
|
|
|
.tab-content {
|
|
padding-top: 25px;
|
|
border-left: 1px inset rgba(28, 110, 164, 0.1);
|
|
border-right: 1px inset rgba(28, 110, 164, 0.1);
|
|
}
|
|
</style>
|