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