diff --git a/lib/data/models/client_model.dart b/lib/data/models/client_model.dart index 82dcc1222a4..ad0caac4918 100644 --- a/lib/data/models/client_model.dart +++ b/lib/data/models/client_model.dart @@ -157,7 +157,7 @@ abstract class ClientEntity extends Object customValue4: '', routingId: '', isTaxExempt: false, - //taxData: TaxDataEntity(), + taxData: TaxDataEntity(), contacts: BuiltList( [ ClientContactEntity().rebuild((b) => b..isPrimary = true) @@ -315,8 +315,8 @@ abstract class ClientEntity extends Object @BuiltValueField(wireName: 'is_tax_exempt') bool get isTaxExempt; - //@BuiltValueField(wireName: 'tax_data') - //TaxDataEntity get taxData; + @BuiltValueField(wireName: 'tax_data_temp') + TaxDataEntity get taxData; BuiltList get contacts; @@ -780,7 +780,7 @@ abstract class ClientEntity extends Object ..number = '' ..routingId = '' ..isTaxExempt = false - //..taxData.replace(TaxDataEntity()) + ..taxData.replace(TaxDataEntity()) ..paymentBalance = 0; static Serializer get serializer => _$clientEntitySerializer; diff --git a/lib/data/models/client_model.g.dart b/lib/data/models/client_model.g.dart index 9554dce0fb0..5a389bb3be6 100644 --- a/lib/data/models/client_model.g.dart +++ b/lib/data/models/client_model.g.dart @@ -221,6 +221,9 @@ class _$ClientEntitySerializer implements StructuredSerializer { 'is_tax_exempt', serializers.serialize(object.isTaxExempt, specifiedType: const FullType(bool)), + 'tax_data_temp', + serializers.serialize(object.taxData, + specifiedType: const FullType(TaxDataEntity)), 'contacts', serializers.serialize(object.contacts, specifiedType: const FullType( @@ -458,6 +461,10 @@ class _$ClientEntitySerializer implements StructuredSerializer { result.isTaxExempt = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool; break; + case 'tax_data_temp': + result.taxData.replace(serializers.deserialize(value, + specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity); + break; case 'contacts': result.contacts.replace(serializers.deserialize(value, specifiedType: const FullType( @@ -1015,6 +1022,8 @@ class _$ClientEntity extends ClientEntity { @override final bool isTaxExempt; @override + final TaxDataEntity taxData; + @override final BuiltList contacts; @override final BuiltList activities; @@ -1085,6 +1094,7 @@ class _$ClientEntity extends ClientEntity { this.customValue4, this.routingId, this.isTaxExempt, + this.taxData, this.contacts, this.activities, this.ledger, @@ -1165,6 +1175,7 @@ class _$ClientEntity extends ClientEntity { routingId, r'ClientEntity', 'routingId'); BuiltValueNullFieldError.checkNotNull( isTaxExempt, r'ClientEntity', 'isTaxExempt'); + BuiltValueNullFieldError.checkNotNull(taxData, r'ClientEntity', 'taxData'); BuiltValueNullFieldError.checkNotNull( contacts, r'ClientEntity', 'contacts'); BuiltValueNullFieldError.checkNotNull( @@ -1233,6 +1244,7 @@ class _$ClientEntity extends ClientEntity { customValue4 == other.customValue4 && routingId == other.routingId && isTaxExempt == other.isTaxExempt && + taxData == other.taxData && contacts == other.contacts && activities == other.activities && ledger == other.ledger && @@ -1291,6 +1303,7 @@ class _$ClientEntity extends ClientEntity { _$hash = $jc(_$hash, customValue4.hashCode); _$hash = $jc(_$hash, routingId.hashCode); _$hash = $jc(_$hash, isTaxExempt.hashCode); + _$hash = $jc(_$hash, taxData.hashCode); _$hash = $jc(_$hash, contacts.hashCode); _$hash = $jc(_$hash, activities.hashCode); _$hash = $jc(_$hash, ledger.hashCode); @@ -1350,6 +1363,7 @@ class _$ClientEntity extends ClientEntity { ..add('customValue4', customValue4) ..add('routingId', routingId) ..add('isTaxExempt', isTaxExempt) + ..add('taxData', taxData) ..add('contacts', contacts) ..add('activities', activities) ..add('ledger', ledger) @@ -1532,6 +1546,11 @@ class ClientEntityBuilder bool get isTaxExempt => _$this._isTaxExempt; set isTaxExempt(bool isTaxExempt) => _$this._isTaxExempt = isTaxExempt; + TaxDataEntityBuilder _taxData; + TaxDataEntityBuilder get taxData => + _$this._taxData ??= new TaxDataEntityBuilder(); + set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData; + ListBuilder _contacts; ListBuilder get contacts => _$this._contacts ??= new ListBuilder(); @@ -1646,6 +1665,7 @@ class ClientEntityBuilder _customValue4 = $v.customValue4; _routingId = $v.routingId; _isTaxExempt = $v.isTaxExempt; + _taxData = $v.taxData.toBuilder(); _contacts = $v.contacts.toBuilder(); _activities = $v.activities.toBuilder(); _ledger = $v.ledger.toBuilder(); @@ -1730,6 +1750,7 @@ class ClientEntityBuilder customValue4: BuiltValueNullFieldError.checkNotNull(customValue4, r'ClientEntity', 'customValue4'), routingId: BuiltValueNullFieldError.checkNotNull(routingId, r'ClientEntity', 'routingId'), isTaxExempt: BuiltValueNullFieldError.checkNotNull(isTaxExempt, r'ClientEntity', 'isTaxExempt'), + taxData: taxData.build(), contacts: contacts.build(), activities: activities.build(), ledger: ledger.build(), @@ -1750,6 +1771,8 @@ class ClientEntityBuilder _$failedField = 'settings'; settings.build(); + _$failedField = 'taxData'; + taxData.build(); _$failedField = 'contacts'; contacts.build(); _$failedField = 'activities'; diff --git a/lib/data/models/invoice_model.dart b/lib/data/models/invoice_model.dart index 46040fde320..c64c6a7cf76 100644 --- a/lib/data/models/invoice_model.dart +++ b/lib/data/models/invoice_model.dart @@ -12,6 +12,7 @@ import 'package:invoiceninja_flutter/data/models/mixins/invoice_mixin.dart'; import 'package:invoiceninja_flutter/data/models/models.dart'; import 'package:invoiceninja_flutter/data/models/quote_model.dart'; import 'package:invoiceninja_flutter/data/models/recurring_invoice_model.dart'; +import 'package:invoiceninja_flutter/data/models/tax_model.dart'; import 'package:invoiceninja_flutter/main_app.dart'; import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/redux/client/client_selectors.dart'; @@ -250,6 +251,7 @@ abstract class InvoiceEntity extends Object dueDateDays: 'terms', saveDefaultTerms: false, saveDefaultFooter: false, + taxData: TaxDataEntity(), ); } @@ -626,6 +628,9 @@ abstract class InvoiceEntity extends Object @BuiltValueField(serialize: false) bool get saveDefaultFooter; + @BuiltValueField(wireName: 'tax_data_temp') + TaxDataEntity get taxData; + bool get isApproved { if (isQuote && [ @@ -1551,6 +1556,7 @@ abstract class InvoiceEntity extends Object ..saveDefaultFooter = false ..autoBillEnabled = false ..nextSendDatetime = '' + ..taxData.replace(TaxDataEntity()) ..subscriptionId = ''; static Serializer get serializer => _$invoiceEntitySerializer; diff --git a/lib/data/models/invoice_model.g.dart b/lib/data/models/invoice_model.g.dart index e6823073663..fff7f7831c0 100644 --- a/lib/data/models/invoice_model.g.dart +++ b/lib/data/models/invoice_model.g.dart @@ -282,6 +282,9 @@ class _$InvoiceEntitySerializer implements StructuredSerializer { serializers.serialize(object.activities, specifiedType: const FullType( BuiltList, const [const FullType(ActivityEntity)])), + 'tax_data_temp', + serializers.serialize(object.taxData, + specifiedType: const FullType(TaxDataEntity)), 'created_at', serializers.serialize(object.createdAt, specifiedType: const FullType(int)), @@ -708,6 +711,10 @@ class _$InvoiceEntitySerializer implements StructuredSerializer { BuiltList, const [const FullType(ActivityEntity)])) as BuiltList); break; + case 'tax_data_temp': + result.taxData.replace(serializers.deserialize(value, + specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity); + break; case 'loadedAt': result.loadedAt = serializers.deserialize(value, specifiedType: const FullType(int)) as int; @@ -1576,6 +1583,8 @@ class _$InvoiceEntity extends InvoiceEntity { @override final bool saveDefaultFooter; @override + final TaxDataEntity taxData; + @override final int loadedAt; @override final bool isChanged; @@ -1666,6 +1675,7 @@ class _$InvoiceEntity extends InvoiceEntity { this.activities, this.saveDefaultTerms, this.saveDefaultFooter, + this.taxData, this.loadedAt, this.isChanged, this.createdAt, @@ -1775,6 +1785,7 @@ class _$InvoiceEntity extends InvoiceEntity { saveDefaultTerms, r'InvoiceEntity', 'saveDefaultTerms'); BuiltValueNullFieldError.checkNotNull( saveDefaultFooter, r'InvoiceEntity', 'saveDefaultFooter'); + BuiltValueNullFieldError.checkNotNull(taxData, r'InvoiceEntity', 'taxData'); BuiltValueNullFieldError.checkNotNull( createdAt, r'InvoiceEntity', 'createdAt'); BuiltValueNullFieldError.checkNotNull( @@ -1860,6 +1871,7 @@ class _$InvoiceEntity extends InvoiceEntity { documents == other.documents && saveDefaultTerms == other.saveDefaultTerms && saveDefaultFooter == other.saveDefaultFooter && + taxData == other.taxData && isChanged == other.isChanged && createdAt == other.createdAt && updatedAt == other.updatedAt && @@ -1941,6 +1953,7 @@ class _$InvoiceEntity extends InvoiceEntity { _$hash = $jc(_$hash, documents.hashCode); _$hash = $jc(_$hash, saveDefaultTerms.hashCode); _$hash = $jc(_$hash, saveDefaultFooter.hashCode); + _$hash = $jc(_$hash, taxData.hashCode); _$hash = $jc(_$hash, isChanged.hashCode); _$hash = $jc(_$hash, createdAt.hashCode); _$hash = $jc(_$hash, updatedAt.hashCode); @@ -2023,6 +2036,7 @@ class _$InvoiceEntity extends InvoiceEntity { ..add('activities', activities) ..add('saveDefaultTerms', saveDefaultTerms) ..add('saveDefaultFooter', saveDefaultFooter) + ..add('taxData', taxData) ..add('loadedAt', loadedAt) ..add('isChanged', isChanged) ..add('createdAt', createdAt) @@ -2333,6 +2347,11 @@ class InvoiceEntityBuilder set saveDefaultFooter(bool saveDefaultFooter) => _$this._saveDefaultFooter = saveDefaultFooter; + TaxDataEntityBuilder _taxData; + TaxDataEntityBuilder get taxData => + _$this._taxData ??= new TaxDataEntityBuilder(); + set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData; + int _loadedAt; int get loadedAt => _$this._loadedAt; set loadedAt(int loadedAt) => _$this._loadedAt = loadedAt; @@ -2448,6 +2467,7 @@ class InvoiceEntityBuilder _activities = $v.activities.toBuilder(); _saveDefaultTerms = $v.saveDefaultTerms; _saveDefaultFooter = $v.saveDefaultFooter; + _taxData = $v.taxData.toBuilder(); _loadedAt = $v.loadedAt; _isChanged = $v.isChanged; _createdAt = $v.createdAt; @@ -2556,6 +2576,7 @@ class InvoiceEntityBuilder activities: activities.build(), saveDefaultTerms: BuiltValueNullFieldError.checkNotNull(saveDefaultTerms, r'InvoiceEntity', 'saveDefaultTerms'), saveDefaultFooter: BuiltValueNullFieldError.checkNotNull(saveDefaultFooter, r'InvoiceEntity', 'saveDefaultFooter'), + taxData: taxData.build(), loadedAt: loadedAt, isChanged: isChanged, createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, r'InvoiceEntity', 'createdAt'), @@ -2579,6 +2600,9 @@ class InvoiceEntityBuilder documents.build(); _$failedField = 'activities'; activities.build(); + + _$failedField = 'taxData'; + taxData.build(); } catch (e) { throw new BuiltValueNestedFieldError( r'InvoiceEntity', _$failedField, e.toString());