From 3aef1605be5eecf3c28e83d114cfe37b820f7a42 Mon Sep 17 00:00:00 2001 From: jackstar12 <62219658+jackstar12@users.noreply.github.com> Date: Tue, 15 Aug 2023 13:39:12 +0200 Subject: [PATCH] Fix csv export (#1852) * fetch all payments for csv export * include fiat amount and currency in export --- lnbits/core/static/js/wallet.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/lnbits/core/static/js/wallet.js b/lnbits/core/static/js/wallet.js index 60dd687da..4b8993dba 100644 --- a/lnbits/core/static/js/wallet.js +++ b/lnbits/core/static/js/wallet.js @@ -175,6 +175,12 @@ new Vue({ }, paymentsCSV: { columns: [ + { + name: 'pending', + align: 'left', + label: 'Pending', + field: 'pending' + }, { name: 'memo', align: 'left', @@ -224,6 +230,18 @@ new Vue({ align: 'right', label: this.$t('webhook'), field: 'webhook' + }, + { + name: 'fiat_currency', + align: 'right', + label: 'Fiat Currency', + field: row => row.extra.wallet_fiat_currency + }, + { + name: 'fiat_amount', + align: 'right', + label: 'Fiat Amount', + field: row => row.extra.wallet_fiat_amount } ], filter: null, @@ -792,14 +810,10 @@ new Vue({ // status is important for export but it is not in paymentsTable // because it is manually added with payment detail link and icons // and would cause duplication in the list - let columns = structuredClone(this.paymentsCSV.columns) - columns.unshift({ - name: 'pending', - align: 'left', - label: 'Pending', - field: 'pending' + LNbits.api.getPayments(this.g.wallet, {}).then(response => { + const payments = response.data.data.map(LNbits.map.payment) + LNbits.utils.exportCSV(this.paymentsCSV.columns, payments) }) - LNbits.utils.exportCSV(columns, this.payments) }, pasteToTextArea: function () { navigator.clipboard.readText().then(text => {