diff --git a/lib/redux/product/product_actions.dart b/lib/redux/product/product_actions.dart index 19f8b4069..03f08ebf4 100644 --- a/lib/redux/product/product_actions.dart +++ b/lib/redux/product/product_actions.dart @@ -192,6 +192,18 @@ class FilterProductsByCustom2 implements PersistUI { final String value; } +class FilterProductsByCustom3 implements PersistUI { + FilterProductsByCustom3(this.value); + + final String value; +} + +class FilterProductsByCustom4 implements PersistUI { + FilterProductsByCustom4(this.value); + + final String value; +} + class FilterProductDropdown { FilterProductDropdown(this.filter); diff --git a/lib/redux/product/product_reducer.dart b/lib/redux/product/product_reducer.dart index 70161a713..0e289bee8 100644 --- a/lib/redux/product/product_reducer.dart +++ b/lib/redux/product/product_reducer.dart @@ -58,6 +58,8 @@ final productListReducer = combineReducers([ TypedReducer(_filterProductsByState), TypedReducer(_filterProductsByCustom1), TypedReducer(_filterProductsByCustom2), + TypedReducer(_filterProductsByCustom3), + TypedReducer(_filterProductsByCustom4), TypedReducer(_startListMultiselect), TypedReducer(_addToListMultiselect), TypedReducer( @@ -95,6 +97,26 @@ ListUIState _filterProductsByCustom2( } } +ListUIState _filterProductsByCustom3( + ListUIState productListState, FilterProductsByCustom3 action) { + if (productListState.custom3Filters.contains(action.value)) { + return productListState + .rebuild((b) => b..custom3Filters.remove(action.value)); + } else { + return productListState.rebuild((b) => b..custom3Filters.add(action.value)); + } +} + +ListUIState _filterProductsByCustom4( + ListUIState productListState, FilterProductsByCustom4 action) { + if (productListState.custom4Filters.contains(action.value)) { + return productListState + .rebuild((b) => b..custom4Filters.remove(action.value)); + } else { + return productListState.rebuild((b) => b..custom4Filters.add(action.value)); + } +} + ListUIState _filterProducts( ListUIState productListState, FilterProducts action) { return productListState.rebuild((b) => b diff --git a/lib/redux/quote/quote_actions.dart b/lib/redux/quote/quote_actions.dart index dd1451264..60713bfcc 100644 --- a/lib/redux/quote/quote_actions.dart +++ b/lib/redux/quote/quote_actions.dart @@ -345,6 +345,18 @@ class FilterQuotesByCustom2 implements PersistUI { final String value; } +class FilterQuotesByCustom3 implements PersistUI { + FilterQuotesByCustom3(this.value); + + final String value; +} + +class FilterQuotesByCustom4 implements PersistUI { + FilterQuotesByCustom4(this.value); + + final String value; +} + class ConvertQuote implements PersistData { ConvertQuote(this.completer, this.quoteId); diff --git a/lib/redux/quote/quote_reducer.dart b/lib/redux/quote/quote_reducer.dart index e25bac230..b1ea74093 100644 --- a/lib/redux/quote/quote_reducer.dart +++ b/lib/redux/quote/quote_reducer.dart @@ -120,6 +120,8 @@ final quoteListReducer = combineReducers([ TypedReducer(_filterQuotes), TypedReducer(_filterQuotesByCustom1), TypedReducer(_filterQuotesByCustom2), + TypedReducer(_filterQuotesByCustom3), + TypedReducer(_filterQuotesByCustom4), TypedReducer(_startListMultiselect), TypedReducer(_addToListMultiselect), TypedReducer( @@ -147,6 +149,26 @@ ListUIState _filterQuotesByCustom2( } } +ListUIState _filterQuotesByCustom3( + ListUIState quoteListState, FilterQuotesByCustom3 action) { + if (quoteListState.custom3Filters.contains(action.value)) { + return quoteListState + .rebuild((b) => b..custom3Filters.remove(action.value)); + } else { + return quoteListState.rebuild((b) => b..custom3Filters.add(action.value)); + } +} + +ListUIState _filterQuotesByCustom4( + ListUIState quoteListState, FilterQuotesByCustom4 action) { + if (quoteListState.custom4Filters.contains(action.value)) { + return quoteListState + .rebuild((b) => b..custom4Filters.remove(action.value)); + } else { + return quoteListState.rebuild((b) => b..custom4Filters.add(action.value)); + } +} + ListUIState _filterQuotesByState( ListUIState quoteListState, FilterQuotesByState action) { if (quoteListState.stateFilters.contains(action.state)) { diff --git a/lib/ui/app/app_bottom_bar.dart b/lib/ui/app/app_bottom_bar.dart index 5bb5605f0..5f0ca9682 100644 --- a/lib/ui/app/app_bottom_bar.dart +++ b/lib/ui/app/app_bottom_bar.dart @@ -16,15 +16,15 @@ class AppBottomBar extends StatefulWidget { this.entityType, this.onSelectedState, this.onSelectedStatus, - @required this.onSelectedCustom1, - @required this.onSelectedCustom2, - @required this.onSelectedCustom3, - @required this.onSelectedCustom4, + this.onSelectedCustom1, + this.onSelectedCustom2, + this.onSelectedCustom3, + this.onSelectedCustom4, this.statuses = const [], - @required this.customValues1 = const [], - @required this.customValues2 = const [], - @required this.customValues3 = const [], - @required this.customValues4 = const [], + this.customValues1 = const [], + this.customValues2 = const [], + this.customValues3 = const [], + this.customValues4 = const [], }); final EntityType entityType; diff --git a/lib/ui/product/product_screen.dart b/lib/ui/product/product_screen.dart index 9992367f1..9061c4f6f 100644 --- a/lib/ui/product/product_screen.dart +++ b/lib/ui/product/product_screen.dart @@ -93,10 +93,18 @@ class ProductScreen extends StatelessWidget { excludeBlank: true), customValues2: company.getCustomFieldValues(CustomFieldType.product2, excludeBlank: true), + customValues3: company.getCustomFieldValues(CustomFieldType.product3, + excludeBlank: true), + customValues4: company.getCustomFieldValues(CustomFieldType.product4, + excludeBlank: true), onSelectedCustom1: (value) => store.dispatch(FilterProductsByCustom1(value)), onSelectedCustom2: (value) => store.dispatch(FilterProductsByCustom2(value)), + onSelectedCustom3: (value) => + store.dispatch(FilterProductsByCustom3(value)), + onSelectedCustom4: (value) => + store.dispatch(FilterProductsByCustom4(value)), sortFields: [ ProductFields.productKey, ProductFields.cost, diff --git a/lib/ui/quote/quote_screen.dart b/lib/ui/quote/quote_screen.dart index d56df07d6..ea61c7885 100644 --- a/lib/ui/quote/quote_screen.dart +++ b/lib/ui/quote/quote_screen.dart @@ -93,10 +93,18 @@ class QuoteScreen extends StatelessWidget { excludeBlank: true), customValues2: company.getCustomFieldValues(CustomFieldType.invoice2, excludeBlank: true), + customValues3: company.getCustomFieldValues(CustomFieldType.invoice3, + excludeBlank: true), + customValues4: company.getCustomFieldValues(CustomFieldType.invoice4, + excludeBlank: true), onSelectedCustom1: (value) => store.dispatch(FilterQuotesByCustom1(value)), onSelectedCustom2: (value) => store.dispatch(FilterQuotesByCustom2(value)), + onSelectedCustom3: (value) => + store.dispatch(FilterQuotesByCustom3(value)), + onSelectedCustom4: (value) => + store.dispatch(FilterQuotesByCustom4(value)), sortFields: [ QuoteFields.quoteNumber, QuoteFields.quoteDate, diff --git a/stubs/redux/stub/stub_actions b/stubs/redux/stub/stub_actions index 088f04f8c..00aa26f20 100644 --- a/stubs/redux/stub/stub_actions +++ b/stubs/redux/stub/stub_actions @@ -233,6 +233,18 @@ class FilterStubsByCustom2 implements PersistUI { final String value; } +class FilterStubsByCustom3 implements PersistUI { + FilterStubsByCustom3(this.value); + + final String value; +} + +class FilterStubsByCustom4 implements PersistUI { + FilterStubsByCustom4(this.value); + + final String value; +} + class FilterStubsByEntity implements PersistUI { FilterStubsByEntity({this.entityId, this.entityType});