Reports
This commit is contained in:
parent
93b4b2a3c3
commit
2c3345dc8c
|
|
@ -17,6 +17,7 @@ class UpdateReportSettings implements PersistUI {
|
||||||
UpdateReportSettings({
|
UpdateReportSettings({
|
||||||
@required this.report,
|
@required this.report,
|
||||||
this.filters,
|
this.filters,
|
||||||
|
this.groupBy,
|
||||||
this.sortIndex,
|
this.sortIndex,
|
||||||
this.customStartDate,
|
this.customStartDate,
|
||||||
this.customEndDate,
|
this.customEndDate,
|
||||||
|
|
@ -24,6 +25,7 @@ class UpdateReportSettings implements PersistUI {
|
||||||
|
|
||||||
final String report;
|
final String report;
|
||||||
final BuiltMap<String, String> filters;
|
final BuiltMap<String, String> filters;
|
||||||
|
final String groupBy;
|
||||||
final int sortIndex;
|
final int sortIndex;
|
||||||
final String customStartDate;
|
final String customStartDate;
|
||||||
final String customEndDate;
|
final String customEndDate;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ ReportsUIState reportsUIReducer(ReportsUIState state, dynamic action) {
|
||||||
if (action is UpdateReportSettings) {
|
if (action is UpdateReportSettings) {
|
||||||
return state.rebuild((b) => b
|
return state.rebuild((b) => b
|
||||||
..report = action.report ?? state.report
|
..report = action.report ?? state.report
|
||||||
|
..groupBy = action.groupBy ?? state.groupBy
|
||||||
..customStartDate = action.customStartDate ?? state.customStartDate
|
..customStartDate = action.customStartDate ?? state.customStartDate
|
||||||
..customEndDate = action.customEndDate ?? state.customEndDate
|
..customEndDate = action.customEndDate ?? state.customEndDate
|
||||||
..filters.replace(action.filters ?? state.filters));
|
..filters.replace(action.filters ?? state.filters));
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ abstract class ReportsUIState
|
||||||
report: kReportClient,
|
report: kReportClient,
|
||||||
customStartDate: '',
|
customStartDate: '',
|
||||||
customEndDate: '',
|
customEndDate: '',
|
||||||
|
groupBy: '',
|
||||||
filters: BuiltMap<String, String>(),
|
filters: BuiltMap<String, String>(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -20,6 +21,8 @@ abstract class ReportsUIState
|
||||||
|
|
||||||
String get report;
|
String get report;
|
||||||
|
|
||||||
|
String get groupBy;
|
||||||
|
|
||||||
String get customStartDate;
|
String get customStartDate;
|
||||||
|
|
||||||
String get customEndDate;
|
String get customEndDate;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ class _$ReportsUIStateSerializer
|
||||||
'report',
|
'report',
|
||||||
serializers.serialize(object.report,
|
serializers.serialize(object.report,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
|
'groupBy',
|
||||||
|
serializers.serialize(object.groupBy,
|
||||||
|
specifiedType: const FullType(String)),
|
||||||
'customStartDate',
|
'customStartDate',
|
||||||
serializers.serialize(object.customStartDate,
|
serializers.serialize(object.customStartDate,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
|
|
@ -54,6 +57,10 @@ class _$ReportsUIStateSerializer
|
||||||
result.report = serializers.deserialize(value,
|
result.report = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
|
case 'groupBy':
|
||||||
|
result.groupBy = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
break;
|
||||||
case 'customStartDate':
|
case 'customStartDate':
|
||||||
result.customStartDate = serializers.deserialize(value,
|
result.customStartDate = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
|
|
@ -80,6 +87,8 @@ class _$ReportsUIState extends ReportsUIState {
|
||||||
@override
|
@override
|
||||||
final String report;
|
final String report;
|
||||||
@override
|
@override
|
||||||
|
final String groupBy;
|
||||||
|
@override
|
||||||
final String customStartDate;
|
final String customStartDate;
|
||||||
@override
|
@override
|
||||||
final String customEndDate;
|
final String customEndDate;
|
||||||
|
|
@ -90,11 +99,18 @@ class _$ReportsUIState extends ReportsUIState {
|
||||||
(new ReportsUIStateBuilder()..update(updates)).build();
|
(new ReportsUIStateBuilder()..update(updates)).build();
|
||||||
|
|
||||||
_$ReportsUIState._(
|
_$ReportsUIState._(
|
||||||
{this.report, this.customStartDate, this.customEndDate, this.filters})
|
{this.report,
|
||||||
|
this.groupBy,
|
||||||
|
this.customStartDate,
|
||||||
|
this.customEndDate,
|
||||||
|
this.filters})
|
||||||
: super._() {
|
: super._() {
|
||||||
if (report == null) {
|
if (report == null) {
|
||||||
throw new BuiltValueNullFieldError('ReportsUIState', 'report');
|
throw new BuiltValueNullFieldError('ReportsUIState', 'report');
|
||||||
}
|
}
|
||||||
|
if (groupBy == null) {
|
||||||
|
throw new BuiltValueNullFieldError('ReportsUIState', 'groupBy');
|
||||||
|
}
|
||||||
if (customStartDate == null) {
|
if (customStartDate == null) {
|
||||||
throw new BuiltValueNullFieldError('ReportsUIState', 'customStartDate');
|
throw new BuiltValueNullFieldError('ReportsUIState', 'customStartDate');
|
||||||
}
|
}
|
||||||
|
|
@ -119,6 +135,7 @@ class _$ReportsUIState extends ReportsUIState {
|
||||||
if (identical(other, this)) return true;
|
if (identical(other, this)) return true;
|
||||||
return other is ReportsUIState &&
|
return other is ReportsUIState &&
|
||||||
report == other.report &&
|
report == other.report &&
|
||||||
|
groupBy == other.groupBy &&
|
||||||
customStartDate == other.customStartDate &&
|
customStartDate == other.customStartDate &&
|
||||||
customEndDate == other.customEndDate &&
|
customEndDate == other.customEndDate &&
|
||||||
filters == other.filters;
|
filters == other.filters;
|
||||||
|
|
@ -127,7 +144,9 @@ class _$ReportsUIState extends ReportsUIState {
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return $jf($jc(
|
return $jf($jc(
|
||||||
$jc($jc($jc(0, report.hashCode), customStartDate.hashCode),
|
$jc(
|
||||||
|
$jc($jc($jc(0, report.hashCode), groupBy.hashCode),
|
||||||
|
customStartDate.hashCode),
|
||||||
customEndDate.hashCode),
|
customEndDate.hashCode),
|
||||||
filters.hashCode));
|
filters.hashCode));
|
||||||
}
|
}
|
||||||
|
|
@ -136,6 +155,7 @@ class _$ReportsUIState extends ReportsUIState {
|
||||||
String toString() {
|
String toString() {
|
||||||
return (newBuiltValueToStringHelper('ReportsUIState')
|
return (newBuiltValueToStringHelper('ReportsUIState')
|
||||||
..add('report', report)
|
..add('report', report)
|
||||||
|
..add('groupBy', groupBy)
|
||||||
..add('customStartDate', customStartDate)
|
..add('customStartDate', customStartDate)
|
||||||
..add('customEndDate', customEndDate)
|
..add('customEndDate', customEndDate)
|
||||||
..add('filters', filters))
|
..add('filters', filters))
|
||||||
|
|
@ -151,6 +171,10 @@ class ReportsUIStateBuilder
|
||||||
String get report => _$this._report;
|
String get report => _$this._report;
|
||||||
set report(String report) => _$this._report = report;
|
set report(String report) => _$this._report = report;
|
||||||
|
|
||||||
|
String _groupBy;
|
||||||
|
String get groupBy => _$this._groupBy;
|
||||||
|
set groupBy(String groupBy) => _$this._groupBy = groupBy;
|
||||||
|
|
||||||
String _customStartDate;
|
String _customStartDate;
|
||||||
String get customStartDate => _$this._customStartDate;
|
String get customStartDate => _$this._customStartDate;
|
||||||
set customStartDate(String customStartDate) =>
|
set customStartDate(String customStartDate) =>
|
||||||
|
|
@ -171,6 +195,7 @@ class ReportsUIStateBuilder
|
||||||
ReportsUIStateBuilder get _$this {
|
ReportsUIStateBuilder get _$this {
|
||||||
if (_$v != null) {
|
if (_$v != null) {
|
||||||
_report = _$v.report;
|
_report = _$v.report;
|
||||||
|
_groupBy = _$v.groupBy;
|
||||||
_customStartDate = _$v.customStartDate;
|
_customStartDate = _$v.customStartDate;
|
||||||
_customEndDate = _$v.customEndDate;
|
_customEndDate = _$v.customEndDate;
|
||||||
_filters = _$v.filters?.toBuilder();
|
_filters = _$v.filters?.toBuilder();
|
||||||
|
|
@ -199,6 +224,7 @@ class ReportsUIStateBuilder
|
||||||
_$result = _$v ??
|
_$result = _$v ??
|
||||||
new _$ReportsUIState._(
|
new _$ReportsUIState._(
|
||||||
report: report,
|
report: report,
|
||||||
|
groupBy: groupBy,
|
||||||
customStartDate: customStartDate,
|
customStartDate: customStartDate,
|
||||||
customEndDate: customEndDate,
|
customEndDate: customEndDate,
|
||||||
filters: filters.build());
|
filters: filters.build());
|
||||||
|
|
|
||||||
|
|
@ -112,11 +112,12 @@ class ReportsScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
AppDropdownButton<String>(
|
AppDropdownButton<String>(
|
||||||
labelText: localization.groupBy,
|
labelText: localization.groupBy,
|
||||||
value: null,
|
value: reportsUIState.groupBy,
|
||||||
blankValue: null,
|
blankValue: '',
|
||||||
showBlank: true,
|
showBlank: true,
|
||||||
onChanged: (dynamic value) {
|
onChanged: (dynamic value) {
|
||||||
print('Group: onChanged - $value');
|
print('Group: onChanged - $value');
|
||||||
|
viewModel.onSettingsChanged(groupBy: value);
|
||||||
},
|
},
|
||||||
items: reportResult.columns
|
items: reportResult.columns
|
||||||
.where((column) =>
|
.where((column) =>
|
||||||
|
|
@ -412,6 +413,7 @@ class ReportResult {
|
||||||
for (String column in columns)
|
for (String column in columns)
|
||||||
if (getReportColumnType(column) == ReportColumnType.number)
|
if (getReportColumnType(column) == ReportColumnType.number)
|
||||||
DataCell(DecoratedFormField(
|
DataCell(DecoratedFormField(
|
||||||
|
label: '',
|
||||||
controller: textEditingControllers[column],
|
controller: textEditingControllers[column],
|
||||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ class ReportsScreenVM {
|
||||||
String report,
|
String report,
|
||||||
String customStartDate,
|
String customStartDate,
|
||||||
String customEndDate,
|
String customEndDate,
|
||||||
|
String groupBy,
|
||||||
}) onSettingsChanged;
|
}) onSettingsChanged;
|
||||||
|
|
||||||
static ReportsScreenVM fromStore(Store<AppState> store) {
|
static ReportsScreenVM fromStore(Store<AppState> store) {
|
||||||
|
|
@ -123,11 +124,13 @@ class ReportsScreenVM {
|
||||||
},
|
},
|
||||||
onSettingsChanged: ({
|
onSettingsChanged: ({
|
||||||
String report,
|
String report,
|
||||||
|
String groupBy,
|
||||||
String customStartDate,
|
String customStartDate,
|
||||||
String customEndDate,
|
String customEndDate,
|
||||||
}) {
|
}) {
|
||||||
store.dispatch(UpdateReportSettings(
|
store.dispatch(UpdateReportSettings(
|
||||||
report: report ?? state.uiState.reportsUIState.report,
|
report: report ?? state.uiState.reportsUIState.report,
|
||||||
|
groupBy: groupBy,
|
||||||
customStartDate: customStartDate,
|
customStartDate: customStartDate,
|
||||||
customEndDate: customEndDate,
|
customEndDate: customEndDate,
|
||||||
));
|
));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue