Settings
This commit is contained in:
parent
6a065b01ee
commit
11e8fa59fe
|
|
@ -243,3 +243,29 @@ const List<String> kLanguages = [
|
||||||
'tr_TR',
|
'tr_TR',
|
||||||
'bg',
|
'bg',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const kDaysOfTheWeek = {
|
||||||
|
0: 'sunday',
|
||||||
|
1: 'monday',
|
||||||
|
2: 'tuesday',
|
||||||
|
3: 'wednesday',
|
||||||
|
4: 'thursday',
|
||||||
|
5: 'friday',
|
||||||
|
6: 'saturday',
|
||||||
|
};
|
||||||
|
|
||||||
|
const kMonthsOfTheYear = {
|
||||||
|
0: 'january',
|
||||||
|
1: 'february',
|
||||||
|
2: 'march',
|
||||||
|
3: 'april',
|
||||||
|
4: 'may',
|
||||||
|
5: 'june',
|
||||||
|
6: 'july',
|
||||||
|
7: 'august',
|
||||||
|
8: 'september',
|
||||||
|
9: 'october',
|
||||||
|
10: 'november',
|
||||||
|
11: 'december',
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -536,17 +536,14 @@ abstract class SettingsEntity
|
||||||
@BuiltValueField(wireName: 'show_tasks_in_portal')
|
@BuiltValueField(wireName: 'show_tasks_in_portal')
|
||||||
bool get showTasksInPortal;
|
bool get showTasksInPortal;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'invoice_terms')
|
@BuiltValueField(wireName: 'invoice_terms')
|
||||||
String get defaultInvoiceTerms;
|
String get defaultInvoiceTerms;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'invoice_taxes')
|
@BuiltValueField(wireName: 'invoice_taxes')
|
||||||
bool get enableInvoiceTaxes;
|
bool get enableInvoiceTaxes;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'invoice_item_taxes')
|
@BuiltValueField(wireName: 'invoice_item_taxes')
|
||||||
bool get enableInvoiceItemTaxes;
|
bool get enableInvoiceItemTaxes;
|
||||||
|
|
@ -559,37 +556,30 @@ abstract class SettingsEntity
|
||||||
@BuiltValueField(wireName: 'quote_design_id')
|
@BuiltValueField(wireName: 'quote_design_id')
|
||||||
String get defaultQuoteDesignId;
|
String get defaultQuoteDesignId;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'invoice_footer')
|
@BuiltValueField(wireName: 'invoice_footer')
|
||||||
String get defaultInvoiceFooter;
|
String get defaultInvoiceFooter;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'show_item_taxes')
|
@BuiltValueField(wireName: 'show_item_taxes')
|
||||||
bool get showInvoiceItemTaxes;
|
bool get showInvoiceItemTaxes;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'tax_name1')
|
@BuiltValueField(wireName: 'tax_name1')
|
||||||
String get defaultTaxName1;
|
String get defaultTaxName1;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'tax_rate1_HIDDEN')
|
@BuiltValueField(wireName: 'tax_rate1_HIDDEN')
|
||||||
double get defaultTaxRate1;
|
double get defaultTaxRate1;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'tax_name2')
|
@BuiltValueField(wireName: 'tax_name2')
|
||||||
String get defaultTaxName2;
|
String get defaultTaxName2;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'tax_rate2_HIDDEN')
|
@BuiltValueField(wireName: 'tax_rate2_HIDDEN')
|
||||||
double get defaultTaxRate2;
|
double get defaultTaxRate2;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'quote_terms')
|
@BuiltValueField(wireName: 'quote_terms')
|
||||||
String get defaultQuoteTerms;
|
String get defaultQuoteTerms;
|
||||||
|
|
@ -598,17 +588,14 @@ abstract class SettingsEntity
|
||||||
@BuiltValueField(wireName: 'show_currency_code')
|
@BuiltValueField(wireName: 'show_currency_code')
|
||||||
bool get showCurrencyCode;
|
bool get showCurrencyCode;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'enable_second_tax_rate')
|
@BuiltValueField(wireName: 'enable_second_tax_rate')
|
||||||
bool get enableSecondTaxRate;
|
bool get enableSecondTaxRate;
|
||||||
|
|
||||||
// TODO change to int/remove nullable
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'payment_terms_HIDDEN')
|
@BuiltValueField(wireName: 'payment_terms_HIDDEN')
|
||||||
int get defaultPaymentTerms;
|
int get defaultPaymentTerms;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'payment_type_id')
|
@BuiltValueField(wireName: 'payment_type_id')
|
||||||
String get defaultPaymentTypeId;
|
String get defaultPaymentTypeId;
|
||||||
|
|
@ -621,7 +608,6 @@ abstract class SettingsEntity
|
||||||
@BuiltValueField(wireName: 'inclusive_taxes')
|
@BuiltValueField(wireName: 'inclusive_taxes')
|
||||||
bool get enableInclusiveTaxes;
|
bool get enableInclusiveTaxes;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'convert_products')
|
@BuiltValueField(wireName: 'convert_products')
|
||||||
bool get convertProductExchangeRate;
|
bool get convertProductExchangeRate;
|
||||||
|
|
@ -634,37 +620,30 @@ abstract class SettingsEntity
|
||||||
@BuiltValueField(wireName: 'custom_invoice_taxes2')
|
@BuiltValueField(wireName: 'custom_invoice_taxes2')
|
||||||
bool get enableCustomInvoiceTaxes2;
|
bool get enableCustomInvoiceTaxes2;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'custom_payment_terms')
|
@BuiltValueField(wireName: 'custom_payment_terms')
|
||||||
BuiltList<PaymentTermEntity> get customPaymentTerms;
|
BuiltList<PaymentTermEntity> get customPaymentTerms;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'invoice_fields')
|
@BuiltValueField(wireName: 'invoice_fields')
|
||||||
String get invoiceFields;
|
String get invoiceFields;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_footer')
|
@BuiltValueField(wireName: 'email_footer')
|
||||||
String get emailFooter;
|
String get emailFooter;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_subject_invoice')
|
@BuiltValueField(wireName: 'email_subject_invoice')
|
||||||
String get emailSubjectInvoice;
|
String get emailSubjectInvoice;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_subject_quote')
|
@BuiltValueField(wireName: 'email_subject_quote')
|
||||||
String get emailSubjectQuote;
|
String get emailSubjectQuote;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_subject_payment')
|
@BuiltValueField(wireName: 'email_subject_payment')
|
||||||
String get emailSubjectPayment;
|
String get emailSubjectPayment;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_template_invoice')
|
@BuiltValueField(wireName: 'email_template_invoice')
|
||||||
String get emailBodyInvoice;
|
String get emailBodyInvoice;
|
||||||
|
|
@ -674,37 +653,30 @@ abstract class SettingsEntity
|
||||||
@BuiltValueField(wireName: 'email_template_quote')
|
@BuiltValueField(wireName: 'email_template_quote')
|
||||||
String get emailBodyQuote;
|
String get emailBodyQuote;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_template_payment')
|
@BuiltValueField(wireName: 'email_template_payment')
|
||||||
String get emailBodyPayment;
|
String get emailBodyPayment;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_subject_reminder1')
|
@BuiltValueField(wireName: 'email_subject_reminder1')
|
||||||
String get emailSubjectReminder1;
|
String get emailSubjectReminder1;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_subject_reminder2')
|
@BuiltValueField(wireName: 'email_subject_reminder2')
|
||||||
String get emailSubjectReminder2;
|
String get emailSubjectReminder2;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_subject_reminder3')
|
@BuiltValueField(wireName: 'email_subject_reminder3')
|
||||||
String get emailSubjectReminder3;
|
String get emailSubjectReminder3;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_template_reminder1')
|
@BuiltValueField(wireName: 'email_template_reminder1')
|
||||||
String get emailBodyReminder1;
|
String get emailBodyReminder1;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_template_reminder2')
|
@BuiltValueField(wireName: 'email_template_reminder2')
|
||||||
String get emailBodyReminder2;
|
String get emailBodyReminder2;
|
||||||
|
|
||||||
// TODO remove this
|
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'email_template_reminder3')
|
@BuiltValueField(wireName: 'email_template_reminder3')
|
||||||
String get emailBodyReminder3;
|
String get emailBodyReminder3;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/static/static_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/static/static_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
||||||
|
|
@ -73,6 +74,7 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
final viewModel = widget.viewModel;
|
final viewModel = widget.viewModel;
|
||||||
final state = viewModel.state;
|
final state = viewModel.state;
|
||||||
final settings = viewModel.settings;
|
final settings = viewModel.settings;
|
||||||
|
final company = viewModel.company;
|
||||||
|
|
||||||
return SettingsScaffold(
|
return SettingsScaffold(
|
||||||
title: localization.localization,
|
title: localization.localization,
|
||||||
|
|
@ -89,17 +91,19 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
labelText: localization.currency,
|
labelText: localization.currency,
|
||||||
initialValue:
|
initialValue:
|
||||||
state.staticState.currencyMap[settings.currencyId]?.name,
|
state.staticState.currencyMap[settings.currencyId]?.name,
|
||||||
onSelected: (SelectableEntity currency) => viewModel.onChanged(
|
onSelected: (SelectableEntity currency) =>
|
||||||
|
viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..currencyId = currency.id)),
|
settings.rebuild((b) => b..currencyId = currency.id)),
|
||||||
),
|
),
|
||||||
SizedBox(height: 12),
|
Padding(
|
||||||
Row(
|
padding: const EdgeInsets.only(top: 10, bottom: 20),
|
||||||
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Radio(
|
Radio(
|
||||||
value: false,
|
value: false,
|
||||||
groupValue: settings.showCurrencyCode,
|
groupValue: settings.showCurrencyCode,
|
||||||
activeColor: Theme.of(context).accentColor,
|
activeColor: Theme.of(context).accentColor,
|
||||||
onChanged: (bool value) => viewModel.onChanged(
|
onChanged: (bool value) => viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..showCurrencyCode = false)),
|
settings.rebuild((b) => b..showCurrencyCode = false)),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
|
@ -107,7 +111,7 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
formatNumber(1000, context,
|
formatNumber(1000, context,
|
||||||
showCurrencyCode: false,
|
showCurrencyCode: false,
|
||||||
currencyId: settings.currencyId)),
|
currencyId: settings.currencyId)),
|
||||||
onTap: () => viewModel.onChanged(
|
onTap: () => viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..showCurrencyCode = false)),
|
settings.rebuild((b) => b..showCurrencyCode = false)),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
|
|
@ -115,7 +119,7 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
value: true,
|
value: true,
|
||||||
groupValue: settings.showCurrencyCode,
|
groupValue: settings.showCurrencyCode,
|
||||||
activeColor: Theme.of(context).accentColor,
|
activeColor: Theme.of(context).accentColor,
|
||||||
onChanged: (bool value) => viewModel.onChanged(
|
onChanged: (bool value) => viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..showCurrencyCode = true)),
|
settings.rebuild((b) => b..showCurrencyCode = true)),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
|
@ -123,12 +127,12 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
formatNumber(1000, context,
|
formatNumber(1000, context,
|
||||||
showCurrencyCode: true,
|
showCurrencyCode: true,
|
||||||
currencyId: settings.currencyId)),
|
currencyId: settings.currencyId)),
|
||||||
onTap: () => viewModel.onChanged(
|
onTap: () => viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..showCurrencyCode = true)),
|
settings.rebuild((b) => b..showCurrencyCode = true)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
),
|
||||||
EntityDropdown(
|
EntityDropdown(
|
||||||
key: ValueKey('__language_${settings.languageId}'),
|
key: ValueKey('__language_${settings.languageId}'),
|
||||||
entityType: EntityType.language,
|
entityType: EntityType.language,
|
||||||
|
|
@ -137,7 +141,8 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
labelText: localization.language,
|
labelText: localization.language,
|
||||||
initialValue:
|
initialValue:
|
||||||
state.staticState.languageMap[settings.languageId]?.name,
|
state.staticState.languageMap[settings.languageId]?.name,
|
||||||
onSelected: (SelectableEntity language) => viewModel.onChanged(
|
onSelected: (SelectableEntity language) =>
|
||||||
|
viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..languageId = language.id)),
|
settings.rebuild((b) => b..languageId = language.id)),
|
||||||
),
|
),
|
||||||
EntityDropdown(
|
EntityDropdown(
|
||||||
|
|
@ -148,7 +153,8 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
labelText: localization.timezone,
|
labelText: localization.timezone,
|
||||||
initialValue:
|
initialValue:
|
||||||
state.staticState.timezoneMap[settings.timezoneId]?.name,
|
state.staticState.timezoneMap[settings.timezoneId]?.name,
|
||||||
onSelected: (SelectableEntity timezone) => viewModel.onChanged(
|
onSelected: (SelectableEntity timezone) =>
|
||||||
|
viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..timezoneId = timezone.id)),
|
settings.rebuild((b) => b..timezoneId = timezone.id)),
|
||||||
),
|
),
|
||||||
EntityDropdown(
|
EntityDropdown(
|
||||||
|
|
@ -159,9 +165,69 @@ class _LocalizationSettingsState extends State<LocalizationSettings> {
|
||||||
labelText: localization.dateFormat,
|
labelText: localization.dateFormat,
|
||||||
initialValue:
|
initialValue:
|
||||||
state.staticState.dateFormatMap[settings.dateFormatId]?.preview,
|
state.staticState.dateFormatMap[settings.dateFormatId]?.preview,
|
||||||
onSelected: (SelectableEntity dateFormat) => viewModel.onChanged(
|
onSelected: (SelectableEntity dateFormat) =>
|
||||||
|
viewModel.onSettingsChanged(
|
||||||
settings.rebuild((b) => b..dateFormatId = dateFormat.id)),
|
settings.rebuild((b) => b..dateFormatId = dateFormat.id)),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10, bottom: 20),
|
||||||
|
child: CheckboxListTile(
|
||||||
|
title: Text(localization.militaryTime),
|
||||||
|
value: settings.enableMilitaryTime,
|
||||||
|
activeColor: Theme.of(context).accentColor,
|
||||||
|
controlAffinity: ListTileControlAffinity.leading,
|
||||||
|
onChanged: (value) => viewModel.onSettingsChanged(
|
||||||
|
settings.rebuild((b) => b..enableMilitaryTime = value)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InputDecorator(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: localization.firstDayOfTheWeek,
|
||||||
|
),
|
||||||
|
isEmpty: company.startOfWeek == null,
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton<int>(
|
||||||
|
value: company.startOfWeek,
|
||||||
|
isExpanded: true,
|
||||||
|
isDense: true,
|
||||||
|
onChanged: (value) => viewModel.onCompanyChanged(
|
||||||
|
company.rebuild((b) => b..startOfWeek = value)),
|
||||||
|
items: kDaysOfTheWeek
|
||||||
|
.map(
|
||||||
|
(id, day) => MapEntry<int, DropdownMenuItem<int>>(
|
||||||
|
id,
|
||||||
|
DropdownMenuItem<int>(
|
||||||
|
child: Text(localization.lookup(day)),
|
||||||
|
value: id,
|
||||||
|
)))
|
||||||
|
.values
|
||||||
|
.toList()),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InputDecorator(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: localization.firstMonthOfTheYear,
|
||||||
|
),
|
||||||
|
isEmpty: company.financialYearStart == null,
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton<int>(
|
||||||
|
value: company.financialYearStart,
|
||||||
|
isExpanded: true,
|
||||||
|
isDense: true,
|
||||||
|
onChanged: (value) => viewModel.onCompanyChanged(
|
||||||
|
company.rebuild((b) => b..financialYearStart = value)),
|
||||||
|
items: kMonthsOfTheYear
|
||||||
|
.map(
|
||||||
|
(id, month) => MapEntry<int, DropdownMenuItem<int>>(
|
||||||
|
id,
|
||||||
|
DropdownMenuItem<int>(
|
||||||
|
child: Text(localization.lookup(month)),
|
||||||
|
value: id,
|
||||||
|
)))
|
||||||
|
.values
|
||||||
|
.toList()),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,10 @@ class LocalizationScreen extends StatelessWidget {
|
||||||
class LocalizationSettingsVM {
|
class LocalizationSettingsVM {
|
||||||
LocalizationSettingsVM({
|
LocalizationSettingsVM({
|
||||||
@required this.state,
|
@required this.state,
|
||||||
|
@required this.company,
|
||||||
@required this.settings,
|
@required this.settings,
|
||||||
@required this.onChanged,
|
@required this.onSettingsChanged,
|
||||||
|
@required this.onCompanyChanged,
|
||||||
@required this.onSavePressed,
|
@required this.onSavePressed,
|
||||||
@required this.onCancelPressed,
|
@required this.onCancelPressed,
|
||||||
});
|
});
|
||||||
|
|
@ -46,9 +48,12 @@ class LocalizationSettingsVM {
|
||||||
return LocalizationSettingsVM(
|
return LocalizationSettingsVM(
|
||||||
state: state,
|
state: state,
|
||||||
settings: state.uiState.settingsUIState.settings,
|
settings: state.uiState.settingsUIState.settings,
|
||||||
onChanged: (settings) {
|
company: state.uiState.settingsUIState.userCompany.company,
|
||||||
|
onSettingsChanged: (settings) {
|
||||||
store.dispatch(UpdateSettings(settings: settings));
|
store.dispatch(UpdateSettings(settings: settings));
|
||||||
},
|
},
|
||||||
|
onCompanyChanged: (company) =>
|
||||||
|
store.dispatch(UpdateCompany(company: company)),
|
||||||
onCancelPressed: (context) => store.dispatch(ResetSettings()),
|
onCancelPressed: (context) => store.dispatch(ResetSettings()),
|
||||||
onSavePressed: (context) {
|
onSavePressed: (context) {
|
||||||
final settingsUIState = state.uiState.settingsUIState;
|
final settingsUIState = state.uiState.settingsUIState;
|
||||||
|
|
@ -73,8 +78,10 @@ class LocalizationSettingsVM {
|
||||||
}
|
}
|
||||||
|
|
||||||
final AppState state;
|
final AppState state;
|
||||||
|
final CompanyEntity company;
|
||||||
final SettingsEntity settings;
|
final SettingsEntity settings;
|
||||||
final Function(SettingsEntity) onChanged;
|
final Function(CompanyEntity) onCompanyChanged;
|
||||||
|
final Function(SettingsEntity) onSettingsChanged;
|
||||||
final Function(BuildContext) onSavePressed;
|
final Function(BuildContext) onSavePressed;
|
||||||
final Function(BuildContext) onCancelPressed;
|
final Function(BuildContext) onCancelPressed;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,27 @@ abstract class LocaleCodeAware {
|
||||||
mixin LocalizationsProvider on LocaleCodeAware {
|
mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
|
'first_day_of_the_week': 'First day of the week',
|
||||||
|
'first_month_of_the_year': 'First month of the year',
|
||||||
|
'sunday': 'Sunday',
|
||||||
|
'monday': 'Monday',
|
||||||
|
'tuesday': 'Tuesday',
|
||||||
|
'wednesday': 'Wednesday',
|
||||||
|
'thursday': 'Thursday',
|
||||||
|
'friday': 'Friday',
|
||||||
|
'saturday': 'Saturday',
|
||||||
|
'january': 'January',
|
||||||
|
'february': 'February',
|
||||||
|
'march': 'March',
|
||||||
|
'april': 'April',
|
||||||
|
'may': 'May',
|
||||||
|
'june': 'June',
|
||||||
|
'july': 'July',
|
||||||
|
'august': 'August',
|
||||||
|
'september': 'September',
|
||||||
|
'october': 'October',
|
||||||
|
'november': 'November',
|
||||||
|
'december': 'December',
|
||||||
'symbol': 'Symbol',
|
'symbol': 'Symbol',
|
||||||
'ocde': 'Code',
|
'ocde': 'Code',
|
||||||
'date_format': 'Date Format',
|
'date_format': 'Date Format',
|
||||||
|
|
@ -14655,6 +14676,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['long_press_multiselect'];
|
_localizedValues[localeCode]['long_press_multiselect'];
|
||||||
|
|
||||||
String get all => _localizedValues[localeCode]['all'];
|
String get all => _localizedValues[localeCode]['all'];
|
||||||
|
|
||||||
String get emailSignUp => _localizedValues[localeCode]['email_sign_up'];
|
String get emailSignUp => _localizedValues[localeCode]['email_sign_up'];
|
||||||
|
|
||||||
String get googleSignUp => _localizedValues[localeCode]['google_sign_up'];
|
String get googleSignUp => _localizedValues[localeCode]['google_sign_up'];
|
||||||
|
|
@ -14762,6 +14784,49 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get code => _localizedValues[localeCode]['ocde'];
|
String get code => _localizedValues[localeCode]['ocde'];
|
||||||
|
|
||||||
|
String get sunday => _localizedValues[localeCode]['sunday'];
|
||||||
|
|
||||||
|
String get monday => _localizedValues[localeCode]['monday'];
|
||||||
|
|
||||||
|
String get tuesday => _localizedValues[localeCode]['tuesday'];
|
||||||
|
|
||||||
|
String get wednesday => _localizedValues[localeCode]['wednesday'];
|
||||||
|
|
||||||
|
String get thursday => _localizedValues[localeCode]['thursday'];
|
||||||
|
|
||||||
|
String get friday => _localizedValues[localeCode]['friday'];
|
||||||
|
|
||||||
|
String get saturday => _localizedValues[localeCode]['saturday'];
|
||||||
|
|
||||||
|
String get january => _localizedValues[localeCode]['january'];
|
||||||
|
|
||||||
|
String get february => _localizedValues[localeCode]['february'];
|
||||||
|
|
||||||
|
String get march => _localizedValues[localeCode]['march'];
|
||||||
|
|
||||||
|
String get april => _localizedValues[localeCode]['april'];
|
||||||
|
|
||||||
|
String get may => _localizedValues[localeCode]['may'];
|
||||||
|
|
||||||
|
String get june => _localizedValues[localeCode]['june'];
|
||||||
|
|
||||||
|
String get july => _localizedValues[localeCode]['july'];
|
||||||
|
|
||||||
|
String get august => _localizedValues[localeCode]['august'];
|
||||||
|
|
||||||
|
String get september => _localizedValues[localeCode]['september'];
|
||||||
|
|
||||||
|
String get october => _localizedValues[localeCode]['october'];
|
||||||
|
|
||||||
|
String get november => _localizedValues[localeCode]['november'];
|
||||||
|
|
||||||
|
String get december => _localizedValues[localeCode]['december'];
|
||||||
|
|
||||||
|
String get firstDayOfTheWeek => _localizedValues[localeCode]['first_day_of_the_week'];
|
||||||
|
|
||||||
|
String get firstMonthOfTheYear => _localizedValues[localeCode]['first_month_of_the_year'];
|
||||||
|
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
return _localizedValues[localeCode][lookupKey] ??
|
return _localizedValues[localeCode][lookupKey] ??
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue