[feat] filter payments in wallet (#2997)
* fix: search payments * fix rogue button * feat: UI polishing * feat: better charts --------- Co-authored-by: Tiago Vasconcelos <talvasconcelos@gmail.com>
This commit is contained in:
co-authored by
Tiago Vasconcelos
parent
5dc1705fa6
commit
5aa1f9b0f8
@@ -854,7 +854,9 @@ window.WalletPageLogic = {
|
||||
handleFilterChange(value = {}) {
|
||||
if (
|
||||
this.paymentsFilter['time[ge]'] !== value['time[ge]'] ||
|
||||
this.paymentsFilter['time[le]'] !== value['time[le]']
|
||||
this.paymentsFilter['time[le]'] !== value['time[le]'] ||
|
||||
this.paymentsFilter['amount[ge]'] !== value['amount[ge]'] ||
|
||||
this.paymentsFilter['amount[le]'] !== value['amount[le]']
|
||||
) {
|
||||
this.refreshCharts()
|
||||
}
|
||||
@@ -884,6 +886,19 @@ window.WalletPageLogic = {
|
||||
filterChartData(data) {
|
||||
const timeFrom = this.paymentsFilter['time[ge]'] + 'T00:00:00'
|
||||
const timeTo = this.paymentsFilter['time[le]'] + 'T23:59:59'
|
||||
|
||||
let totalBalance = 0
|
||||
data = data.map(p => {
|
||||
if (this.paymentsFilter['amount[ge]'] !== undefined) {
|
||||
totalBalance += p.balance_in
|
||||
return {...p, balance: totalBalance, balance_out: 0, count_out: 0}
|
||||
}
|
||||
if (this.paymentsFilter['amount[le]'] !== undefined) {
|
||||
totalBalance -= p.balance_out
|
||||
return {...p, balance: totalBalance, balance_in: 0, count_in: 0}
|
||||
}
|
||||
return {...p}
|
||||
})
|
||||
data = data.filter(p => {
|
||||
if (
|
||||
this.paymentsFilter['time[ge]'] &&
|
||||
@@ -899,6 +914,7 @@ window.WalletPageLogic = {
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
const labels = data.map(s =>
|
||||
new Date(s.date).toLocaleString('default', {
|
||||
month: 'short',
|
||||
|
||||
Reference in New Issue
Block a user