Add UI for show_pdfhtml_on_mobile

This commit is contained in:
Hillel Coren 2024-01-29 18:01:24 +02:00
parent 09f1b3a8e5
commit b2006e462d
4 changed files with 44 additions and 4 deletions

View File

@ -815,6 +815,9 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'payment_email_all_contacts') @BuiltValueField(wireName: 'payment_email_all_contacts')
bool? get paymentEmailAllContacts; bool? get paymentEmailAllContacts;
@BuiltValueField(wireName: 'show_pdfhtml_on_mobile')
bool? get showPdfhtmlOnMobile;
bool get hasAddress => address1 != null && address1!.isNotEmpty; bool get hasAddress => address1 != null && address1!.isNotEmpty;
bool get hasLogo => companyLogo != null && companyLogo!.isNotEmpty; bool get hasLogo => companyLogo != null && companyLogo!.isNotEmpty;

View File

@ -1578,6 +1578,13 @@ class _$SettingsEntitySerializer
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(bool))); serializers.serialize(value, specifiedType: const FullType(bool)));
} }
value = object.showPdfhtmlOnMobile;
if (value != null) {
result
..add('show_pdfhtml_on_mobile')
..add(
serializers.serialize(value, specifiedType: const FullType(bool)));
}
return result; return result;
} }
@ -2496,6 +2503,10 @@ class _$SettingsEntitySerializer
result.paymentEmailAllContacts = serializers.deserialize(value, result.paymentEmailAllContacts = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool?; specifiedType: const FullType(bool)) as bool?;
break; break;
case 'show_pdfhtml_on_mobile':
result.showPdfhtmlOnMobile = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool?;
break;
} }
} }
@ -3023,6 +3034,8 @@ class _$SettingsEntity extends SettingsEntity {
final String? classification; final String? classification;
@override @override
final bool? paymentEmailAllContacts; final bool? paymentEmailAllContacts;
@override
final bool? showPdfhtmlOnMobile;
factory _$SettingsEntity([void Function(SettingsEntityBuilder)? updates]) => factory _$SettingsEntity([void Function(SettingsEntityBuilder)? updates]) =>
(new SettingsEntityBuilder()..update(updates))._build(); (new SettingsEntityBuilder()..update(updates))._build();
@ -3251,7 +3264,8 @@ class _$SettingsEntity extends SettingsEntity {
this.eInvoiceType, this.eInvoiceType,
this.defaultExpensePaymentTypeId, this.defaultExpensePaymentTypeId,
this.classification, this.classification,
this.paymentEmailAllContacts}) this.paymentEmailAllContacts,
this.showPdfhtmlOnMobile})
: super._(); : super._();
@override @override
@ -3494,7 +3508,8 @@ class _$SettingsEntity extends SettingsEntity {
eInvoiceType == other.eInvoiceType && eInvoiceType == other.eInvoiceType &&
defaultExpensePaymentTypeId == other.defaultExpensePaymentTypeId && defaultExpensePaymentTypeId == other.defaultExpensePaymentTypeId &&
classification == other.classification && classification == other.classification &&
paymentEmailAllContacts == other.paymentEmailAllContacts; paymentEmailAllContacts == other.paymentEmailAllContacts &&
showPdfhtmlOnMobile == other.showPdfhtmlOnMobile;
} }
int? __hashCode; int? __hashCode;
@ -3726,6 +3741,7 @@ class _$SettingsEntity extends SettingsEntity {
_$hash = $jc(_$hash, defaultExpensePaymentTypeId.hashCode); _$hash = $jc(_$hash, defaultExpensePaymentTypeId.hashCode);
_$hash = $jc(_$hash, classification.hashCode); _$hash = $jc(_$hash, classification.hashCode);
_$hash = $jc(_$hash, paymentEmailAllContacts.hashCode); _$hash = $jc(_$hash, paymentEmailAllContacts.hashCode);
_$hash = $jc(_$hash, showPdfhtmlOnMobile.hashCode);
_$hash = $jf(_$hash); _$hash = $jf(_$hash);
return __hashCode ??= _$hash; return __hashCode ??= _$hash;
} }
@ -3961,7 +3977,8 @@ class _$SettingsEntity extends SettingsEntity {
..add('eInvoiceType', eInvoiceType) ..add('eInvoiceType', eInvoiceType)
..add('defaultExpensePaymentTypeId', defaultExpensePaymentTypeId) ..add('defaultExpensePaymentTypeId', defaultExpensePaymentTypeId)
..add('classification', classification) ..add('classification', classification)
..add('paymentEmailAllContacts', paymentEmailAllContacts)) ..add('paymentEmailAllContacts', paymentEmailAllContacts)
..add('showPdfhtmlOnMobile', showPdfhtmlOnMobile))
.toString(); .toString();
} }
} }
@ -5077,6 +5094,11 @@ class SettingsEntityBuilder
set paymentEmailAllContacts(bool? paymentEmailAllContacts) => set paymentEmailAllContacts(bool? paymentEmailAllContacts) =>
_$this._paymentEmailAllContacts = paymentEmailAllContacts; _$this._paymentEmailAllContacts = paymentEmailAllContacts;
bool? _showPdfhtmlOnMobile;
bool? get showPdfhtmlOnMobile => _$this._showPdfhtmlOnMobile;
set showPdfhtmlOnMobile(bool? showPdfhtmlOnMobile) =>
_$this._showPdfhtmlOnMobile = showPdfhtmlOnMobile;
SettingsEntityBuilder(); SettingsEntityBuilder();
SettingsEntityBuilder get _$this { SettingsEntityBuilder get _$this {
@ -5306,6 +5328,7 @@ class SettingsEntityBuilder
_defaultExpensePaymentTypeId = $v.defaultExpensePaymentTypeId; _defaultExpensePaymentTypeId = $v.defaultExpensePaymentTypeId;
_classification = $v.classification; _classification = $v.classification;
_paymentEmailAllContacts = $v.paymentEmailAllContacts; _paymentEmailAllContacts = $v.paymentEmailAllContacts;
_showPdfhtmlOnMobile = $v.showPdfhtmlOnMobile;
_$v = null; _$v = null;
} }
return this; return this;
@ -5554,7 +5577,8 @@ class SettingsEntityBuilder
eInvoiceType: eInvoiceType, eInvoiceType: eInvoiceType,
defaultExpensePaymentTypeId: defaultExpensePaymentTypeId, defaultExpensePaymentTypeId: defaultExpensePaymentTypeId,
classification: classification, classification: classification,
paymentEmailAllContacts: paymentEmailAllContacts); paymentEmailAllContacts: paymentEmailAllContacts,
showPdfhtmlOnMobile: showPdfhtmlOnMobile);
} catch (_) { } catch (_) {
late String _$failedField; late String _$failedField;
try { try {

View File

@ -622,6 +622,14 @@ class _InvoiceDesignState extends State<InvoiceDesign>
settings settings
.rebuild((b) => b..embedDocuments = value)), .rebuild((b) => b..embedDocuments = value)),
), ),
BoolDropdownButton(
label: localization.mobileVersion,
value: settings.showPdfhtmlOnMobile ?? true,
iconData: Icons.mobile_friendly,
onChanged: (value) => viewModel.onSettingsChanged(
settings.rebuild(
(b) => b..showPdfhtmlOnMobile = value)),
),
], ],
), ),
FormCard( FormCard(

View File

@ -18,6 +18,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
'mobile_version': 'Mobile Version',
'venmo': 'Venmo', 'venmo': 'Venmo',
'mercado_pago': 'Mercado Pago', 'mercado_pago': 'Mercado Pago',
'my_bank': 'MyBank', 'my_bank': 'MyBank',
@ -114268,6 +114269,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]!['email_report'] ?? _localizedValues[localeCode]!['email_report'] ??
_localizedValues['en']!['email_report']!; _localizedValues['en']!['email_report']!;
String get mobileVersion =>
_localizedValues[localeCode]!['mobile_version'] ??
_localizedValues['en']!['mobile_version']!;
// STARTER: lang field - do not remove comment // STARTER: lang field - do not remove comment
String lookup(String? key) { String lookup(String? key) {