This commit is contained in:
Hillel Coren 2019-11-07 12:20:20 +02:00
parent d992e49f96
commit 617efc98ff
9 changed files with 185 additions and 244 deletions

View File

@ -709,12 +709,12 @@ abstract class SettingsEntity
String get defaultQuoteFooter;
@nullable
@BuiltValueField(wireName: 'invoice_taxes')
bool get enableInvoiceTaxes;
@BuiltValueField(wireName: 'invoice_taxes_HIDDEN')
int get numberOfInvoiceTaxRates;
@nullable
@BuiltValueField(wireName: 'invoice_item_taxes')
bool get enableInvoiceItemTaxes;
@BuiltValueField(wireName: 'invoice_item_taxes_HIDDEN')
int get numberOfItemTaxRates;
@nullable
@BuiltValueField(wireName: 'invoice_design_id')
@ -760,10 +760,6 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'payment_type_id')
String get defaultPaymentTypeId;
@nullable
@BuiltValueField(wireName: 'enable_second_tax_rate')
bool get enableSecondTaxRate;
@nullable
@BuiltValueField(wireName: 'invoice_fields')
String get invoiceFields;
@ -1013,10 +1009,6 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'email_template_reminder4')
String get emailBodyReminder4;
@nullable
@BuiltValueField(wireName: 'number_of_tax_rates')
int get numberOfTaxRates;
// TODO remove this field
@nullable
@BuiltValueField(wireName: 'custom_payment_terms')
@ -1037,6 +1029,18 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'has_custom_design3_HIDDEN')
bool get hasCustomDesign3;
bool get enableFirstInvoiceTaxRate => (numberOfInvoiceTaxRates ?? 0) >= 1;
bool get enableSecondInvoiceTaxRate => (numberOfInvoiceTaxRates ?? 0) >= 2;
bool get enableThirdInvoiceTaxRate => (numberOfInvoiceTaxRates ?? 0) >= 3;
bool get enableFirstItemTaxRate => (numberOfItemTaxRates ?? 0) >= 1;
bool get enableSecondItemTaxRate => (numberOfItemTaxRates ?? 0) >= 2;
bool get enableThirdItemTaxRate => (numberOfItemTaxRates ?? 0) >= 3;
bool get hasAddress => address1 != null && address1.isNotEmpty;
bool get hasLogo => companyLogo != null && companyLogo.isNotEmpty;

View File

@ -1038,17 +1038,17 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(object.defaultQuoteFooter,
specifiedType: const FullType(String)));
}
if (object.enableInvoiceTaxes != null) {
if (object.numberOfInvoiceTaxRates != null) {
result
..add('invoice_taxes')
..add(serializers.serialize(object.enableInvoiceTaxes,
specifiedType: const FullType(bool)));
..add('invoice_taxes_HIDDEN')
..add(serializers.serialize(object.numberOfInvoiceTaxRates,
specifiedType: const FullType(int)));
}
if (object.enableInvoiceItemTaxes != null) {
if (object.numberOfItemTaxRates != null) {
result
..add('invoice_item_taxes')
..add(serializers.serialize(object.enableInvoiceItemTaxes,
specifiedType: const FullType(bool)));
..add('invoice_item_taxes_HIDDEN')
..add(serializers.serialize(object.numberOfItemTaxRates,
specifiedType: const FullType(int)));
}
if (object.defaultInvoiceDesignId != null) {
result
@ -1116,12 +1116,6 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(object.defaultPaymentTypeId,
specifiedType: const FullType(String)));
}
if (object.enableSecondTaxRate != null) {
result
..add('enable_second_tax_rate')
..add(serializers.serialize(object.enableSecondTaxRate,
specifiedType: const FullType(bool)));
}
if (object.invoiceFields != null) {
result
..add('invoice_fields')
@ -1506,12 +1500,6 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(object.emailBodyReminder4,
specifiedType: const FullType(String)));
}
if (object.numberOfTaxRates != null) {
result
..add('number_of_tax_rates')
..add(serializers.serialize(object.numberOfTaxRates,
specifiedType: const FullType(int)));
}
if (object.customPaymentTerms != null) {
result
..add('custom_payment_terms')
@ -1791,13 +1779,13 @@ class _$SettingsEntitySerializer
result.defaultQuoteFooter = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'invoice_taxes':
result.enableInvoiceTaxes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
case 'invoice_taxes_HIDDEN':
result.numberOfInvoiceTaxRates = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'invoice_item_taxes':
result.enableInvoiceItemTaxes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
case 'invoice_item_taxes_HIDDEN':
result.numberOfItemTaxRates = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'invoice_design_id':
result.defaultInvoiceDesignId = serializers.deserialize(value,
@ -1843,10 +1831,6 @@ class _$SettingsEntitySerializer
result.defaultPaymentTypeId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'enable_second_tax_rate':
result.enableSecondTaxRate = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'invoice_fields':
result.invoiceFields = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
@ -2103,10 +2087,6 @@ class _$SettingsEntitySerializer
result.emailBodyReminder4 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'number_of_tax_rates':
result.numberOfTaxRates = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'custom_payment_terms':
result.customPaymentTerms.replace(serializers.deserialize(value,
specifiedType: const FullType(
@ -3334,9 +3314,9 @@ class _$SettingsEntity extends SettingsEntity {
@override
final String defaultQuoteFooter;
@override
final bool enableInvoiceTaxes;
final int numberOfInvoiceTaxRates;
@override
final bool enableInvoiceItemTaxes;
final int numberOfItemTaxRates;
@override
final String defaultInvoiceDesignId;
@override
@ -3360,8 +3340,6 @@ class _$SettingsEntity extends SettingsEntity {
@override
final String defaultPaymentTypeId;
@override
final bool enableSecondTaxRate;
@override
final String invoiceFields;
@override
final String emailFooter;
@ -3490,8 +3468,6 @@ class _$SettingsEntity extends SettingsEntity {
@override
final String emailBodyReminder4;
@override
final int numberOfTaxRates;
@override
final BuiltList<PaymentTermEntity> customPaymentTerms;
@override
final bool hasCustomDesign1;
@ -3563,8 +3539,8 @@ class _$SettingsEntity extends SettingsEntity {
this.defaultInvoiceTerms,
this.defaultQuoteTerms,
this.defaultQuoteFooter,
this.enableInvoiceTaxes,
this.enableInvoiceItemTaxes,
this.numberOfInvoiceTaxRates,
this.numberOfItemTaxRates,
this.defaultInvoiceDesignId,
this.defaultQuoteDesignId,
this.defaultInvoiceFooter,
@ -3576,7 +3552,6 @@ class _$SettingsEntity extends SettingsEntity {
this.defaultTaxName3,
this.defaultTaxRate3,
this.defaultPaymentTypeId,
this.enableSecondTaxRate,
this.invoiceFields,
this.emailFooter,
this.emailSubjectInvoice,
@ -3641,7 +3616,6 @@ class _$SettingsEntity extends SettingsEntity {
this.lateFeePercent3,
this.emailSubjectReminder4,
this.emailBodyReminder4,
this.numberOfTaxRates,
this.customPaymentTerms,
this.hasCustomDesign1,
this.hasCustomDesign2,
@ -3719,8 +3693,8 @@ class _$SettingsEntity extends SettingsEntity {
defaultInvoiceTerms == other.defaultInvoiceTerms &&
defaultQuoteTerms == other.defaultQuoteTerms &&
defaultQuoteFooter == other.defaultQuoteFooter &&
enableInvoiceTaxes == other.enableInvoiceTaxes &&
enableInvoiceItemTaxes == other.enableInvoiceItemTaxes &&
numberOfInvoiceTaxRates == other.numberOfInvoiceTaxRates &&
numberOfItemTaxRates == other.numberOfItemTaxRates &&
defaultInvoiceDesignId == other.defaultInvoiceDesignId &&
defaultQuoteDesignId == other.defaultQuoteDesignId &&
defaultInvoiceFooter == other.defaultInvoiceFooter &&
@ -3732,7 +3706,6 @@ class _$SettingsEntity extends SettingsEntity {
defaultTaxName3 == other.defaultTaxName3 &&
defaultTaxRate3 == other.defaultTaxRate3 &&
defaultPaymentTypeId == other.defaultPaymentTypeId &&
enableSecondTaxRate == other.enableSecondTaxRate &&
invoiceFields == other.invoiceFields &&
emailFooter == other.emailFooter &&
emailSubjectInvoice == other.emailSubjectInvoice &&
@ -3797,7 +3770,6 @@ class _$SettingsEntity extends SettingsEntity {
lateFeePercent3 == other.lateFeePercent3 &&
emailSubjectReminder4 == other.emailSubjectReminder4 &&
emailBodyReminder4 == other.emailBodyReminder4 &&
numberOfTaxRates == other.numberOfTaxRates &&
customPaymentTerms == other.customPaymentTerms &&
hasCustomDesign1 == other.hasCustomDesign1 &&
hasCustomDesign2 == other.hasCustomDesign2 &&
@ -3824,22 +3796,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($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), 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), vatNumber.hashCode), idNumber.hashCode), pageSize.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), enableReminder4.hashCode), numDaysReminder1.hashCode),
numDaysReminder2.hashCode),
numDaysReminder3.hashCode),
scheduleReminder1.hashCode),
scheduleReminder2.hashCode),
scheduleReminder3.hashCode),
endlessReminderFrequencyId.hashCode),
lateFeeAmount1.hashCode),
lateFeeAmount2.hashCode),
lateFeeAmount3.hashCode),
lateFeePercent1.hashCode),
lateFeePercent2.hashCode),
lateFeePercent3.hashCode),
emailSubjectReminder4.hashCode),
emailBodyReminder4.hashCode),
numberOfTaxRates.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(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), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), defaultInvoiceDesignId.hashCode), defaultQuoteDesignId.hashCode), defaultInvoiceFooter.hashCode), invoiceLabels.hashCode), defaultTaxName1.hashCode), defaultTaxRate1.hashCode), defaultTaxName2.hashCode), defaultTaxRate2.hashCode), defaultTaxName3.hashCode), defaultTaxRate3.hashCode), defaultPaymentTypeId.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), vatNumber.hashCode), idNumber.hashCode), pageSize.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), enableReminder4.hashCode),
numDaysReminder1.hashCode),
numDaysReminder2.hashCode),
numDaysReminder3.hashCode),
scheduleReminder1.hashCode),
scheduleReminder2.hashCode),
scheduleReminder3.hashCode),
endlessReminderFrequencyId.hashCode),
lateFeeAmount1.hashCode),
lateFeeAmount2.hashCode),
lateFeeAmount3.hashCode),
lateFeePercent1.hashCode),
lateFeePercent2.hashCode),
lateFeePercent3.hashCode),
emailSubjectReminder4.hashCode),
emailBodyReminder4.hashCode),
customPaymentTerms.hashCode),
hasCustomDesign1.hashCode),
hasCustomDesign2.hashCode),
@ -3908,8 +3880,8 @@ class _$SettingsEntity extends SettingsEntity {
..add('defaultInvoiceTerms', defaultInvoiceTerms)
..add('defaultQuoteTerms', defaultQuoteTerms)
..add('defaultQuoteFooter', defaultQuoteFooter)
..add('enableInvoiceTaxes', enableInvoiceTaxes)
..add('enableInvoiceItemTaxes', enableInvoiceItemTaxes)
..add('numberOfInvoiceTaxRates', numberOfInvoiceTaxRates)
..add('numberOfItemTaxRates', numberOfItemTaxRates)
..add('defaultInvoiceDesignId', defaultInvoiceDesignId)
..add('defaultQuoteDesignId', defaultQuoteDesignId)
..add('defaultInvoiceFooter', defaultInvoiceFooter)
@ -3921,7 +3893,6 @@ class _$SettingsEntity extends SettingsEntity {
..add('defaultTaxName3', defaultTaxName3)
..add('defaultTaxRate3', defaultTaxRate3)
..add('defaultPaymentTypeId', defaultPaymentTypeId)
..add('enableSecondTaxRate', enableSecondTaxRate)
..add('invoiceFields', invoiceFields)
..add('emailFooter', emailFooter)
..add('emailSubjectInvoice', emailSubjectInvoice)
@ -3986,7 +3957,6 @@ class _$SettingsEntity extends SettingsEntity {
..add('lateFeePercent3', lateFeePercent3)
..add('emailSubjectReminder4', emailSubjectReminder4)
..add('emailBodyReminder4', emailBodyReminder4)
..add('numberOfTaxRates', numberOfTaxRates)
..add('customPaymentTerms', customPaymentTerms)
..add('hasCustomDesign1', hasCustomDesign1)
..add('hasCustomDesign2', hasCustomDesign2)
@ -4286,15 +4256,15 @@ class SettingsEntityBuilder
set defaultQuoteFooter(String defaultQuoteFooter) =>
_$this._defaultQuoteFooter = defaultQuoteFooter;
bool _enableInvoiceTaxes;
bool get enableInvoiceTaxes => _$this._enableInvoiceTaxes;
set enableInvoiceTaxes(bool enableInvoiceTaxes) =>
_$this._enableInvoiceTaxes = enableInvoiceTaxes;
int _numberOfInvoiceTaxRates;
int get numberOfInvoiceTaxRates => _$this._numberOfInvoiceTaxRates;
set numberOfInvoiceTaxRates(int numberOfInvoiceTaxRates) =>
_$this._numberOfInvoiceTaxRates = numberOfInvoiceTaxRates;
bool _enableInvoiceItemTaxes;
bool get enableInvoiceItemTaxes => _$this._enableInvoiceItemTaxes;
set enableInvoiceItemTaxes(bool enableInvoiceItemTaxes) =>
_$this._enableInvoiceItemTaxes = enableInvoiceItemTaxes;
int _numberOfItemTaxRates;
int get numberOfItemTaxRates => _$this._numberOfItemTaxRates;
set numberOfItemTaxRates(int numberOfItemTaxRates) =>
_$this._numberOfItemTaxRates = numberOfItemTaxRates;
String _defaultInvoiceDesignId;
String get defaultInvoiceDesignId => _$this._defaultInvoiceDesignId;
@ -4351,11 +4321,6 @@ class SettingsEntityBuilder
set defaultPaymentTypeId(String defaultPaymentTypeId) =>
_$this._defaultPaymentTypeId = defaultPaymentTypeId;
bool _enableSecondTaxRate;
bool get enableSecondTaxRate => _$this._enableSecondTaxRate;
set enableSecondTaxRate(bool enableSecondTaxRate) =>
_$this._enableSecondTaxRate = enableSecondTaxRate;
String _invoiceFields;
String get invoiceFields => _$this._invoiceFields;
set invoiceFields(String invoiceFields) =>
@ -4658,11 +4623,6 @@ class SettingsEntityBuilder
set emailBodyReminder4(String emailBodyReminder4) =>
_$this._emailBodyReminder4 = emailBodyReminder4;
int _numberOfTaxRates;
int get numberOfTaxRates => _$this._numberOfTaxRates;
set numberOfTaxRates(int numberOfTaxRates) =>
_$this._numberOfTaxRates = numberOfTaxRates;
ListBuilder<PaymentTermEntity> _customPaymentTerms;
ListBuilder<PaymentTermEntity> get customPaymentTerms =>
_$this._customPaymentTerms ??= new ListBuilder<PaymentTermEntity>();
@ -4747,8 +4707,8 @@ class SettingsEntityBuilder
_defaultInvoiceTerms = _$v.defaultInvoiceTerms;
_defaultQuoteTerms = _$v.defaultQuoteTerms;
_defaultQuoteFooter = _$v.defaultQuoteFooter;
_enableInvoiceTaxes = _$v.enableInvoiceTaxes;
_enableInvoiceItemTaxes = _$v.enableInvoiceItemTaxes;
_numberOfInvoiceTaxRates = _$v.numberOfInvoiceTaxRates;
_numberOfItemTaxRates = _$v.numberOfItemTaxRates;
_defaultInvoiceDesignId = _$v.defaultInvoiceDesignId;
_defaultQuoteDesignId = _$v.defaultQuoteDesignId;
_defaultInvoiceFooter = _$v.defaultInvoiceFooter;
@ -4760,7 +4720,6 @@ class SettingsEntityBuilder
_defaultTaxName3 = _$v.defaultTaxName3;
_defaultTaxRate3 = _$v.defaultTaxRate3;
_defaultPaymentTypeId = _$v.defaultPaymentTypeId;
_enableSecondTaxRate = _$v.enableSecondTaxRate;
_invoiceFields = _$v.invoiceFields;
_emailFooter = _$v.emailFooter;
_emailSubjectInvoice = _$v.emailSubjectInvoice;
@ -4825,7 +4784,6 @@ class SettingsEntityBuilder
_lateFeePercent3 = _$v.lateFeePercent3;
_emailSubjectReminder4 = _$v.emailSubjectReminder4;
_emailBodyReminder4 = _$v.emailBodyReminder4;
_numberOfTaxRates = _$v.numberOfTaxRates;
_customPaymentTerms = _$v.customPaymentTerms?.toBuilder();
_hasCustomDesign1 = _$v.hasCustomDesign1;
_hasCustomDesign2 = _$v.hasCustomDesign2;
@ -4913,8 +4871,8 @@ class SettingsEntityBuilder
defaultInvoiceTerms: defaultInvoiceTerms,
defaultQuoteTerms: defaultQuoteTerms,
defaultQuoteFooter: defaultQuoteFooter,
enableInvoiceTaxes: enableInvoiceTaxes,
enableInvoiceItemTaxes: enableInvoiceItemTaxes,
numberOfInvoiceTaxRates: numberOfInvoiceTaxRates,
numberOfItemTaxRates: numberOfItemTaxRates,
defaultInvoiceDesignId: defaultInvoiceDesignId,
defaultQuoteDesignId: defaultQuoteDesignId,
defaultInvoiceFooter: defaultInvoiceFooter,
@ -4926,7 +4884,6 @@ class SettingsEntityBuilder
defaultTaxName3: defaultTaxName3,
defaultTaxRate3: defaultTaxRate3,
defaultPaymentTypeId: defaultPaymentTypeId,
enableSecondTaxRate: enableSecondTaxRate,
invoiceFields: invoiceFields,
emailFooter: emailFooter,
emailSubjectInvoice: emailSubjectInvoice,
@ -4991,7 +4948,6 @@ class SettingsEntityBuilder
lateFeePercent3: lateFeePercent3,
emailSubjectReminder4: emailSubjectReminder4,
emailBodyReminder4: emailBodyReminder4,
numberOfTaxRates: numberOfTaxRates,
customPaymentTerms: _customPaymentTerms?.build(),
hasCustomDesign1: hasCustomDesign1,
hasCustomDesign2: hasCustomDesign2,

View File

@ -642,7 +642,7 @@ class _FeesEditorState extends State<FeesEditor> {
label: localization.feeCap,
controller: _capController,
),
if (company.settings.enableInvoiceItemTaxes)
if (company.settings.enableFirstItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
@ -653,8 +653,7 @@ class _FeesEditorState extends State<FeesEditor> {
initialTaxName: companyGateway.taxName1,
initialTaxRate: companyGateway.taxRate1,
),
if (company.settings.enableInvoiceItemTaxes &&
company.settings.enableSecondTaxRate)
if (company.settings.enableSecondItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>

View File

@ -112,28 +112,28 @@ class ExpenseEditSettingsState extends State<ExpenseEditSettings> {
children: <Widget>[
FormCard(
children: <Widget>[
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(expense.rebuild((b) => b
..taxRate1 = taxRate.rate
..taxName1 = taxRate.name)),
labelText: localization.tax,
initialTaxName: expense.taxName1,
initialTaxRate: expense.taxRate1,
),
company.settings.enableSecondTaxRate
? TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(expense.rebuild((b) => b
..taxRate2 = taxRate.rate
..taxName2 = taxRate.name)),
labelText: localization.tax,
initialTaxName: expense.taxName2,
initialTaxRate: expense.taxRate2,
)
: SizedBox(),
if (company.settings.enableFirstItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(expense.rebuild((b) => b
..taxRate1 = taxRate.rate
..taxName1 = taxRate.name)),
labelText: localization.tax,
initialTaxName: expense.taxName1,
initialTaxRate: expense.taxRate1,
),
if (company.settings.enableSecondItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(expense.rebuild((b) => b
..taxRate2 = taxRate.rate
..taxName2 = taxRate.name)),
labelText: localization.tax,
initialTaxName: expense.taxName2,
initialTaxRate: expense.taxRate2,
),
SizedBox(height: 16),
expense.isInvoiced
? SizedBox()

View File

@ -276,27 +276,24 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
TextInputType.numberWithOptions(decimal: true),
)
: Container(),
(company.settings.enableInvoiceTaxes ?? false)
? TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(invoice.applyTax(taxRate)),
labelText: localization.tax,
initialTaxName: invoice.taxName1,
initialTaxRate: invoice.taxRate1,
)
: Container(),
(company.settings.enableInvoiceTaxes ?? false) &&
company.settings.enableSecondTaxRate
? TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) => viewModel
.onChanged(invoice.applyTax(taxRate, isSecond: true)),
labelText: localization.tax,
initialTaxName: invoice.taxName2,
initialTaxRate: invoice.taxRate2,
)
: Container(),
if (company.settings.enableFirstInvoiceTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(invoice.applyTax(taxRate)),
labelText: localization.tax,
initialTaxName: invoice.taxName1,
initialTaxRate: invoice.taxRate1,
),
if (company.settings.enableSecondInvoiceTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) => viewModel
.onChanged(invoice.applyTax(taxRate, isSecond: true)),
labelText: localization.tax,
initialTaxName: invoice.taxName2,
initialTaxRate: invoice.taxRate2,
),
AppDropdownButton(
labelText: localization.design,
value: invoice.designId,

View File

@ -255,31 +255,28 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
TextInputType.numberWithOptions(decimal: true),
)
: Container(),
company.settings.enableInvoiceItemTaxes
? TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) {
_taxRate1 = taxRate;
_onChanged();
},
labelText: localization.tax,
initialTaxName: invoiceItem.taxName1,
initialTaxRate: invoiceItem.taxRate1,
)
: Container(),
company.settings.enableInvoiceItemTaxes &&
company.settings.enableSecondTaxRate
? TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) {
_taxRate2 = taxRate;
_onChanged();
},
labelText: localization.tax,
initialTaxName: invoiceItem.taxName2,
initialTaxRate: invoiceItem.taxRate2,
)
: Container(),
if (company.settings.enableFirstItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) {
_taxRate1 = taxRate;
_onChanged();
},
labelText: localization.tax,
initialTaxName: invoiceItem.taxName1,
initialTaxRate: invoiceItem.taxRate1,
),
if (company.settings.enableSecondItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) {
_taxRate2 = taxRate;
_onChanged();
},
labelText: localization.tax,
initialTaxName: invoiceItem.taxName2,
initialTaxRate: invoiceItem.taxRate2,
),
],
),
),

View File

@ -208,31 +208,28 @@ class _ProductEditState extends State<ProductEdit> {
keyboardType:
TextInputType.numberWithOptions(decimal: true),
),
(company.settings.enableInvoiceItemTaxes ?? false)
? TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(product.rebuild((b) => b
..taxRate1 = taxRate.rate
..taxName1 = taxRate.name)),
labelText: localization.tax,
initialTaxName: product.taxName1,
initialTaxRate: product.taxRate1,
)
: Container(),
(company.settings.enableInvoiceItemTaxes ?? false) &&
company.settings.enableSecondTaxRate
? TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(product.rebuild((b) => b
..taxRate2 = taxRate.rate
..taxName2 = taxRate.name)),
labelText: localization.tax,
initialTaxName: product.taxName2,
initialTaxRate: product.taxRate2,
)
: Container(),
if (company.settings.enableFirstItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(product.rebuild((b) => b
..taxRate1 = taxRate.rate
..taxName1 = taxRate.name)),
labelText: localization.tax,
initialTaxName: product.taxName1,
initialTaxRate: product.taxRate1,
),
if (company.settings.enableSecondItemTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onChanged(product.rebuild((b) => b
..taxRate2 = taxRate.rate
..taxName2 = taxRate.name)),
labelText: localization.tax,
initialTaxName: product.taxName2,
initialTaxRate: product.taxRate2,
),
],
),
],

View File

@ -42,19 +42,22 @@ class _TaxSettingsState extends State<TaxSettings> {
children: <Widget>[
FormCard(
children: <Widget>[
BoolDropdownButton(
iconData: FontAwesomeIcons.fileInvoice,
label: localization.invoiceTax,
value: settings.enableInvoiceTaxes,
AppDropdownButton(
labelText: localization.invoiceTaxRates,
// TODO remove this
showBlank: true,
value: settings.numberOfInvoiceTaxRates == null
? ''
: '${settings.numberOfInvoiceTaxRates}',
onChanged: (value) => viewModel.onSettingsChanged(
settings.rebuild((b) => b..enableInvoiceTaxes = value)),
),
BoolDropdownButton(
iconData: FontAwesomeIcons.cubes,
label: localization.lineItemTax,
value: settings.enableInvoiceItemTaxes,
onChanged: (value) => viewModel.onSettingsChanged(
settings.rebuild((b) => b..enableInvoiceItemTaxes = value)),
settings.rebuild(
(b) => b..numberOfInvoiceTaxRates = int.parse(value))),
items: List<int>.generate(3, (i) => i + 1)
.map((value) => DropdownMenuItem<String>(
child: Text('$value'),
value: '$value',
))
.toList(),
),
BoolDropdownButton(
iconData: FontAwesomeIcons.percent,
@ -65,62 +68,43 @@ class _TaxSettingsState extends State<TaxSettings> {
),
],
),
FormCard(
children: <Widget>[
AppDropdownButton(
labelText: localization.numberOfRates,
// TODO remove this
showBlank: true,
value: settings.numberOfTaxRates == null
? ''
: '${settings.numberOfTaxRates}',
onChanged: (value) => viewModel.onSettingsChanged(settings
.rebuild((b) => b..numberOfTaxRates = int.parse(value))),
items: List<int>.generate(3, (i) => i + 1)
.map((value) => DropdownMenuItem<String>(
child: Text('$value'),
value: '$value',
))
.toList(),
),
if (settings.enableInvoiceTaxes) ...[
if (settings.enableFirstInvoiceTaxRate)
FormCard(
children: <Widget>[
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onSettingsChanged(settings.rebuild((b) => b
..defaultTaxName1 = taxRate.name
..defaultTaxRate1 = taxRate.rate)),
labelText: localization.tax,
labelText: localization.defaultTaxRate,
initialTaxName: settings.defaultTaxName1,
initialTaxRate: settings.defaultTaxRate1,
),
// TODO get null value from company
if ((settings.numberOfTaxRates ?? 0) > 1)
if (settings.enableSecondInvoiceTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onSettingsChanged(settings.rebuild((b) => b
..defaultTaxName2 = taxRate.name
..defaultTaxRate2 = taxRate.rate)),
labelText: localization.tax,
labelText: localization.defaultTaxRate,
initialTaxName: settings.defaultTaxName2,
initialTaxRate: settings.defaultTaxRate2,
),
// TODO get null value from company
if ((settings.numberOfTaxRates ?? 0) > 2)
if (settings.enableThirdInvoiceTaxRate)
TaxRateDropdown(
taxRates: company.taxRates,
onSelected: (taxRate) =>
viewModel.onSettingsChanged(settings.rebuild((b) => b
..defaultTaxName3 = taxRate.name
..defaultTaxRate3 = taxRate.rate)),
labelText: localization.tax,
labelText: localization.defaultTaxRate,
initialTaxName: settings.defaultTaxName3,
initialTaxRate: settings.defaultTaxRate3,
),
],
],
),
),
if (!state.uiState.settingsUIState.isFiltered)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),

View File

@ -14,11 +14,13 @@ abstract class LocaleCodeAware {
mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
'default_tax_rate': 'Default Tax Rate',
'user': 'User',
'invoice_tax': 'Invoice Tax',
'line_item_tax': 'Line Item Tax',
'inclusive_taxes': 'Inclusive Taxes',
'number_of_rates': 'Number of Rates',
'invoice_tax_rates': 'Invoice Tax Rates',
'item_tax_rates': 'Item Tax Rates',
'no_client_selected': 'No client selected',
'configure_rates': 'Configure rates',
'tax_settings': 'Tax Settings',
@ -15511,10 +15513,15 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get inclusiveTaxes => _localizedValues[localeCode]['inclusive_taxes'];
String get numberOfRates => _localizedValues[localeCode]['number_of_rates'];
String get invoiceTaxRates => _localizedValues[localeCode]['invoice_tax_rates'];
String get itemTaxRates => _localizedValues[localeCode]['item_tax_rates'];
String get user => _localizedValues[localeCode]['user'];
String get defaultTaxRate => _localizedValues[localeCode]['default_tax_rate'];
String lookup(String key) {
final lookupKey = toSnakeCase(key);
return _localizedValues[localeCode][lookupKey] ??