This commit is contained in:
Hillel Coren 2019-12-15 21:30:12 +02:00
parent 3145476574
commit b8db4744c7
8 changed files with 104 additions and 8 deletions

View File

@ -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);

View File

@ -58,6 +58,8 @@ final productListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, FilterProductsByState>(_filterProductsByState),
TypedReducer<ListUIState, FilterProductsByCustom1>(_filterProductsByCustom1),
TypedReducer<ListUIState, FilterProductsByCustom2>(_filterProductsByCustom2),
TypedReducer<ListUIState, FilterProductsByCustom3>(_filterProductsByCustom3),
TypedReducer<ListUIState, FilterProductsByCustom4>(_filterProductsByCustom4),
TypedReducer<ListUIState, StartProductMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToProductMultiselect>(_addToListMultiselect),
TypedReducer<ListUIState, RemoveFromProductMultiselect>(
@ -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

View File

@ -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);

View File

@ -120,6 +120,8 @@ final quoteListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, FilterQuotes>(_filterQuotes),
TypedReducer<ListUIState, FilterQuotesByCustom1>(_filterQuotesByCustom1),
TypedReducer<ListUIState, FilterQuotesByCustom2>(_filterQuotesByCustom2),
TypedReducer<ListUIState, FilterQuotesByCustom3>(_filterQuotesByCustom3),
TypedReducer<ListUIState, FilterQuotesByCustom4>(_filterQuotesByCustom4),
TypedReducer<ListUIState, StartQuoteMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToQuoteMultiselect>(_addToListMultiselect),
TypedReducer<ListUIState, RemoveFromQuoteMultiselect>(
@ -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)) {

View File

@ -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;

View File

@ -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,

View File

@ -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,

View File

@ -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});