This commit is contained in:
Hillel Coren 2019-12-15 21:25:39 +02:00
parent db390d8495
commit 3145476574
4 changed files with 51 additions and 0 deletions

View File

@ -234,6 +234,18 @@ class FilterProjectsByCustom2 implements PersistUI {
final String value;
}
class FilterProjectsByCustom3 implements PersistUI {
FilterProjectsByCustom3(this.value);
final String value;
}
class FilterProjectsByCustom4 implements PersistUI {
FilterProjectsByCustom4(this.value);
final String value;
}
class FilterProjectsByEntity implements PersistUI {
FilterProjectsByEntity({this.entityId, this.entityType});

View File

@ -65,6 +65,8 @@ final projectListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, FilterProjects>(_filterProjects),
TypedReducer<ListUIState, FilterProjectsByCustom1>(_filterProjectsByCustom1),
TypedReducer<ListUIState, FilterProjectsByCustom2>(_filterProjectsByCustom2),
TypedReducer<ListUIState, FilterProjectsByCustom3>(_filterProjectsByCustom3),
TypedReducer<ListUIState, FilterProjectsByCustom4>(_filterProjectsByCustom4),
TypedReducer<ListUIState, FilterProjectsByEntity>(_filterProjectsByClient),
TypedReducer<ListUIState, StartProjectMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToProjectMultiselect>(_addToListMultiselect),
@ -100,6 +102,26 @@ ListUIState _filterProjectsByCustom2(
}
}
ListUIState _filterProjectsByCustom3(
ListUIState projectListState, FilterProjectsByCustom3 action) {
if (projectListState.custom3Filters.contains(action.value)) {
return projectListState
.rebuild((b) => b..custom3Filters.remove(action.value));
} else {
return projectListState.rebuild((b) => b..custom3Filters.add(action.value));
}
}
ListUIState _filterProjectsByCustom4(
ListUIState projectListState, FilterProjectsByCustom4 action) {
if (projectListState.custom4Filters.contains(action.value)) {
return projectListState
.rebuild((b) => b..custom4Filters.remove(action.value));
} else {
return projectListState.rebuild((b) => b..custom4Filters.add(action.value));
}
}
ListUIState _filterProjectsByState(
ListUIState projectListState, FilterProjectsByState action) {
if (projectListState.stateFilters.contains(action.state)) {

View File

@ -26,6 +26,7 @@ class PaymentScreen extends StatelessWidget {
Widget build(BuildContext context) {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final company = state.company;
final userCompany = state.userCompany;
final localization = AppLocalization.of(context);
final listUIState = state.uiState.paymentUIState.listUIState;
@ -86,6 +87,14 @@ class PaymentScreen extends StatelessWidget {
bottomNavigationBar: AppBottomBar(
entityType: EntityType.payment,
onSelectedSortField: (value) => store.dispatch(SortPayments(value)),
customValues1: company.getCustomFieldValues(CustomFieldType.payment1,
excludeBlank: true),
customValues2: company.getCustomFieldValues(CustomFieldType.payment2,
excludeBlank: true),
customValues3: company.getCustomFieldValues(CustomFieldType.payment3,
excludeBlank: true),
customValues4: company.getCustomFieldValues(CustomFieldType.payment4,
excludeBlank: true),
onSelectedCustom1: (value) =>
store.dispatch(FilterPaymentsByCustom1(value)),
onSelectedCustom2: (value) =>

View File

@ -93,10 +93,18 @@ class ProjectScreen extends StatelessWidget {
excludeBlank: true),
customValues2: company.getCustomFieldValues(CustomFieldType.project2,
excludeBlank: true),
customValues3: company.getCustomFieldValues(CustomFieldType.project3,
excludeBlank: true),
customValues4: company.getCustomFieldValues(CustomFieldType.project4,
excludeBlank: true),
onSelectedCustom1: (value) =>
store.dispatch(FilterProjectsByCustom1(value)),
onSelectedCustom2: (value) =>
store.dispatch(FilterProjectsByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterProjectsByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterProjectsByCustom4(value)),
sortFields: [
ProjectFields.name,
ProjectFields.updatedAt,