taxtank-core 0.28.18 → 0.28.21
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 +373 -278
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/chat.collection.js +26 -0
- package/esm2015/lib/collections/index.js +2 -1
- package/esm2015/lib/collections/message.collection.js +13 -1
- package/esm2015/lib/collections/property/index.js +4 -0
- package/esm2015/lib/collections/property/property-category-movement.collection.js +17 -0
- package/esm2015/lib/collections/property/property-sale/index.js +3 -0
- package/esm2015/lib/db/Enums/chat-status.enum.js +1 -1
- package/esm2015/lib/db/Enums/property/property-category-list.enum.js +2 -1
- package/esm2015/lib/forms/sole/sole-business.form.js +3 -3
- package/esm2015/lib/forms/sole/sole-invoice.form.js +3 -2
- package/esm2015/lib/models/bank/bank-account.js +7 -1
- package/esm2015/lib/models/chart-accounts/chart-accounts.js +12 -6
- package/esm2015/lib/models/chat/message.js +5 -1
- package/esm2015/lib/models/endpoint/endpoints.const.js +2 -1
- package/esm2015/lib/models/financial-year/financial-year.js +7 -2
- package/esm2015/lib/models/property/property-category.js +7 -3
- package/esm2015/public-api.js +2 -3
- package/fesm2015/taxtank-core.js +278 -205
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/chat.collection.d.ts +10 -0
- package/lib/collections/index.d.ts +1 -0
- package/lib/collections/message.collection.d.ts +5 -0
- package/lib/collections/property/index.d.ts +3 -0
- package/lib/collections/property/property-category-movement.collection.d.ts +11 -0
- package/lib/collections/property/property-sale/index.d.ts +2 -0
- package/lib/db/Enums/property/property-category-list.enum.d.ts +1 -0
- package/lib/models/bank/bank-account.d.ts +2 -0
- package/lib/models/chart-accounts/chart-accounts.d.ts +6 -1
- package/lib/models/chat/message.d.ts +2 -0
- package/lib/models/financial-year/financial-year.d.ts +1 -1
- package/lib/models/property/property-category.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
-
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('lodash/differenceBy'), require('@angular/forms'), require('lodash/merge'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', 'lodash/differenceBy', '@angular/forms', 'lodash/merge', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.differenceBy, global.ng.forms, global.merge, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
+
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, differenceBy, forms, merge, isEqual, fromPairs, _, i1$2, clone, html2pdf, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
var concat__default = /*#__PURE__*/_interopDefaultLegacy(concat);
|
|
38
38
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
|
|
39
39
|
var compact__default = /*#__PURE__*/_interopDefaultLegacy(compact);
|
|
40
|
+
var differenceBy__default = /*#__PURE__*/_interopDefaultLegacy(differenceBy);
|
|
40
41
|
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
41
42
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
42
43
|
var fromPairs__default = /*#__PURE__*/_interopDefaultLegacy(fromPairs);
|
|
@@ -1033,6 +1034,7 @@
|
|
|
1033
1034
|
PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
|
|
1034
1035
|
PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
|
|
1035
1036
|
PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
|
|
1037
|
+
PROPERTIES_CATEGORIES_MOVEMENTS_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/category-movements'),
|
|
1036
1038
|
PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
|
|
1037
1039
|
PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
|
|
1038
1040
|
PROPERTIES_SHARES_PUT: new Endpoint('PUT', '\\/properties\\/shares\\/\\d+'),
|
|
@@ -1638,7 +1640,12 @@
|
|
|
1638
1640
|
function FinancialYear(date) {
|
|
1639
1641
|
this.yearStartDate = '-07-01';
|
|
1640
1642
|
this.yearEndDate = '-06-30';
|
|
1641
|
-
|
|
1643
|
+
if (date) {
|
|
1644
|
+
this.year = date instanceof Date ? FinancialYear.toFinYear(date) : date;
|
|
1645
|
+
}
|
|
1646
|
+
else {
|
|
1647
|
+
this.year = +localStorage.getItem('financialYear') || FinancialYear.toFinYear(new Date());
|
|
1648
|
+
}
|
|
1642
1649
|
this.setStartDate(this.year);
|
|
1643
1650
|
this.setEndDate(this.year);
|
|
1644
1651
|
}
|
|
@@ -3075,6 +3082,9 @@
|
|
|
3075
3082
|
ChartAccounts.prototype.isIncome = function () {
|
|
3076
3083
|
return CHART_ACCOUNTS_CATEGORIES.income.includes(this.category);
|
|
3077
3084
|
};
|
|
3085
|
+
ChartAccounts.prototype.isExpense = function () {
|
|
3086
|
+
return CHART_ACCOUNTS_CATEGORIES.expense.includes(this.category);
|
|
3087
|
+
};
|
|
3078
3088
|
ChartAccounts.prototype.isProperty = function () {
|
|
3079
3089
|
return CHART_ACCOUNTS_CATEGORIES.property.includes(this.category);
|
|
3080
3090
|
};
|
|
@@ -3090,7 +3100,7 @@
|
|
|
3090
3100
|
* Check if chart accounts is property expense
|
|
3091
3101
|
*/
|
|
3092
3102
|
ChartAccounts.prototype.isPropertyExpense = function () {
|
|
3093
|
-
return this.
|
|
3103
|
+
return this.isProperty() && this.isExpense();
|
|
3094
3104
|
};
|
|
3095
3105
|
/**
|
|
3096
3106
|
* Check if chart accounts is property income
|
|
@@ -3104,10 +3114,6 @@
|
|
|
3104
3114
|
ChartAccounts.prototype.isPersonalExpense = function () {
|
|
3105
3115
|
return this.category === exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE;
|
|
3106
3116
|
};
|
|
3107
|
-
ChartAccounts.prototype.isPropertyDepreciation = function () {
|
|
3108
|
-
return [exports.ChartAccountsCategoryEnum.PROPERTY_DEPRECIATION, exports.ChartAccountsCategoryEnum.PROPERTY_CAPITAL_WORKS]
|
|
3109
|
-
.includes(this.category);
|
|
3110
|
-
};
|
|
3111
3117
|
/**
|
|
3112
3118
|
* Check if chart accounts category is depreciation
|
|
3113
3119
|
*/
|
|
@@ -3132,6 +3138,13 @@
|
|
|
3132
3138
|
ChartAccounts.prototype.getValueByYear = function (year) {
|
|
3133
3139
|
return this.values.find(function (value) { return value.financialYear === year; });
|
|
3134
3140
|
};
|
|
3141
|
+
/**
|
|
3142
|
+
* no way to check how much used for work/sole, so we let user adjust it
|
|
3143
|
+
* except vehicle expense, which is equal to vehicleClaim.workUsage and personal, which is equal to 0
|
|
3144
|
+
*/
|
|
3145
|
+
ChartAccounts.prototype.isClaimPercentEditable = function () {
|
|
3146
|
+
return (this.isWorkExpense() || this.isSoleExpense()) && (!this.isVehicleExpense() && !this.isPersonalExpense());
|
|
3147
|
+
};
|
|
3135
3148
|
return ChartAccounts;
|
|
3136
3149
|
}(ChartAccounts$1));
|
|
3137
3150
|
__decorate([
|
|
@@ -5005,6 +5018,13 @@
|
|
|
5005
5018
|
return PropertyCategory;
|
|
5006
5019
|
}(AbstractModel));
|
|
5007
5020
|
|
|
5021
|
+
exports.PropertyCategoryListEnum = void 0;
|
|
5022
|
+
(function (PropertyCategoryListEnum) {
|
|
5023
|
+
PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
|
|
5024
|
+
PropertyCategoryListEnum[PropertyCategoryListEnum["SHARED"] = 4] = "SHARED";
|
|
5025
|
+
PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 5] = "VACANT_LAND";
|
|
5026
|
+
})(exports.PropertyCategoryListEnum || (exports.PropertyCategoryListEnum = {}));
|
|
5027
|
+
|
|
5008
5028
|
var PropertyCategory = /** @class */ (function (_super) {
|
|
5009
5029
|
__extends(PropertyCategory, _super);
|
|
5010
5030
|
function PropertyCategory() {
|
|
@@ -5012,10 +5032,13 @@
|
|
|
5012
5032
|
}
|
|
5013
5033
|
// @Todo check if category is Owner Occupied. If will be needed to check more categories - move the checking to the backend
|
|
5014
5034
|
PropertyCategory.prototype.isOwnerOccupied = function () {
|
|
5015
|
-
return this.
|
|
5035
|
+
return this.id === exports.PropertyCategoryListEnum.OWNER_OCCUPIED;
|
|
5016
5036
|
};
|
|
5017
5037
|
PropertyCategory.prototype.isVacantLand = function () {
|
|
5018
|
-
return this.
|
|
5038
|
+
return this.id === exports.PropertyCategoryListEnum.VACANT_LAND;
|
|
5039
|
+
};
|
|
5040
|
+
PropertyCategory.prototype.isShared = function () {
|
|
5041
|
+
return this.id === exports.PropertyCategoryListEnum.SHARED;
|
|
5019
5042
|
};
|
|
5020
5043
|
return PropertyCategory;
|
|
5021
5044
|
}(PropertyCategory$1));
|
|
@@ -5217,12 +5240,6 @@
|
|
|
5217
5240
|
TaxExemptionEnum[TaxExemptionEnum["OTHER"] = 7] = "OTHER";
|
|
5218
5241
|
})(exports.TaxExemptionEnum || (exports.TaxExemptionEnum = {}));
|
|
5219
5242
|
|
|
5220
|
-
exports.PropertyCategoryListEnum = void 0;
|
|
5221
|
-
(function (PropertyCategoryListEnum) {
|
|
5222
|
-
PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
|
|
5223
|
-
PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 5] = "VACANT_LAND";
|
|
5224
|
-
})(exports.PropertyCategoryListEnum || (exports.PropertyCategoryListEnum = {}));
|
|
5225
|
-
|
|
5226
5243
|
exports.TaxExemptionMetadataEnum = void 0;
|
|
5227
5244
|
(function (TaxExemptionMetadataEnum) {
|
|
5228
5245
|
// principle place of residence
|
|
@@ -5721,6 +5738,20 @@
|
|
|
5721
5738
|
enumerable: false,
|
|
5722
5739
|
configurable: true
|
|
5723
5740
|
});
|
|
5741
|
+
Object.defineProperty(BankAccount.prototype, "bsb", {
|
|
5742
|
+
get: function () {
|
|
5743
|
+
return this.accountNumber.split(' ')[0];
|
|
5744
|
+
},
|
|
5745
|
+
enumerable: false,
|
|
5746
|
+
configurable: true
|
|
5747
|
+
});
|
|
5748
|
+
Object.defineProperty(BankAccount.prototype, "number", {
|
|
5749
|
+
get: function () {
|
|
5750
|
+
return this.accountNumber.split(' ')[1];
|
|
5751
|
+
},
|
|
5752
|
+
enumerable: false,
|
|
5753
|
+
configurable: true
|
|
5754
|
+
});
|
|
5724
5755
|
/**
|
|
5725
5756
|
* Get current opening balance amount
|
|
5726
5757
|
*/
|
|
@@ -6900,6 +6931,192 @@
|
|
|
6900
6931
|
return SoleInvoiceCollection;
|
|
6901
6932
|
}(Collection));
|
|
6902
6933
|
|
|
6934
|
+
var PropertySaleCollection = /** @class */ (function (_super) {
|
|
6935
|
+
__extends(PropertySaleCollection, _super);
|
|
6936
|
+
function PropertySaleCollection() {
|
|
6937
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6938
|
+
}
|
|
6939
|
+
Object.defineProperty(PropertySaleCollection.prototype, "grossCGT", {
|
|
6940
|
+
get: function () {
|
|
6941
|
+
return this.create(this.items.filter(function (propertySale) { return propertySale.grossCGT > 0; })).sumBy('grossCGT');
|
|
6942
|
+
},
|
|
6943
|
+
enumerable: false,
|
|
6944
|
+
configurable: true
|
|
6945
|
+
});
|
|
6946
|
+
/**
|
|
6947
|
+
* Property sales are CGT applicable unless it has "Principle place of residence" exemption type
|
|
6948
|
+
*/
|
|
6949
|
+
PropertySaleCollection.prototype.getCGTApplicable = function () {
|
|
6950
|
+
return this.create(this.items.filter(function (propertySale) { return propertySale.isCGTApplicable(); }));
|
|
6951
|
+
};
|
|
6952
|
+
PropertySaleCollection.prototype.getByPropertyShareIds = function (ids) {
|
|
6953
|
+
return this.filterBy('share.id', ids);
|
|
6954
|
+
};
|
|
6955
|
+
return PropertySaleCollection;
|
|
6956
|
+
}(Collection));
|
|
6957
|
+
|
|
6958
|
+
var PropertyCollection = /** @class */ (function (_super) {
|
|
6959
|
+
__extends(PropertyCollection, _super);
|
|
6960
|
+
function PropertyCollection() {
|
|
6961
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6962
|
+
}
|
|
6963
|
+
/**
|
|
6964
|
+
* Get new property collection filtered by category id
|
|
6965
|
+
* @param id id of category for filter
|
|
6966
|
+
*/
|
|
6967
|
+
PropertyCollection.prototype.getByCategoryId = function (id) {
|
|
6968
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.category.id === id; }));
|
|
6969
|
+
};
|
|
6970
|
+
/**
|
|
6971
|
+
* Get new property collection filtered by active status
|
|
6972
|
+
*/
|
|
6973
|
+
PropertyCollection.prototype.getActiveProperties = function () {
|
|
6974
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.isActive; }));
|
|
6975
|
+
};
|
|
6976
|
+
PropertyCollection.prototype.getCreatedProperties = function () {
|
|
6977
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.isOwn(); }));
|
|
6978
|
+
};
|
|
6979
|
+
/**
|
|
6980
|
+
* Get new property collection filtered by shared
|
|
6981
|
+
*/
|
|
6982
|
+
PropertyCollection.prototype.getSharedProperties = function () {
|
|
6983
|
+
return new PropertyCollection(this.items.filter(function (property) { return !property.isOwn(); }));
|
|
6984
|
+
};
|
|
6985
|
+
/**
|
|
6986
|
+
* Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
|
|
6987
|
+
*/
|
|
6988
|
+
PropertyCollection.prototype.getTaxInclusive = function () {
|
|
6989
|
+
return this.create(this.items.filter(function (property) { return property.category.isTaxInclusive; }));
|
|
6990
|
+
};
|
|
6991
|
+
PropertyCollection.prototype.getUnsold = function () {
|
|
6992
|
+
return this.create(this.items.filter(function (property) { return !property.isSold(); }));
|
|
6993
|
+
};
|
|
6994
|
+
Object.defineProperty(PropertyCollection.prototype, "purchasePrice", {
|
|
6995
|
+
/**
|
|
6996
|
+
* Get total purchase price for all properties in the collection
|
|
6997
|
+
*/
|
|
6998
|
+
get: function () {
|
|
6999
|
+
return this.sumBy('purchasePrice');
|
|
7000
|
+
},
|
|
7001
|
+
enumerable: false,
|
|
7002
|
+
configurable: true
|
|
7003
|
+
});
|
|
7004
|
+
Object.defineProperty(PropertyCollection.prototype, "growthPercent", {
|
|
7005
|
+
get: function () {
|
|
7006
|
+
return this.sumBy('growthPercent');
|
|
7007
|
+
},
|
|
7008
|
+
enumerable: false,
|
|
7009
|
+
configurable: true
|
|
7010
|
+
});
|
|
7011
|
+
Object.defineProperty(PropertyCollection.prototype, "marketValue", {
|
|
7012
|
+
get: function () {
|
|
7013
|
+
return this.sumBy('marketValue');
|
|
7014
|
+
},
|
|
7015
|
+
enumerable: false,
|
|
7016
|
+
configurable: true
|
|
7017
|
+
});
|
|
7018
|
+
Object.defineProperty(PropertyCollection.prototype, "firstForecastYear", {
|
|
7019
|
+
get: function () {
|
|
7020
|
+
return this.items.reduce(function (min, property) {
|
|
7021
|
+
var current = property.firstForecastYear;
|
|
7022
|
+
return min > current ? current : min;
|
|
7023
|
+
}, new FinancialYear().year);
|
|
7024
|
+
},
|
|
7025
|
+
enumerable: false,
|
|
7026
|
+
configurable: true
|
|
7027
|
+
});
|
|
7028
|
+
Object.defineProperty(PropertyCollection.prototype, "marketValueGrowth", {
|
|
7029
|
+
get: function () {
|
|
7030
|
+
return (this.marketValue - this.purchasePrice) / this.purchasePrice;
|
|
7031
|
+
},
|
|
7032
|
+
enumerable: false,
|
|
7033
|
+
configurable: true
|
|
7034
|
+
});
|
|
7035
|
+
/**
|
|
7036
|
+
* list of properties
|
|
7037
|
+
*/
|
|
7038
|
+
PropertyCollection.prototype.getCGTApplicable = function () {
|
|
7039
|
+
return this.create(this.items.filter(function (property) { return property.isCGTApplicable(); }));
|
|
7040
|
+
};
|
|
7041
|
+
PropertyCollection.prototype.getOwnerOccupiedProperties = function () {
|
|
7042
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.category.isOwnerOccupied(); }));
|
|
7043
|
+
};
|
|
7044
|
+
Object.defineProperty(PropertyCollection.prototype, "earliestContractDate", {
|
|
7045
|
+
get: function () {
|
|
7046
|
+
return this.items.reduce(function (min, property) {
|
|
7047
|
+
return min < property.contractDate ? min : property.contractDate;
|
|
7048
|
+
}, new FinancialYear(new Date()).startDate);
|
|
7049
|
+
},
|
|
7050
|
+
enumerable: false,
|
|
7051
|
+
configurable: true
|
|
7052
|
+
});
|
|
7053
|
+
/**
|
|
7054
|
+
* Get list of unique property categories from collection
|
|
7055
|
+
*/
|
|
7056
|
+
PropertyCollection.prototype.getCategories = function () {
|
|
7057
|
+
return uniqBy__default["default"](this.items.map(function (property) { return property.category; }), 'id');
|
|
7058
|
+
};
|
|
7059
|
+
/**
|
|
7060
|
+
* Get property with the highest growth percent
|
|
7061
|
+
*/
|
|
7062
|
+
PropertyCollection.prototype.getBestPerformanceGrowthProperty = function () {
|
|
7063
|
+
return this.items.reduce(function (max, current) {
|
|
7064
|
+
return max.growthPercent < current.growthPercent ? current : max;
|
|
7065
|
+
}, this.first);
|
|
7066
|
+
};
|
|
7067
|
+
/**
|
|
7068
|
+
* Get property with the lowest tax position
|
|
7069
|
+
*/
|
|
7070
|
+
PropertyCollection.prototype.getBestPerformanceTaxProperty = function (transactions, depreciations) {
|
|
7071
|
+
var transactionsByProperty = transactions.groupBy('property.id');
|
|
7072
|
+
var depreciationsByProperty = depreciations.groupBy('property.id');
|
|
7073
|
+
return this.items.reduce(function (min, current) {
|
|
7074
|
+
var minTaxPosition = min.getTaxPosition(transactionsByProperty.get(min.id), depreciationsByProperty.get(min.id));
|
|
7075
|
+
var currentTaxPosition = current.getTaxPosition(transactionsByProperty.get(current.id), depreciationsByProperty.get(current.id));
|
|
7076
|
+
return minTaxPosition > currentTaxPosition ? current : min;
|
|
7077
|
+
}, this.first);
|
|
7078
|
+
};
|
|
7079
|
+
/**
|
|
7080
|
+
* Show best performance properties first
|
|
7081
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677997/Property+Tank+Dashboard
|
|
7082
|
+
*/
|
|
7083
|
+
PropertyCollection.prototype.sortByBestPerformance = function (transactions, depreciations) {
|
|
7084
|
+
var activeProperties = this.getActiveProperties();
|
|
7085
|
+
// nothing to sort when no active properties
|
|
7086
|
+
if (!activeProperties.length) {
|
|
7087
|
+
return this;
|
|
7088
|
+
}
|
|
7089
|
+
var bestProperties = uniqBy__default["default"](this.create([
|
|
7090
|
+
activeProperties.getBestPerformanceGrowthProperty(),
|
|
7091
|
+
activeProperties.getBestPerformanceTaxProperty(transactions, depreciations)
|
|
7092
|
+
]).toArray(), 'id');
|
|
7093
|
+
var newItems = this.remove(bestProperties).toArray();
|
|
7094
|
+
newItems.unshift.apply(newItems, __spreadArray([], __read(bestProperties)));
|
|
7095
|
+
return this.create(newItems);
|
|
7096
|
+
};
|
|
7097
|
+
return PropertyCollection;
|
|
7098
|
+
}(Collection));
|
|
7099
|
+
|
|
7100
|
+
var PropertyCategoryMovementCollection = /** @class */ (function (_super) {
|
|
7101
|
+
__extends(PropertyCategoryMovementCollection, _super);
|
|
7102
|
+
function PropertyCategoryMovementCollection() {
|
|
7103
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7104
|
+
}
|
|
7105
|
+
/**
|
|
7106
|
+
* @TODO TT-2355 Alex refactor propertyForecast, use separated api (then I can remove property from param)
|
|
7107
|
+
*/
|
|
7108
|
+
PropertyCategoryMovementCollection.prototype.getByForecast = function (property, forecast) {
|
|
7109
|
+
var financialYear = new FinancialYear(forecast.financialYear);
|
|
7110
|
+
return this.filterBy('property.id', property.id).filter(function (movement) {
|
|
7111
|
+
return movement.fromDate <= financialYear.endDate && movement.toDate >= financialYear.startDate;
|
|
7112
|
+
});
|
|
7113
|
+
};
|
|
7114
|
+
PropertyCategoryMovementCollection.prototype.hasCategory = function (categoryId) {
|
|
7115
|
+
return !!this.findBy('propertyCategory.id', categoryId);
|
|
7116
|
+
};
|
|
7117
|
+
return PropertyCategoryMovementCollection;
|
|
7118
|
+
}(Collection));
|
|
7119
|
+
|
|
6903
7120
|
// @TODO Alex move here all collections
|
|
6904
7121
|
|
|
6905
7122
|
var AccountSetupItemCollection = /** @class */ (function (_super) {
|
|
@@ -7064,34 +7281,138 @@
|
|
|
7064
7281
|
return ChartAccountsCollection;
|
|
7065
7282
|
}(Collection));
|
|
7066
7283
|
|
|
7067
|
-
var
|
|
7068
|
-
__extends(
|
|
7069
|
-
function
|
|
7284
|
+
var MessageCollection = /** @class */ (function (_super) {
|
|
7285
|
+
__extends(MessageCollection, _super);
|
|
7286
|
+
function MessageCollection() {
|
|
7070
7287
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
7071
7288
|
}
|
|
7072
|
-
|
|
7289
|
+
MessageCollection.prototype.getFirstUnreadMessage = function (user) {
|
|
7290
|
+
return this.items.find(function (message) {
|
|
7291
|
+
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
7292
|
+
});
|
|
7293
|
+
};
|
|
7294
|
+
/**
|
|
7295
|
+
* Get List of unread chats
|
|
7296
|
+
*/
|
|
7297
|
+
MessageCollection.prototype.getUnread = function () {
|
|
7298
|
+
return this.items.filter(function (message) { return !message.readAt; });
|
|
7299
|
+
};
|
|
7300
|
+
MessageCollection.prototype.getFromActiveChats = function () {
|
|
7301
|
+
return this.filter(function (message) { return message.chat.isActive(); });
|
|
7302
|
+
};
|
|
7303
|
+
/**
|
|
7304
|
+
* Get amount of chats that contains unread messages
|
|
7305
|
+
*/
|
|
7306
|
+
MessageCollection.prototype.getUnreadChatsAmount = function (isFromEmployee) {
|
|
7307
|
+
if (isFromEmployee === void 0) { isFromEmployee = false; }
|
|
7308
|
+
// filtered messages for client/employee
|
|
7309
|
+
var filteredMessages = this.filter(function (message) { return isFromEmployee ? message.isFromEmployee() : !message.isFromEmployee(); });
|
|
7310
|
+
return uniqBy__default["default"](filteredMessages.getFromActiveChats().getUnread(), 'chat.id').length;
|
|
7311
|
+
};
|
|
7312
|
+
/**
|
|
7313
|
+
* Check if chat has unread chats
|
|
7314
|
+
*/
|
|
7315
|
+
MessageCollection.prototype.hasUnread = function () {
|
|
7316
|
+
return !!this.getUnread().length;
|
|
7317
|
+
};
|
|
7318
|
+
return MessageCollection;
|
|
7073
7319
|
}(Collection));
|
|
7074
7320
|
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
}
|
|
7094
|
-
|
|
7321
|
+
/**
|
|
7322
|
+
* List of objects grouped by passed property
|
|
7323
|
+
*/
|
|
7324
|
+
var Dictionary = /** @class */ (function () {
|
|
7325
|
+
function Dictionary(items, path) {
|
|
7326
|
+
if (path === void 0) { path = 'id'; }
|
|
7327
|
+
this.items = {};
|
|
7328
|
+
if (!items.length) {
|
|
7329
|
+
return;
|
|
7330
|
+
}
|
|
7331
|
+
// Do nothing if provided path was not found in the 1st item
|
|
7332
|
+
if (!hasIn__default["default"](items[0], path.split('.')[0])) {
|
|
7333
|
+
return;
|
|
7334
|
+
}
|
|
7335
|
+
this.groupItems(items, path);
|
|
7336
|
+
}
|
|
7337
|
+
Dictionary.prototype.add = function (key, value) {
|
|
7338
|
+
this.items[key] = value;
|
|
7339
|
+
};
|
|
7340
|
+
Dictionary.prototype.get = function (key) {
|
|
7341
|
+
return this.items[key] !== undefined ? this.items[key] : null;
|
|
7342
|
+
};
|
|
7343
|
+
Dictionary.prototype.groupItems = function (items, path) {
|
|
7344
|
+
var _this = this;
|
|
7345
|
+
items.forEach(function (item) {
|
|
7346
|
+
var key = get__default["default"](item, path);
|
|
7347
|
+
// if object does not have property for grouping it will be grouped as 'other'
|
|
7348
|
+
if (key === undefined) {
|
|
7349
|
+
key = 'other';
|
|
7350
|
+
}
|
|
7351
|
+
_this.items[key] = item;
|
|
7352
|
+
});
|
|
7353
|
+
};
|
|
7354
|
+
return Dictionary;
|
|
7355
|
+
}());
|
|
7356
|
+
|
|
7357
|
+
exports.ChatStatusEnum = void 0;
|
|
7358
|
+
(function (ChatStatusEnum) {
|
|
7359
|
+
ChatStatusEnum[ChatStatusEnum["ACTIVE"] = 1] = "ACTIVE";
|
|
7360
|
+
ChatStatusEnum[ChatStatusEnum["INACTIVE"] = 2] = "INACTIVE";
|
|
7361
|
+
})(exports.ChatStatusEnum || (exports.ChatStatusEnum = {}));
|
|
7362
|
+
|
|
7363
|
+
var ChatCollection = /** @class */ (function (_super) {
|
|
7364
|
+
__extends(ChatCollection, _super);
|
|
7365
|
+
function ChatCollection() {
|
|
7366
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7367
|
+
}
|
|
7368
|
+
/**
|
|
7369
|
+
* Sort chats by last messages (newest first) + empty chats in the end
|
|
7370
|
+
*/
|
|
7371
|
+
ChatCollection.prototype.getSortedByNewest = function (messages) {
|
|
7372
|
+
var chatsById = new Dictionary(this.toArray());
|
|
7373
|
+
// get chats array sorted from newest to oldest
|
|
7374
|
+
var chats = uniqBy__default["default"](new MessageCollection(messages)
|
|
7375
|
+
.filterBy('chat.id', this.getIds())
|
|
7376
|
+
.sortBy('createdAt', true)
|
|
7377
|
+
.toArray()
|
|
7378
|
+
.map(function (message) { return chatsById.get(message.chat.id); }), 'id');
|
|
7379
|
+
var emptyChats = differenceBy__default["default"](this.toArray(), chats, 'id');
|
|
7380
|
+
return this.create(__spreadArray(__spreadArray([], __read(chats)), __read(emptyChats)));
|
|
7381
|
+
};
|
|
7382
|
+
ChatCollection.prototype.getActive = function () {
|
|
7383
|
+
return this.filterBy('status', exports.ChatStatusEnum.ACTIVE);
|
|
7384
|
+
};
|
|
7385
|
+
return ChatCollection;
|
|
7386
|
+
}(Collection));
|
|
7387
|
+
|
|
7388
|
+
var ClientCollection = /** @class */ (function (_super) {
|
|
7389
|
+
__extends(ClientCollection, _super);
|
|
7390
|
+
function ClientCollection() {
|
|
7391
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7392
|
+
}
|
|
7393
|
+
return ClientCollection;
|
|
7394
|
+
}(Collection));
|
|
7395
|
+
|
|
7396
|
+
exports.FirmTypeEnum = void 0;
|
|
7397
|
+
(function (FirmTypeEnum) {
|
|
7398
|
+
FirmTypeEnum[FirmTypeEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
|
|
7399
|
+
FirmTypeEnum[FirmTypeEnum["ADVISOR"] = 2] = "ADVISOR";
|
|
7400
|
+
})(exports.FirmTypeEnum || (exports.FirmTypeEnum = {}));
|
|
7401
|
+
|
|
7402
|
+
var EmployeeCollection = /** @class */ (function (_super) {
|
|
7403
|
+
__extends(EmployeeCollection, _super);
|
|
7404
|
+
function EmployeeCollection() {
|
|
7405
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7406
|
+
}
|
|
7407
|
+
Object.defineProperty(EmployeeCollection.prototype, "accountant", {
|
|
7408
|
+
get: function () {
|
|
7409
|
+
var _a;
|
|
7410
|
+
return (_a = this.items.filter(function (user) { return user.employeeDetails.firm.type === exports.FirmTypeEnum.ACCOUNTANT; })[0]) !== null && _a !== void 0 ? _a : null;
|
|
7411
|
+
},
|
|
7412
|
+
enumerable: false,
|
|
7413
|
+
configurable: true
|
|
7414
|
+
});
|
|
7415
|
+
Object.defineProperty(EmployeeCollection.prototype, "advisors", {
|
|
7095
7416
|
get: function () {
|
|
7096
7417
|
return this.items.filter(function (user) { return user.employeeDetails.firm.type === exports.FirmTypeEnum.ADVISOR; });
|
|
7097
7418
|
},
|
|
@@ -7726,31 +8047,6 @@
|
|
|
7726
8047
|
return LoanCollection;
|
|
7727
8048
|
}(Collection));
|
|
7728
8049
|
|
|
7729
|
-
var MessageCollection = /** @class */ (function (_super) {
|
|
7730
|
-
__extends(MessageCollection, _super);
|
|
7731
|
-
function MessageCollection() {
|
|
7732
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
7733
|
-
}
|
|
7734
|
-
MessageCollection.prototype.getFirstUnreadMessage = function (user) {
|
|
7735
|
-
return this.items.find(function (message) {
|
|
7736
|
-
return !message.isRead() && message.isFromEmployee() !== user.isEmployee();
|
|
7737
|
-
});
|
|
7738
|
-
};
|
|
7739
|
-
/**
|
|
7740
|
-
* Get List of unread chats
|
|
7741
|
-
*/
|
|
7742
|
-
MessageCollection.prototype.getUnread = function () {
|
|
7743
|
-
return this.items.filter(function (message) { return !message.readAt; });
|
|
7744
|
-
};
|
|
7745
|
-
/**
|
|
7746
|
-
* Check if chat has unread chats
|
|
7747
|
-
*/
|
|
7748
|
-
MessageCollection.prototype.hasUnread = function () {
|
|
7749
|
-
return !!this.getUnread().length;
|
|
7750
|
-
};
|
|
7751
|
-
return MessageCollection;
|
|
7752
|
-
}(Collection));
|
|
7753
|
-
|
|
7754
8050
|
/**
|
|
7755
8051
|
* Collection of MessageDocument instances
|
|
7756
8052
|
*/
|
|
@@ -7768,172 +8064,6 @@
|
|
|
7768
8064
|
return MessageDocumentCollection;
|
|
7769
8065
|
}(Collection));
|
|
7770
8066
|
|
|
7771
|
-
var PropertyCollection = /** @class */ (function (_super) {
|
|
7772
|
-
__extends(PropertyCollection, _super);
|
|
7773
|
-
function PropertyCollection() {
|
|
7774
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
7775
|
-
}
|
|
7776
|
-
/**
|
|
7777
|
-
* Get new property collection filtered by category id
|
|
7778
|
-
* @param id id of category for filter
|
|
7779
|
-
*/
|
|
7780
|
-
PropertyCollection.prototype.getByCategoryId = function (id) {
|
|
7781
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.category.id === id; }));
|
|
7782
|
-
};
|
|
7783
|
-
/**
|
|
7784
|
-
* Get new property collection filtered by active status
|
|
7785
|
-
*/
|
|
7786
|
-
PropertyCollection.prototype.getActiveProperties = function () {
|
|
7787
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.isActive; }));
|
|
7788
|
-
};
|
|
7789
|
-
PropertyCollection.prototype.getCreatedProperties = function () {
|
|
7790
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.isOwn(); }));
|
|
7791
|
-
};
|
|
7792
|
-
/**
|
|
7793
|
-
* Get new property collection filtered by shared
|
|
7794
|
-
*/
|
|
7795
|
-
PropertyCollection.prototype.getSharedProperties = function () {
|
|
7796
|
-
return new PropertyCollection(this.items.filter(function (property) { return !property.isOwn(); }));
|
|
7797
|
-
};
|
|
7798
|
-
/**
|
|
7799
|
-
* Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
|
|
7800
|
-
*/
|
|
7801
|
-
PropertyCollection.prototype.getTaxInclusive = function () {
|
|
7802
|
-
return this.create(this.items.filter(function (property) { return property.category.isTaxInclusive; }));
|
|
7803
|
-
};
|
|
7804
|
-
PropertyCollection.prototype.getUnsold = function () {
|
|
7805
|
-
return this.create(this.items.filter(function (property) { return !property.isSold(); }));
|
|
7806
|
-
};
|
|
7807
|
-
Object.defineProperty(PropertyCollection.prototype, "purchasePrice", {
|
|
7808
|
-
/**
|
|
7809
|
-
* Get total purchase price for all properties in the collection
|
|
7810
|
-
*/
|
|
7811
|
-
get: function () {
|
|
7812
|
-
return this.sumBy('purchasePrice');
|
|
7813
|
-
},
|
|
7814
|
-
enumerable: false,
|
|
7815
|
-
configurable: true
|
|
7816
|
-
});
|
|
7817
|
-
Object.defineProperty(PropertyCollection.prototype, "growthPercent", {
|
|
7818
|
-
get: function () {
|
|
7819
|
-
return this.sumBy('growthPercent');
|
|
7820
|
-
},
|
|
7821
|
-
enumerable: false,
|
|
7822
|
-
configurable: true
|
|
7823
|
-
});
|
|
7824
|
-
Object.defineProperty(PropertyCollection.prototype, "marketValue", {
|
|
7825
|
-
get: function () {
|
|
7826
|
-
return this.sumBy('marketValue');
|
|
7827
|
-
},
|
|
7828
|
-
enumerable: false,
|
|
7829
|
-
configurable: true
|
|
7830
|
-
});
|
|
7831
|
-
Object.defineProperty(PropertyCollection.prototype, "firstForecastYear", {
|
|
7832
|
-
get: function () {
|
|
7833
|
-
return this.items.reduce(function (min, property) {
|
|
7834
|
-
var current = property.firstForecastYear;
|
|
7835
|
-
return min > current ? current : min;
|
|
7836
|
-
}, new FinancialYear().year);
|
|
7837
|
-
},
|
|
7838
|
-
enumerable: false,
|
|
7839
|
-
configurable: true
|
|
7840
|
-
});
|
|
7841
|
-
Object.defineProperty(PropertyCollection.prototype, "marketValueGrowth", {
|
|
7842
|
-
get: function () {
|
|
7843
|
-
return (this.marketValue - this.purchasePrice) / this.purchasePrice;
|
|
7844
|
-
},
|
|
7845
|
-
enumerable: false,
|
|
7846
|
-
configurable: true
|
|
7847
|
-
});
|
|
7848
|
-
/**
|
|
7849
|
-
* list of properties
|
|
7850
|
-
*/
|
|
7851
|
-
PropertyCollection.prototype.getCGTApplicable = function () {
|
|
7852
|
-
return this.create(this.items.filter(function (property) { return property.isCGTApplicable(); }));
|
|
7853
|
-
};
|
|
7854
|
-
PropertyCollection.prototype.getOwnerOccupiedProperties = function () {
|
|
7855
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.category.isOwnerOccupied(); }));
|
|
7856
|
-
};
|
|
7857
|
-
Object.defineProperty(PropertyCollection.prototype, "earliestContractDate", {
|
|
7858
|
-
get: function () {
|
|
7859
|
-
return this.items.reduce(function (min, property) {
|
|
7860
|
-
return min < property.contractDate ? min : property.contractDate;
|
|
7861
|
-
}, new FinancialYear(new Date()).startDate);
|
|
7862
|
-
},
|
|
7863
|
-
enumerable: false,
|
|
7864
|
-
configurable: true
|
|
7865
|
-
});
|
|
7866
|
-
/**
|
|
7867
|
-
* Get list of unique property categories from collection
|
|
7868
|
-
*/
|
|
7869
|
-
PropertyCollection.prototype.getCategories = function () {
|
|
7870
|
-
return uniqBy__default["default"](this.items.map(function (property) { return property.category; }), 'id');
|
|
7871
|
-
};
|
|
7872
|
-
/**
|
|
7873
|
-
* Get property with the highest growth percent
|
|
7874
|
-
*/
|
|
7875
|
-
PropertyCollection.prototype.getBestPerformanceGrowthProperty = function () {
|
|
7876
|
-
return this.items.reduce(function (max, current) {
|
|
7877
|
-
return max.growthPercent < current.growthPercent ? current : max;
|
|
7878
|
-
}, this.first);
|
|
7879
|
-
};
|
|
7880
|
-
/**
|
|
7881
|
-
* Get property with the lowest tax position
|
|
7882
|
-
*/
|
|
7883
|
-
PropertyCollection.prototype.getBestPerformanceTaxProperty = function (transactions, depreciations) {
|
|
7884
|
-
var transactionsByProperty = transactions.groupBy('property.id');
|
|
7885
|
-
var depreciationsByProperty = depreciations.groupBy('property.id');
|
|
7886
|
-
return this.items.reduce(function (min, current) {
|
|
7887
|
-
var minTaxPosition = min.getTaxPosition(transactionsByProperty.get(min.id), depreciationsByProperty.get(min.id));
|
|
7888
|
-
var currentTaxPosition = current.getTaxPosition(transactionsByProperty.get(current.id), depreciationsByProperty.get(current.id));
|
|
7889
|
-
return minTaxPosition > currentTaxPosition ? current : min;
|
|
7890
|
-
}, this.first);
|
|
7891
|
-
};
|
|
7892
|
-
/**
|
|
7893
|
-
* Show best performance properties first
|
|
7894
|
-
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677997/Property+Tank+Dashboard
|
|
7895
|
-
*/
|
|
7896
|
-
PropertyCollection.prototype.sortByBestPerformance = function (transactions, depreciations) {
|
|
7897
|
-
var activeProperties = this.getActiveProperties();
|
|
7898
|
-
// nothing to sort when no active properties
|
|
7899
|
-
if (!activeProperties.length) {
|
|
7900
|
-
return this;
|
|
7901
|
-
}
|
|
7902
|
-
var bestProperties = uniqBy__default["default"](this.create([
|
|
7903
|
-
activeProperties.getBestPerformanceGrowthProperty(),
|
|
7904
|
-
activeProperties.getBestPerformanceTaxProperty(transactions, depreciations)
|
|
7905
|
-
]).toArray(), 'id');
|
|
7906
|
-
var newItems = this.remove(bestProperties).toArray();
|
|
7907
|
-
newItems.unshift.apply(newItems, __spreadArray([], __read(bestProperties)));
|
|
7908
|
-
return this.create(newItems);
|
|
7909
|
-
};
|
|
7910
|
-
return PropertyCollection;
|
|
7911
|
-
}(Collection));
|
|
7912
|
-
|
|
7913
|
-
var PropertySaleCollection = /** @class */ (function (_super) {
|
|
7914
|
-
__extends(PropertySaleCollection, _super);
|
|
7915
|
-
function PropertySaleCollection() {
|
|
7916
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
7917
|
-
}
|
|
7918
|
-
Object.defineProperty(PropertySaleCollection.prototype, "grossCGT", {
|
|
7919
|
-
get: function () {
|
|
7920
|
-
return this.create(this.items.filter(function (propertySale) { return propertySale.grossCGT > 0; })).sumBy('grossCGT');
|
|
7921
|
-
},
|
|
7922
|
-
enumerable: false,
|
|
7923
|
-
configurable: true
|
|
7924
|
-
});
|
|
7925
|
-
/**
|
|
7926
|
-
* Property sales are CGT applicable unless it has "Principle place of residence" exemption type
|
|
7927
|
-
*/
|
|
7928
|
-
PropertySaleCollection.prototype.getCGTApplicable = function () {
|
|
7929
|
-
return this.create(this.items.filter(function (propertySale) { return propertySale.isCGTApplicable(); }));
|
|
7930
|
-
};
|
|
7931
|
-
PropertySaleCollection.prototype.getByPropertyShareIds = function (ids) {
|
|
7932
|
-
return this.filterBy('share.id', ids);
|
|
7933
|
-
};
|
|
7934
|
-
return PropertySaleCollection;
|
|
7935
|
-
}(Collection));
|
|
7936
|
-
|
|
7937
8067
|
/**
|
|
7938
8068
|
* Enum with symbols based on depreciation LVP asset type
|
|
7939
8069
|
*/
|
|
@@ -8712,12 +8842,6 @@
|
|
|
8712
8842
|
ChartAccountsTypeEnum[ChartAccountsTypeEnum["EXPENSE"] = 2] = "EXPENSE";
|
|
8713
8843
|
})(exports.ChartAccountsTypeEnum || (exports.ChartAccountsTypeEnum = {}));
|
|
8714
8844
|
|
|
8715
|
-
exports.ChatStatusEnum = void 0;
|
|
8716
|
-
(function (ChatStatusEnum) {
|
|
8717
|
-
ChatStatusEnum[ChatStatusEnum["ACTIVE"] = 1] = "ACTIVE";
|
|
8718
|
-
ChatStatusEnum[ChatStatusEnum["INACTIVE"] = 2] = "INACTIVE";
|
|
8719
|
-
})(exports.ChatStatusEnum || (exports.ChatStatusEnum = {}));
|
|
8720
|
-
|
|
8721
8845
|
exports.ClientDetailsMedicareExemptionEnum = void 0;
|
|
8722
8846
|
(function (ClientDetailsMedicareExemptionEnum) {
|
|
8723
8847
|
ClientDetailsMedicareExemptionEnum[ClientDetailsMedicareExemptionEnum["NO"] = 0] = "NO";
|
|
@@ -9567,6 +9691,9 @@
|
|
|
9567
9691
|
__decorate([
|
|
9568
9692
|
classTransformer.Type(function () { return User; })
|
|
9569
9693
|
], Message.prototype, "employee", void 0);
|
|
9694
|
+
__decorate([
|
|
9695
|
+
classTransformer.Type(function () { return Chat; })
|
|
9696
|
+
], Message.prototype, "chat", void 0);
|
|
9570
9697
|
__decorate([
|
|
9571
9698
|
classTransformer.Type(function () { return MessageDocument; }),
|
|
9572
9699
|
classTransformer.Expose()
|
|
@@ -9828,42 +9955,6 @@
|
|
|
9828
9955
|
AlphabetColorsEnum["Z"] = "#E3C9CE";
|
|
9829
9956
|
})(exports.AlphabetColorsEnum || (exports.AlphabetColorsEnum = {}));
|
|
9830
9957
|
|
|
9831
|
-
/**
|
|
9832
|
-
* List of objects grouped by passed property
|
|
9833
|
-
*/
|
|
9834
|
-
var Dictionary = /** @class */ (function () {
|
|
9835
|
-
function Dictionary(items, path) {
|
|
9836
|
-
if (path === void 0) { path = 'id'; }
|
|
9837
|
-
this.items = {};
|
|
9838
|
-
if (!items.length) {
|
|
9839
|
-
return;
|
|
9840
|
-
}
|
|
9841
|
-
// Do nothing if provided path was not found in the 1st item
|
|
9842
|
-
if (!hasIn__default["default"](items[0], path.split('.')[0])) {
|
|
9843
|
-
return;
|
|
9844
|
-
}
|
|
9845
|
-
this.groupItems(items, path);
|
|
9846
|
-
}
|
|
9847
|
-
Dictionary.prototype.add = function (key, value) {
|
|
9848
|
-
this.items[key] = value;
|
|
9849
|
-
};
|
|
9850
|
-
Dictionary.prototype.get = function (key) {
|
|
9851
|
-
return this.items[key] !== undefined ? this.items[key] : null;
|
|
9852
|
-
};
|
|
9853
|
-
Dictionary.prototype.groupItems = function (items, path) {
|
|
9854
|
-
var _this = this;
|
|
9855
|
-
items.forEach(function (item) {
|
|
9856
|
-
var key = get__default["default"](item, path);
|
|
9857
|
-
// if object does not have property for grouping it will be grouped as 'other'
|
|
9858
|
-
if (key === undefined) {
|
|
9859
|
-
key = 'other';
|
|
9860
|
-
}
|
|
9861
|
-
_this.items[key] = item;
|
|
9862
|
-
});
|
|
9863
|
-
};
|
|
9864
|
-
return Dictionary;
|
|
9865
|
-
}());
|
|
9866
|
-
|
|
9867
9958
|
exports.DepreciationGroupEnum = void 0;
|
|
9868
9959
|
(function (DepreciationGroupEnum) {
|
|
9869
9960
|
DepreciationGroupEnum[DepreciationGroupEnum["BUILDING_IMPROVEMENTS"] = 0] = "BUILDING_IMPROVEMENTS";
|
|
@@ -17476,7 +17567,7 @@
|
|
|
17476
17567
|
* We take the first forecast because income sources available only for new business, so we have only one forecast
|
|
17477
17568
|
*/
|
|
17478
17569
|
get: function () {
|
|
17479
|
-
if (
|
|
17570
|
+
if (this.business.id) {
|
|
17480
17571
|
return null;
|
|
17481
17572
|
}
|
|
17482
17573
|
return this.get('incomeSource').get('soleForecasts').at(0);
|
|
@@ -17489,7 +17580,7 @@
|
|
|
17489
17580
|
* We take the first loss because losses available only for new business, so we have only one loss
|
|
17490
17581
|
*/
|
|
17491
17582
|
get: function () {
|
|
17492
|
-
if (
|
|
17583
|
+
if (this.business.id) {
|
|
17493
17584
|
return null;
|
|
17494
17585
|
}
|
|
17495
17586
|
return this.get('losses').at(0);
|
|
@@ -17647,7 +17738,8 @@
|
|
|
17647
17738
|
items: new forms.FormArray((invoice.items || [classTransformer.plainToClass(SoleInvoiceItem, {})]).map(function (item) { return new SoleInvoiceItemForm(item); })),
|
|
17648
17739
|
payer: new forms.FormControl(invoice.payer, forms.Validators.required),
|
|
17649
17740
|
taxType: new forms.FormControl(invoice.taxType, forms.Validators.required),
|
|
17650
|
-
bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required)
|
|
17741
|
+
bankAccount: new forms.FormControl(invoice.bankAccount, forms.Validators.required),
|
|
17742
|
+
reference: new forms.FormControl(invoice.reference)
|
|
17651
17743
|
}, invoice) || this;
|
|
17652
17744
|
_this.soleDetailsGST = soleDetailsGST;
|
|
17653
17745
|
// we need invoice template only for new invoices
|
|
@@ -18895,6 +18987,7 @@
|
|
|
18895
18987
|
exports.ChartData = ChartData;
|
|
18896
18988
|
exports.ChartSerie = ChartSerie;
|
|
18897
18989
|
exports.Chat = Chat;
|
|
18990
|
+
exports.ChatCollection = ChatCollection;
|
|
18898
18991
|
exports.ChatService = ChatService;
|
|
18899
18992
|
exports.ClientCollection = ClientCollection;
|
|
18900
18993
|
exports.ClientDetails = ClientDetails;
|
|
@@ -19030,6 +19123,7 @@
|
|
|
19030
19123
|
exports.PropertyCalculationService = PropertyCalculationService;
|
|
19031
19124
|
exports.PropertyCategory = PropertyCategory;
|
|
19032
19125
|
exports.PropertyCategoryMovement = PropertyCategoryMovement;
|
|
19126
|
+
exports.PropertyCategoryMovementCollection = PropertyCategoryMovementCollection;
|
|
19033
19127
|
exports.PropertyCategoryMovementService = PropertyCategoryMovementService;
|
|
19034
19128
|
exports.PropertyCategoryService = PropertyCategoryService;
|
|
19035
19129
|
exports.PropertyCollection = PropertyCollection;
|
|
@@ -19052,6 +19146,7 @@
|
|
|
19052
19146
|
exports.PropertySaleExemptionsForm = PropertySaleExemptionsForm;
|
|
19053
19147
|
exports.PropertySaleService = PropertySaleService;
|
|
19054
19148
|
exports.PropertySaleTaxExemptionMetadata = PropertySaleTaxExemptionMetadata;
|
|
19149
|
+
exports.PropertySaleTaxExemptionMetadataCollection = PropertySaleTaxExemptionMetadataCollection;
|
|
19055
19150
|
exports.PropertyService = PropertyService;
|
|
19056
19151
|
exports.PropertyShare = PropertyShare;
|
|
19057
19152
|
exports.PropertyShareService = PropertyShareService;
|