taxtank-core 0.21.0 → 0.21.3
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 +131 -49
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/property/property.collection.js +24 -5
- package/esm2015/lib/forms/bank/bank-account/bank-account-add-manual.form.js +3 -2
- package/esm2015/lib/forms/register/register-client.form.js +3 -9
- package/esm2015/lib/forms/register/register-firm.form.js +4 -1
- package/esm2015/lib/functions/mat-options-functions.js +4 -1
- package/esm2015/lib/models/badge/badge-color.enum.js +8 -0
- package/esm2015/lib/models/badge/badge.js +14 -0
- package/esm2015/lib/models/property/property.js +6 -1
- package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +35 -1
- package/esm2015/public-api.js +4 -1
- package/fesm2015/taxtank-core.js +122 -47
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/property/property.collection.d.ts +5 -0
- package/lib/forms/register/register-client.form.d.ts +3 -2
- package/lib/forms/register/register-firm.form.d.ts +1 -0
- package/lib/models/badge/badge-color.enum.d.ts +6 -0
- package/lib/models/badge/badge.d.ts +10 -0
- package/lib/models/property/property.d.ts +5 -0
- package/lib/services/property/property-calculation/property-calculation.service.d.ts +10 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -3149,6 +3149,11 @@
|
|
|
3149
3149
|
if (unitOfTime === void 0) { unitOfTime = 'days'; }
|
|
3150
3150
|
return moment__namespace(sale.contractDate).diff(moment__namespace(this.contractDate), unitOfTime);
|
|
3151
3151
|
};
|
|
3152
|
+
/**
|
|
3153
|
+
* Tax Position = Income - Expense - Interest - Depreciation
|
|
3154
|
+
* Where (Income - Expense - Interest) is cash position.
|
|
3155
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217415928/Dashboard+Property
|
|
3156
|
+
*/
|
|
3152
3157
|
Property.prototype.getTaxPosition = function (transactions, depreciations) {
|
|
3153
3158
|
return transactions.cashPosition - Math.abs(depreciations.claimAmount);
|
|
3154
3159
|
};
|
|
@@ -4905,13 +4910,32 @@
|
|
|
4905
4910
|
* Get property with the lowest tax position
|
|
4906
4911
|
*/
|
|
4907
4912
|
PropertyCollection.prototype.getBestPerformanceTaxProperty = function (transactions, depreciations) {
|
|
4913
|
+
var transactionsByProperty = transactions.groupBy('property.id');
|
|
4914
|
+
var depreciationsByProperty = depreciations.groupBy('property.id');
|
|
4908
4915
|
return this.items.reduce(function (min, current) {
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
: min;
|
|
4916
|
+
var minTaxPosition = min.getTaxPosition(transactionsByProperty.get(min.id), depreciationsByProperty.get(min.id));
|
|
4917
|
+
var currentTaxPosition = current.getTaxPosition(transactionsByProperty.get(current.id), depreciationsByProperty.get(current.id));
|
|
4918
|
+
return minTaxPosition > currentTaxPosition ? current : min;
|
|
4913
4919
|
}, this.first);
|
|
4914
4920
|
};
|
|
4921
|
+
/**
|
|
4922
|
+
* Show best performance properties first
|
|
4923
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677997/Property+Tank+Dashboard
|
|
4924
|
+
*/
|
|
4925
|
+
PropertyCollection.prototype.sortByBestPerformance = function (transactions, depreciations) {
|
|
4926
|
+
var activeProperties = this.getActiveProperties();
|
|
4927
|
+
// nothing to sort when no active properties
|
|
4928
|
+
if (!activeProperties.length) {
|
|
4929
|
+
return this;
|
|
4930
|
+
}
|
|
4931
|
+
var bestProperties = uniqBy__default["default"](this.create([
|
|
4932
|
+
activeProperties.getBestPerformanceGrowthProperty(),
|
|
4933
|
+
activeProperties.getBestPerformanceTaxProperty(transactions, depreciations)
|
|
4934
|
+
]).toArray(), 'id');
|
|
4935
|
+
var newItems = this.remove(bestProperties).toArray();
|
|
4936
|
+
newItems.unshift.apply(newItems, __spreadArray([], __read(bestProperties)));
|
|
4937
|
+
return this.create(newItems);
|
|
4938
|
+
};
|
|
4915
4939
|
return PropertyCollection;
|
|
4916
4940
|
}(Collection));
|
|
4917
4941
|
|
|
@@ -7511,6 +7535,29 @@
|
|
|
7511
7535
|
return AccountSetupItem;
|
|
7512
7536
|
}(AbstractModel));
|
|
7513
7537
|
|
|
7538
|
+
exports.BadgeColorEnum = void 0;
|
|
7539
|
+
(function (BadgeColorEnum) {
|
|
7540
|
+
BadgeColorEnum["DEFAULT"] = "default";
|
|
7541
|
+
BadgeColorEnum["GREEN"] = "green";
|
|
7542
|
+
BadgeColorEnum["GOLD"] = "gold";
|
|
7543
|
+
BadgeColorEnum["GRAY"] = "gray";
|
|
7544
|
+
})(exports.BadgeColorEnum || (exports.BadgeColorEnum = {}));
|
|
7545
|
+
|
|
7546
|
+
/**
|
|
7547
|
+
* Class for UI element badge
|
|
7548
|
+
*/
|
|
7549
|
+
var Badge = /** @class */ (function (_super) {
|
|
7550
|
+
__extends(Badge, _super);
|
|
7551
|
+
function Badge(text, color) {
|
|
7552
|
+
var _this = _super.call(this) || this;
|
|
7553
|
+
_this.text = '';
|
|
7554
|
+
_this.text = text;
|
|
7555
|
+
_this.color = color || exports.BadgeColorEnum.DEFAULT;
|
|
7556
|
+
return _this;
|
|
7557
|
+
}
|
|
7558
|
+
return Badge;
|
|
7559
|
+
}(AbstractModel));
|
|
7560
|
+
|
|
7514
7561
|
/**
|
|
7515
7562
|
* bank account collection UI class with frontend specific data
|
|
7516
7563
|
*/
|
|
@@ -8219,6 +8266,42 @@
|
|
|
8219
8266
|
AlphabetColorsEnum["Z"] = "#E3C9CE";
|
|
8220
8267
|
})(exports.AlphabetColorsEnum || (exports.AlphabetColorsEnum = {}));
|
|
8221
8268
|
|
|
8269
|
+
/**
|
|
8270
|
+
* List of objects grouped by passed property
|
|
8271
|
+
*/
|
|
8272
|
+
var Dictionary = /** @class */ (function () {
|
|
8273
|
+
function Dictionary(items, path) {
|
|
8274
|
+
if (path === void 0) { path = 'id'; }
|
|
8275
|
+
this.items = {};
|
|
8276
|
+
if (!items.length) {
|
|
8277
|
+
return;
|
|
8278
|
+
}
|
|
8279
|
+
// Do nothing if provided path was not found in the 1st item
|
|
8280
|
+
if (!hasIn__default["default"](items[0], path.split('.')[0])) {
|
|
8281
|
+
return;
|
|
8282
|
+
}
|
|
8283
|
+
this.groupItems(items, path);
|
|
8284
|
+
}
|
|
8285
|
+
Dictionary.prototype.add = function (key, value) {
|
|
8286
|
+
this.items[key] = value;
|
|
8287
|
+
};
|
|
8288
|
+
Dictionary.prototype.get = function (key) {
|
|
8289
|
+
return this.items[key] ? this.items[key] : null;
|
|
8290
|
+
};
|
|
8291
|
+
Dictionary.prototype.groupItems = function (items, path) {
|
|
8292
|
+
var _this = this;
|
|
8293
|
+
items.forEach(function (item) {
|
|
8294
|
+
var key = get__default["default"](item, path);
|
|
8295
|
+
// if object does not have property for grouping it will be grouped as 'other'
|
|
8296
|
+
if (key === undefined) {
|
|
8297
|
+
key = 'other';
|
|
8298
|
+
}
|
|
8299
|
+
_this.items[key] = item;
|
|
8300
|
+
});
|
|
8301
|
+
};
|
|
8302
|
+
return Dictionary;
|
|
8303
|
+
}());
|
|
8304
|
+
|
|
8222
8305
|
exports.DepreciationGroupEnum = void 0;
|
|
8223
8306
|
(function (DepreciationGroupEnum) {
|
|
8224
8307
|
DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
|
|
@@ -8308,42 +8391,6 @@
|
|
|
8308
8391
|
return DepreciationReceipt;
|
|
8309
8392
|
}(DepreciationReceipt$1));
|
|
8310
8393
|
|
|
8311
|
-
/**
|
|
8312
|
-
* List of objects grouped by passed property
|
|
8313
|
-
*/
|
|
8314
|
-
var Dictionary = /** @class */ (function () {
|
|
8315
|
-
function Dictionary(items, path) {
|
|
8316
|
-
if (path === void 0) { path = 'id'; }
|
|
8317
|
-
this.items = {};
|
|
8318
|
-
if (!items.length) {
|
|
8319
|
-
return;
|
|
8320
|
-
}
|
|
8321
|
-
// Do nothing if provided path was not found in the 1st item
|
|
8322
|
-
if (!hasIn__default["default"](items[0], path.split('.')[0])) {
|
|
8323
|
-
return;
|
|
8324
|
-
}
|
|
8325
|
-
this.groupItems(items, path);
|
|
8326
|
-
}
|
|
8327
|
-
Dictionary.prototype.add = function (key, value) {
|
|
8328
|
-
this.items[key] = value;
|
|
8329
|
-
};
|
|
8330
|
-
Dictionary.prototype.get = function (key) {
|
|
8331
|
-
return this.items[key] ? this.items[key] : null;
|
|
8332
|
-
};
|
|
8333
|
-
Dictionary.prototype.groupItems = function (items, path) {
|
|
8334
|
-
var _this = this;
|
|
8335
|
-
items.forEach(function (item) {
|
|
8336
|
-
var key = get__default["default"](item, path);
|
|
8337
|
-
// if object does not have property for grouping it will be grouped as 'other'
|
|
8338
|
-
if (key === undefined) {
|
|
8339
|
-
key = 'other';
|
|
8340
|
-
}
|
|
8341
|
-
_this.items[key] = item;
|
|
8342
|
-
});
|
|
8343
|
-
};
|
|
8344
|
-
return Dictionary;
|
|
8345
|
-
}());
|
|
8346
|
-
|
|
8347
8394
|
var Document$1 = /** @class */ (function (_super) {
|
|
8348
8395
|
__extends(Document, _super);
|
|
8349
8396
|
function Document() {
|
|
@@ -13448,6 +13495,38 @@
|
|
|
13448
13495
|
// Math abs is required for correct percentage calculation
|
|
13449
13496
|
return properties.purchasePrice - Math.abs(this.getLoanAmount(properties, bankAccounts, loans));
|
|
13450
13497
|
};
|
|
13498
|
+
/**
|
|
13499
|
+
* Get dictionary of badges for each property in collection
|
|
13500
|
+
*/
|
|
13501
|
+
PropertyCalculationService.prototype.getBadgesByProperty = function (properties, transactions, depreciations) {
|
|
13502
|
+
var _this = this;
|
|
13503
|
+
var badgesByProperty = new Dictionary([]);
|
|
13504
|
+
properties.toArray().forEach(function (property) {
|
|
13505
|
+
badgesByProperty.add(property.id, _this.getBadge(property, properties, transactions, depreciations));
|
|
13506
|
+
});
|
|
13507
|
+
return badgesByProperty;
|
|
13508
|
+
};
|
|
13509
|
+
/**
|
|
13510
|
+
* Get Badge for single property in collection
|
|
13511
|
+
*/
|
|
13512
|
+
PropertyCalculationService.prototype.getBadge = function (property, properties, transactions, depreciations) {
|
|
13513
|
+
// best performance properties could be only from active properties list
|
|
13514
|
+
var activeProperties = properties.getActiveProperties();
|
|
13515
|
+
var bestPerformanceGrowthProperty = activeProperties.getBestPerformanceGrowthProperty();
|
|
13516
|
+
var bestPerformanceTaxProperty = activeProperties.getBestPerformanceTaxProperty(transactions, depreciations);
|
|
13517
|
+
switch (true) {
|
|
13518
|
+
case !property.isActive:
|
|
13519
|
+
return new Badge('Inactive', exports.BadgeColorEnum.GRAY);
|
|
13520
|
+
case property.id === bestPerformanceTaxProperty.id && property.id === bestPerformanceGrowthProperty.id:
|
|
13521
|
+
return new Badge('Best performance growth & tax', exports.BadgeColorEnum.GOLD);
|
|
13522
|
+
case property.id === bestPerformanceTaxProperty.id:
|
|
13523
|
+
return new Badge('Best performance tax', exports.BadgeColorEnum.GOLD);
|
|
13524
|
+
case property.id === bestPerformanceGrowthProperty.id:
|
|
13525
|
+
return new Badge('Best performance growth', exports.BadgeColorEnum.GREEN);
|
|
13526
|
+
default:
|
|
13527
|
+
return new Badge('Monitoring performance');
|
|
13528
|
+
}
|
|
13529
|
+
};
|
|
13451
13530
|
return PropertyCalculationService;
|
|
13452
13531
|
}());
|
|
13453
13532
|
PropertyCalculationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyCalculationService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -14712,6 +14791,9 @@
|
|
|
14712
14791
|
}
|
|
14713
14792
|
|
|
14714
14793
|
function compareMatOptions(option, value) {
|
|
14794
|
+
if (!option) {
|
|
14795
|
+
return false;
|
|
14796
|
+
}
|
|
14715
14797
|
return option.id === value.id;
|
|
14716
14798
|
}
|
|
14717
14799
|
function displayMatOptions(option) {
|
|
@@ -14899,7 +14981,7 @@
|
|
|
14899
14981
|
currentBalance: new forms.FormControl(null, forms.Validators.required),
|
|
14900
14982
|
accountNumber: new forms.FormControl(null, [forms.Validators.required, forms.Validators.pattern(BankAccountAddManualForm.accountNumberPattern)]),
|
|
14901
14983
|
tankType: new forms.FormControl(null, forms.Validators.required),
|
|
14902
|
-
}) || this;
|
|
14984
|
+
}, classTransformer.plainToClass(BankAccount, {})) || this;
|
|
14903
14985
|
_this.connection = connection;
|
|
14904
14986
|
_this.listenEvents();
|
|
14905
14987
|
return _this;
|
|
@@ -15180,18 +15262,13 @@
|
|
|
15180
15262
|
referenceCode: new forms.FormControl(referenceCode)
|
|
15181
15263
|
}) || this;
|
|
15182
15264
|
}
|
|
15183
|
-
RegisterClientForm.prototype.submit = function () {
|
|
15265
|
+
RegisterClientForm.prototype.submit = function (data) {
|
|
15266
|
+
if (data === void 0) { data = {}; }
|
|
15267
|
+
return _super.prototype.submit.call(this, { password: this.get('password').submit().password });
|
|
15184
15268
|
var formValue = _super.prototype.submit.call(this);
|
|
15185
15269
|
if (!formValue) {
|
|
15186
15270
|
return null;
|
|
15187
15271
|
}
|
|
15188
|
-
return {
|
|
15189
|
-
firstName: this.value.firstName,
|
|
15190
|
-
lastName: this.value.lastName,
|
|
15191
|
-
email: this.value.email,
|
|
15192
|
-
password: this.value.password.password,
|
|
15193
|
-
referenceCode: this.value.referenceCode
|
|
15194
|
-
};
|
|
15195
15272
|
};
|
|
15196
15273
|
return RegisterClientForm;
|
|
15197
15274
|
}(AbstractForm));
|
|
@@ -15209,6 +15286,10 @@
|
|
|
15209
15286
|
_this.firmType = firmType;
|
|
15210
15287
|
return _this;
|
|
15211
15288
|
}
|
|
15289
|
+
RegisterFirmForm.prototype.submit = function (data) {
|
|
15290
|
+
if (data === void 0) { data = {}; }
|
|
15291
|
+
return _super.prototype.submit.call(this, { owner: this.get('owner').submit() });
|
|
15292
|
+
};
|
|
15212
15293
|
return RegisterFirmForm;
|
|
15213
15294
|
}(AbstractForm));
|
|
15214
15295
|
|
|
@@ -15749,6 +15830,7 @@
|
|
|
15749
15830
|
exports.AssetsService = AssetsService;
|
|
15750
15831
|
exports.AuthService = AuthService;
|
|
15751
15832
|
exports.BANK_ACCOUNT_TYPES = BANK_ACCOUNT_TYPES;
|
|
15833
|
+
exports.Badge = Badge;
|
|
15752
15834
|
exports.Bank = Bank;
|
|
15753
15835
|
exports.BankAccount = BankAccount;
|
|
15754
15836
|
exports.BankAccountAddManualForm = BankAccountAddManualForm;
|