feat: add failed payments toggle to wallet page (#2794)

* feat: add failed payments toggle to wallet page

---------

Co-authored-by: Tiago Vasconcelos <talvasconcelos@gmail.com>
This commit is contained in:
dni ⚡
2024-12-10 11:47:09 +01:00
committed by GitHub
co-authored by Tiago Vasconcelos
parent 5104cbb285
commit 7ee78248b7
7 changed files with 54 additions and 23 deletions
+1
View File
@@ -127,6 +127,7 @@ class Payment(BaseModel):
class PaymentFilters(FilterModel): class PaymentFilters(FilterModel):
__search_fields__ = ["memo", "amount"] __search_fields__ = ["memo", "amount"]
status: str
checking_id: str checking_id: str
amount: int amount: int
fee: int fee: int
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -378,6 +378,7 @@ window.LNbits = {
prepareFilterQuery(tableConfig, props) { prepareFilterQuery(tableConfig, props) {
if (props) { if (props) {
tableConfig.pagination = props.pagination tableConfig.pagination = props.pagination
tableConfig.filter = props.filter
} }
let pagination = tableConfig.pagination let pagination = tableConfig.pagination
tableConfig.loading = true tableConfig.loading = true
+14 -1
View File
@@ -6,6 +6,7 @@ window.app.component('payment-list', {
data: function () { data: function () {
return { return {
denomination: LNBITS_DENOMINATION, denomination: LNBITS_DENOMINATION,
failedPaymentsToggle: false,
payments: [], payments: [],
paymentsTable: { paymentsTable: {
columns: [ columns: [
@@ -32,6 +33,9 @@ window.app.component('payment-list', {
rowsNumber: 10 rowsNumber: 10
}, },
search: null, search: null,
filter: {
'status[ne]': 'failed'
},
loading: false loading: false
}, },
exportTagName: '', exportTagName: '',
@@ -107,7 +111,6 @@ window.app.component('payment-list', {
field: row => row.extra.wallet_fiat_amount field: row => row.extra.wallet_fiat_amount
} }
], ],
filter: null,
loading: false loading: false
} }
} }
@@ -215,6 +218,16 @@ window.app.component('payment-list', {
} }
}, },
watch: { watch: {
failedPaymentsToggle(newVal) {
if (newVal === false) {
this.paymentsTable.filter = {
'status[ne]': 'failed'
}
} else {
this.paymentsTable.filter = null
}
this.fetchPayments()
},
lazy: function (newVal) { lazy: function (newVal) {
if (newVal === true) this.fetchPayments() if (newVal === true) this.fetchPayments()
}, },
+35 -20
View File
@@ -570,7 +570,10 @@
<template id="payment-list"> <template id="payment-list">
<div class="row items-center no-wrap q-mb-sm"> <div class="row items-center no-wrap q-mb-sm">
<div class="col"> <div class="col">
<h5 class="text-subtitle1 q-my-none" :v-text="$t('transactions')"></h5> <span
class="text-subtitle1 q-my-none col q-mr-sm"
v-text="$t('transactions')"
></span>
</div> </div>
<div class="gt-sm col-auto"> <div class="gt-sm col-auto">
<q-btn-dropdown <q-btn-dropdown
@@ -578,7 +581,7 @@
persistent persistent
class="q-mr-sm" class="q-mr-sm"
color="grey" color="grey"
:label="$t('export_csv')" label="Export"
split split
@click="exportCSV(false)" @click="exportCSV(false)"
> >
@@ -627,26 +630,38 @@
</q-item> </q-item>
</q-list> </q-list>
</q-btn-dropdown> </q-btn-dropdown>
<payment-chart :wallet="wallet" /> <payment-chart :wallet="wallet"></payment-chart>
<q-checkbox
v-model="failedPaymentsToggle"
checked-icon="warning"
unchecked-icon="warning_off"
:color="failedPaymentsToggle ? 'yellow' : 'grey'"
size="xs"
>
<q-tooltip>
<span v-text="`View failed payments`"></span>
</q-tooltip>
</q-checkbox>
</div> </div>
</div> </div>
<q-input <div class="row q-my-md">
:style=" <q-input
$q.screen.lt.md :style="
? { $q.screen.lt.md
display: mobileSimple ? 'none !important' : '' ? {
} display: mobileSimple ? 'none !important' : ''
: '' }
" : ''
filled "
dense filled
clearable dense
v-model="paymentsTable.search" clearable
debounce="300" v-model="paymentsTable.search"
:placeholder="$t('search_by_tag_memo_amount')" debounce="300"
class="q-mb-md" :placeholder="$t('search_by_tag_memo_amount')"
> class="col"
</q-input> />
</div>
<q-table <q-table
dense dense
flat flat