taxtank-core 0.33.6 → 0.33.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/src/lib/collections/bank-account.collection.mjs +5 -41
- package/esm2022/src/lib/collections/depreciation.collection.mjs +6 -18
- package/esm2022/src/lib/collections/property/property.collection.mjs +8 -4
- package/esm2022/src/lib/collections/transaction/transaction.collection.mjs +3 -15
- package/esm2022/src/lib/db/Enums/bank/bank-account-type.enum.mjs +2 -2
- package/esm2022/src/lib/db/Models/bank/bank-account.mjs +1 -1
- package/esm2022/src/lib/db/Models/transaction/transaction-base.mjs +6 -40
- package/esm2022/src/lib/forms/property/property-share.form.mjs +2 -2
- package/esm2022/src/lib/models/bank/bank-account.mjs +6 -3
- package/esm2022/src/lib/models/bank/type-loan.const.mjs +2 -5
- package/esm2022/src/lib/models/depreciation/depreciation.mjs +8 -22
- package/esm2022/src/lib/models/property/property.mjs +1 -4
- package/esm2022/src/lib/models/report/reports.const.mjs +17 -17
- package/esm2022/src/lib/models/transaction/transaction.mjs +1 -19
- package/esm2022/src/lib/services/http/transaction/transaction.service.mjs +1 -18
- package/fesm2022/taxtank-core.mjs +53 -195
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/collections/bank-account.collection.d.ts +1 -21
- package/src/lib/collections/depreciation.collection.d.ts +1 -1
- package/src/lib/collections/property/property.collection.d.ts +1 -1
- package/src/lib/db/Enums/bank/bank-account-type.enum.d.ts +1 -0
- package/src/lib/db/Models/bank/bank-account.d.ts +0 -1
- package/src/lib/db/Models/transaction/transaction-base.d.ts +0 -9
- package/src/lib/models/bank/bank-account.d.ts +1 -0
- package/src/lib/models/bank/type-loan.const.d.ts +0 -3
- package/src/lib/models/depreciation/depreciation.d.ts +3 -11
- package/src/lib/models/property/property.d.ts +0 -1
- package/src/lib/models/transaction/transaction.d.ts +1 -6
- package/src/lib/services/http/transaction/transaction.service.d.ts +0 -6
@@ -25,7 +25,6 @@ import round from 'lodash/round';
|
|
25
25
|
import range from 'lodash/range';
|
26
26
|
import { Validators, FormGroup, FormArray, UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormControl } from '@angular/forms';
|
27
27
|
import compact from 'lodash/compact';
|
28
|
-
import concat from 'lodash/concat';
|
29
28
|
import cloneDeep$1 from 'lodash/cloneDeep';
|
30
29
|
import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.js';
|
31
30
|
import clone from 'lodash/clone';
|
@@ -465,57 +464,23 @@ class TransactionBase extends ObservableModel {
|
|
465
464
|
/**
|
466
465
|
* @TODO remove when AllocateForm is refactored and not merging with Transaction class which cause the issue
|
467
466
|
*/
|
468
|
-
set tankType(tankType) {
|
469
|
-
}
|
470
|
-
/**
|
471
|
-
* Check if current tank is Property
|
472
|
-
*/
|
467
|
+
set tankType(tankType) { }
|
473
468
|
isPropertyTank() {
|
474
|
-
|
475
|
-
if (this.chartAccounts) {
|
476
|
-
return CHART_ACCOUNTS_CATEGORIES.property.includes(this.chartAccounts.category);
|
477
|
-
}
|
478
|
-
return !!this.property;
|
469
|
+
return CHART_ACCOUNTS_CATEGORIES.property.includes(this.chartAccounts?.category);
|
479
470
|
}
|
480
|
-
/**
|
481
|
-
* Check if current tank is Work
|
482
|
-
*/
|
483
471
|
isWorkTank() {
|
484
|
-
|
485
|
-
if (this.chartAccounts) {
|
486
|
-
return CHART_ACCOUNTS_CATEGORIES.work.includes(this.chartAccounts?.category);
|
487
|
-
}
|
488
|
-
return !this.isPropertyTank() && !this.isSoleTank();
|
472
|
+
return CHART_ACCOUNTS_CATEGORIES.work.includes(this.chartAccounts?.category);
|
489
473
|
}
|
490
|
-
/**
|
491
|
-
* Check if current tank is Sole
|
492
|
-
*/
|
493
474
|
isSoleTank() {
|
494
|
-
|
495
|
-
if (this.chartAccounts) {
|
496
|
-
return CHART_ACCOUNTS_CATEGORIES.sole.includes(this.chartAccounts?.category);
|
497
|
-
}
|
498
|
-
return !!this.business;
|
475
|
+
return CHART_ACCOUNTS_CATEGORIES.sole.includes(this.chartAccounts?.category);
|
499
476
|
}
|
500
477
|
isHoldingTank() {
|
501
|
-
|
502
|
-
if (this.chartAccounts) {
|
503
|
-
return CHART_ACCOUNTS_CATEGORIES.holding.includes(this.chartAccounts?.category);
|
504
|
-
}
|
505
|
-
// @TODO Alex we need another way to distinguish work/holding
|
506
|
-
return !this.isPropertyTank() && !this.isSoleTank();
|
478
|
+
return CHART_ACCOUNTS_CATEGORIES.holding.includes(this.chartAccounts?.category);
|
507
479
|
}
|
508
480
|
isOtherTank() {
|
509
|
-
// chart accounts may be empty for new instances
|
510
|
-
if (!this.chartAccounts) {
|
511
|
-
return false;
|
512
|
-
}
|
513
481
|
return CHART_ACCOUNTS_CATEGORIES.other.includes(this.chartAccounts?.category);
|
514
482
|
}
|
515
483
|
isPersonalTank() {
|
516
|
-
if (!this.chartAccounts) {
|
517
|
-
return false;
|
518
|
-
}
|
519
484
|
return CHART_ACCOUNTS_CATEGORIES.personal.includes(this.chartAccounts?.category);
|
520
485
|
}
|
521
486
|
get amountWithGst() {
|
@@ -974,7 +939,7 @@ var BankAccountTypeEnum;
|
|
974
939
|
BankAccountTypeEnum[BankAccountTypeEnum["SAVINGS"] = 2] = "SAVINGS";
|
975
940
|
BankAccountTypeEnum[BankAccountTypeEnum["CREDIT_CARD"] = 3] = "CREDIT_CARD";
|
976
941
|
// @TODO Alex: should be removed by backend (TT-2107)
|
977
|
-
|
942
|
+
BankAccountTypeEnum[BankAccountTypeEnum["MORTGAGE"] = 4] = "MORTGAGE";
|
978
943
|
BankAccountTypeEnum[BankAccountTypeEnum["LOAN"] = 5] = "LOAN";
|
979
944
|
BankAccountTypeEnum[BankAccountTypeEnum["INVESTMENT"] = 6] = "INVESTMENT";
|
980
945
|
BankAccountTypeEnum[BankAccountTypeEnum["TERM_DEPOSIT"] = 7] = "TERM_DEPOSIT";
|
@@ -2337,10 +2302,14 @@ class PropertyCollection extends Collection {
|
|
2337
2302
|
return this.sumBy('growthPercent');
|
2338
2303
|
}
|
2339
2304
|
get marketValue() {
|
2340
|
-
return this.sumBy('marketValue');
|
2305
|
+
return this.sumBy('valuation.marketValue');
|
2341
2306
|
}
|
2342
|
-
get
|
2343
|
-
|
2307
|
+
get sharedMarketValue() {
|
2308
|
+
let sharedMarketValue = 0;
|
2309
|
+
this.items.forEach(property => {
|
2310
|
+
sharedMarketValue += property.shareRatio * property.marketValue;
|
2311
|
+
});
|
2312
|
+
return sharedMarketValue;
|
2344
2313
|
}
|
2345
2314
|
/**
|
2346
2315
|
* Get list of unique property categories from collection
|
@@ -5831,9 +5800,6 @@ class Property extends Property$1 {
|
|
5831
5800
|
get forecastedCashPosition() {
|
5832
5801
|
return this.currentYearForecast?.cashPosition || 0;
|
5833
5802
|
}
|
5834
|
-
get marketValueGrowth() {
|
5835
|
-
return (this.marketValue - this.purchasePrice) / this.marketValue;
|
5836
|
-
}
|
5837
5803
|
get myShare() {
|
5838
5804
|
return this.shares.find((share) => share.user.id === +localStorage.getItem('userId'));
|
5839
5805
|
}
|
@@ -6462,24 +6428,6 @@ class Transaction extends Transaction$1 {
|
|
6462
6428
|
isInterest() {
|
6463
6429
|
return this.chartAccounts.id === ChartAccountsListEnum.INTEREST_ON_LOAN;
|
6464
6430
|
}
|
6465
|
-
get chartAccountsCategories() {
|
6466
|
-
switch (true) {
|
6467
|
-
case this.isPersonal():
|
6468
|
-
return CHART_ACCOUNTS_CATEGORIES.personal;
|
6469
|
-
case this.isPropertyTank():
|
6470
|
-
return CHART_ACCOUNTS_CATEGORIES.property;
|
6471
|
-
case this.isSoleTank():
|
6472
|
-
return CHART_ACCOUNTS_CATEGORIES.sole;
|
6473
|
-
default:
|
6474
|
-
return CHART_ACCOUNTS_CATEGORIES.work;
|
6475
|
-
}
|
6476
|
-
}
|
6477
|
-
/**
|
6478
|
-
* Get transaction date
|
6479
|
-
*/
|
6480
|
-
getDate() {
|
6481
|
-
return this.date;
|
6482
|
-
}
|
6483
6431
|
/**
|
6484
6432
|
* Check if transaction type is vehicle
|
6485
6433
|
*/
|
@@ -6803,14 +6751,10 @@ class Depreciation extends Depreciation$1 {
|
|
6803
6751
|
super(...arguments);
|
6804
6752
|
this.forecasts = [];
|
6805
6753
|
this.type = DepreciationTypeEnum.PLANT_EQUIPMENT;
|
6806
|
-
/**
|
6807
|
-
* @TODO remove after ? signs removed from db models
|
6808
|
-
*/
|
6809
6754
|
this.amount = 0;
|
6810
6755
|
}
|
6811
|
-
static { this.
|
6812
|
-
static { this.
|
6813
|
-
// Type checking
|
6756
|
+
static { this.writtenOffThreshold = 300; }
|
6757
|
+
static { this.lowValuePoolThreshold = 1000; }
|
6814
6758
|
isCapital() {
|
6815
6759
|
return this.type === DepreciationTypeEnum.CAPITAL_WORKS;
|
6816
6760
|
}
|
@@ -6820,7 +6764,6 @@ class Depreciation extends Depreciation$1 {
|
|
6820
6764
|
isAsset() {
|
6821
6765
|
return this.type === DepreciationTypeEnum.PLANT_EQUIPMENT;
|
6822
6766
|
}
|
6823
|
-
// Calculation checking
|
6824
6767
|
isSBPCalculation() {
|
6825
6768
|
return this.calculation === DepreciationCalculationEnum.SBP;
|
6826
6769
|
}
|
@@ -6839,7 +6782,7 @@ class Depreciation extends Depreciation$1 {
|
|
6839
6782
|
&& !this.isSBPCalculation()
|
6840
6783
|
&& this.isDiminishing()
|
6841
6784
|
&& !this.isWrittenOff()
|
6842
|
-
&& this.currentYearForecast.closeBalance <= Depreciation.
|
6785
|
+
&& this.currentYearForecast.closeBalance <= Depreciation.lowValuePoolThreshold;
|
6843
6786
|
}
|
6844
6787
|
isSBP() {
|
6845
6788
|
return this.isAsset() && this.isSBPCalculation() && !this.isWrittenOff();
|
@@ -6859,12 +6802,6 @@ class Depreciation extends Depreciation$1 {
|
|
6859
6802
|
isVehicleDepreciation() {
|
6860
6803
|
return this.chartAccounts.heading?.id === ChartAccountsHeadingVehicleListEnum.DEPRECIATION_VEHICLES;
|
6861
6804
|
}
|
6862
|
-
/**
|
6863
|
-
* Get depreciation purchase date
|
6864
|
-
*/
|
6865
|
-
getDate() {
|
6866
|
-
return this.date;
|
6867
|
-
}
|
6868
6805
|
/**
|
6869
6806
|
* @TODO Vik: Research a problem with depreciations without current year forecast
|
6870
6807
|
*/
|
@@ -6886,9 +6823,6 @@ class Depreciation extends Depreciation$1 {
|
|
6886
6823
|
getCloseBalanceByYear(year) {
|
6887
6824
|
return this.getForecastByYear(year)?.closeBalance || 0;
|
6888
6825
|
}
|
6889
|
-
isBuildingAtCost() {
|
6890
|
-
return this.chartAccounts.id === ChartAccountsListEnum.BUILDING_AT_COST;
|
6891
|
-
}
|
6892
6826
|
/**
|
6893
6827
|
* Create a new transaction from current depreciation
|
6894
6828
|
*/
|
@@ -6909,7 +6843,7 @@ class Depreciation extends Depreciation$1 {
|
|
6909
6843
|
}
|
6910
6844
|
get amountWithGst() {
|
6911
6845
|
// gst applies only to new assets
|
6912
|
-
if (this.
|
6846
|
+
if (this.isCurrentYearBuy()) {
|
6913
6847
|
return super.amountWithGst;
|
6914
6848
|
}
|
6915
6849
|
return this.amount;
|
@@ -6920,7 +6854,7 @@ class Depreciation extends Depreciation$1 {
|
|
6920
6854
|
/**
|
6921
6855
|
* assets purchased in the current financial year
|
6922
6856
|
*/
|
6923
|
-
|
6857
|
+
isCurrentYearBuy() {
|
6924
6858
|
return new FinancialYear(this.date).year === new FinancialYear().year;
|
6925
6859
|
}
|
6926
6860
|
}
|
@@ -6954,7 +6888,7 @@ __decorate([
|
|
6954
6888
|
forecast.closeBalance < 1000 &&
|
6955
6889
|
obj.calculation === DepreciationCalculationEnum.DIMINISHING &&
|
6956
6890
|
obj.type === DepreciationTypeEnum.PLANT_EQUIPMENT &&
|
6957
|
-
!(obj.amount > Depreciation.
|
6891
|
+
!(obj.amount > Depreciation.writtenOffThreshold && obj.amount < Depreciation.lowValuePoolThreshold) &&
|
6958
6892
|
!(obj.writeOffDate && new FinancialYear(new Date(obj.writeOffDate)).year === obj.financialYear);
|
6959
6893
|
});
|
6960
6894
|
return value;
|
@@ -7092,7 +7026,7 @@ class TransactionCollection extends ExportableCollection {
|
|
7092
7026
|
* Get new collection of property transactions
|
7093
7027
|
*/
|
7094
7028
|
getPropertyTransactions() {
|
7095
|
-
return
|
7029
|
+
return this.filterBy('tankType', TankTypeEnum.PROPERTY);
|
7096
7030
|
}
|
7097
7031
|
getDebitTransactions() {
|
7098
7032
|
return new TransactionCollection(this.items.filter((transaction) => transaction.isDebit()));
|
@@ -7125,19 +7059,7 @@ class TransactionCollection extends ExportableCollection {
|
|
7125
7059
|
* Get new transaction collection filtered by tank type
|
7126
7060
|
*/
|
7127
7061
|
getByTankType(tankType) {
|
7128
|
-
return this.
|
7129
|
-
switch (tankType) {
|
7130
|
-
case TankTypeEnum.PROPERTY:
|
7131
|
-
return transaction.isPropertyTank();
|
7132
|
-
case TankTypeEnum.WORK:
|
7133
|
-
return transaction.isWorkTank();
|
7134
|
-
case TankTypeEnum.SOLE:
|
7135
|
-
return transaction.isSoleTank();
|
7136
|
-
// Transaction may be not related to any tank type (personal)
|
7137
|
-
default:
|
7138
|
-
return false;
|
7139
|
-
}
|
7140
|
-
}));
|
7062
|
+
return this.filterBy('tankType', tankType);
|
7141
7063
|
}
|
7142
7064
|
getExportHeader() {
|
7143
7065
|
return ['Date', 'Description', 'Debit', 'Credit'];
|
@@ -7264,8 +7186,8 @@ class DepreciationCollection extends Collection {
|
|
7264
7186
|
getSoleDepreciations() {
|
7265
7187
|
return this.filter((depreciation) => depreciation.isSoleTank());
|
7266
7188
|
}
|
7267
|
-
|
7268
|
-
return this.filter(
|
7189
|
+
getCurrentYearBuy() {
|
7190
|
+
return this.filter(depreciation => depreciation.isCurrentYearBuy());
|
7269
7191
|
}
|
7270
7192
|
/**
|
7271
7193
|
* Get total amount of all depreciations in the collection
|
@@ -7274,7 +7196,7 @@ class DepreciationCollection extends Collection {
|
|
7274
7196
|
return this.items.reduce((sum, depreciation) => sum + depreciation.amount, 0);
|
7275
7197
|
}
|
7276
7198
|
get claimAmount() {
|
7277
|
-
return this.
|
7199
|
+
return this.sumBy('currentYearForecast.claimAmount');
|
7278
7200
|
}
|
7279
7201
|
getClaimedAmountByYear(year = +localStorage.getItem('financialYear')) {
|
7280
7202
|
const closeBalance = this.items.reduce((sum, depreciation) => sum + depreciation.getCloseBalanceByYear(year), 0);
|
@@ -7287,7 +7209,7 @@ class DepreciationCollection extends Collection {
|
|
7287
7209
|
return this.items.reduce((sum, depreciation) => sum + depreciation.getCloseBalanceByYear(year), 0);
|
7288
7210
|
}
|
7289
7211
|
getCurrentYearForecastAmount() {
|
7290
|
-
return this.
|
7212
|
+
return this.sumBy('currentYearForecast.amount');
|
7291
7213
|
}
|
7292
7214
|
get closeBalance() {
|
7293
7215
|
return this.sumBy('currentYearForecast.closeBalance');
|
@@ -7338,19 +7260,7 @@ class DepreciationCollection extends Collection {
|
|
7338
7260
|
return this.filter((depreciation) => depreciation.isVehicleDepreciation());
|
7339
7261
|
}
|
7340
7262
|
getByTankType(tankType) {
|
7341
|
-
return this.
|
7342
|
-
switch (tankType) {
|
7343
|
-
case TankTypeEnum.PROPERTY:
|
7344
|
-
return depreciation.isPropertyTank();
|
7345
|
-
case TankTypeEnum.WORK:
|
7346
|
-
return depreciation.isWorkTank();
|
7347
|
-
case TankTypeEnum.SOLE:
|
7348
|
-
return depreciation.isSoleTank();
|
7349
|
-
// case for other tank or some extra
|
7350
|
-
default:
|
7351
|
-
return false;
|
7352
|
-
}
|
7353
|
-
}));
|
7263
|
+
return this.filterBy('tankType', tankType);
|
7354
7264
|
}
|
7355
7265
|
/**
|
7356
7266
|
* Create TransactionCollection from depreciation items
|
@@ -8219,19 +8129,19 @@ class VehicleExpense extends AbstractModel {
|
|
8219
8129
|
}
|
8220
8130
|
|
8221
8131
|
const REPORTS = new Collection([
|
8222
|
-
{
|
8223
|
-
title: 'Income & Expense Report',
|
8224
|
-
description: 'Income and expense report with prior year comparison and monthly view option. Filter by Tank, property, business or personal categories',
|
8225
|
-
route: './income-expense',
|
8226
|
-
roles: [UserRolesEnum.CLIENT],
|
8227
|
-
},
|
8228
8132
|
// @TODO TT-4385
|
8229
8133
|
// {
|
8230
|
-
// title: '
|
8231
|
-
// description: '
|
8232
|
-
// route: './
|
8233
|
-
// roles: [UserRolesEnum.CLIENT]
|
8134
|
+
// title: 'Income & Expense Report',
|
8135
|
+
// description: 'Income and expense report with prior year comparison and monthly view option. Filter by Tank, property, business or personal categories',
|
8136
|
+
// route: './income-expense',
|
8137
|
+
// roles: [UserRolesEnum.CLIENT],
|
8234
8138
|
// },
|
8139
|
+
{
|
8140
|
+
title: 'Transactions Report',
|
8141
|
+
description: 'Detailed report of the transactions allocated to each category. Filter by tank, property, business or your own search criteria',
|
8142
|
+
route: './transactions',
|
8143
|
+
roles: [UserRolesEnum.CLIENT]
|
8144
|
+
},
|
8235
8145
|
{
|
8236
8146
|
title: 'MyTax Report',
|
8237
8147
|
description: 'Coded to the ATO\'s MyTax report, our interactive report enable you to self lodge faster, easier and more accurately online without the stress',
|
@@ -8239,12 +8149,12 @@ const REPORTS = new Collection([
|
|
8239
8149
|
roles: [UserRolesEnum.CLIENT]
|
8240
8150
|
},
|
8241
8151
|
// @TODO TT-4386
|
8242
|
-
|
8243
|
-
|
8244
|
-
|
8245
|
-
|
8246
|
-
|
8247
|
-
|
8152
|
+
{
|
8153
|
+
title: 'Net Asset',
|
8154
|
+
description: 'See your current net financial position, including a breakdown of net assets and liabilities across all tanks',
|
8155
|
+
route: './net-assets',
|
8156
|
+
roles: [UserRolesEnum.CLIENT]
|
8157
|
+
},
|
8248
8158
|
{
|
8249
8159
|
title: 'Property Schedule',
|
8250
8160
|
description: 'Compliant property schedule detailing incomes, expenses and depreciation for each property and ownership percentage',
|
@@ -8961,26 +8871,6 @@ class AccountSetupItemCollection extends Collection {
|
|
8961
8871
|
* Collection of bank accounts.
|
8962
8872
|
*/
|
8963
8873
|
class BankAccountCollection extends Collection {
|
8964
|
-
/**
|
8965
|
-
* get list of bank accounts with passed types
|
8966
|
-
*/
|
8967
|
-
getByType(types, isExclude = false) {
|
8968
|
-
// get types always as array (if only one passed)
|
8969
|
-
const typesArray = concat(types);
|
8970
|
-
return this.items.filter((bankAccount) => {
|
8971
|
-
if (isExclude) {
|
8972
|
-
return !typesArray.includes(bankAccount.type);
|
8973
|
-
}
|
8974
|
-
return typesArray.includes(bankAccount.type);
|
8975
|
-
});
|
8976
|
-
}
|
8977
|
-
/**
|
8978
|
-
* get amount of current loans
|
8979
|
-
*/
|
8980
|
-
getCurrentLoanAmount() {
|
8981
|
-
return this.getByType(TYPE_LOAN)
|
8982
|
-
.reduce((sum, bankAccount) => sum += bankAccount.currentBalance, 0);
|
8983
|
-
}
|
8984
8874
|
/**
|
8985
8875
|
* get collection filtered by property id
|
8986
8876
|
*/
|
@@ -9009,18 +8899,15 @@ class BankAccountCollection extends Collection {
|
|
9009
8899
|
getActive() {
|
9010
8900
|
return this.getOwn().filter((bankAccount) => bankAccount.isActive());
|
9011
8901
|
}
|
9012
|
-
/**
|
9013
|
-
* Get collection of loan bank accounts
|
9014
|
-
*/
|
9015
8902
|
getLoanAccounts() {
|
9016
|
-
return
|
8903
|
+
return this.filterBy('type', TYPE_LOAN);
|
8904
|
+
}
|
8905
|
+
getDebitAccounts() {
|
8906
|
+
return this.filter(bankAccount => ![...TYPE_LOAN, BankAccountTypeEnum.CREDIT_CARD].includes(bankAccount.type));
|
9017
8907
|
}
|
9018
8908
|
get loans() {
|
9019
8909
|
return new LoanCollection(this.filterBy('type', BankAccountTypeEnum.LOAN).map((bankAccount) => bankAccount.loan));
|
9020
8910
|
}
|
9021
|
-
getSavingsAccounts() {
|
9022
|
-
return new BankAccountCollection(this.getByType(TYPE_LOAN, true));
|
9023
|
-
}
|
9024
8911
|
getOpeningBalance() {
|
9025
8912
|
return this.items.reduce((sum, bankAccount) => sum + bankAccount.getOpeningBalance(), 0);
|
9026
8913
|
}
|
@@ -9030,18 +8917,6 @@ class BankAccountCollection extends Collection {
|
|
9030
8917
|
get bankShortNames() {
|
9031
8918
|
return uniq(this.map((bankAccount) => bankAccount.bank.shortName)).join(', ');
|
9032
8919
|
}
|
9033
|
-
/**
|
9034
|
-
* Get Collection of bank accounts with property tank type
|
9035
|
-
*/
|
9036
|
-
getPropertyBankAccounts() {
|
9037
|
-
return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.isPropertyTank()));
|
9038
|
-
}
|
9039
|
-
/**
|
9040
|
-
* Get Collection of bank accounts with work tank type
|
9041
|
-
*/
|
9042
|
-
getWorkBankAccounts() {
|
9043
|
-
return new BankAccountCollection(this.items.filter((bankAccount) => bankAccount.isWorkTank()));
|
9044
|
-
}
|
9045
8920
|
/**
|
9046
8921
|
* Get Collection of bank accounts by tank type
|
9047
8922
|
*/
|
@@ -9957,7 +9832,7 @@ class BankAccount extends BankAccount$1 {
|
|
9957
9832
|
* first import (transactions) of basiq accounts
|
9958
9833
|
*/
|
9959
9834
|
isFirstImport() {
|
9960
|
-
return !this.lastTransactionDate && !this.isManual;
|
9835
|
+
return !this.lastTransactionDate && !this.isManual();
|
9961
9836
|
}
|
9962
9837
|
/**
|
9963
9838
|
* Check if passed user id is owner of bank account
|
@@ -9972,11 +9847,14 @@ class BankAccount extends BankAccount$1 {
|
|
9972
9847
|
const shouldPayoutLoanAccount = this.isActive() && this.isLoan() && taxTankBalance === 0;
|
9973
9848
|
// we don't check current balance for basiq accounts, because basiq doesn't provide us last transactions (can't do for closed accounts),
|
9974
9849
|
// that's why balance won't be 0 (updated by basiq)
|
9975
|
-
if (shouldPayoutLoanAccount && this.isManual) {
|
9850
|
+
if (shouldPayoutLoanAccount && this.isManual()) {
|
9976
9851
|
return this.currentBalance === 0;
|
9977
9852
|
}
|
9978
9853
|
return shouldPayoutLoanAccount;
|
9979
9854
|
}
|
9855
|
+
isManual() {
|
9856
|
+
return !this.accountId;
|
9857
|
+
}
|
9980
9858
|
}
|
9981
9859
|
__decorate([
|
9982
9860
|
Type(() => BankAccountProperty)
|
@@ -10212,11 +10090,8 @@ var BankTransactionSummaryFieldsEnum;
|
|
10212
10090
|
BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
|
10213
10091
|
})(BankTransactionSummaryFieldsEnum || (BankTransactionSummaryFieldsEnum = {}));
|
10214
10092
|
|
10215
|
-
/**
|
10216
|
-
* @TODO credit card has nothing to do with loan
|
10217
|
-
*/
|
10218
10093
|
const TYPE_LOAN = [
|
10219
|
-
BankAccountTypeEnum.
|
10094
|
+
BankAccountTypeEnum.MORTGAGE,
|
10220
10095
|
BankAccountTypeEnum.LOAN
|
10221
10096
|
];
|
10222
10097
|
|
@@ -15410,23 +15285,6 @@ class TransactionService extends RestService {
|
|
15410
15285
|
this.transactionDeleted.emit(model);
|
15411
15286
|
}));
|
15412
15287
|
}
|
15413
|
-
/**
|
15414
|
-
* @TODO Alex wrong place for this logic, move to model
|
15415
|
-
* calculate gross income amount based on transaction amount and taxes (fees)
|
15416
|
-
* @param transaction Transaction instance for calculation
|
15417
|
-
*/
|
15418
|
-
calculateGrossAmount(transaction) {
|
15419
|
-
let amount = transaction.amount || 0;
|
15420
|
-
// gross income amount includes amount of fees for property tank and tax for work tank
|
15421
|
-
if (transaction.isPropertyTank()) {
|
15422
|
-
amount += transaction.transactions.reduce((sum, item) => sum + item.amount, 0);
|
15423
|
-
}
|
15424
|
-
else {
|
15425
|
-
// @TODO Alex: fix logic after TT-641 ready
|
15426
|
-
amount += (transaction.tax || 0);
|
15427
|
-
}
|
15428
|
-
return amount;
|
15429
|
-
}
|
15430
15288
|
/**
|
15431
15289
|
* Listen to EventDispatcherService event related to Depreciation changing
|
15432
15290
|
*/
|
@@ -22428,7 +22286,7 @@ class PropertyShareForm extends AbstractForm {
|
|
22428
22286
|
constructor(share = plainToClass(PropertyShare, {})) {
|
22429
22287
|
super({
|
22430
22288
|
fromDate: new UntypedFormControl(share.fromDate || new Date()),
|
22431
|
-
percent: new UntypedFormControl(share.percent, [Validators.required, Validators.min(
|
22289
|
+
percent: new UntypedFormControl(share.percent, [Validators.required, Validators.min(1), Validators.max(100)])
|
22432
22290
|
}, share);
|
22433
22291
|
}
|
22434
22292
|
}
|