Refactor transaction table: Disable sorting for transaction fields and streamline date formatting in the dashboard display for improved clarity and consistency.
This commit is contained in:
parent
9c4b7a307a
commit
1730c5cd81
2 changed files with 9 additions and 16 deletions
|
|
@ -15,42 +15,35 @@ window.app = Vue.createApp({
|
||||||
label: 'Date',
|
label: 'Date',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: row => row.transaction_time || row.created_at,
|
field: row => row.transaction_time || row.created_at,
|
||||||
format: val => val,
|
sortable: false
|
||||||
sortable: true,
|
|
||||||
sort: (a, b, rowA, rowB) => {
|
|
||||||
// Sort by most recent first
|
|
||||||
const dateA = new Date(rowA.transaction_time || rowA.created_at);
|
|
||||||
const dateB = new Date(rowB.transaction_time || rowB.created_at);
|
|
||||||
return dateB - dateA;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'amount_sats',
|
name: 'amount_sats',
|
||||||
label: 'Bitcoin',
|
label: 'Bitcoin',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'amount_sats',
|
field: 'amount_sats',
|
||||||
sortable: true
|
sortable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'amount_fiat',
|
name: 'amount_fiat',
|
||||||
label: 'Fiat Amount',
|
label: 'Fiat Amount',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'amount_fiat',
|
field: 'amount_fiat',
|
||||||
sortable: true
|
sortable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'type',
|
name: 'type',
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
field: 'transaction_type',
|
field: 'transaction_type',
|
||||||
sortable: true
|
sortable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'status',
|
name: 'status',
|
||||||
label: 'Status',
|
label: 'Status',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
field: 'status',
|
field: 'status',
|
||||||
sortable: true
|
sortable: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
transactionPagination: {
|
transactionPagination: {
|
||||||
|
|
@ -125,11 +118,11 @@ window.app = Vue.createApp({
|
||||||
'/satmachineclient/api/v1/dashboard/transactions?limit=50',
|
'/satmachineclient/api/v1/dashboard/transactions?limit=50',
|
||||||
this.g.user.wallets[0].inkey
|
this.g.user.wallets[0].inkey
|
||||||
)
|
)
|
||||||
// Sort transactions by most recent first
|
// Sort by most recent first and store
|
||||||
this.transactions = data.sort((a, b) => {
|
this.transactions = data.sort((a, b) => {
|
||||||
const dateA = new Date(a.transaction_time || a.created_at)
|
const dateA = new Date(a.transaction_time || a.created_at)
|
||||||
const dateB = new Date(b.transaction_time || b.created_at)
|
const dateB = new Date(b.transaction_time || b.created_at)
|
||||||
return dateB - dateA
|
return dateB - dateA // Most recent first
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading transactions:', error)
|
console.error('Error loading transactions:', error)
|
||||||
|
|
|
||||||
|
|
@ -192,9 +192,9 @@
|
||||||
|
|
||||||
<template v-slot:body-cell-date="props">
|
<template v-slot:body-cell-date="props">
|
||||||
<q-td :props="props">
|
<q-td :props="props">
|
||||||
<div>${formatDate(props.row.transaction_time || props.row.created_at)}</div>
|
<div>${formatDate(props.value)}</div>
|
||||||
<div class="text-caption text-grey">
|
<div class="text-caption text-grey">
|
||||||
${formatTime(props.row.transaction_time || props.row.created_at)}
|
${formatTime(props.value)}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue