CardAdvanceTransactions.vue
3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<script setup>
import { kFormatter } from '@core/utils/formatters'
import arrowGrowth from '@images/cards/arrow-growth.png'
import atmCard from '@images/cards/atm-card.png'
import creditCard from '@images/cards/credit-card.png'
import paypal from '@images/cards/paypal.png'
import wallet from '@images/cards/wallet.png'
const transactions = [
{
gateway: 'PayPal',
for: 'Received Money',
amount: 2482,
img: paypal,
imgHeight: 22,
},
{
gateway: 'Credit Card',
for: 'DigitalOcean',
amount: -1250,
img: creditCard,
imgHeight: 15,
},
{
gateway: 'Mastercard',
for: 'Netflix',
amount: -99,
img: atmCard,
imgHeight: 15,
},
{
gateway: 'Wallet',
for: 'Mac\'D',
amount: -82,
img: wallet,
imgHeight: 18,
},
{
gateway: 'Transfer',
for: 'Refund',
amount: 8934,
img: arrowGrowth,
imgHeight: 12,
},
{
gateway: 'Wallet',
for: 'Buy Apple Watch',
amount: -399,
img: wallet,
imgHeight: 18,
},
]
const transactionsColors = {
'PayPal': 'error',
'Credit Card': 'success',
'Mastercard': 'warning',
'Wallet': 'primary',
'Transfer': 'info',
}
const formateAmount = amount => {
return Math.sign(amount) === 1 ? `+${ kFormatter(amount) }` : `-${ Math.abs(amount) }`
}
</script>
<template>
<VCard>
<!-- SECTION Card Header and Menu -->
<VCardItem>
<!-- 👉 Title -->
<VCardTitle>Transactions</VCardTitle>
<!-- 👉 menu -->
<template #append>
<div class="me-n3">
<MoreBtn />
</div>
</template>
</VCardItem>
<!-- !SECTION -->
<!-- SECTION Transactions List -->
<VCardText>
<VList class="card-list">
<VListItem
v-for="transaction in transactions"
:key="transaction.for"
>
<!-- 👉 Avatar -->
<template #prepend>
<VAvatar
rounded
variant="tonal"
:color="transactionsColors[transaction.gateway]"
>
<img
:src="transaction.img"
:height="transaction.imgHeight"
>
</VAvatar>
</template>
<!-- 👉 Title and Subtitle -->
<VListItemTitle>
<h6 class="text-h6">
{{ transaction.gateway }}
</h6>
</VListItemTitle>
<VListItemSubtitle>
<div class="text-body-1 me-2">
{{ transaction.for }}
</div>
</VListItemSubtitle>
<!-- 👉 Amounts -->
<template #append>
<VListItemAction>
<h6 class="text-h6 me-2">
{{ formateAmount(transaction.amount) }}
</h6>
<VIcon
:size="24"
:color="Math.sign(transaction.amount) === 1 ? 'success' : 'error'"
:icon="Math.sign(transaction.amount) === 1 ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'"
/>
</VListItemAction>
</template>
</VListItem>
</VList>
</VCardText>
<!-- !SECTION -->
</VCard>
</template>
<style lang="scss" scoped>
.card-list {
--v-card-list-gap: 1.5rem;
}
</style>