Settings
This commit is contained in:
parent
d9bbd53ec8
commit
95edfb00ad
|
|
@ -735,6 +735,15 @@ abstract class SettingsEntity
|
||||||
|
|
||||||
bool get hasTimezone => timezoneId != null && timezoneId.isNotEmpty;
|
bool get hasTimezone => timezoneId != null && timezoneId.isNotEmpty;
|
||||||
|
|
||||||
|
bool get hasDateFormat => dateFormatId != null && dateFormatId.isNotEmpty;
|
||||||
|
|
||||||
|
bool get hasDatetimeFormat =>
|
||||||
|
datetimeFormatId != null && datetimeFormatId.isNotEmpty;
|
||||||
|
|
||||||
|
bool get hasLanguage => languageId != null && languageId.isNotEmpty;
|
||||||
|
|
||||||
|
bool get hasCurrency => currencyId != null && currencyId.isNotEmpty;
|
||||||
|
|
||||||
bool hasInvoiceField(String field,
|
bool hasInvoiceField(String field,
|
||||||
[EntityType entityType = EntityType.product]) {
|
[EntityType entityType = EntityType.product]) {
|
||||||
if (invoiceFields != null && invoiceFields.isNotEmpty) {
|
if (invoiceFields != null && invoiceFields.isNotEmpty) {
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ class SettingsViewer extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
final staticState = state.staticState;
|
||||||
|
|
||||||
return FieldGrid({
|
return FieldGrid({
|
||||||
localization.name: settings.name,
|
localization.name: settings.name,
|
||||||
|
|
@ -114,8 +115,26 @@ class SettingsViewer extends StatelessWidget {
|
||||||
localization.vatNumber: settings.vatNumber,
|
localization.vatNumber: settings.vatNumber,
|
||||||
localization.website: settings.website,
|
localization.website: settings.website,
|
||||||
localization.timezone: settings.hasTimezone
|
localization.timezone: settings.hasTimezone
|
||||||
? state.staticState.timezoneMap[settings.timezoneId]?.name
|
? staticState.timezoneMap[settings.timezoneId]?.name
|
||||||
: null,
|
: null,
|
||||||
|
localization.dateFormat: settings.hasDateFormat
|
||||||
|
? staticState.dateFormatMap[settings.dateFormatId]?.format
|
||||||
|
: null,
|
||||||
|
localization.datetimeFormat: settings.hasDatetimeFormat
|
||||||
|
? staticState.datetimeFormatMap[settings.datetimeFormatId]?.format
|
||||||
|
: null,
|
||||||
|
localization.militaryTime:
|
||||||
|
settings.enableMilitaryTime ? localization.enabled : null,
|
||||||
|
localization.language: settings.hasLanguage
|
||||||
|
? staticState.languageMap[settings.languageId]?.name
|
||||||
|
: null,
|
||||||
|
localization.currency: settings.hasCurrency
|
||||||
|
? staticState.currencyMap[settings.currencyId]?.name
|
||||||
|
: null,
|
||||||
|
localization.sendReminders:
|
||||||
|
settings.sendReminders ? localization.enabled : null,
|
||||||
|
localization.showTasks:
|
||||||
|
settings.showTasksInPortal ? localization.enabled : null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@ 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': {
|
||||||
|
'date_format': 'Date Format',
|
||||||
|
'datetime_format': 'Datetime Format',
|
||||||
|
'military_time': 'Military Time',
|
||||||
|
'send_reminders': 'Send Reminders',
|
||||||
'timezone': 'Timezone',
|
'timezone': 'Timezone',
|
||||||
'filtered_by_group': 'Filtered by Group',
|
'filtered_by_group': 'Filtered by Group',
|
||||||
'filtered_by_client': 'Filtered by Client',
|
'filtered_by_client': 'Filtered by Client',
|
||||||
|
|
@ -14729,6 +14733,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get timezone => _localizedValues[localeCode]['timezone'];
|
String get timezone => _localizedValues[localeCode]['timezone'];
|
||||||
|
|
||||||
|
String get dateFormat => _localizedValues[localeCode]['date_format'];
|
||||||
|
|
||||||
|
String get datetimeFormat => _localizedValues[localeCode]['datetime_format'];
|
||||||
|
|
||||||
|
String get militaryTime => _localizedValues[localeCode]['military_time'];
|
||||||
|
|
||||||
|
String get sendReminders => _localizedValues[localeCode]['send_reminders'];
|
||||||
|
|
||||||
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