Fix filter bug
This commit is contained in:
parent
340934ac5f
commit
00cd2705d4
|
|
@ -144,6 +144,12 @@ class DiscardChanges {}
|
|||
|
||||
class ClearEntityFilter {}
|
||||
|
||||
class ClearEntitySelection {
|
||||
ClearEntitySelection({this.entityType});
|
||||
|
||||
final EntityType entityType;
|
||||
}
|
||||
|
||||
class FilterByEntity implements PersistUI {
|
||||
FilterByEntity({this.entityId, this.entityType});
|
||||
|
||||
|
|
@ -189,10 +195,11 @@ void viewEntitiesByType({
|
|||
if (filterEntity != null) {
|
||||
if (uiState.filterEntityType != filterEntity.entityType ||
|
||||
uiState.filterEntityId != filterEntity.id) {
|
||||
filterByEntity(
|
||||
context: context,
|
||||
entity: filterEntity,
|
||||
);
|
||||
store.dispatch(ClearEntitySelection(entityType: entityType));
|
||||
store.dispatch(FilterByEntity(
|
||||
entityId: filterEntity.id,
|
||||
entityType: filterEntity.entityType,
|
||||
));
|
||||
}
|
||||
} else if (uiState.filterEntityType != null) {
|
||||
store.dispatch(ClearEntityFilter());
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ final selectedIdReducer = combineReducers<String>([
|
|||
}),
|
||||
TypedReducer<String, SelectCompany>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
|
||||
action.entityType == EntityType.client ? '' : selectedId),
|
||||
TypedReducer<String, FilterByEntity>((selectedId, action) =>
|
||||
action.entityType == EntityType.client ? action.entityId : selectedId),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ Reducer<String> selectedIdReducer = combineReducers([
|
|||
(selectedId, action) => action.credit.id),
|
||||
TypedReducer<String, SelectCompany>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
|
||||
action.entityType == EntityType.credit ? '' : selectedId),
|
||||
TypedReducer<String, FilterByEntity>((selectedId, action) =>
|
||||
action.entityType == EntityType.credit ? action.entityId : selectedId),
|
||||
]);
|
||||
|
||||
final editingReducer = combineReducers<InvoiceEntity>([
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ Reducer<String> selectedIdReducer = combineReducers([
|
|||
(String selectedId, action) => action.group.id),
|
||||
TypedReducer<String, SelectCompany>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
|
||||
action.entityType == EntityType.group ? '' : selectedId),
|
||||
TypedReducer<String, FilterByEntity>((selectedId, action) =>
|
||||
action.entityType == EntityType.group ? action.entityId : selectedId),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ Reducer<String> selectedIdReducer = combineReducers([
|
|||
(selectedId, action) => action.invoice.id),
|
||||
TypedReducer<String, SelectCompany>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
|
||||
action.entityType == EntityType.invoice ? '' : selectedId),
|
||||
TypedReducer<String, FilterByEntity>((selectedId, action) =>
|
||||
action.entityType == EntityType.invoice ? action.entityId : selectedId),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ Reducer<String> selectedIdReducer = combineReducers([
|
|||
(selectedId, action) => action.payment.id),
|
||||
TypedReducer<String, SelectCompany>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
|
||||
action.entityType == EntityType.payment ? '' : selectedId),
|
||||
TypedReducer<String, FilterByEntity>((selectedId, action) =>
|
||||
action.entityType == EntityType.payment ? action.entityId : selectedId),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/client_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/company/company_actions.dart';
|
||||
|
|
@ -38,6 +39,10 @@ Reducer<String> selectedIdReducer = combineReducers([
|
|||
TypedReducer<String, ShowEmailQuote>((selectedId, action) => action.quote.id),
|
||||
TypedReducer<String, SelectCompany>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
|
||||
action.entityType == EntityType.quote ? '' : selectedId),
|
||||
TypedReducer<String, FilterByEntity>((selectedId, action) =>
|
||||
action.entityType == EntityType.quote ? action.entityId : selectedId),
|
||||
]);
|
||||
|
||||
final editingReducer = combineReducers<InvoiceEntity>([
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ Reducer<String> selectedIdReducer = combineReducers([
|
|||
(String selectedId, action) => action.user.id),
|
||||
TypedReducer<String, SelectCompany>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
|
||||
TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
|
||||
action.entityType == EntityType.user ? '' : selectedId),
|
||||
TypedReducer<String, FilterByEntity>((selectedId, action) =>
|
||||
action.entityType == EntityType.user ? action.entityId : selectedId),
|
||||
]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue