taxtank-core 0.21.8 → 0.21.9
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/bundles/taxtank-core.umd.js +81 -36
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/collection.js +7 -1
- package/esm2015/lib/db/Enums/income-source-forecast-trust-type.enum.js +15 -0
- package/esm2015/lib/db/Enums/income-source-type-list-other.enum.js +3 -2
- package/esm2015/lib/db/Models/bank/bank-account.js +1 -1
- package/esm2015/lib/db/Models/depreciation/depreciation.js +1 -1
- package/esm2015/lib/db/Models/incomeSource/income-source-forecast.js +1 -1
- package/esm2015/lib/db/Models/sole/sole-forecast.js +1 -1
- package/esm2015/lib/db/Models/transaction/transaction.js +1 -1
- package/esm2015/lib/db/Models/vehicle/vehicle-claim.js +1 -1
- package/esm2015/lib/db/Models/vehicle/vehicle.js +1 -1
- package/esm2015/lib/forms/report/my-tax/my-tax-partnerships-and-trusts.form.js +5 -2
- package/esm2015/lib/interfaces/income-source-forecast.interface.js +1 -1
- package/esm2015/lib/models/bank/bank-account.js +4 -14
- package/esm2015/lib/models/income-source/income-source-type.js +3 -3
- package/esm2015/lib/models/logbook/vehicle-claim.js +3 -6
- package/esm2015/lib/models/report/my-tax/my-tax-partnerships-and-trusts/my-tax-partnerships-and-trusts.js +20 -2
- package/esm2015/lib/services/event/sse.service.js +1 -2
- package/esm2015/lib/validators/conditional.validator.js +26 -0
- package/esm2015/lib/validators/index.js +2 -1
- package/esm2015/public-api.js +2 -1
- package/fesm2015/taxtank-core.js +82 -30
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/collection.d.ts +2 -0
- package/lib/db/Enums/income-source-forecast-trust-type.enum.d.ts +13 -0
- package/lib/db/Enums/income-source-type-list-other.enum.d.ts +3 -2
- package/lib/db/Models/bank/bank-account.d.ts +2 -2
- package/lib/db/Models/depreciation/depreciation.d.ts +0 -2
- package/lib/db/Models/incomeSource/income-source-forecast.d.ts +3 -1
- package/lib/db/Models/transaction/transaction.d.ts +0 -2
- package/lib/db/Models/vehicle/vehicle-claim.d.ts +2 -2
- package/lib/db/Models/vehicle/vehicle.d.ts +2 -0
- package/lib/forms/report/my-tax/my-tax-partnerships-and-trusts.form.d.ts +1 -1
- package/lib/interfaces/income-source-forecast.interface.d.ts +2 -0
- package/lib/models/bank/bank-account.d.ts +0 -2
- package/lib/models/logbook/vehicle-claim.d.ts +0 -1
- package/lib/models/report/my-tax/my-tax-partnerships-and-trusts/my-tax-partnerships-and-trusts.d.ts +9 -1
- package/lib/services/event/sse.service.d.ts +0 -1
- package/lib/validators/conditional.validator.d.ts +2 -0
- package/lib/validators/index.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/esm2015/lib/db/Models/sole/sole-business-allocation.js +0 -4
- package/esm2015/lib/db/Models/sole/sole-business-loss.js +0 -4
- package/esm2015/lib/db/Models/sole/sole-business.js +0 -4
- package/esm2015/lib/db/Models/sole/sole-contact.js +0 -4
- package/esm2015/lib/db/Models/sole/sole-invoice-item.js +0 -4
- package/esm2015/lib/db/Models/sole/sole-invoice-template.js +0 -4
- package/esm2015/lib/db/Models/sole/sole-invoice.js +0 -4
- package/lib/db/Models/sole/sole-business-allocation.d.ts +0 -9
- package/lib/db/Models/sole/sole-business-loss.d.ts +0 -9
- package/lib/db/Models/sole/sole-business.d.ts +0 -26
- package/lib/db/Models/sole/sole-contact.d.ts +0 -17
- package/lib/db/Models/sole/sole-invoice-item.d.ts +0 -12
- package/lib/db/Models/sole/sole-invoice-template.d.ts +0 -10
- package/lib/db/Models/sole/sole-invoice.d.ts +0 -18
|
@@ -2867,6 +2867,12 @@
|
|
|
2867
2867
|
Collection.prototype.removeBy = function (path, values) {
|
|
2868
2868
|
return this.filter(function (item) { return !(Array.isArray(values) ? values : [values]).includes(get__default["default"](item, path)); });
|
|
2869
2869
|
};
|
|
2870
|
+
Collection.prototype.minBy = function (path) {
|
|
2871
|
+
return this.items.reduce(function (prev, current) { return (get__default["default"](prev, path) < get__default["default"](current, path) ? prev : current); });
|
|
2872
|
+
};
|
|
2873
|
+
Collection.prototype.maxBy = function (path) {
|
|
2874
|
+
return this.items.reduce(function (prev, current) { return (get__default["default"](prev, path) > get__default["default"](current, path) ? prev : current); });
|
|
2875
|
+
};
|
|
2870
2876
|
return Collection;
|
|
2871
2877
|
}());
|
|
2872
2878
|
|
|
@@ -3370,34 +3376,20 @@
|
|
|
3370
3376
|
* check if bank account related to work tank
|
|
3371
3377
|
*/
|
|
3372
3378
|
BankAccount.prototype.isWorkTank = function () {
|
|
3373
|
-
return
|
|
3379
|
+
return this.tankType === exports.TankTypeEnum.WORK;
|
|
3374
3380
|
};
|
|
3375
3381
|
/**
|
|
3376
3382
|
* check if bank account related to work tank
|
|
3377
3383
|
*/
|
|
3378
3384
|
BankAccount.prototype.isPropertyTank = function () {
|
|
3379
|
-
return
|
|
3385
|
+
return this.tankType === exports.TankTypeEnum.PROPERTY;
|
|
3380
3386
|
};
|
|
3381
3387
|
/**
|
|
3382
3388
|
* check if bank account related to sole tank
|
|
3383
3389
|
*/
|
|
3384
3390
|
BankAccount.prototype.isSoleTank = function () {
|
|
3385
|
-
return
|
|
3391
|
+
return this.tankType === exports.TankTypeEnum.SOLE;
|
|
3386
3392
|
};
|
|
3387
|
-
Object.defineProperty(BankAccount.prototype, "tankType", {
|
|
3388
|
-
get: function () {
|
|
3389
|
-
switch (true) {
|
|
3390
|
-
case this.isPropertyTank():
|
|
3391
|
-
return exports.TankTypeEnum.PROPERTY;
|
|
3392
|
-
case this.isSoleTank():
|
|
3393
|
-
return exports.TankTypeEnum.SOLE;
|
|
3394
|
-
default:
|
|
3395
|
-
return exports.TankTypeEnum.WORK;
|
|
3396
|
-
}
|
|
3397
|
-
},
|
|
3398
|
-
enumerable: false,
|
|
3399
|
-
configurable: true
|
|
3400
|
-
});
|
|
3401
3393
|
/**
|
|
3402
3394
|
* Get Bank account property by id
|
|
3403
3395
|
* @param id Id of property
|
|
@@ -5702,10 +5694,16 @@
|
|
|
5702
5694
|
(function (IncomeSourceTypeListOtherEnum) {
|
|
5703
5695
|
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PSI"] = 6] = "PSI";
|
|
5704
5696
|
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
|
|
5705
|
-
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["
|
|
5697
|
+
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["TRUSTS"] = 9] = "TRUSTS";
|
|
5706
5698
|
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["OTHER_INCOME"] = 10] = "OTHER_INCOME";
|
|
5699
|
+
IncomeSourceTypeListOtherEnum[IncomeSourceTypeListOtherEnum["PARTNERSHIPS"] = 12] = "PARTNERSHIPS";
|
|
5707
5700
|
})(exports.IncomeSourceTypeListOtherEnum || (exports.IncomeSourceTypeListOtherEnum = {}));
|
|
5708
5701
|
|
|
5702
|
+
exports.IncomeSourceTypeListSoleEnum = void 0;
|
|
5703
|
+
(function (IncomeSourceTypeListSoleEnum) {
|
|
5704
|
+
IncomeSourceTypeListSoleEnum[IncomeSourceTypeListSoleEnum["SOLE_TRADER"] = 7] = "SOLE_TRADER";
|
|
5705
|
+
})(exports.IncomeSourceTypeListSoleEnum || (exports.IncomeSourceTypeListSoleEnum = {}));
|
|
5706
|
+
|
|
5709
5707
|
var IncomeSourceType = /** @class */ (function (_super) {
|
|
5710
5708
|
__extends(IncomeSourceType, _super);
|
|
5711
5709
|
function IncomeSourceType() {
|
|
@@ -5721,8 +5719,7 @@
|
|
|
5721
5719
|
return !!exports.IncomeSourceTypeListOtherEnum[this.id];
|
|
5722
5720
|
};
|
|
5723
5721
|
IncomeSourceType.prototype.isSole = function () {
|
|
5724
|
-
|
|
5725
|
-
return !!exports.IncomeSourceTypeListOtherEnum[this.id];
|
|
5722
|
+
return !!exports.IncomeSourceTypeListSoleEnum[this.id];
|
|
5726
5723
|
};
|
|
5727
5724
|
Object.defineProperty(IncomeSourceType.prototype, "type", {
|
|
5728
5725
|
get: function () {
|
|
@@ -7238,10 +7235,20 @@
|
|
|
7238
7235
|
DepreciationWriteOffAmountEnum[DepreciationWriteOffAmountEnum["BORROWING_EXPENSES"] = 100] = "BORROWING_EXPENSES";
|
|
7239
7236
|
})(exports.DepreciationWriteOffAmountEnum || (exports.DepreciationWriteOffAmountEnum = {}));
|
|
7240
7237
|
|
|
7241
|
-
exports.
|
|
7242
|
-
(function (
|
|
7243
|
-
|
|
7244
|
-
|
|
7238
|
+
exports.IncomeSourceForecastTrustTypeEnum = void 0;
|
|
7239
|
+
(function (IncomeSourceForecastTrustTypeEnum) {
|
|
7240
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["SPECIAL_DISABILITY_TRUST"] = 1] = "SPECIAL_DISABILITY_TRUST";
|
|
7241
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DECEASED_ESTATE"] = 2] = "DECEASED_ESTATE";
|
|
7242
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["FIXED_TRUST"] = 3] = "FIXED_TRUST";
|
|
7243
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["HYBRID_TRUST"] = 4] = "HYBRID_TRUST";
|
|
7244
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_SERVICE_TRUST"] = 5] = "DISCRETIONARY_SERVICE_TRUST";
|
|
7245
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_TRADING_TRUST"] = 6] = "DISCRETIONARY_TRADING_TRUST";
|
|
7246
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["DISCRETIONARY_INVESTMENT_TRUST"] = 7] = "DISCRETIONARY_INVESTMENT_TRUST";
|
|
7247
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["CASH_MANAGEMENT_UNIT_TRUST"] = 8] = "CASH_MANAGEMENT_UNIT_TRUST";
|
|
7248
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["PUBLIC_UNIT_TRUST_LISTED"] = 9] = "PUBLIC_UNIT_TRUST_LISTED";
|
|
7249
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["PUBLIC_UNIT_TRUST_UNLISTED"] = 10] = "PUBLIC_UNIT_TRUST_UNLISTED";
|
|
7250
|
+
IncomeSourceForecastTrustTypeEnum[IncomeSourceForecastTrustTypeEnum["TESTAMENTARY_TRUST"] = 11] = "TESTAMENTARY_TRUST";
|
|
7251
|
+
})(exports.IncomeSourceForecastTrustTypeEnum || (exports.IncomeSourceForecastTrustTypeEnum = {}));
|
|
7245
7252
|
|
|
7246
7253
|
exports.InviteStatusEnum = void 0;
|
|
7247
7254
|
(function (InviteStatusEnum) {
|
|
@@ -8735,18 +8742,11 @@
|
|
|
8735
8742
|
return this.method === exports.VehicleClaimMethodEnum.KMS;
|
|
8736
8743
|
};
|
|
8737
8744
|
VehicleClaim.prototype.isWorkTank = function () {
|
|
8738
|
-
return
|
|
8745
|
+
return this.tankType === exports.TankTypeEnum.WORK;
|
|
8739
8746
|
};
|
|
8740
8747
|
VehicleClaim.prototype.isSoleTank = function () {
|
|
8741
|
-
return
|
|
8748
|
+
return this.tankType === exports.TankTypeEnum.SOLE;
|
|
8742
8749
|
};
|
|
8743
|
-
Object.defineProperty(VehicleClaim.prototype, "tankType", {
|
|
8744
|
-
get: function () {
|
|
8745
|
-
return this.isSoleTank() ? exports.TankTypeEnum.SOLE : exports.TankTypeEnum.WORK;
|
|
8746
|
-
},
|
|
8747
|
-
enumerable: false,
|
|
8748
|
-
configurable: true
|
|
8749
|
-
});
|
|
8750
8750
|
/**
|
|
8751
8751
|
* Claim amount for KLMs method. Exists only for KLMs method.
|
|
8752
8752
|
*/
|
|
@@ -9697,12 +9697,14 @@
|
|
|
9697
9697
|
}());
|
|
9698
9698
|
|
|
9699
9699
|
var MyTaxPartnershipsAndTrusts = /** @class */ (function () {
|
|
9700
|
-
function MyTaxPartnershipsAndTrusts(transactions) {
|
|
9700
|
+
function MyTaxPartnershipsAndTrusts(transactions, incomeSources) {
|
|
9701
9701
|
this.transactions = transactions;
|
|
9702
|
+
this.incomeSources = incomeSources;
|
|
9702
9703
|
this.partnershipIncomes = this.transactions.filterBy('chartAccounts.id', exports.ChartAccountsListEnum.PARTNERSHIP_INCOME);
|
|
9703
9704
|
this.partnershipExpenses = this.transactions.filterBy('chartAccounts.id', exports.ChartAccountsListEnum.PARTNERSHIP_EXPENSES);
|
|
9704
9705
|
this.trustsIncomes = this.transactions.filterBy('chartAccounts.id', exports.ChartAccountsListEnum.TRUST_INCOME);
|
|
9705
9706
|
this.trustsExpenses = this.transactions.filterBy('chartAccounts.id', exports.ChartAccountsListEnum.TRUST_EXPENSES);
|
|
9707
|
+
this.trustType = this.getTrustType();
|
|
9706
9708
|
this.netNonPrimaryProductionAmount = (this.partnershipIncomes.sumBy('amount') - this.partnershipExpenses.sumBy('amount')) +
|
|
9707
9709
|
(this.trustsIncomes.sumBy('amount') - this.trustsExpenses.sumBy('amount'));
|
|
9708
9710
|
this.partnershipsNetIncome = this.partnershipIncomes.sumBy('amount') -
|
|
@@ -9722,6 +9724,22 @@
|
|
|
9722
9724
|
.sumBy('value');
|
|
9723
9725
|
this.taxOffsetNRASTotalAmount = this.transactions.filterBy('chartAccounts.id', exports.ChartAccountsListEnum.TAX_OFFSETS_N_R_A_S).sumBy('amount');
|
|
9724
9726
|
}
|
|
9727
|
+
/**
|
|
9728
|
+
* Get Income source forecast trust type, related to trust income with max amount
|
|
9729
|
+
*/
|
|
9730
|
+
MyTaxPartnershipsAndTrusts.prototype.getTrustType = function () {
|
|
9731
|
+
var filteredTrustIncomes = this.trustsIncomes
|
|
9732
|
+
.filterBy('incomeSource.id', this.incomeSources
|
|
9733
|
+
.removeBy('actualForecast.trustType', null)
|
|
9734
|
+
.getIds());
|
|
9735
|
+
if (!filteredTrustIncomes.length) {
|
|
9736
|
+
return null;
|
|
9737
|
+
}
|
|
9738
|
+
return this.incomeSources
|
|
9739
|
+
.findBy('id', filteredTrustIncomes.maxBy('amount').incomeSource.id)
|
|
9740
|
+
.actualForecast
|
|
9741
|
+
.trustType;
|
|
9742
|
+
};
|
|
9725
9743
|
return MyTaxPartnershipsAndTrusts;
|
|
9726
9744
|
}());
|
|
9727
9745
|
|
|
@@ -11757,7 +11775,6 @@
|
|
|
11757
11775
|
|
|
11758
11776
|
/**
|
|
11759
11777
|
* server sent events service
|
|
11760
|
-
* https://symfony.com/doc/current/mercure.html
|
|
11761
11778
|
*/
|
|
11762
11779
|
var SseService = /** @class */ (function () {
|
|
11763
11780
|
function SseService(zone, jwtService, environment) {
|
|
@@ -15287,6 +15304,31 @@
|
|
|
15287
15304
|
};
|
|
15288
15305
|
}
|
|
15289
15306
|
|
|
15307
|
+
function conditionalValidator(condition, validator) {
|
|
15308
|
+
return function (control) {
|
|
15309
|
+
revalidateOnChanges(control);
|
|
15310
|
+
if (control && control.parent) {
|
|
15311
|
+
if (condition(control.parent)) {
|
|
15312
|
+
return validator(control);
|
|
15313
|
+
}
|
|
15314
|
+
}
|
|
15315
|
+
return null;
|
|
15316
|
+
};
|
|
15317
|
+
}
|
|
15318
|
+
/**
|
|
15319
|
+
* Conditional validator depends on other fields and should be updated on each form value change
|
|
15320
|
+
*/
|
|
15321
|
+
function revalidateOnChanges(control) {
|
|
15322
|
+
if (control && control.parent && !control['_revalidateOnChanges']) {
|
|
15323
|
+
control['_revalidateOnChanges'] = true;
|
|
15324
|
+
control.parent.valueChanges.pipe(operators.distinctUntilChanged(function (a, b) { return JSON.stringify(a) === JSON.stringify(b); }))
|
|
15325
|
+
.subscribe(function () {
|
|
15326
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
15327
|
+
});
|
|
15328
|
+
}
|
|
15329
|
+
return;
|
|
15330
|
+
}
|
|
15331
|
+
|
|
15290
15332
|
/**
|
|
15291
15333
|
* Regular expressions that are used to check password strength and valid values
|
|
15292
15334
|
*/
|
|
@@ -15895,7 +15937,9 @@
|
|
|
15895
15937
|
value: partnershipsAndTrusts.trustsNetIncome,
|
|
15896
15938
|
disabled: true
|
|
15897
15939
|
}),
|
|
15898
|
-
trustType: new forms.FormControl(
|
|
15940
|
+
trustType: new forms.FormControl(partnershipsAndTrusts.trustType, conditionalValidator(function (control) {
|
|
15941
|
+
return !!partnershipsAndTrusts.trustsIncomes.length;
|
|
15942
|
+
}, forms.Validators.required)),
|
|
15899
15943
|
partnershipsSmallBusinessNetIncome: new forms.FormControl(partnershipsAndTrusts.partnershipsSmallBusinessNetIncome, forms.Validators.required),
|
|
15900
15944
|
trustsSmallBusinessNetIncome: new forms.FormControl(partnershipsAndTrusts.trustsSmallBusinessNetIncome, forms.Validators.required),
|
|
15901
15945
|
taxPaidTotal: new forms.FormControl({
|
|
@@ -16222,6 +16266,7 @@
|
|
|
16222
16266
|
exports.cloneDeep = cloneDeep;
|
|
16223
16267
|
exports.compare = compare;
|
|
16224
16268
|
exports.compareMatOptions = compareMatOptions;
|
|
16269
|
+
exports.conditionalValidator = conditionalValidator;
|
|
16225
16270
|
exports.createDate = createDate;
|
|
16226
16271
|
exports.displayMatOptions = displayMatOptions;
|
|
16227
16272
|
exports.enumToList = enumToList;
|