Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Sep 12, 2023
2 parents 1acdd8a + ad29f2c commit df5e022
Show file tree
Hide file tree
Showing 24 changed files with 428 additions and 76 deletions.
18 changes: 18 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,24 @@ const kTaxCategories = {
kTaxCategoryReverseTax: 'reverse_tax',
};

const String kTaxClassificationIndividual = 'individual';
const String kTaxClassificationCompany = 'company';
const String kTaxClassificationPartnership = 'partnership';
const String kTaxClassificationTrust = 'trust';
const String kTaxClassificationCharity = 'charity';
const String kTaxClassificationGovernment = 'government';
const String kTaxClassificationOther = 'other';

const kTaxClassifications = [
kTaxClassificationIndividual,
kTaxClassificationCompany,
kTaxClassificationPartnership,
kTaxClassificationTrust,
kTaxClassificationCharity,
kTaxClassificationGovernment,
kTaxClassificationOther,
];

const String kEInvoiceTypeEN16931 = 'EN16931';
const String kEInvoiceTypeXInvoice_2_2 = 'XInvoice_2_2';
const String kEInvoiceTypeXInvoice_2_1 = 'XInvoice_2_1';
Expand Down
10 changes: 9 additions & 1 deletion lib/data/models/client_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class ClientFields {
static const String group = 'group';
static const String routingId = 'routing_id';
static const String isTaxExempt = 'tax_exempt';
static const String classification = 'classification';
}

abstract class ClientEntity extends Object
Expand Down Expand Up @@ -157,6 +158,7 @@ abstract class ClientEntity extends Object
customValue4: '',
routingId: '',
isTaxExempt: false,
classification: '',
taxData: TaxDataEntity(),
contacts: BuiltList<ClientContactEntity>(
<ClientContactEntity>[
Expand Down Expand Up @@ -318,6 +320,8 @@ abstract class ClientEntity extends Object
@BuiltValueField(wireName: 'tax_info')
TaxDataEntity get taxData;

String get classification;

BuiltList<ClientContactEntity> get contacts;

@override
Expand Down Expand Up @@ -552,6 +556,9 @@ abstract class ClientEntity extends Object
case ClientFields.group:
response = clientA.groupId.compareTo(clientB.groupId);
break;
case ClientFields.classification:
response = clientA.classification.compareTo(clientB.classification);
break;
default:
print('## ERROR: sort by client.$sortField not implemented');
break;
Expand Down Expand Up @@ -781,7 +788,8 @@ abstract class ClientEntity extends Object
..routingId = ''
..isTaxExempt = false
..taxData.replace(TaxDataEntity())
..paymentBalance = 0;
..paymentBalance = 0
..classification = '';

static Serializer<ClientEntity> get serializer => _$clientEntitySerializer;
}
Expand Down
23 changes: 23 additions & 0 deletions lib/data/models/client_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/data/models/settings_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,9 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'default_expense_payment_type_id')
String get defaultExpensePaymentTypeId;

@nullable
String get classification;

bool get hasAddress => address1 != null && address1.isNotEmpty;

bool get hasLogo => companyLogo != null && companyLogo.isNotEmpty;
Expand Down
32 changes: 28 additions & 4 deletions lib/data/models/settings_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion lib/data/models/vendor_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class VendorFields {
static const String postalCity = 'postal_city';
static const String lastLoginAt = 'last_login_at';
static const String contactEmail = 'contact_email';
static const String classification = 'classification';
}

abstract class VendorEntity extends Object
Expand Down Expand Up @@ -124,6 +125,7 @@ abstract class VendorEntity extends Object
createdUserId: '',
createdAt: 0,
lastLogin: 0,
classification: '',
documents: BuiltList<DocumentEntity>(),
);
}
Expand Down Expand Up @@ -217,6 +219,8 @@ abstract class VendorEntity extends Object
@BuiltValueField(wireName: 'last_login')
int get lastLogin;

String get classification;

BuiltList<VendorContactEntity> get contacts;

@override
Expand Down Expand Up @@ -371,6 +375,9 @@ abstract class VendorEntity extends Object
case VendorFields.customValue4:
response = vendorA.customValue4.compareTo(vendorB.customValue4);
break;
case VendorFields.classification:
response = vendorA.classification.compareTo(vendorB.classification);
break;
default:
print('## ERROR: sort by vendor.$sortField is not implemented');
break;
Expand Down Expand Up @@ -512,7 +519,8 @@ abstract class VendorEntity extends Object
static void _initializeBuilder(VendorEntityBuilder builder) => builder
..activities.replace(BuiltList<ActivityEntity>())
..lastLogin = 0
..languageId = '';
..languageId = ''
..classification = '';

static Serializer<VendorEntity> get serializer => _$vendorEntitySerializer;
}
Expand Down
Loading

0 comments on commit df5e022

Please sign in to comment.