Transactions
This commit is contained in:
parent
0f7fee4501
commit
b24b6c4a8a
|
|
@ -210,6 +210,21 @@ abstract class TransactionEntity extends Object
|
|||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
bool matchesStatuses(BuiltList<EntityStatus> statuses) {
|
||||
if (statuses.isEmpty) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (final status in statuses) {
|
||||
if (status.id == calculatedStatusId || status.id == calculatedStatusId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
bool matchesFilter(String filter) {
|
||||
return matchesStrings(
|
||||
|
|
|
|||
|
|
@ -212,6 +212,12 @@ class FilterTransactionsByState implements PersistUI {
|
|||
final EntityState state;
|
||||
}
|
||||
|
||||
class FilterTransactionsByStatus implements PersistUI {
|
||||
FilterTransactionsByStatus(this.status);
|
||||
|
||||
final TransactionStatusEntity status;
|
||||
}
|
||||
|
||||
class FilterTransactionsByCustom1 implements PersistUI {
|
||||
FilterTransactionsByCustom1(this.value);
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ final transactionListReducer = combineReducers<ListUIState>([
|
|||
TypedReducer<ListUIState, SortTransactions>(_sortTransactions),
|
||||
TypedReducer<ListUIState, FilterTransactionsByState>(
|
||||
_filterTransactionsByState),
|
||||
TypedReducer<ListUIState, FilterTransactionsByStatus>(
|
||||
_filterTransactionsByStatus),
|
||||
TypedReducer<ListUIState, FilterTransactions>(_filterTransactions),
|
||||
TypedReducer<ListUIState, FilterTransactionsByCustom1>(
|
||||
_filterTransactionsByCustom1),
|
||||
|
|
@ -155,6 +157,17 @@ ListUIState _filterTransactionsByState(
|
|||
}
|
||||
}
|
||||
|
||||
ListUIState _filterTransactionsByStatus(
|
||||
ListUIState transactionListState, FilterTransactionsByStatus action) {
|
||||
if (transactionListState.statusFilters.contains(action.status)) {
|
||||
return transactionListState
|
||||
.rebuild((b) => b..statusFilters.remove(action.status));
|
||||
} else {
|
||||
return transactionListState
|
||||
.rebuild((b) => b..statusFilters.add(action.status));
|
||||
}
|
||||
}
|
||||
|
||||
ListUIState _filterTransactions(
|
||||
ListUIState transactionListState, FilterTransactions action) {
|
||||
return transactionListState.rebuild((b) => b
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ class TransactionScreen extends StatelessWidget {
|
|||
onSelectedState: (EntityState state, value) {
|
||||
store.dispatch(FilterTransactionsByState(state));
|
||||
},
|
||||
onSelectedStatus: (EntityStatus status, value) {
|
||||
store.dispatch(FilterTransactionsByStatus(status));
|
||||
},
|
||||
statuses: statuses,
|
||||
),
|
||||
onCheckboxPressed: () {
|
||||
if (store.state.transactionListState.isInMultiselect()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue