2020-06-22 18:03:57 +02:00
|
|
|
<template>
|
|
|
|
|
<table class="table table-striped">
|
2020-06-29 08:04:38 +02:00
|
|
|
<caption style="display:none;">A table containing transactions.</caption>
|
2020-06-27 17:33:18 +02:00
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2020-06-29 08:04:38 +02:00
|
|
|
<th class="text-left">Description</th>
|
|
|
|
|
<th class="text-right">Amount</th>
|
2020-06-27 17:33:18 +02:00
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
2020-06-29 08:04:38 +02:00
|
|
|
<tr v-for="transaction in this.transactions">
|
2020-06-22 18:03:57 +02:00
|
|
|
<td>
|
2020-06-29 08:04:38 +02:00
|
|
|
<a :href="'transactions/show/' + transaction.id " :title="transaction.date">
|
2020-06-22 18:03:57 +02:00
|
|
|
<span v-if="transaction.attributes.transactions.length > 1">{{ transaction.attributes.group_title }}</span>
|
|
|
|
|
<span v-if="1===transaction.attributes.transactions.length">{{ transaction.attributes.transactions[0].description }}</span>
|
|
|
|
|
</a>
|
|
|
|
|
</td>
|
|
|
|
|
<td style="text-align:right;">
|
|
|
|
|
<span v-for="tr in transaction.attributes.transactions">
|
|
|
|
|
<span v-if="'withdrawal' === tr.type" class="text-danger">
|
|
|
|
|
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount * -1)}}<br>
|
|
|
|
|
</span>
|
|
|
|
|
<span v-if="'deposit' === tr.type" class="text-success">
|
|
|
|
|
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount)}}<br>
|
|
|
|
|
</span>
|
2020-06-29 08:04:38 +02:00
|
|
|
<span v-if="'transfer' === tr.type && tr.source_id === account_id" class="text-info">
|
|
|
|
|
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount * -1)}}<br>
|
|
|
|
|
</span>
|
|
|
|
|
<span v-if="'transfer' === tr.type && tr.destination_id === account_id" class="text-info">
|
|
|
|
|
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount)}}<br>
|
|
|
|
|
</span>
|
2020-06-22 18:03:57 +02:00
|
|
|
</span>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2020-06-27 17:33:18 +02:00
|
|
|
</tbody>
|
2020-06-22 18:03:57 +02:00
|
|
|
</table>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name: "TransactionListSmall",
|
|
|
|
|
props: {
|
|
|
|
|
transactions: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: function () {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-06-29 08:04:38 +02:00
|
|
|
account_id: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: function() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-06-22 18:03:57 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
</style>
|