Add paymentEmailAllContacts to settings model

This commit is contained in:
Hillel Coren 2023-11-30 18:05:48 +02:00
parent 9cd377746a
commit ca75884848
4 changed files with 59 additions and 4 deletions

View File

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

View File

@ -1571,6 +1571,13 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(value,
specifiedType: const FullType(String)));
}
value = object.paymentEmailAllContacts;
if (value != null) {
result
..add('payment_email_all_contacts')
..add(
serializers.serialize(value, specifiedType: const FullType(bool)));
}
return result;
}
@ -2485,6 +2492,10 @@ class _$SettingsEntitySerializer
result.classification = serializers.deserialize(value,
specifiedType: const FullType(String)) as String?;
break;
case 'payment_email_all_contacts':
result.paymentEmailAllContacts = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool?;
break;
}
}
@ -3010,6 +3021,8 @@ class _$SettingsEntity extends SettingsEntity {
final String? defaultExpensePaymentTypeId;
@override
final String? classification;
@override
final bool? paymentEmailAllContacts;
factory _$SettingsEntity([void Function(SettingsEntityBuilder)? updates]) =>
(new SettingsEntityBuilder()..update(updates))._build();
@ -3237,7 +3250,8 @@ class _$SettingsEntity extends SettingsEntity {
this.enableEInvoice,
this.eInvoiceType,
this.defaultExpensePaymentTypeId,
this.classification})
this.classification,
this.paymentEmailAllContacts})
: super._();
@override
@ -3479,7 +3493,8 @@ class _$SettingsEntity extends SettingsEntity {
enableEInvoice == other.enableEInvoice &&
eInvoiceType == other.eInvoiceType &&
defaultExpensePaymentTypeId == other.defaultExpensePaymentTypeId &&
classification == other.classification;
classification == other.classification &&
paymentEmailAllContacts == other.paymentEmailAllContacts;
}
int? __hashCode;
@ -3710,6 +3725,7 @@ class _$SettingsEntity extends SettingsEntity {
_$hash = $jc(_$hash, eInvoiceType.hashCode);
_$hash = $jc(_$hash, defaultExpensePaymentTypeId.hashCode);
_$hash = $jc(_$hash, classification.hashCode);
_$hash = $jc(_$hash, paymentEmailAllContacts.hashCode);
_$hash = $jf(_$hash);
return __hashCode ??= _$hash;
}
@ -3944,7 +3960,8 @@ class _$SettingsEntity extends SettingsEntity {
..add('enableEInvoice', enableEInvoice)
..add('eInvoiceType', eInvoiceType)
..add('defaultExpensePaymentTypeId', defaultExpensePaymentTypeId)
..add('classification', classification))
..add('classification', classification)
..add('paymentEmailAllContacts', paymentEmailAllContacts))
.toString();
}
}
@ -5055,6 +5072,11 @@ class SettingsEntityBuilder
set classification(String? classification) =>
_$this._classification = classification;
bool? _paymentEmailAllContacts;
bool? get paymentEmailAllContacts => _$this._paymentEmailAllContacts;
set paymentEmailAllContacts(bool? paymentEmailAllContacts) =>
_$this._paymentEmailAllContacts = paymentEmailAllContacts;
SettingsEntityBuilder();
SettingsEntityBuilder get _$this {
@ -5283,6 +5305,7 @@ class SettingsEntityBuilder
_eInvoiceType = $v.eInvoiceType;
_defaultExpensePaymentTypeId = $v.defaultExpensePaymentTypeId;
_classification = $v.classification;
_paymentEmailAllContacts = $v.paymentEmailAllContacts;
_$v = null;
}
return this;
@ -5530,7 +5553,8 @@ class SettingsEntityBuilder
enableEInvoice: enableEInvoice,
eInvoiceType: eInvoiceType,
defaultExpensePaymentTypeId: defaultExpensePaymentTypeId,
classification: classification);
classification: classification,
paymentEmailAllContacts: paymentEmailAllContacts);
} catch (_) {
late String _$failedField;
try {

View File

@ -295,6 +295,18 @@ class _PaymentSettingsState extends State<PaymentSettings> {
helpLabel: localization.markPaidPaymentEmailHelp,
iconData: Icons.email,
),
if (!state.settingsUIState.isFiltered) SizedBox(height: 10),
BoolDropdownButton(
value: state.settingsUIState.isFiltered
? settings.paymentEmailAllContacts
: settings.paymentEmailAllContacts ?? false,
onChanged: (value) => viewModel.onSettingsChanged(settings
.rebuild((b) => b..paymentEmailAllContacts = value)),
label: localization.sendEmailTo,
iconData: Icons.email,
enabledLabel: localization.primaryContact,
disabledLabel: localization.allContacts,
),
],
)
],

View File

@ -18,6 +18,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'send_email_to': 'Send Email To',
'primary_contact': 'Primary Contact',
'all_contacts': 'All Contacts',
'insert_below': 'Insert Below',
'aged_receivable_detailed_report': 'Aged Receivable Detailed Report',
'aged_receivable_summary_report': 'Aged Receivable Summary Report',
@ -110953,6 +110956,19 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]!['insert_below'] ??
_localizedValues['en']!['insert_below']!;
String get primaryContact =>
_localizedValues[localeCode]!['primary_contact'] ??
_localizedValues['en']!['primary_contact']!;
String get allContacts =>
_localizedValues[localeCode]!['all_contacts'] ??
_localizedValues['en']!['all_contacts']!;
String get sendEmailTo =>
_localizedValues[localeCode]!['send_email_to'] ??
_localizedValues['en']!['send_email_to']!;
// STARTER: lang field - do not remove comment
String lookup(String? key) {