Reports
This commit is contained in:
parent
8908e54837
commit
8be56443bc
|
|
@ -448,7 +448,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
//return 'isAuthenticated: ${authState.isAuthenticated}';
|
||||
//return 'MultiSelect: ${productListState.isInMultiselect()} SelectedIds: ${productListState.selectedIds}';
|
||||
//return 'History: $historyList';
|
||||
return 'Settings: ${userCompany.settings}';
|
||||
return 'Report State: ${uiState.reportsUIState}, Settings: ${userCompany.settings}';
|
||||
return 'Layout: ${prefState.appLayout}, Route: ${uiState.currentRoute} Prev: ${uiState.previousRoute}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
|
||||
|
|
@ -20,7 +21,7 @@ class UpdateReportSettings implements PersistUI {
|
|||
});
|
||||
|
||||
final String report;
|
||||
final Map<String, String> filters;
|
||||
final BuiltMap<String, String> filters;
|
||||
final int sortIndex;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ import 'package:invoiceninja_flutter/redux/reports/reports_state.dart';
|
|||
ReportsUIState reportsUIReducer(ReportsUIState state, dynamic action) {
|
||||
if (action is UpdateReportSettings) {
|
||||
return state.rebuild((b) => b
|
||||
..report = action.report ?? state.report);
|
||||
..report = action.report ?? state.report
|
||||
..filters.replace(action.filters ?? state.filters));
|
||||
} else if (action is SelectCompany) {
|
||||
//return state.rebuild((b) => b..currencyId = action.company.jcurrencyId);
|
||||
// TODO re-enable
|
||||
|
|
|
|||
|
|
@ -226,6 +226,10 @@ class _ReportDataTableState extends State<ReportDataTable> {
|
|||
_textEditingControllers[state.uiState.reportsUIState.report],
|
||||
(column, value) {
|
||||
print('## Filter changed: $column, $value');
|
||||
widget.viewModel.onReportFiltersChanged(
|
||||
context,
|
||||
state.uiState.reportsUIState.filters
|
||||
.rebuild((b) => b..addAll({column: value})));
|
||||
}),
|
||||
...reportResult.tableRows(context),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class ReportsScreenVM {
|
|||
@required this.state,
|
||||
@required this.onSettingsChanged,
|
||||
@required this.onReportColumnsChanged,
|
||||
@required this.onReportFiltersChanged,
|
||||
@required this.onReportSorted,
|
||||
@required this.reportResult,
|
||||
});
|
||||
|
|
@ -44,11 +45,13 @@ class ReportsScreenVM {
|
|||
final AppState state;
|
||||
final ReportResult reportResult;
|
||||
final Function(BuildContext, List<String>) onReportColumnsChanged;
|
||||
final Function(BuildContext, BuiltMap<String, String>) onReportFiltersChanged;
|
||||
final Function(int, bool) onReportSorted;
|
||||
final Function({String report}) onSettingsChanged;
|
||||
|
||||
static ReportsScreenVM fromStore(Store<AppState> store) {
|
||||
final state = store.state;
|
||||
final report = state.uiState.reportsUIState.report;
|
||||
ReportResult reportResult;
|
||||
|
||||
switch (state.uiState.reportsUIState.report) {
|
||||
|
|
@ -70,8 +73,13 @@ class ReportsScreenVM {
|
|||
sortIndex: index,
|
||||
));
|
||||
},
|
||||
onReportFiltersChanged: (context, filterMap) {
|
||||
store.dispatch(UpdateReportSettings(
|
||||
report: report,
|
||||
filters: filterMap,
|
||||
));
|
||||
},
|
||||
onReportColumnsChanged: (context, columns) {
|
||||
final report = state.uiState.reportsUIState.report;
|
||||
final allReportSettings = state.userCompany.settings.reportSettings;
|
||||
final reportSettings =
|
||||
(allReportSettings != null && allReportSettings.containsKey(report)
|
||||
|
|
|
|||
Loading…
Reference in New Issue