Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Dec 3, 2024
2 parents 746e93b + 0851137 commit db2b46b
Show file tree
Hide file tree
Showing 29 changed files with 459 additions and 56 deletions.
5 changes: 5 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ const kEQuoteTypes = [
];

const String kCountryUnitedStates = '840';
const String kCountryUnitedKingdom = '826';
const String kCountryAustralia = '36';
const String kCountryCanada = '124';
const String kCountrySwitzerland = '756';
Expand Down Expand Up @@ -829,6 +830,7 @@ const String kDefaultLightBorderColor = '#dfdfdf';
const String kTaxRegionUnitedStates = 'US';
const String kTaxRegionEurope = 'EU';
const String kTaxRegionAustralia = 'AU';
const String kTaxRegionUnitedKingdom = 'UK';

const String kReportGroupDay = 'day';
const String kReportGroupWeek = 'week';
Expand Down Expand Up @@ -1145,3 +1147,6 @@ const String kActivityQuoteEmailReminder1 = '142';
const String kActivityAutoBillSuccess = '143';
const String kActivityAutoBillFailure = '144';
const String kActivityEInvoiceSuccess = '145';
const String kActivityEInvoiceDeliverySuccess = '146';
const String kActivityEInvoiceDeliveryFailure = '147';
const String kActivityEExpenseCreated = '148';
2 changes: 1 addition & 1 deletion lib/data/models/client_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ abstract class ClientEntity extends Object
}
}

if (!isDeleted! && multiselect) {
if (!isDeleted!) {
actions.add(EntityAction.bulkUpdate);
}

Expand Down
5 changes: 5 additions & 0 deletions lib/data/models/entities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ abstract class ActivityEntity
kActivityAutoBillSuccess,
kActivityAutoBillFailure,
kActivityEInvoiceSuccess,
kActivityEInvoiceDeliverySuccess,
kActivityEInvoiceDeliveryFailure,
].contains(activityTypeId)) {
return EntityType.invoice;
} else if ([
Expand Down Expand Up @@ -881,6 +883,7 @@ abstract class ActivityEntity
kActivityRestoreExpense,
kActivityUpdateExpense,
kActivityExpenseNotificationSent,
kActivityEExpenseCreated,
].contains(activityTypeId)) {
return EntityType.expense;
} else if ([
Expand Down Expand Up @@ -1017,6 +1020,8 @@ abstract class ActivityEntity
':recurring_expense', vendor?.name ?? ''); // TODO implement
activity = activity.replaceAll(' ', ' ');

activity = activity.replaceFirst(' - :notes', '');

return activity;
}

Expand Down
7 changes: 6 additions & 1 deletion lib/data/models/tax_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ abstract class TaxConfigSubregionEntity
taxRate: 0,
reducedTaxRate: 0,
taxName: '',
vatNumber: '',
);
}

Expand All @@ -228,13 +229,17 @@ abstract class TaxConfigSubregionEntity
@BuiltValueField(wireName: 'reduced_tax_rate')
double get reducedTaxRate;

@BuiltValueField(wireName: 'vat_number')
String get vatNumber;

// ignore: unused_element
static void _initializeBuilder(TaxConfigSubregionEntityBuilder builder) =>
builder
..applyTax = false
..taxName = ''
..reducedTaxRate = 0
..taxRate = 0;
..taxRate = 0
..vatNumber = '';

static Serializer<TaxConfigSubregionEntity> get serializer =>
_$taxConfigSubregionEntitySerializer;
Expand Down
30 changes: 26 additions & 4 deletions lib/data/models/tax_model.g.dart

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

16 changes: 16 additions & 0 deletions lib/data/models/vendor_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class VendorFields {
static const String contactEmail = 'contact_email';
static const String classification = 'classification';
static const String routingId = 'routing_id';
static const String isTaxExempt = 'is_tax_exempt';
}

abstract class VendorEntity extends Object
Expand Down Expand Up @@ -124,6 +125,7 @@ abstract class VendorEntity extends Object
updatedAt: 0,
archivedAt: 0,
isDeleted: false,
isTaxExempt: false,
assignedUserId: user?.id ?? '',
createdUserId: '',
createdAt: 0,
Expand Down Expand Up @@ -224,6 +226,9 @@ abstract class VendorEntity extends Object
@BuiltValueField(wireName: 'routing_id')
String get routingId;

@BuiltValueField(wireName: 'is_tax_exempt')
bool get isTaxExempt;

@BuiltValueField(wireName: 'last_login')
int get lastLogin;

Expand Down Expand Up @@ -273,6 +278,16 @@ abstract class VendorEntity extends Object
actions.add(EntityAction.addComment);
}

/*
if (!isDeleted!) {
actions.add(EntityAction.bulkUpdate);
}
*/

if (userCompany!.isAdmin && !multiselect) {
actions.add(EntityAction.merge);
}

if (actions.isNotEmpty && actions.last != null) {
actions.add(null);
}
Expand Down Expand Up @@ -534,6 +549,7 @@ abstract class VendorEntity extends Object
..lastLogin = 0
..routingId = ''
..languageId = ''
..isTaxExempt = false
..displayName = ''
..classification = '';

Expand Down
21 changes: 21 additions & 0 deletions lib/data/models/vendor_model.g.dart

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

18 changes: 18 additions & 0 deletions lib/data/repositories/vendor_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@ class VendorRepository {
return vendorResponse.data;
}

Future<VendorEntity> merge({
required Credentials credentials,
required String? vendorId,
required String? mergeIntoVendorId,
required String? password,
required String? idToken,
}) async {
final url = credentials.url + '/vendors/$mergeIntoVendorId/$vendorId/merge';

final dynamic response = await webClient.post(url, credentials.token,
password: password, idToken: idToken);

final VendorItemResponse clientResponse =
serializers.deserializeWith(VendorItemResponse.serializer, response)!;

return clientResponse.data;
}

Future<VendorEntity> uploadDocument(
Credentials credentials,
BaseEntity entity,
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class MyHttpOverrides extends HttpOverrides {
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback = (X509Certificate cert, String host, int port) {
print('## Comparing ${this.host} to $host');
return this.host == host;
};
}
Expand Down
Loading

0 comments on commit db2b46b

Please sign in to comment.