Custom labels
This commit is contained in:
parent
563da2779e
commit
8a669fe3fe
|
|
@ -50,6 +50,7 @@ const String kCronsHelpUrl =
|
|||
'https://invoiceninja.github.io/selfhost.html#cron-configuration';
|
||||
const String kGitHubDiffUrl =
|
||||
'https://github.com/invoiceninja/invoiceninja/compare/vVERSION...v5-stable';
|
||||
const String kGitHubLangUrl = 'https://github.com/invoiceninja/invoiceninja/blob/master/resources/lang/en/texts.php';
|
||||
|
||||
enum AppEnvironment {
|
||||
hosted,
|
||||
|
|
|
|||
|
|
@ -1239,9 +1239,6 @@ abstract class SettingsEntity
|
|||
emailBodyReminderEndless: clientSettings?.emailBodyReminderEndless ??
|
||||
groupSettings?.emailBodyReminderEndless ??
|
||||
companySettings?.emailBodyReminderEndless,
|
||||
customPaymentTerms: clientSettings?.customPaymentTerms ??
|
||||
groupSettings?.customPaymentTerms ??
|
||||
companySettings?.customPaymentTerms,
|
||||
pdfVariables: clientSettings?.pdfVariables ??
|
||||
groupSettings?.pdfVariables ??
|
||||
companySettings?.pdfVariables,
|
||||
|
|
@ -1966,11 +1963,6 @@ abstract class SettingsEntity
|
|||
@BuiltValueField(wireName: 'portal_custom_js')
|
||||
String get clientPortalCustomJs;
|
||||
|
||||
// TODO remove this field
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'custom_payment_terms')
|
||||
BuiltList<PaymentTermEntity> get customPaymentTerms;
|
||||
|
||||
// TODO remove this field
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'has_custom_design1_HIDDEN')
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -525,7 +525,6 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
const FullType(BuiltList, const [const FullType(String)])
|
||||
]),
|
||||
() => new MapBuilder<String, BuiltList<String>>())
|
||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(PaymentTermEntity)]), () => new ListBuilder<PaymentTermEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(TaskEntity)]), () => new MapBuilder<String, TaskEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(String)]), () => new ListBuilder<String>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(TaskStatusEntity)]), () => new MapBuilder<String, TaskStatusEntity>())
|
||||
|
|
|
|||
|
|
@ -15,9 +15,11 @@ import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
|||
import 'package:invoiceninja_flutter/ui/app/forms/bool_dropdown_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/settings/localization_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
||||
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class LocalizationSettings extends StatefulWidget {
|
||||
const LocalizationSettings({
|
||||
|
|
@ -251,20 +253,44 @@ class _LocalizationSettingsState extends State<LocalizationSettings>
|
|||
FormCard(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
items: customLabels
|
||||
.map((key) => DropdownMenuItem(
|
||||
child: Text(localization.lookup(key)),
|
||||
value: key,
|
||||
))
|
||||
.toList(),
|
||||
hint: Text(localization.selectLabel),
|
||||
onChanged: (value) {
|
||||
viewModel.onSettingsChanged(settings
|
||||
.rebuild((b) => b..translations[value] = ''));
|
||||
},
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
items: customLabels
|
||||
.map((key) => DropdownMenuItem(
|
||||
child: Text(localization.lookup(key)),
|
||||
value: key,
|
||||
))
|
||||
.toList(),
|
||||
hint: Text(localization.selectLabel),
|
||||
onChanged: (value) {
|
||||
viewModel.onSettingsChanged(settings
|
||||
.rebuild((b) => b..translations[value] = ''));
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
FlatButton(
|
||||
child: Text(localization.addCustom),
|
||||
onPressed: () {
|
||||
fieldCallback(
|
||||
context: context,
|
||||
callback: (value) {
|
||||
viewModel.onSettingsChanged(settings.rebuild(
|
||||
(b) => b..translations[value] = ''));
|
||||
},
|
||||
field: localization.label,
|
||||
title: localization.addCustom,
|
||||
secondaryActions: [
|
||||
FlatButton(
|
||||
child: Text(localization.labels.toUpperCase()),
|
||||
onPressed: () => launch(kGitHubLangUrl),
|
||||
)
|
||||
]);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
for (var key in translations.keys)
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ void fieldCallback({
|
|||
String field,
|
||||
Function(String) callback,
|
||||
int maxLength,
|
||||
List<FlatButton> secondaryActions,
|
||||
}) {
|
||||
showDialog<AlertDialog>(
|
||||
context: context,
|
||||
|
|
@ -166,6 +167,7 @@ void fieldCallback({
|
|||
field: field,
|
||||
title: title,
|
||||
maxLength: maxLength,
|
||||
secondaryActions: secondaryActions,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
@ -177,12 +179,14 @@ class FieldConfirmation extends StatefulWidget {
|
|||
@required this.title,
|
||||
@required this.field,
|
||||
this.maxLength,
|
||||
this.secondaryActions,
|
||||
});
|
||||
|
||||
final Function(String) callback;
|
||||
final String title;
|
||||
final String field;
|
||||
final int maxLength;
|
||||
final List<FlatButton> secondaryActions;
|
||||
|
||||
@override
|
||||
_FieldConfirmationState createState() => _FieldConfirmationState();
|
||||
|
|
@ -213,6 +217,8 @@ class _FieldConfirmationState extends State<FieldConfirmation> {
|
|||
onSubmitted: (value) => _submit(),
|
||||
),
|
||||
actions: <Widget>[
|
||||
...widget.secondaryActions ?? [],
|
||||
SizedBox(width: 6),
|
||||
SaveCancelButtons(
|
||||
isHeader: false,
|
||||
saveLabel: localization.save.toUpperCase(),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'labels': 'Labels',
|
||||
'add_custom': 'Add Custom',
|
||||
'payment_tax': 'Payment Tax',
|
||||
'unpaid': 'Unpaid',
|
||||
'white_label': 'White Label',
|
||||
|
|
@ -5217,6 +5219,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
|
||||
String get paymentTax => _localizedValues[localeCode]['payment_tax'] ?? '';
|
||||
|
||||
String get addCustom => _localizedValues[localeCode]['add_custom'] ?? '';
|
||||
|
||||
String get labels => _localizedValues[localeCode]['labels'] ?? '';
|
||||
|
||||
String lookup(String key) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ packages:
|
|||
name: intl
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.17.0-nullsafety.2"
|
||||
version: "0.16.1"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ dependencies:
|
|||
extended_image: 1.3.1-dev #TODO remove
|
||||
|
||||
# https://github.com/flutter/flutter/issues/70433#issuecomment-727154345
|
||||
dependency_overrides:
|
||||
intl: ^0.17.0-nullsafety.2
|
||||
#dependency_overrides:
|
||||
#vf intl: ^0.17.0-nullsafety.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_driver:
|
||||
|
|
|
|||
Loading…
Reference in New Issue