From a907d2525da8108ee6fb79de6fc11d1d05d3f75a Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 17 Jan 2023 13:08:46 +0200 Subject: [PATCH] Add auto bill standard invoices --- lib/data/models/settings_model.dart | 4 ++++ lib/data/models/settings_model.g.dart | 25 ++++++++++++++++++++++++- lib/ui/settings/payment_settings.dart | 18 +++++++++++++++++- lib/utils/i18n.dart | 11 +++++++++++ 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/lib/data/models/settings_model.dart b/lib/data/models/settings_model.dart index 4a157806f..0c2b5f4d1 100644 --- a/lib/data/models/settings_model.dart +++ b/lib/data/models/settings_model.dart @@ -826,6 +826,10 @@ abstract class SettingsEntity @BuiltValueField(wireName: 'auto_bill') String get autoBill; + @nullable + @BuiltValueField(wireName: 'auto_bill_standard_invoices') + bool get autoBillStandardInvoices; + @nullable @BuiltValueField(wireName: 'client_portal_allow_under_payment') bool get clientPortalAllowUnderPayment; diff --git a/lib/data/models/settings_model.g.dart b/lib/data/models/settings_model.g.dart index b7a495b9b..3d502796d 100644 --- a/lib/data/models/settings_model.g.dart +++ b/lib/data/models/settings_model.g.dart @@ -1240,6 +1240,13 @@ class _$SettingsEntitySerializer ..add(serializers.serialize(value, specifiedType: const FullType(String))); } + value = object.autoBillStandardInvoices; + if (value != null) { + result + ..add('auto_bill_standard_invoices') + ..add( + serializers.serialize(value, specifiedType: const FullType(bool))); + } value = object.clientPortalAllowUnderPayment; if (value != null) { result @@ -2143,6 +2150,10 @@ class _$SettingsEntitySerializer result.autoBill = serializers.deserialize(value, specifiedType: const FullType(String)) as String; break; + case 'auto_bill_standard_invoices': + result.autoBillStandardInvoices = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; case 'client_portal_allow_under_payment': result.clientPortalAllowUnderPayment = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool; @@ -2609,6 +2620,8 @@ class _$SettingsEntity extends SettingsEntity { @override final String autoBill; @override + final bool autoBillStandardInvoices; + @override final bool clientPortalAllowUnderPayment; @override final bool clientPortalAllowOverPayment; @@ -2841,6 +2854,7 @@ class _$SettingsEntity extends SettingsEntity { this.clientPortalPrivacy, this.lockInvoices, this.autoBill, + this.autoBillStandardInvoices, this.clientPortalAllowUnderPayment, this.clientPortalAllowOverPayment, this.autoBillDate, @@ -3060,6 +3074,7 @@ class _$SettingsEntity extends SettingsEntity { clientPortalPrivacy == other.clientPortalPrivacy && lockInvoices == other.lockInvoices && autoBill == other.autoBill && + autoBillStandardInvoices == other.autoBillStandardInvoices && clientPortalAllowUnderPayment == other.clientPortalAllowUnderPayment && clientPortalAllowOverPayment == other.clientPortalAllowOverPayment && autoBillDate == other.autoBillDate && @@ -3110,7 +3125,7 @@ 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($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), defaultValidUntil.hashCode), companyGatewayIds.hashCode), defaultTaskRate.hashCode), sendReminders.hashCode), enablePortal.hashCode), enablePortalDashboard.hashCode), enablePortalTasks.hashCode), enableClientPortalUploads.hashCode), enableVendorPortalUploads.hashCode), emailStyle.hashCode), replyToEmail.hashCode), replyToName.hashCode), emailFromName.hashCode), bccEmail.hashCode), pdfEmailAttachment.hashCode), ublEmailAttachment.hashCode), documentEmailAttachment.hashCode), emailStyleCustom.hashCode), customMessageDashboard.hashCode), customMessageUnpaidInvoice.hashCode), customMessagePaidInvoice.hashCode), customMessageUnapprovedQuote.hashCode), autoArchiveInvoice.hashCode), autoArchiveInvoiceCancelled.hashCode), autoArchiveQuote.hashCode), autoEmailInvoice.hashCode), autoConvertQuote.hashCode), enableInclusiveTaxes.hashCode), translations.hashCode), taskNumberPattern.hashCode), taskNumberCounter.hashCode), expenseNumberPattern.hashCode), expenseNumberCounter.hashCode), recurringExpenseNumberPattern.hashCode), recurringExpenseNumberCounter.hashCode), vendorNumberPattern.hashCode), vendorNumberCounter.hashCode), ticketNumberPattern.hashCode), ticketNumberCounter.hashCode), paymentNumberPattern.hashCode), paymentNumberCounter.hashCode), projectNumberPattern.hashCode), projectNumberCounter.hashCode), invoiceNumberPattern.hashCode), invoiceNumberCounter.hashCode), recurringInvoiceNumberPattern.hashCode), recurringInvoiceNumberCounter.hashCode), quoteNumberPattern.hashCode), quoteNumberCounter.hashCode), clientNumberPattern.hashCode), clientNumberCounter.hashCode), creditNumberPattern.hashCode), creditNumberCounter.hashCode), recurringNumberPrefix.hashCode), resetCounterFrequencyId.hashCode), resetCounterDate.hashCode), counterPadding.hashCode), sharedInvoiceQuoteCounter.hashCode), sharedInvoiceCreditCounter.hashCode), defaultInvoiceTerms.hashCode), defaultQuoteTerms.hashCode), defaultQuoteFooter.hashCode), defaultCreditTerms.hashCode), defaultCreditFooter.hashCode), defaultInvoiceDesignId.hashCode), defaultQuoteDesignId.hashCode), defaultCreditDesignId.hashCode), defaultInvoiceFooter.hashCode), defaultTaxName1.hashCode), defaultTaxRate1.hashCode), defaultTaxName2.hashCode), defaultTaxRate2.hashCode), defaultTaxName3.hashCode), defaultTaxRate3.hashCode), defaultPaymentTypeId.hashCode), pdfVariables.hashCode), emailSignature.hashCode), emailSubjectInvoice.hashCode), emailSubjectQuote.hashCode), emailSubjectCredit.hashCode), emailSubjectPayment.hashCode), emailSubjectPaymentPartial.hashCode), emailBodyInvoice.hashCode), emailBodyQuote.hashCode), emailBodyCredit.hashCode), emailBodyPayment.hashCode), emailBodyPaymentPartial.hashCode), emailSubjectReminder1.hashCode), emailSubjectReminder2.hashCode), emailSubjectReminder3.hashCode), emailBodyReminder1.hashCode), emailBodyReminder2.hashCode), emailBodyReminder3.hashCode), emailSubjectCustom1.hashCode), emailBodyCustom1.hashCode), emailSubjectCustom2.hashCode), emailBodyCustom2.hashCode), emailSubjectCustom3.hashCode), emailBodyCustom3.hashCode), emailSubjectStatement.hashCode), emailBodyStatement.hashCode), emailSubjectPurchaseOrder.hashCode), emailBodyPurchaseOrder.hashCode), enablePortalPassword.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), vatNumber.hashCode), idNumber.hashCode), pageSize.hashCode), pageLayout.hashCode), fontSize.hashCode), primaryColor.hashCode), secondaryColor.hashCode), primaryFont.hashCode), secondaryFont.hashCode), hidePaidToDate.hashCode), embedDocuments.hashCode), allPagesHeader.hashCode), allPagesFooter.hashCode), enableReminder1.hashCode), enableReminder2.hashCode), enableReminder3.hashCode), enableReminderEndless.hashCode), numDaysReminder1.hashCode), numDaysReminder2.hashCode), numDaysReminder3.hashCode), scheduleReminder1.hashCode), scheduleReminder2.hashCode), scheduleReminder3.hashCode), endlessReminderFrequencyId.hashCode), lateFeeAmount1.hashCode), lateFeeAmount2.hashCode), lateFeeAmount3.hashCode), lateFeeAmountEndless.hashCode), lateFeePercent1.hashCode), lateFeePercent2.hashCode), lateFeePercent3.hashCode), lateFeePercentEndless.hashCode), emailSubjectReminderEndless.hashCode), emailBodyReminderEndless.hashCode), clientOnlinePaymentNotification.hashCode), clientManualPaymentNotification.hashCode), clientMarkPaidPaymentNotification.hashCode), counterNumberApplied.hashCode), emailSendingMethod.hashCode), gmailSendingUserId.hashCode), clientPortalTerms.hashCode), clientPortalPrivacy.hashCode), lockInvoices.hashCode), autoBill.hashCode), clientPortalAllowUnderPayment.hashCode), clientPortalAllowOverPayment.hashCode), autoBillDate.hashCode), clientPortalUnderPaymentMinimum.hashCode), useCreditsPayment.hashCode), clientPortalCustomHeader.hashCode), clientPortalCustomCss.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($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), defaultValidUntil.hashCode), companyGatewayIds.hashCode), defaultTaskRate.hashCode), sendReminders.hashCode), enablePortal.hashCode), enablePortalDashboard.hashCode), enablePortalTasks.hashCode), enableClientPortalUploads.hashCode), enableVendorPortalUploads.hashCode), emailStyle.hashCode), replyToEmail.hashCode), replyToName.hashCode), emailFromName.hashCode), bccEmail.hashCode), pdfEmailAttachment.hashCode), ublEmailAttachment.hashCode), documentEmailAttachment.hashCode), emailStyleCustom.hashCode), customMessageDashboard.hashCode), customMessageUnpaidInvoice.hashCode), customMessagePaidInvoice.hashCode), customMessageUnapprovedQuote.hashCode), autoArchiveInvoice.hashCode), autoArchiveInvoiceCancelled.hashCode), autoArchiveQuote.hashCode), autoEmailInvoice.hashCode), autoConvertQuote.hashCode), enableInclusiveTaxes.hashCode), translations.hashCode), taskNumberPattern.hashCode), taskNumberCounter.hashCode), expenseNumberPattern.hashCode), expenseNumberCounter.hashCode), recurringExpenseNumberPattern.hashCode), recurringExpenseNumberCounter.hashCode), vendorNumberPattern.hashCode), vendorNumberCounter.hashCode), ticketNumberPattern.hashCode), ticketNumberCounter.hashCode), paymentNumberPattern.hashCode), paymentNumberCounter.hashCode), projectNumberPattern.hashCode), projectNumberCounter.hashCode), invoiceNumberPattern.hashCode), invoiceNumberCounter.hashCode), recurringInvoiceNumberPattern.hashCode), recurringInvoiceNumberCounter.hashCode), quoteNumberPattern.hashCode), quoteNumberCounter.hashCode), clientNumberPattern.hashCode), clientNumberCounter.hashCode), creditNumberPattern.hashCode), creditNumberCounter.hashCode), recurringNumberPrefix.hashCode), resetCounterFrequencyId.hashCode), resetCounterDate.hashCode), counterPadding.hashCode), sharedInvoiceQuoteCounter.hashCode), sharedInvoiceCreditCounter.hashCode), defaultInvoiceTerms.hashCode), defaultQuoteTerms.hashCode), defaultQuoteFooter.hashCode), defaultCreditTerms.hashCode), defaultCreditFooter.hashCode), defaultInvoiceDesignId.hashCode), defaultQuoteDesignId.hashCode), defaultCreditDesignId.hashCode), defaultInvoiceFooter.hashCode), defaultTaxName1.hashCode), defaultTaxRate1.hashCode), defaultTaxName2.hashCode), defaultTaxRate2.hashCode), defaultTaxName3.hashCode), defaultTaxRate3.hashCode), defaultPaymentTypeId.hashCode), pdfVariables.hashCode), emailSignature.hashCode), emailSubjectInvoice.hashCode), emailSubjectQuote.hashCode), emailSubjectCredit.hashCode), emailSubjectPayment.hashCode), emailSubjectPaymentPartial.hashCode), emailBodyInvoice.hashCode), emailBodyQuote.hashCode), emailBodyCredit.hashCode), emailBodyPayment.hashCode), emailBodyPaymentPartial.hashCode), emailSubjectReminder1.hashCode), emailSubjectReminder2.hashCode), emailSubjectReminder3.hashCode), emailBodyReminder1.hashCode), emailBodyReminder2.hashCode), emailBodyReminder3.hashCode), emailSubjectCustom1.hashCode), emailBodyCustom1.hashCode), emailSubjectCustom2.hashCode), emailBodyCustom2.hashCode), emailSubjectCustom3.hashCode), emailBodyCustom3.hashCode), emailSubjectStatement.hashCode), emailBodyStatement.hashCode), emailSubjectPurchaseOrder.hashCode), emailBodyPurchaseOrder.hashCode), enablePortalPassword.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), vatNumber.hashCode), idNumber.hashCode), pageSize.hashCode), pageLayout.hashCode), fontSize.hashCode), primaryColor.hashCode), secondaryColor.hashCode), primaryFont.hashCode), secondaryFont.hashCode), hidePaidToDate.hashCode), embedDocuments.hashCode), allPagesHeader.hashCode), allPagesFooter.hashCode), enableReminder1.hashCode), enableReminder2.hashCode), enableReminder3.hashCode), enableReminderEndless.hashCode), numDaysReminder1.hashCode), numDaysReminder2.hashCode), numDaysReminder3.hashCode), scheduleReminder1.hashCode), scheduleReminder2.hashCode), scheduleReminder3.hashCode), endlessReminderFrequencyId.hashCode), lateFeeAmount1.hashCode), lateFeeAmount2.hashCode), lateFeeAmount3.hashCode), lateFeeAmountEndless.hashCode), lateFeePercent1.hashCode), lateFeePercent2.hashCode), lateFeePercent3.hashCode), lateFeePercentEndless.hashCode), emailSubjectReminderEndless.hashCode), emailBodyReminderEndless.hashCode), clientOnlinePaymentNotification.hashCode), clientManualPaymentNotification.hashCode), clientMarkPaidPaymentNotification.hashCode), counterNumberApplied.hashCode), emailSendingMethod.hashCode), gmailSendingUserId.hashCode), clientPortalTerms.hashCode), clientPortalPrivacy.hashCode), lockInvoices.hashCode), autoBill.hashCode), autoBillStandardInvoices.hashCode), clientPortalAllowUnderPayment.hashCode), clientPortalAllowOverPayment.hashCode), autoBillDate.hashCode), clientPortalUnderPaymentMinimum.hashCode), useCreditsPayment.hashCode), clientPortalCustomHeader.hashCode), clientPortalCustomCss.hashCode), clientPortalCustomFooter.hashCode), clientPortalCustomJs.hashCode), hideEmptyColumnsOnPdf.hashCode), @@ -3314,6 +3329,7 @@ class _$SettingsEntity extends SettingsEntity { ..add('clientPortalPrivacy', clientPortalPrivacy) ..add('lockInvoices', lockInvoices) ..add('autoBill', autoBill) + ..add('autoBillStandardInvoices', autoBillStandardInvoices) ..add('clientPortalAllowUnderPayment', clientPortalAllowUnderPayment) ..add('clientPortalAllowOverPayment', clientPortalAllowOverPayment) ..add('autoBillDate', autoBillDate) @@ -4208,6 +4224,11 @@ class SettingsEntityBuilder String get autoBill => _$this._autoBill; set autoBill(String autoBill) => _$this._autoBill = autoBill; + bool _autoBillStandardInvoices; + bool get autoBillStandardInvoices => _$this._autoBillStandardInvoices; + set autoBillStandardInvoices(bool autoBillStandardInvoices) => + _$this._autoBillStandardInvoices = autoBillStandardInvoices; + bool _clientPortalAllowUnderPayment; bool get clientPortalAllowUnderPayment => _$this._clientPortalAllowUnderPayment; @@ -4520,6 +4541,7 @@ class SettingsEntityBuilder _clientPortalPrivacy = $v.clientPortalPrivacy; _lockInvoices = $v.lockInvoices; _autoBill = $v.autoBill; + _autoBillStandardInvoices = $v.autoBillStandardInvoices; _clientPortalAllowUnderPayment = $v.clientPortalAllowUnderPayment; _clientPortalAllowOverPayment = $v.clientPortalAllowOverPayment; _autoBillDate = $v.autoBillDate; @@ -4745,6 +4767,7 @@ class SettingsEntityBuilder clientPortalPrivacy: clientPortalPrivacy, lockInvoices: lockInvoices, autoBill: autoBill, + autoBillStandardInvoices: autoBillStandardInvoices, clientPortalAllowUnderPayment: clientPortalAllowUnderPayment, clientPortalAllowOverPayment: clientPortalAllowOverPayment, autoBillDate: autoBillDate, diff --git a/lib/ui/settings/payment_settings.dart b/lib/ui/settings/payment_settings.dart index 621966a9e..03d19c8ae 100644 --- a/lib/ui/settings/payment_settings.dart +++ b/lib/ui/settings/payment_settings.dart @@ -96,8 +96,24 @@ class _PaymentSettingsState extends State { children: [ FormCard( children: [ + AppDropdownButton( + blankValue: null, + showBlank: true, + labelText: localization.autoBillStandardInvoices, + value: state.settingsUIState.isFiltered + ? settings.autoBillStandardInvoices + : settings.autoBillStandardInvoices ?? false, + onChanged: (dynamic value) => viewModel.onSettingsChanged( + settings + .rebuild((b) => b..autoBillStandardInvoices = value)), + items: [ + DropdownMenuItem( + child: Text(localization.enabled), value: true), + DropdownMenuItem( + child: Text(localization.off), value: false), + ]), AppDropdownButton( - labelText: localization.autoBill, + labelText: localization.autoBillRecurringInvoices, value: settings.autoBill, onChanged: (dynamic value) => viewModel.onSettingsChanged( settings.rebuild((b) => b..autoBill = value)), diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index a2df5244a..13cb1ace8 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -16,6 +16,8 @@ mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { // STARTER: lang key - do not remove comment + 'auto_bill_standard_invoices': 'Auto Bill Standard Invoices', + 'auto_bill_recurring_invoices': 'Auto Bill Recurring Invoices', 'email_alignment': 'Email Alignment', 'pdf_preview_location': 'PDF Preview Location', 'mailgun': 'Mailgun', @@ -92993,6 +92995,15 @@ mixin LocalizationsProvider on LocaleCodeAware { _localizedValues[localeCode]['email_alignment'] ?? _localizedValues['en']['email_alignment']; + String get autoBillStandardInvoices => + _localizedValues[localeCode]['auto_bill_standard_invoices'] ?? + _localizedValues['en']['auto_bill_standard_invoices']; + + String get autoBillRecurringInvoices => + _localizedValues[localeCode]['auto_bill_recurring_invoices'] ?? + _localizedValues['en']['auto_bill_recurring_invoices']; + + // STARTER: lang field - do not remove comment String lookup(String key) {