From 1730c5cd815f8b2a2c465cab83754552da5a6c1e Mon Sep 17 00:00:00 2001 From: padreug Date: Sun, 22 Jun 2025 17:15:18 +0200 Subject: [PATCH] Refactor transaction table: Disable sorting for transaction fields and streamline date formatting in the dashboard display for improved clarity and consistency. --- static/js/index.js | 21 +++++++-------------- templates/satmachineclient/index.html | 4 ++-- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index c9fb6e5..f91c022 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -15,42 +15,35 @@ window.app = Vue.createApp({ label: 'Date', align: 'left', field: row => row.transaction_time || row.created_at, - format: val => val, - 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; - } + sortable: false }, { name: 'amount_sats', label: 'Bitcoin', align: 'right', field: 'amount_sats', - sortable: true + sortable: false }, { name: 'amount_fiat', label: 'Fiat Amount', align: 'right', field: 'amount_fiat', - sortable: true + sortable: false }, { name: 'type', label: 'Type', align: 'center', field: 'transaction_type', - sortable: true + sortable: false }, { name: 'status', label: 'Status', align: 'center', field: 'status', - sortable: true + sortable: false } ], transactionPagination: { @@ -125,11 +118,11 @@ window.app = Vue.createApp({ '/satmachineclient/api/v1/dashboard/transactions?limit=50', 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) => { const dateA = new Date(a.transaction_time || a.created_at) const dateB = new Date(b.transaction_time || b.created_at) - return dateB - dateA + return dateB - dateA // Most recent first }) } catch (error) { console.error('Error loading transactions:', error) diff --git a/templates/satmachineclient/index.html b/templates/satmachineclient/index.html index a09834a..1cddfa4 100644 --- a/templates/satmachineclient/index.html +++ b/templates/satmachineclient/index.html @@ -192,9 +192,9 @@