Skip to content

Commit

Permalink
ActivityFilter: add toggle for Unpaid
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Mar 17, 2023
1 parent 0d23a74 commit 3b208e3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions stores/ActivityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface ActivityFilter {
channels: boolean;
sent: boolean;
received: boolean;
unpaid: boolean;
minimumAmount: number;
startDate: any;
endDate: any;
Expand All @@ -38,6 +39,7 @@ export default class ActivityStore {
channels: true,
sent: true,
received: true,
unpaid: true,
startDate: null,
endDate: null
};
Expand Down Expand Up @@ -145,6 +147,7 @@ export default class ActivityStore {
channels: true,
sent: true,
received: true,
unpaid: true,
minimumAmount: 0,
startDate: null,
endDate: null
Expand Down Expand Up @@ -215,6 +218,17 @@ export default class ActivityStore {
);
}

if (filters.unpaid == false) {
filteredActivity = filteredActivity.filter(
(activity: any) =>
!(
activity.model ===
localeString('views.Invoice.title') &&
!activity.isPaid
)
);
}

if (filters.minimumAmount > 0) {
filteredActivity = filteredActivity.filter(
(activity: any) =>
Expand Down
7 changes: 7 additions & 0 deletions views/Activity/ActivityFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default class ActivityFilter extends React.Component<
channels,
sent,
received,
unpaid,
minimumAmount,
startDate,
endDate
Expand Down Expand Up @@ -246,6 +247,12 @@ export default class ActivityFilter extends React.Component<
var: 'received',
type: 'Toggle'
},
{
label: localeString('views.Wallet.Invoices.unpaid'),
value: unpaid,
var: 'unpaid',
type: 'Toggle'
},
{
label: localeString('views.ActivityFilter.minimumAmount'),
value: minimumAmount,
Expand Down

0 comments on commit 3b208e3

Please sign in to comment.