taxtank-core 0.12.1 → 0.12.4
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 +53 -7
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/collection.js +3 -3
- package/esm2015/lib/collections/report/vehicle-expense/vehicle-expense.collection.js +20 -0
- package/esm2015/lib/db/Enums/user-roles.enum.js +2 -1
- package/esm2015/lib/db/Models/client-income-types.js +1 -1
- package/esm2015/lib/forms/client/client-income-types.form.js +3 -3
- package/esm2015/lib/models/report/vehicle-expense/vehicle-expense.js +14 -0
- package/esm2015/lib/models/user/user-roles.const.js +2 -1
- package/esm2015/lib/services/account-setup/account-setup.service.js +2 -2
- package/esm2015/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.js +8 -2
- package/esm2015/public-api.js +3 -1
- package/fesm2015/taxtank-core.js +46 -7
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/collection.d.ts +1 -1
- package/lib/collections/report/vehicle-expense/vehicle-expense.collection.d.ts +9 -0
- package/lib/db/Enums/user-roles.enum.d.ts +1 -0
- package/lib/db/Models/client-income-types.d.ts +2 -2
- package/lib/models/report/vehicle-expense/vehicle-expense.d.ts +10 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -1340,10 +1340,10 @@
|
|
|
1340
1340
|
/**
|
|
1341
1341
|
* Sort collection items by provided field
|
|
1342
1342
|
*/
|
|
1343
|
-
Collection.prototype.sortBy = function (
|
|
1344
|
-
if (
|
|
1343
|
+
Collection.prototype.sortBy = function (field, isDesc) {
|
|
1344
|
+
if (field === void 0) { field = 'id'; }
|
|
1345
1345
|
if (isDesc === void 0) { isDesc = true; }
|
|
1346
|
-
sort(this.items,
|
|
1346
|
+
sort(this.items, field, isDesc);
|
|
1347
1347
|
};
|
|
1348
1348
|
Object.defineProperty(Collection.prototype, "first", {
|
|
1349
1349
|
get: function () {
|
|
@@ -2999,6 +2999,7 @@
|
|
|
2999
2999
|
UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
|
|
3000
3000
|
UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
|
|
3001
3001
|
UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
|
|
3002
|
+
UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
|
|
3002
3003
|
UserRolesEnum["SWITCH_USER"] = "ROLE_PREVIOUS_ADMIN";
|
|
3003
3004
|
})(exports.UserRolesEnum || (exports.UserRolesEnum = {}));
|
|
3004
3005
|
|
|
@@ -5222,6 +5223,42 @@
|
|
|
5222
5223
|
return PropertyReportItemDepreciationCollection;
|
|
5223
5224
|
}(PropertyReportItemCollection));
|
|
5224
5225
|
|
|
5226
|
+
/**
|
|
5227
|
+
* Vehicle expense for logbook section
|
|
5228
|
+
*/
|
|
5229
|
+
var VehicleExpense = /** @class */ (function () {
|
|
5230
|
+
function VehicleExpense(amount, claimPercent, description) {
|
|
5231
|
+
this.amount = amount;
|
|
5232
|
+
this.claimPercent = claimPercent;
|
|
5233
|
+
this.description = description;
|
|
5234
|
+
}
|
|
5235
|
+
VehicleExpense.prototype.getClaimAmount = function () {
|
|
5236
|
+
return +(this.amount * (this.claimPercent / 100)).toFixed(2);
|
|
5237
|
+
};
|
|
5238
|
+
return VehicleExpense;
|
|
5239
|
+
}());
|
|
5240
|
+
|
|
5241
|
+
var VehicleExpenseCollection = /** @class */ (function (_super) {
|
|
5242
|
+
__extends(VehicleExpenseCollection, _super);
|
|
5243
|
+
function VehicleExpenseCollection(transactions, depreciations, vehicleClaim) {
|
|
5244
|
+
var _this = _super.call(this) || this;
|
|
5245
|
+
_this.setItems(transactions, depreciations, vehicleClaim);
|
|
5246
|
+
return _this;
|
|
5247
|
+
}
|
|
5248
|
+
VehicleExpenseCollection.prototype.setItems = function (transactions, depreciations, vehicleClaim) {
|
|
5249
|
+
var _a;
|
|
5250
|
+
this.items = [];
|
|
5251
|
+
var transactionsByChartAccounts = new CollectionDictionary(transactions, 'chartAccounts.name');
|
|
5252
|
+
var transactionExpenses = transactionsByChartAccounts.keys.map(function (chartAccountsName) {
|
|
5253
|
+
return new VehicleExpense(transactionsByChartAccounts.get(chartAccountsName).amount, vehicleClaim.workUsage, chartAccountsName);
|
|
5254
|
+
});
|
|
5255
|
+
// group all depreciations into one expense item
|
|
5256
|
+
var depreciationExpense = new VehicleExpense(depreciations.getCurrentYearForecastAmount(), vehicleClaim.workUsage, 'Depreciation');
|
|
5257
|
+
(_a = this.items).push.apply(_a, __spreadArray([depreciationExpense], __read(transactionExpenses)));
|
|
5258
|
+
};
|
|
5259
|
+
return VehicleExpenseCollection;
|
|
5260
|
+
}(Collection));
|
|
5261
|
+
|
|
5225
5262
|
var ServicePriceCollection = /** @class */ (function (_super) {
|
|
5226
5263
|
__extends(ServicePriceCollection, _super);
|
|
5227
5264
|
function ServicePriceCollection() {
|
|
@@ -8457,6 +8494,7 @@
|
|
|
8457
8494
|
ROLE_USER_SUBSCRIPTION: [exports.UserRolesEnum.SUBSCRIPTION],
|
|
8458
8495
|
ROLE_USER_WORK: [exports.UserRolesEnum.WORK_TANK],
|
|
8459
8496
|
ROLE_USER_PROPERTY: [exports.UserRolesEnum.PROPERTY_TANK],
|
|
8497
|
+
ROLE_USER_SOLE: [exports.UserRolesEnum.SOLE_TANK],
|
|
8460
8498
|
ROLE_PREVIOUS_ADMIN: [exports.UserRolesEnum.SWITCH_USER]
|
|
8461
8499
|
};
|
|
8462
8500
|
|
|
@@ -9309,7 +9347,11 @@
|
|
|
9309
9347
|
*/
|
|
9310
9348
|
TransactionAllocationService.prototype.onTransactionsCreated = function () {
|
|
9311
9349
|
var _this = this;
|
|
9312
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(function () {
|
|
9350
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTIONS_CREATED).subscribe(function (transactions) {
|
|
9351
|
+
// @TODO Alex hack: research and refactor cache update logic, dont reset cache each time transactions changed
|
|
9352
|
+
if (transactions[0].isTransfer) {
|
|
9353
|
+
return;
|
|
9354
|
+
}
|
|
9313
9355
|
// Update allocations cache to synchronize data and fire subscriptions
|
|
9314
9356
|
_this.resetCache();
|
|
9315
9357
|
});
|
|
@@ -9320,6 +9362,7 @@
|
|
|
9320
9362
|
TransactionAllocationService.prototype.onDepreciationCreated = function () {
|
|
9321
9363
|
var _this = this;
|
|
9322
9364
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.DEPRECIATIONS_CREATED).subscribe(function () {
|
|
9365
|
+
// @TODO Alex hack: research and refactor cache update logic, dont reset cache each time depreciations changed
|
|
9323
9366
|
// Update allocations cache to synchronize data and fire subscriptions
|
|
9324
9367
|
_this.resetCache();
|
|
9325
9368
|
});
|
|
@@ -9330,6 +9373,7 @@
|
|
|
9330
9373
|
TransactionAllocationService.prototype.onTransactionDeleted = function () {
|
|
9331
9374
|
var _this = this;
|
|
9332
9375
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.TRANSACTION_DELETED).subscribe(function () {
|
|
9376
|
+
// @TODO Alex hack: research and refactor cache update logic, dont reset cache each time transactions changed
|
|
9333
9377
|
// Update allocations cache to synchronize data and fire subscriptions
|
|
9334
9378
|
_this.resetCache();
|
|
9335
9379
|
});
|
|
@@ -9436,7 +9480,7 @@
|
|
|
9436
9480
|
batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(exports.IncomeSourceTypeEnum.OTHER)));
|
|
9437
9481
|
}
|
|
9438
9482
|
// Rental income item is completed when user added at least one property
|
|
9439
|
-
if (incomeTypes.
|
|
9483
|
+
if (incomeTypes.property) {
|
|
9440
9484
|
batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.get()));
|
|
9441
9485
|
}
|
|
9442
9486
|
// Bank feeds item is completed when user added at least one bank account (basiq or manual)
|
|
@@ -13427,8 +13471,8 @@
|
|
|
13427
13471
|
function ClientIncomeTypesForm(clientIncomeTypes) {
|
|
13428
13472
|
var _this = _super.call(this, {
|
|
13429
13473
|
salary: new forms.FormControl(clientIncomeTypes.salary),
|
|
13430
|
-
|
|
13431
|
-
|
|
13474
|
+
property: new forms.FormControl(clientIncomeTypes.property),
|
|
13475
|
+
sole: new forms.FormControl(clientIncomeTypes.sole),
|
|
13432
13476
|
dividends: new forms.FormControl(clientIncomeTypes.dividends),
|
|
13433
13477
|
other: new forms.FormControl(clientIncomeTypes.other)
|
|
13434
13478
|
}, atLeastOneCheckedValidator()) || this;
|
|
@@ -13894,6 +13938,8 @@
|
|
|
13894
13938
|
exports.VehicleClaimForm = VehicleClaimForm;
|
|
13895
13939
|
exports.VehicleClaimService = VehicleClaimService;
|
|
13896
13940
|
exports.VehicleCollection = VehicleCollection;
|
|
13941
|
+
exports.VehicleExpense = VehicleExpense;
|
|
13942
|
+
exports.VehicleExpenseCollection = VehicleExpenseCollection;
|
|
13897
13943
|
exports.VehicleForm = VehicleForm;
|
|
13898
13944
|
exports.VehicleLogbook = VehicleLogbook;
|
|
13899
13945
|
exports.VehicleLogbookCollection = VehicleLogbookCollection;
|