Dashboard overview
This commit is contained in:
parent
2dfbd223c3
commit
e3f2aad65c
|
|
@ -25,6 +25,7 @@ class UpdateDashboardSettings implements PersistUI {
|
||||||
this.showPreviousPeriod,
|
this.showPreviousPeriod,
|
||||||
this.showTotal,
|
this.showTotal,
|
||||||
this.totalFields,
|
this.totalFields,
|
||||||
|
this.numberFieldsPerRow,
|
||||||
});
|
});
|
||||||
|
|
||||||
DashboardSettings settings;
|
DashboardSettings settings;
|
||||||
|
|
@ -36,6 +37,7 @@ class UpdateDashboardSettings implements PersistUI {
|
||||||
bool showPreviousPeriod;
|
bool showPreviousPeriod;
|
||||||
bool showTotal;
|
bool showTotal;
|
||||||
BuiltList<String> totalFields;
|
BuiltList<String> totalFields;
|
||||||
|
final int numberFieldsPerRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateDashboardSelection implements PersistUI {
|
class UpdateDashboardSelection implements PersistUI {
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,9 @@ DashboardUISettings dashboardSettingsReducer(
|
||||||
return state.rebuild((b) => b..showTotal = action.showTotal);
|
return state.rebuild((b) => b..showTotal = action.showTotal);
|
||||||
} else if (action.totalFields != null) {
|
} else if (action.totalFields != null) {
|
||||||
return state.rebuild((b) => b..totalFields.replace(action.totalFields));
|
return state.rebuild((b) => b..totalFields.replace(action.totalFields));
|
||||||
|
} else if (action.numberFieldsPerRow != null) {
|
||||||
|
return state
|
||||||
|
.rebuild((b) => b..numberFieldsPerRow = action.numberFieldsPerRow);
|
||||||
}
|
}
|
||||||
} else if (action is SelectCompany) {
|
} else if (action is SelectCompany) {
|
||||||
//return state.rebuild((b) => b..currencyId = action.company.currencyId);
|
//return state.rebuild((b) => b..currencyId = action.company.currencyId);
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ abstract class DashboardUISettings
|
||||||
showCurrentPeriod: true,
|
showCurrentPeriod: true,
|
||||||
showPreviousPeriod: false,
|
showPreviousPeriod: false,
|
||||||
showTotal: true,
|
showTotal: true,
|
||||||
|
numberFieldsPerRow: 2,
|
||||||
totalFields: BuiltList<String>(<String>[
|
totalFields: BuiltList<String>(<String>[
|
||||||
FIELD_COMPLETED_PAYMENTS,
|
FIELD_COMPLETED_PAYMENTS,
|
||||||
FIELD_OUTSTANDING_INVOICES,
|
FIELD_OUTSTANDING_INVOICES,
|
||||||
|
|
@ -116,6 +117,8 @@ abstract class DashboardUISettings
|
||||||
|
|
||||||
bool get showTotal;
|
bool get showTotal;
|
||||||
|
|
||||||
|
int get numberFieldsPerRow;
|
||||||
|
|
||||||
BuiltList<String> get totalFields;
|
BuiltList<String> get totalFields;
|
||||||
|
|
||||||
bool matchesCurrency(String match) {
|
bool matchesCurrency(String match) {
|
||||||
|
|
@ -154,6 +157,7 @@ abstract class DashboardUISettings
|
||||||
..showTotal = true
|
..showTotal = true
|
||||||
..showPreviousPeriod = false
|
..showPreviousPeriod = false
|
||||||
..showCurrentPeriod = true
|
..showCurrentPeriod = true
|
||||||
|
..numberFieldsPerRow = 2
|
||||||
..totalFields.replace(BuiltList<String>());
|
..totalFields.replace(BuiltList<String>());
|
||||||
|
|
||||||
static Serializer<DashboardUISettings> get serializer =>
|
static Serializer<DashboardUISettings> get serializer =>
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,9 @@ class _$DashboardUISettingsSerializer
|
||||||
'showTotal',
|
'showTotal',
|
||||||
serializers.serialize(object.showTotal,
|
serializers.serialize(object.showTotal,
|
||||||
specifiedType: const FullType(bool)),
|
specifiedType: const FullType(bool)),
|
||||||
|
'numberFieldsPerRow',
|
||||||
|
serializers.serialize(object.numberFieldsPerRow,
|
||||||
|
specifiedType: const FullType(int)),
|
||||||
'totalFields',
|
'totalFields',
|
||||||
serializers.serialize(object.totalFields,
|
serializers.serialize(object.totalFields,
|
||||||
specifiedType:
|
specifiedType:
|
||||||
|
|
@ -215,6 +218,10 @@ class _$DashboardUISettingsSerializer
|
||||||
result.showTotal = serializers.deserialize(value,
|
result.showTotal = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(bool)) as bool;
|
specifiedType: const FullType(bool)) as bool;
|
||||||
break;
|
break;
|
||||||
|
case 'numberFieldsPerRow':
|
||||||
|
result.numberFieldsPerRow = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
break;
|
||||||
case 'totalFields':
|
case 'totalFields':
|
||||||
result.totalFields.replace(serializers.deserialize(value,
|
result.totalFields.replace(serializers.deserialize(value,
|
||||||
specifiedType:
|
specifiedType:
|
||||||
|
|
@ -409,6 +416,8 @@ class _$DashboardUISettings extends DashboardUISettings {
|
||||||
@override
|
@override
|
||||||
final bool showTotal;
|
final bool showTotal;
|
||||||
@override
|
@override
|
||||||
|
final int numberFieldsPerRow;
|
||||||
|
@override
|
||||||
final BuiltList<String> totalFields;
|
final BuiltList<String> totalFields;
|
||||||
|
|
||||||
factory _$DashboardUISettings(
|
factory _$DashboardUISettings(
|
||||||
|
|
@ -430,6 +439,7 @@ class _$DashboardUISettings extends DashboardUISettings {
|
||||||
this.showCurrentPeriod,
|
this.showCurrentPeriod,
|
||||||
this.showPreviousPeriod,
|
this.showPreviousPeriod,
|
||||||
this.showTotal,
|
this.showTotal,
|
||||||
|
this.numberFieldsPerRow,
|
||||||
this.totalFields})
|
this.totalFields})
|
||||||
: super._() {
|
: super._() {
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
|
@ -460,6 +470,8 @@ class _$DashboardUISettings extends DashboardUISettings {
|
||||||
showPreviousPeriod, 'DashboardUISettings', 'showPreviousPeriod');
|
showPreviousPeriod, 'DashboardUISettings', 'showPreviousPeriod');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
showTotal, 'DashboardUISettings', 'showTotal');
|
showTotal, 'DashboardUISettings', 'showTotal');
|
||||||
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
numberFieldsPerRow, 'DashboardUISettings', 'numberFieldsPerRow');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
totalFields, 'DashboardUISettings', 'totalFields');
|
totalFields, 'DashboardUISettings', 'totalFields');
|
||||||
}
|
}
|
||||||
|
|
@ -491,6 +503,7 @@ class _$DashboardUISettings extends DashboardUISettings {
|
||||||
showCurrentPeriod == other.showCurrentPeriod &&
|
showCurrentPeriod == other.showCurrentPeriod &&
|
||||||
showPreviousPeriod == other.showPreviousPeriod &&
|
showPreviousPeriod == other.showPreviousPeriod &&
|
||||||
showTotal == other.showTotal &&
|
showTotal == other.showTotal &&
|
||||||
|
numberFieldsPerRow == other.numberFieldsPerRow &&
|
||||||
totalFields == other.totalFields;
|
totalFields == other.totalFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,23 +525,28 @@ class _$DashboardUISettings extends DashboardUISettings {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
0,
|
$jc(
|
||||||
dateRange
|
0,
|
||||||
|
dateRange
|
||||||
|
.hashCode),
|
||||||
|
customStartDate
|
||||||
.hashCode),
|
.hashCode),
|
||||||
customStartDate
|
customEndDate
|
||||||
.hashCode),
|
.hashCode),
|
||||||
customEndDate.hashCode),
|
enableComparison
|
||||||
enableComparison.hashCode),
|
.hashCode),
|
||||||
compareDateRange.hashCode),
|
compareDateRange.hashCode),
|
||||||
compareCustomStartDate.hashCode),
|
compareCustomStartDate
|
||||||
compareCustomEndDate.hashCode),
|
.hashCode),
|
||||||
offset.hashCode),
|
compareCustomEndDate.hashCode),
|
||||||
currencyId.hashCode),
|
offset.hashCode),
|
||||||
includeTaxes.hashCode),
|
currencyId.hashCode),
|
||||||
groupBy.hashCode),
|
includeTaxes.hashCode),
|
||||||
showCurrentPeriod.hashCode),
|
groupBy.hashCode),
|
||||||
showPreviousPeriod.hashCode),
|
showCurrentPeriod.hashCode),
|
||||||
showTotal.hashCode),
|
showPreviousPeriod.hashCode),
|
||||||
|
showTotal.hashCode),
|
||||||
|
numberFieldsPerRow.hashCode),
|
||||||
totalFields.hashCode));
|
totalFields.hashCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -549,6 +567,7 @@ class _$DashboardUISettings extends DashboardUISettings {
|
||||||
..add('showCurrentPeriod', showCurrentPeriod)
|
..add('showCurrentPeriod', showCurrentPeriod)
|
||||||
..add('showPreviousPeriod', showPreviousPeriod)
|
..add('showPreviousPeriod', showPreviousPeriod)
|
||||||
..add('showTotal', showTotal)
|
..add('showTotal', showTotal)
|
||||||
|
..add('numberFieldsPerRow', numberFieldsPerRow)
|
||||||
..add('totalFields', totalFields))
|
..add('totalFields', totalFields))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
@ -622,6 +641,11 @@ class DashboardUISettingsBuilder
|
||||||
bool get showTotal => _$this._showTotal;
|
bool get showTotal => _$this._showTotal;
|
||||||
set showTotal(bool showTotal) => _$this._showTotal = showTotal;
|
set showTotal(bool showTotal) => _$this._showTotal = showTotal;
|
||||||
|
|
||||||
|
int _numberFieldsPerRow;
|
||||||
|
int get numberFieldsPerRow => _$this._numberFieldsPerRow;
|
||||||
|
set numberFieldsPerRow(int numberFieldsPerRow) =>
|
||||||
|
_$this._numberFieldsPerRow = numberFieldsPerRow;
|
||||||
|
|
||||||
ListBuilder<String> _totalFields;
|
ListBuilder<String> _totalFields;
|
||||||
ListBuilder<String> get totalFields =>
|
ListBuilder<String> get totalFields =>
|
||||||
_$this._totalFields ??= new ListBuilder<String>();
|
_$this._totalFields ??= new ListBuilder<String>();
|
||||||
|
|
@ -649,6 +673,7 @@ class DashboardUISettingsBuilder
|
||||||
_showCurrentPeriod = $v.showCurrentPeriod;
|
_showCurrentPeriod = $v.showCurrentPeriod;
|
||||||
_showPreviousPeriod = $v.showPreviousPeriod;
|
_showPreviousPeriod = $v.showPreviousPeriod;
|
||||||
_showTotal = $v.showTotal;
|
_showTotal = $v.showTotal;
|
||||||
|
_numberFieldsPerRow = $v.numberFieldsPerRow;
|
||||||
_totalFields = $v.totalFields.toBuilder();
|
_totalFields = $v.totalFields.toBuilder();
|
||||||
_$v = null;
|
_$v = null;
|
||||||
}
|
}
|
||||||
|
|
@ -693,6 +718,7 @@ class DashboardUISettingsBuilder
|
||||||
showCurrentPeriod: BuiltValueNullFieldError.checkNotNull(showCurrentPeriod, 'DashboardUISettings', 'showCurrentPeriod'),
|
showCurrentPeriod: BuiltValueNullFieldError.checkNotNull(showCurrentPeriod, 'DashboardUISettings', 'showCurrentPeriod'),
|
||||||
showPreviousPeriod: BuiltValueNullFieldError.checkNotNull(showPreviousPeriod, 'DashboardUISettings', 'showPreviousPeriod'),
|
showPreviousPeriod: BuiltValueNullFieldError.checkNotNull(showPreviousPeriod, 'DashboardUISettings', 'showPreviousPeriod'),
|
||||||
showTotal: BuiltValueNullFieldError.checkNotNull(showTotal, 'DashboardUISettings', 'showTotal'),
|
showTotal: BuiltValueNullFieldError.checkNotNull(showTotal, 'DashboardUISettings', 'showTotal'),
|
||||||
|
numberFieldsPerRow: BuiltValueNullFieldError.checkNotNull(numberFieldsPerRow, 'DashboardUISettings', 'numberFieldsPerRow'),
|
||||||
totalFields: totalFields.build());
|
totalFields: totalFields.build());
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
String _$failedField;
|
String _$failedField;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/app_border.dart';
|
import 'package:invoiceninja_flutter/ui/app/app_border.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/live_text.dart';
|
import 'package:invoiceninja_flutter/ui/app/live_text.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/review_app.dart';
|
import 'package:invoiceninja_flutter/ui/app/review_app.dart';
|
||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
@ -680,7 +681,7 @@ class DashboardPanels extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
child: StaggeredGrid.count(
|
child: StaggeredGrid.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: settings.numberFieldsPerRow,
|
||||||
crossAxisSpacing: 8,
|
crossAxisSpacing: 8,
|
||||||
mainAxisSpacing: 12,
|
mainAxisSpacing: 12,
|
||||||
children: settings.totalFields.map<Widget>((field) {
|
children: settings.totalFields.map<Widget>((field) {
|
||||||
|
|
@ -1099,6 +1100,23 @@ class _DashboardTotalsSettingsState extends State<_DashboardTotalsSettings> {
|
||||||
title: Text(localization.total),
|
title: Text(localization.total),
|
||||||
controlAffinity: ListTileControlAffinity.leading,
|
controlAffinity: ListTileControlAffinity.leading,
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16, right: 24),
|
||||||
|
child: AppDropdownButton<int>(
|
||||||
|
labelText: localization.fieldsPerRow,
|
||||||
|
value: settings.numberFieldsPerRow,
|
||||||
|
onChanged: (dynamic value) {
|
||||||
|
store.dispatch(
|
||||||
|
UpdateDashboardSettings(numberFieldsPerRow: value));
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
items: List<int>.generate(8, (i) => i + 1)
|
||||||
|
.map((value) => DropdownMenuItem<int>(
|
||||||
|
child: Text('$value'),
|
||||||
|
value: value,
|
||||||
|
))
|
||||||
|
.toList()),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -382,9 +382,9 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
||||||
child: Text(localization.usePaymentTerms),
|
child: Text(localization.usePaymentTerms),
|
||||||
value: 'terms',
|
value: 'terms',
|
||||||
),
|
),
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
child: Text(localization.dueOnReceipt),
|
child: Text(localization.dueOnReceipt),
|
||||||
value: 'on_receipt',
|
value: 'on_receipt',
|
||||||
),
|
),
|
||||||
...List<int>.generate(31, (i) => i + 1)
|
...List<int>.generate(31, (i) => i + 1)
|
||||||
.map((value) => DropdownMenuItem(
|
.map((value) => DropdownMenuItem(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
// STARTER: lang key - do not remove comment
|
// STARTER: lang key - do not remove comment
|
||||||
|
'fields_per_row': 'Fields Per Row',
|
||||||
'total_active_invoices': 'Active Invoices',
|
'total_active_invoices': 'Active Invoices',
|
||||||
'total_outstanding_invoices': 'Outstanding Invoices',
|
'total_outstanding_invoices': 'Outstanding Invoices',
|
||||||
'total_completed_payments': 'Completed Payments',
|
'total_completed_payments': 'Completed Payments',
|
||||||
|
|
@ -85354,6 +85355,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['total_invoice_paid_expenses'] ??
|
_localizedValues[localeCode]['total_invoice_paid_expenses'] ??
|
||||||
_localizedValues['en']['total_invoice_paid_expenses'];
|
_localizedValues['en']['total_invoice_paid_expenses'];
|
||||||
|
|
||||||
|
String get fieldsPerRow =>
|
||||||
|
_localizedValues[localeCode]['fields_per_row'] ??
|
||||||
|
_localizedValues['en']['fields_per_row'];
|
||||||
|
|
||||||
// STARTER: lang field - do not remove comment
|
// STARTER: lang field - do not remove comment
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue