feat: sort payments in wallet (#3642)
Co-authored-by: dni ⚡ <office@dnilabs.com>
This commit is contained in:
parent
7b635a31e5
commit
cd6cfff9cf
5 changed files with 69 additions and 2 deletions
|
|
@ -794,9 +794,11 @@ async def m039_index_payments(db: Connection):
|
||||||
"checking_id",
|
"checking_id",
|
||||||
"payment_hash",
|
"payment_hash",
|
||||||
"amount",
|
"amount",
|
||||||
|
"fee",
|
||||||
"labels",
|
"labels",
|
||||||
"time",
|
"time",
|
||||||
"status",
|
"status",
|
||||||
|
"memo",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,15 @@ class PaymentFilters(FilterModel):
|
||||||
"labels",
|
"labels",
|
||||||
]
|
]
|
||||||
|
|
||||||
__sort_fields__ = ["created_at", "amount", "fee", "memo", "time", "tag"]
|
__sort_fields__ = [
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
"amount",
|
||||||
|
"fee",
|
||||||
|
"memo",
|
||||||
|
"time",
|
||||||
|
"tag",
|
||||||
|
]
|
||||||
|
|
||||||
status: str | None
|
status: str | None
|
||||||
tag: str | None
|
tag: str | None
|
||||||
|
|
|
||||||
2
lnbits/static/bundle-components.min.js
vendored
2
lnbits/static/bundle-components.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -29,6 +29,13 @@ window.app.component('lnbits-payment-list', {
|
||||||
descending: true,
|
descending: true,
|
||||||
rowsNumber: 10
|
rowsNumber: 10
|
||||||
},
|
},
|
||||||
|
sortFields: [
|
||||||
|
{name: 'amount', label: 'Amount'},
|
||||||
|
{name: 'fee', label: 'Fee'},
|
||||||
|
{name: 'memo', label: 'Memo'},
|
||||||
|
{name: 'time', label: 'Creation Date'},
|
||||||
|
{name: 'updated_at', label: 'Last Updated'}
|
||||||
|
],
|
||||||
search: '',
|
search: '',
|
||||||
loading: false
|
loading: false
|
||||||
},
|
},
|
||||||
|
|
@ -243,6 +250,16 @@ window.app.component('lnbits-payment-list', {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
sortByColumn(columnName) {
|
||||||
|
if (this.paymentsTable.pagination.sortBy === columnName) {
|
||||||
|
this.paymentsTable.pagination.descending =
|
||||||
|
!this.paymentsTable.pagination.descending
|
||||||
|
} else {
|
||||||
|
this.paymentsTable.pagination.sortBy = columnName
|
||||||
|
this.paymentsTable.pagination.descending = false
|
||||||
|
}
|
||||||
|
this.fetchPayments()
|
||||||
|
},
|
||||||
fetchPaymentsAsAdmin(walletId, params) {
|
fetchPaymentsAsAdmin(walletId, params) {
|
||||||
params = (params || '') + '&wallet_id=' + walletId
|
params = (params || '') + '&wallet_id=' + walletId
|
||||||
return LNbits.api
|
return LNbits.api
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,46 @@
|
||||||
<span v-text="$t('filter_payments')"></span>
|
<span v-text="$t('filter_payments')"></span>
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
<q-btn color="grey" icon="sort" class="q-pa-sm" flat>
|
||||||
|
<q-menu>
|
||||||
|
<q-list>
|
||||||
|
<template
|
||||||
|
class="full-width"
|
||||||
|
v-for="column in paymentsTable.sortFields"
|
||||||
|
:key="column.name"
|
||||||
|
>
|
||||||
|
<q-item
|
||||||
|
@click="sortByColumn(column.name)"
|
||||||
|
clickable
|
||||||
|
v-ripple
|
||||||
|
v-close-popup
|
||||||
|
dense
|
||||||
|
>
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label lines="1" class="full-width"
|
||||||
|
><span v-text="column.label"></span
|
||||||
|
></q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section side>
|
||||||
|
<template
|
||||||
|
v-if="paymentsTable.pagination.sortBy === column.name"
|
||||||
|
>
|
||||||
|
<q-icon
|
||||||
|
v-if="paymentsTable.pagination.descending"
|
||||||
|
name="arrow_downward"
|
||||||
|
></q-icon>
|
||||||
|
<q-icon v-else name="arrow_upward"></q-icon>
|
||||||
|
</template>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-list>
|
||||||
|
</q-menu>
|
||||||
|
<q-tooltip>
|
||||||
|
<span v-text="$t('filter_payments')"></span>
|
||||||
|
</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
dense
|
dense
|
||||||
outline
|
outline
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue