taxtank-core 0.12.3 → 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 +43 -3
- 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/models/report/vehicle-expense/vehicle-expense.js +14 -0
- package/esm2015/lib/models/user/user-roles.const.js +2 -1
- package/esm2015/public-api.js +3 -1
- package/fesm2015/taxtank-core.js +36 -3
- 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/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
|
|
|
@@ -13900,6 +13938,8 @@
|
|
|
13900
13938
|
exports.VehicleClaimForm = VehicleClaimForm;
|
|
13901
13939
|
exports.VehicleClaimService = VehicleClaimService;
|
|
13902
13940
|
exports.VehicleCollection = VehicleCollection;
|
|
13941
|
+
exports.VehicleExpense = VehicleExpense;
|
|
13942
|
+
exports.VehicleExpenseCollection = VehicleExpenseCollection;
|
|
13903
13943
|
exports.VehicleForm = VehicleForm;
|
|
13904
13944
|
exports.VehicleLogbook = VehicleLogbook;
|
|
13905
13945
|
exports.VehicleLogbookCollection = VehicleLogbookCollection;
|