This commit is contained in:
Hillel Coren 2019-11-01 15:53:14 +02:00
parent 010292c248
commit aa1af9cc7d
3 changed files with 125 additions and 18 deletions

View File

@ -950,6 +950,19 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'all_pages_footer') @BuiltValueField(wireName: 'all_pages_footer')
bool get allPagesFooter; bool get allPagesFooter;
@nullable
@BuiltValueField(wireName: 'enableReminder1')
bool get enableReminder1;
@nullable
@BuiltValueField(wireName: 'enableReminder2')
bool get enableReminder2;
@nullable
@BuiltValueField(wireName: 'enableReminder3')
bool get enableReminder3;
// TODO remove this field // TODO remove this field
@nullable @nullable
@BuiltValueField(wireName: 'custom_payment_terms') @BuiltValueField(wireName: 'custom_payment_terms')

View File

@ -1395,6 +1395,24 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(object.allPagesFooter, ..add(serializers.serialize(object.allPagesFooter,
specifiedType: const FullType(bool))); specifiedType: const FullType(bool)));
} }
if (object.enableReminder1 != null) {
result
..add('enableReminder1')
..add(serializers.serialize(object.enableReminder1,
specifiedType: const FullType(bool)));
}
if (object.enableReminder2 != null) {
result
..add('enableReminder2')
..add(serializers.serialize(object.enableReminder2,
specifiedType: const FullType(bool)));
}
if (object.enableReminder3 != null) {
result
..add('enableReminder3')
..add(serializers.serialize(object.enableReminder3,
specifiedType: const FullType(bool)));
}
if (object.customPaymentTerms != null) { if (object.customPaymentTerms != null) {
result result
..add('custom_payment_terms') ..add('custom_payment_terms')
@ -1914,6 +1932,18 @@ class _$SettingsEntitySerializer
result.allPagesFooter = serializers.deserialize(value, result.allPagesFooter = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool; specifiedType: const FullType(bool)) as bool;
break; break;
case 'enableReminder1':
result.enableReminder1 = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'enableReminder2':
result.enableReminder2 = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'enableReminder3':
result.enableReminder3 = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'custom_payment_terms': case 'custom_payment_terms':
result.customPaymentTerms.replace(serializers.deserialize(value, result.customPaymentTerms.replace(serializers.deserialize(value,
specifiedType: const FullType( specifiedType: const FullType(
@ -3269,6 +3299,12 @@ class _$SettingsEntity extends SettingsEntity {
@override @override
final bool allPagesFooter; final bool allPagesFooter;
@override @override
final bool enableReminder1;
@override
final bool enableReminder2;
@override
final bool enableReminder3;
@override
final BuiltList<PaymentTermEntity> customPaymentTerms; final BuiltList<PaymentTermEntity> customPaymentTerms;
@override @override
final bool hasCustomDesign1; final bool hasCustomDesign1;
@ -3400,6 +3436,9 @@ class _$SettingsEntity extends SettingsEntity {
this.embedDocuments, this.embedDocuments,
this.allPagesHeader, this.allPagesHeader,
this.allPagesFooter, this.allPagesFooter,
this.enableReminder1,
this.enableReminder2,
this.enableReminder3,
this.customPaymentTerms, this.customPaymentTerms,
this.hasCustomDesign1, this.hasCustomDesign1,
this.hasCustomDesign2, this.hasCustomDesign2,
@ -3537,6 +3576,9 @@ class _$SettingsEntity extends SettingsEntity {
embedDocuments == other.embedDocuments && embedDocuments == other.embedDocuments &&
allPagesHeader == other.allPagesHeader && allPagesHeader == other.allPagesHeader &&
allPagesFooter == other.allPagesFooter && allPagesFooter == other.allPagesFooter &&
enableReminder1 == other.enableReminder1 &&
enableReminder2 == other.enableReminder2 &&
enableReminder3 == other.enableReminder3 &&
customPaymentTerms == other.customPaymentTerms && customPaymentTerms == other.customPaymentTerms &&
hasCustomDesign1 == other.hasCustomDesign1 && hasCustomDesign1 == other.hasCustomDesign1 &&
hasCustomDesign2 == other.hasCustomDesign2 && hasCustomDesign2 == other.hasCustomDesign2 &&
@ -3563,22 +3605,22 @@ class _$SettingsEntity extends SettingsEntity {
$jc( $jc(
$jc( $jc(
$jc( $jc(
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, timezoneId.hashCode), dateFormatId.hashCode), enableMilitaryTime.hashCode), languageId.hashCode), showCurrencyCode.hashCode), currencyId.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), defaultPaymentTerms.hashCode), companyGatewayIds.hashCode), defaultTaskRate.hashCode), sendReminders.hashCode), showTasksInPortal.hashCode), emailStyle.hashCode), replyToEmail.hashCode), bccEmail.hashCode), pdfEmailAttachment.hashCode), ublEmailAttachment.hashCode), documentEmailAttachment.hashCode), emailStyleCustom.hashCode), customMessageDashboard.hashCode), customMessageUnpaidInvoice.hashCode), customMessagePaidInvoice.hashCode), customMessageUnapprovedQuote.hashCode), lockSentInvoices.hashCode), autoArchiveInvoice.hashCode), autoArchiveQuote.hashCode), autoEmailInvoice.hashCode), autoConvertQuote.hashCode), enableInclusiveTaxes.hashCode), translations.hashCode), taskNumberPattern.hashCode), taskNumberCounter.hashCode), expenseNumberPattern.hashCode), expenseNumberCounter.hashCode), vendorNumberPattern.hashCode), vendorNumberCounter.hashCode), ticketNumberPattern.hashCode), ticketNumberCounter.hashCode), paymentNumberPattern.hashCode), paymentNumberCounter.hashCode), invoiceNumberPattern.hashCode), invoiceNumberCounter.hashCode), quoteNumberPattern.hashCode), quoteNumberCounter.hashCode), clientNumberPattern.hashCode), clientNumberCounter.hashCode), creditNumberPattern.hashCode), creditNumberCounter.hashCode), recurringInvoiceNumberPrefix.hashCode), resetCounterFrequencyId.hashCode), resetCounterDate.hashCode), counterPadding.hashCode), sharedInvoiceQuoteCounter.hashCode), defaultInvoiceTerms.hashCode), defaultQuoteTerms.hashCode), defaultQuoteFooter.hashCode), enableInvoiceTaxes.hashCode), enableInvoiceItemTaxes.hashCode), defaultInvoiceDesignId.hashCode), defaultQuoteDesignId.hashCode), defaultInvoiceFooter.hashCode), invoiceLabels.hashCode), showInvoiceItemTaxes.hashCode), defaultTaxName1.hashCode), defaultTaxRate1.hashCode), defaultTaxName2.hashCode), defaultTaxRate2.hashCode), defaultTaxName3.hashCode), defaultTaxRate3.hashCode), defaultPaymentTypeId.hashCode), enableSecondTaxRate.hashCode), invoiceFields.hashCode), emailFooter.hashCode), emailSubjectInvoice.hashCode), emailSubjectQuote.hashCode), emailSubjectPayment.hashCode), emailBodyInvoice.hashCode), emailBodyQuote.hashCode), emailBodyPayment.hashCode), emailSubjectReminder1.hashCode), emailSubjectReminder2.hashCode), emailSubjectReminder3.hashCode), emailBodyReminder1.hashCode), emailBodyReminder2.hashCode), emailBodyReminder3.hashCode), enablePortalPassword.hashCode), sendPortalPassword.hashCode), signatureOnPdf.hashCode), enableEmailMarkup.hashCode), showAcceptInvoiceTerms.hashCode), showAcceptQuoteTerms.hashCode), requireInvoiceSignature.hashCode), requireQuoteSignature.hashCode), name.hashCode), companyLogo.hashCode), website.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), $jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, timezoneId.hashCode), dateFormatId.hashCode), enableMilitaryTime.hashCode), languageId.hashCode), showCurrencyCode.hashCode), currencyId.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), defaultPaymentTerms.hashCode), companyGatewayIds.hashCode), defaultTaskRate.hashCode), sendReminders.hashCode), showTasksInPortal.hashCode), emailStyle.hashCode), replyToEmail.hashCode), bccEmail.hashCode), pdfEmailAttachment.hashCode), ublEmailAttachment.hashCode), documentEmailAttachment.hashCode), emailStyleCustom.hashCode), customMessageDashboard.hashCode), customMessageUnpaidInvoice.hashCode), customMessagePaidInvoice.hashCode), customMessageUnapprovedQuote.hashCode), lockSentInvoices.hashCode), autoArchiveInvoice.hashCode), autoArchiveQuote.hashCode), autoEmailInvoice.hashCode), autoConvertQuote.hashCode), enableInclusiveTaxes.hashCode), translations.hashCode), taskNumberPattern.hashCode), taskNumberCounter.hashCode), expenseNumberPattern.hashCode), expenseNumberCounter.hashCode), vendorNumberPattern.hashCode), vendorNumberCounter.hashCode), ticketNumberPattern.hashCode), ticketNumberCounter.hashCode), paymentNumberPattern.hashCode), paymentNumberCounter.hashCode), invoiceNumberPattern.hashCode), invoiceNumberCounter.hashCode), quoteNumberPattern.hashCode), quoteNumberCounter.hashCode), clientNumberPattern.hashCode), clientNumberCounter.hashCode), creditNumberPattern.hashCode), creditNumberCounter.hashCode), recurringInvoiceNumberPrefix.hashCode), resetCounterFrequencyId.hashCode), resetCounterDate.hashCode), counterPadding.hashCode), sharedInvoiceQuoteCounter.hashCode), defaultInvoiceTerms.hashCode), defaultQuoteTerms.hashCode), defaultQuoteFooter.hashCode), enableInvoiceTaxes.hashCode), enableInvoiceItemTaxes.hashCode), defaultInvoiceDesignId.hashCode), defaultQuoteDesignId.hashCode), defaultInvoiceFooter.hashCode), invoiceLabels.hashCode), showInvoiceItemTaxes.hashCode), defaultTaxName1.hashCode), defaultTaxRate1.hashCode), defaultTaxName2.hashCode), defaultTaxRate2.hashCode), defaultTaxName3.hashCode), defaultTaxRate3.hashCode), defaultPaymentTypeId.hashCode), enableSecondTaxRate.hashCode), invoiceFields.hashCode), emailFooter.hashCode), emailSubjectInvoice.hashCode), emailSubjectQuote.hashCode), emailSubjectPayment.hashCode), emailBodyInvoice.hashCode), emailBodyQuote.hashCode), emailBodyPayment.hashCode), emailSubjectReminder1.hashCode), emailSubjectReminder2.hashCode), emailSubjectReminder3.hashCode), emailBodyReminder1.hashCode), emailBodyReminder2.hashCode), emailBodyReminder3.hashCode), enablePortalPassword.hashCode), sendPortalPassword.hashCode), signatureOnPdf.hashCode), enableEmailMarkup.hashCode), showAcceptInvoiceTerms.hashCode), showAcceptQuoteTerms.hashCode), requireInvoiceSignature.hashCode), requireQuoteSignature.hashCode), name.hashCode), companyLogo.hashCode), website.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), phone.hashCode), email.hashCode), countryId.hashCode),
phone.hashCode), vatNumber.hashCode),
email.hashCode), idNumber.hashCode),
countryId.hashCode), pageSize.hashCode),
vatNumber.hashCode), fontSize.hashCode),
idNumber.hashCode), primaryColor.hashCode),
pageSize.hashCode), secondaryColor.hashCode),
fontSize.hashCode), primaryFont.hashCode),
primaryColor.hashCode), secondaryFont.hashCode),
secondaryColor.hashCode), hidePaidToDate.hashCode),
primaryFont.hashCode), embedDocuments.hashCode),
secondaryFont.hashCode), allPagesHeader.hashCode),
hidePaidToDate.hashCode), allPagesFooter.hashCode),
embedDocuments.hashCode), enableReminder1.hashCode),
allPagesHeader.hashCode), enableReminder2.hashCode),
allPagesFooter.hashCode), enableReminder3.hashCode),
customPaymentTerms.hashCode), customPaymentTerms.hashCode),
hasCustomDesign1.hashCode), hasCustomDesign1.hashCode),
hasCustomDesign2.hashCode), hasCustomDesign2.hashCode),
@ -3707,6 +3749,9 @@ class _$SettingsEntity extends SettingsEntity {
..add('embedDocuments', embedDocuments) ..add('embedDocuments', embedDocuments)
..add('allPagesHeader', allPagesHeader) ..add('allPagesHeader', allPagesHeader)
..add('allPagesFooter', allPagesFooter) ..add('allPagesFooter', allPagesFooter)
..add('enableReminder1', enableReminder1)
..add('enableReminder2', enableReminder2)
..add('enableReminder3', enableReminder3)
..add('customPaymentTerms', customPaymentTerms) ..add('customPaymentTerms', customPaymentTerms)
..add('hasCustomDesign1', hasCustomDesign1) ..add('hasCustomDesign1', hasCustomDesign1)
..add('hasCustomDesign2', hasCustomDesign2) ..add('hasCustomDesign2', hasCustomDesign2)
@ -4288,6 +4333,21 @@ class SettingsEntityBuilder
set allPagesFooter(bool allPagesFooter) => set allPagesFooter(bool allPagesFooter) =>
_$this._allPagesFooter = allPagesFooter; _$this._allPagesFooter = allPagesFooter;
bool _enableReminder1;
bool get enableReminder1 => _$this._enableReminder1;
set enableReminder1(bool enableReminder1) =>
_$this._enableReminder1 = enableReminder1;
bool _enableReminder2;
bool get enableReminder2 => _$this._enableReminder2;
set enableReminder2(bool enableReminder2) =>
_$this._enableReminder2 = enableReminder2;
bool _enableReminder3;
bool get enableReminder3 => _$this._enableReminder3;
set enableReminder3(bool enableReminder3) =>
_$this._enableReminder3 = enableReminder3;
ListBuilder<PaymentTermEntity> _customPaymentTerms; ListBuilder<PaymentTermEntity> _customPaymentTerms;
ListBuilder<PaymentTermEntity> get customPaymentTerms => ListBuilder<PaymentTermEntity> get customPaymentTerms =>
_$this._customPaymentTerms ??= new ListBuilder<PaymentTermEntity>(); _$this._customPaymentTerms ??= new ListBuilder<PaymentTermEntity>();
@ -4432,6 +4492,9 @@ class SettingsEntityBuilder
_embedDocuments = _$v.embedDocuments; _embedDocuments = _$v.embedDocuments;
_allPagesHeader = _$v.allPagesHeader; _allPagesHeader = _$v.allPagesHeader;
_allPagesFooter = _$v.allPagesFooter; _allPagesFooter = _$v.allPagesFooter;
_enableReminder1 = _$v.enableReminder1;
_enableReminder2 = _$v.enableReminder2;
_enableReminder3 = _$v.enableReminder3;
_customPaymentTerms = _$v.customPaymentTerms?.toBuilder(); _customPaymentTerms = _$v.customPaymentTerms?.toBuilder();
_hasCustomDesign1 = _$v.hasCustomDesign1; _hasCustomDesign1 = _$v.hasCustomDesign1;
_hasCustomDesign2 = _$v.hasCustomDesign2; _hasCustomDesign2 = _$v.hasCustomDesign2;
@ -4579,6 +4642,9 @@ class SettingsEntityBuilder
embedDocuments: embedDocuments, embedDocuments: embedDocuments,
allPagesHeader: allPagesHeader, allPagesHeader: allPagesHeader,
allPagesFooter: allPagesFooter, allPagesFooter: allPagesFooter,
enableReminder1: enableReminder1,
enableReminder2: enableReminder2,
enableReminder3: enableReminder3,
customPaymentTerms: _customPaymentTerms?.build(), customPaymentTerms: _customPaymentTerms?.build(),
hasCustomDesign1: hasCustomDesign1, hasCustomDesign1: hasCustomDesign1,
hasCustomDesign2: hasCustomDesign2, hasCustomDesign2: hasCustomDesign2,

View File

@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/data/models/company_model.dart';
import 'package:invoiceninja_flutter/ui/app/form_card.dart'; import 'package:invoiceninja_flutter/ui/app/form_card.dart';
import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart'; import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart';
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart'; 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/app/forms/decorated_form_field.dart'; import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart'; import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart';
import 'package:invoiceninja_flutter/ui/settings/templates_and_reminders_vm.dart'; import 'package:invoiceninja_flutter/ui/settings/templates_and_reminders_vm.dart';
@ -171,6 +172,7 @@ class _TemplatesAndRemindersState extends State<TemplatesAndReminders>
final localization = AppLocalization.of(context); final localization = AppLocalization.of(context);
final viewModel = widget.viewModel; final viewModel = widget.viewModel;
final state = viewModel.state; final state = viewModel.state;
final settings = viewModel.settings;
return SettingsScaffold( return SettingsScaffold(
title: localization.templatesAndReminders, title: localization.templatesAndReminders,
@ -220,7 +222,34 @@ class _TemplatesAndRemindersState extends State<TemplatesAndReminders>
controller: _bodyController, controller: _bodyController,
maxLines: 8, maxLines: 8,
), ),
]) ]),
if ([
kEmailTemplateReminder1,
kEmailTemplateReminder2,
kEmailTemplateReminder3
].contains(_template))
FormCard(
children: <Widget>[
BoolDropdownButton(
label: localization.sendEmail,
showBlank: state.settingsUIState.isFiltered,
value: _template == kEmailTemplateReminder1
? settings.enableReminder1
: _template == kEmailTemplateReminder2
? settings.enableReminder2
: settings.enableReminder3,
onChanged: (value) => viewModel.onSettingsChanged(
_template == kEmailTemplateReminder1
? settings
.rebuild((b) => b..enableReminder1 = value)
: _template == kEmailTemplateReminder2
? settings.rebuild(
(b) => b..enableReminder2 = value)
: settings.rebuild(
(b) => b..enableReminder3 = value)),
),
],
),
], ],
), ),
TemplatePreview(_getUrl(_template)), TemplatePreview(_getUrl(_template)),
@ -241,7 +270,6 @@ class TemplatePreview extends StatefulWidget {
class _TemplatePreviewState extends State<TemplatePreview> class _TemplatePreviewState extends State<TemplatePreview>
with AutomaticKeepAliveClientMixin<TemplatePreview> { with AutomaticKeepAliveClientMixin<TemplatePreview> {
WebViewController _webViewController; WebViewController _webViewController;
@override @override