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 14, 2022
2 parents 220e678 + 6e219f6 commit f6bfc4f
Show file tree
Hide file tree
Showing 78 changed files with 3,784 additions and 121 deletions.
1 change: 1 addition & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ const String kSettingsExpenseCategoryEdit = 'expense_category/edit';
const String kSettingsTaskStatuses = 'task_status';
const String kSettingsTaskStatusView = 'task_status/view';
const String kSettingsTaskStatusEdit = 'task_status/edit';
const String kSettingsBankAccountSettings = 'bank_account_settings';
const String kSettingsBankAccounts = 'bank_accounts';
const String kSettingsBankAccountsView = 'bank_accounts/view';

Expand Down
2 changes: 1 addition & 1 deletion lib/data/models/account_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ abstract class AccountEntity
..trialDaysLeft = 0
..hostedClientCount = 0
..hostedCompanyCount = 1
..accountSmsVerified = false
..accountSmsVerified = true
..setReactAsDefaultAP = false;

static Serializer<AccountEntity> get serializer => _$accountEntitySerializer;
Expand Down
51 changes: 31 additions & 20 deletions lib/data/models/bank_account_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:built_value/serializer.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/utils/formatting.dart';
import 'package:invoiceninja_flutter/utils/strings.dart';

part 'bank_account_model.g.dart';

Expand Down Expand Up @@ -44,8 +45,9 @@ abstract class BankAccountItemResponse
}

class BankAccountFields {
// STARTER: fields - do not remove comment
static const String name = 'name';
static const String type = 'type';
static const String balance = 'balance';
}

abstract class BankAccountEntity extends Object
Expand Down Expand Up @@ -123,9 +125,18 @@ abstract class BankAccountEntity extends Object
switch (sortField) {
// STARTER: sort switch - do not remove comment
case BankAccountFields.name:
response = bankAccountA.name.compareTo(bankAccountB.name);
response = bankAccountA.name
.toLowerCase()
.compareTo(bankAccountB.name.toLowerCase());
break;
case BankAccountFields.balance:
response = bankAccountA.balance.compareTo(bankAccountB.balance);
break;
case BankAccountFields.type:
response = bankAccountA.type
.toLowerCase()
.compareTo(bankAccountB.type.toLowerCase());
break;

default:
print('## ERROR: sort by bankAccount.$sortField is not implemented');
break;
Expand All @@ -141,34 +152,34 @@ abstract class BankAccountEntity extends Object

@override
bool matchesFilter(String filter) {
if (filter == null || filter.isEmpty) {
return true;
}

filter = filter.toLowerCase();

return false;
return matchesStrings(
haystacks: [
name,
type,
],
needle: filter,
);
}

@override
String matchesFilterValue(String filter) {
if (filter == null || filter.isEmpty) {
return null;
}

filter = filter.toLowerCase();

return null;
return matchesStringsValue(
haystacks: [
name,
type,
],
needle: filter,
);
}

@override
String get listDisplayName => null;
String get listDisplayName => name;

@override
double get listDisplayAmount => null;
double get listDisplayAmount => balance;

@override
FormatNumberType get listDisplayAmountType => null;
FormatNumberType get listDisplayAmountType => FormatNumberType.money;

static Serializer<BankAccountEntity> get serializer =>
_$bankAccountEntitySerializer;
Expand Down
8 changes: 7 additions & 1 deletion lib/data/models/company_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ abstract class CompanyEntity extends Object
clientRegistrationFields: BuiltList<RegistrationFieldEntity>(),
purchaseOrders: BuiltList<InvoiceEntity>(),
bankAccounts: BuiltList<BankAccountEntity>(),
transactions: BuiltList<TransactionEntity>(),
);
}

Expand Down Expand Up @@ -328,6 +329,9 @@ abstract class CompanyEntity extends Object
@BuiltValueField(wireName: 'bank_integrations')
BuiltList<BankAccountEntity> get bankAccounts;

@BuiltValueField(wireName: 'bank_transactions')
BuiltList<TransactionEntity> get transactions;

BuiltList<TaskEntity> get tasks;

BuiltList<ProjectEntity> get projects;
Expand Down Expand Up @@ -596,6 +600,7 @@ abstract class CompanyEntity extends Object
..quotes.clear()
..purchaseOrders.clear()
..bankAccounts.clear()
..transactions.clear()
..credits.clear()
..tasks.clear()
..projects.clear()
Expand Down Expand Up @@ -678,7 +683,8 @@ abstract class CompanyEntity extends Object
..recurringExpenses.replace(BuiltList<ExpenseEntity>())
..clientRegistrationFields.replace(BuiltList<RegistrationFieldEntity>())
..purchaseOrders.replace(BuiltList<InvoiceEntity>())
..bankAccounts.replace(BuiltList<BankAccountEntity>());
..bankAccounts.replace(BuiltList<BankAccountEntity>())
..transactions.replace(BuiltList<BankAccountEntity>());

static Serializer<CompanyEntity> get serializer => _$companyEntitySerializer;
}
Expand Down
29 changes: 28 additions & 1 deletion lib/data/models/company_model.g.dart

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

2 changes: 2 additions & 0 deletions lib/data/models/entities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class EntityType extends EnumClass {
static const EntityType invoiceItem = _$invoiceItem;
static const EntityType design = _$design;
// STARTER: entity type - do not remove comment
static const EntityType transaction = _$transaction;

static const EntityType bankAccount = _$bankAccount;

static const EntityType recurringExpense = _$recurringExpense;
Expand Down
4 changes: 4 additions & 0 deletions lib/data/models/entities.g.dart

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

1 change: 1 addition & 0 deletions lib/data/models/expense_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ abstract class ExpenseEntity extends Object
..date = convertDateTimeToSqlDate()
..documents.clear()
..transactionReference = ''
..transactionId = ''
..paymentTypeId = ''
..paymentDate = '');

Expand Down
1 change: 1 addition & 0 deletions lib/data/models/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export 'package:invoiceninja_flutter/data/models/task_status_model.dart';
export 'package:invoiceninja_flutter/data/models/user_model.dart';
export 'package:invoiceninja_flutter/data/models/vendor_model.dart';
export 'package:invoiceninja_flutter/data/models/bank_account_model.dart';
export 'package:invoiceninja_flutter/data/models/transaction_model.dart';
// STARTER: export - do not remove comment

part 'models.g.dart';
Expand Down
8 changes: 6 additions & 2 deletions lib/data/models/serializers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ import 'package:invoiceninja_flutter/redux/ui/ui_state.dart';
import 'package:invoiceninja_flutter/redux/user/user_state.dart';
import 'package:invoiceninja_flutter/redux/vendor/vendor_state.dart';
import 'package:invoiceninja_flutter/redux/webhook/webhook_state.dart';

// STARTER: import - do not remove comment
import 'package:invoiceninja_flutter/redux/transaction/transaction_state.dart';
import 'package:invoiceninja_flutter/redux/bank_account/bank_account_state.dart';
// STARTER: import - do not remove comment

part 'serializers.g.dart';

Expand Down Expand Up @@ -115,6 +115,10 @@ part 'serializers.g.dart';
TaxRateItemResponse,
TaxRateListResponse,
// STARTER: serializers - do not remove comment
TransactionEntity,
TransactionListResponse,
TransactionItemResponse,

BankAccountEntity,
BankAccountListResponse,
BankAccountItemResponse,
Expand Down
Loading

0 comments on commit f6bfc4f

Please sign in to comment.