taxtank-core 0.33.103 → 0.33.104
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/esm2022/src/lib/collections/bank-account.collection.mjs +2 -2
- package/esm2022/src/lib/collections/property/property-category-movement.collection.mjs +2 -1
- package/esm2022/src/lib/db/Models/property/property-forecast.mjs +1 -1
- package/esm2022/src/lib/forms/property/property-add.form.mjs +25 -38
- package/esm2022/src/lib/forms/property/property-forecast.form.mjs +1 -2
- package/esm2022/src/lib/models/client/sharesight/sharesight-details-messages.enum.mjs +3 -2
- package/esm2022/src/lib/models/client/sharesight/sharesight-details.mjs +5 -1
- package/esm2022/src/lib/models/property/property-forecast.mjs +6 -11
- package/esm2022/src/lib/models/property/property.mjs +3 -3
- package/esm2022/src/lib/models/report/property/property-report-item-depreciation.mjs +1 -2
- package/esm2022/src/lib/services/http/property/property.service.mjs +5 -2
- package/fesm2022/taxtank-core.mjs +39 -50
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/db/Models/property/property-forecast.d.ts +3 -3
- package/src/lib/forms/property/property-add.form.d.ts +5 -7
- package/src/lib/models/client/sharesight/sharesight-details-messages.enum.d.ts +2 -1
- package/src/lib/models/client/sharesight/sharesight-details.d.ts +1 -0
- package/src/lib/models/property/property-forecast.d.ts +0 -6
@@ -2311,6 +2311,7 @@ class PropertyCategoryMovementCollection extends Collection {
|
|
2311
2311
|
* @TODO TT-2355 Alex refactor propertyForecast, use separated api (then I can remove property from param)
|
2312
2312
|
*/
|
2313
2313
|
filterByForecast(property, forecast) {
|
2314
|
+
console.log(property, forecast);
|
2314
2315
|
return this.filterBy('property.id', property.id)
|
2315
2316
|
.filterByFinancialYear('fromDate', 'toDate', new FinancialYear(forecast.financialYear));
|
2316
2317
|
}
|
@@ -4387,7 +4388,8 @@ __decorate([
|
|
4387
4388
|
|
4388
4389
|
var SharesightDetailsMessagesEnum;
|
4389
4390
|
(function (SharesightDetailsMessagesEnum) {
|
4390
|
-
SharesightDetailsMessagesEnum["
|
4391
|
+
SharesightDetailsMessagesEnum["HOLDING_CONNECTED"] = "We're syncing your ShareSight trades, which might take a few minutes.";
|
4392
|
+
SharesightDetailsMessagesEnum["PROPERTY_CONNECTED"] = "We're syncing your properties, which might take a few minutes.";
|
4391
4393
|
SharesightDetailsMessagesEnum["DISCONNECTED"] = "Sharesight disconnected";
|
4392
4394
|
SharesightDetailsMessagesEnum["DISCONNECT_CONFIRM"] = "Disconnecting ShareSight means we can no longer sync data. Any trades already imported will become editable in TaxTank.";
|
4393
4395
|
SharesightDetailsMessagesEnum["ERROR"] = "Sharesight connection error";
|
@@ -4403,6 +4405,9 @@ class SharesightDetails extends AbstractModel {
|
|
4403
4405
|
isHolding() {
|
4404
4406
|
return this.redirectUri.includes('holdings-tank');
|
4405
4407
|
}
|
4408
|
+
get connectedMessage() {
|
4409
|
+
return this.isHolding() ? SharesightDetailsMessagesEnum.HOLDING_CONNECTED : SharesightDetailsMessagesEnum.PROPERTY_CONNECTED;
|
4410
|
+
}
|
4406
4411
|
}
|
4407
4412
|
__decorate([
|
4408
4413
|
Type(() => Date)
|
@@ -5663,6 +5668,11 @@ __decorate([
|
|
5663
5668
|
class PropertyForecast extends PropertyForecast$1 {
|
5664
5669
|
constructor() {
|
5665
5670
|
super(...arguments);
|
5671
|
+
this.income = 0;
|
5672
|
+
this.expense = 0;
|
5673
|
+
this.interest = 0;
|
5674
|
+
this.depreciation = 0;
|
5675
|
+
this.loanBalance = 0;
|
5666
5676
|
this.financialYear = new FinancialYear(new Date()).year;
|
5667
5677
|
}
|
5668
5678
|
/**
|
@@ -5679,13 +5689,6 @@ class PropertyForecast extends PropertyForecast$1 {
|
|
5679
5689
|
get taxPosition() {
|
5680
5690
|
return this.cashPosition + this.depreciation;
|
5681
5691
|
}
|
5682
|
-
/**
|
5683
|
-
* Get rental return percent
|
5684
|
-
* Rental Return = Income / Market Value
|
5685
|
-
*/
|
5686
|
-
get rentalReturn() {
|
5687
|
-
return this.income / this.marketValue;
|
5688
|
-
}
|
5689
5692
|
}
|
5690
5693
|
__decorate([
|
5691
5694
|
Transform(({ value }) => +value)
|
@@ -5702,9 +5705,6 @@ __decorate([
|
|
5702
5705
|
__decorate([
|
5703
5706
|
Transform(({ value }) => +value)
|
5704
5707
|
], PropertyForecast.prototype, "loanBalance", void 0);
|
5705
|
-
__decorate([
|
5706
|
-
Transform(({ value }) => +value)
|
5707
|
-
], PropertyForecast.prototype, "marketValue", void 0);
|
5708
5708
|
|
5709
5709
|
/**
|
5710
5710
|
* propertySale docs - https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4209508353/Property+Sold+button
|
@@ -5749,7 +5749,7 @@ class Property extends Property$1 {
|
|
5749
5749
|
?? plainToClass(PropertyForecast, {});
|
5750
5750
|
}
|
5751
5751
|
get forecastedRentalReturn() {
|
5752
|
-
return this.currentYearForecast?.
|
5752
|
+
return (this.currentYearForecast?.income ?? 0) / this.valuation.marketValue;
|
5753
5753
|
}
|
5754
5754
|
get forecastedTaxPosition() {
|
5755
5755
|
return this.currentYearForecast?.taxPosition || 0;
|
@@ -5777,7 +5777,7 @@ class Property extends Property$1 {
|
|
5777
5777
|
return this.subscriptions[0];
|
5778
5778
|
}
|
5779
5779
|
getForecastByYear(year) {
|
5780
|
-
return this.forecasts.find((forecast) => forecast.financialYear === year);
|
5780
|
+
return this.forecasts.find((forecast) => forecast.financialYear === year) ?? plainToClass(PropertyForecast, {});
|
5781
5781
|
}
|
5782
5782
|
get isShared() {
|
5783
5783
|
return this.shares.length > 1;
|
@@ -8101,7 +8101,6 @@ class PropertyReportItemDepreciation extends PropertyReportItem {
|
|
8101
8101
|
constructor(depreciations, property, chartAccounts) {
|
8102
8102
|
super(property, chartAccounts);
|
8103
8103
|
this.amount = Math.abs(depreciations.getCurrentYearForecastAmount());
|
8104
|
-
console.log(depreciations.first.type);
|
8105
8104
|
this.description = DEPRECIATION_TYPE_LABELS[depreciations.first.type];
|
8106
8105
|
}
|
8107
8106
|
}
|
@@ -9072,7 +9071,7 @@ class BankAccountCollection extends Collection {
|
|
9072
9071
|
return this.getLoanAccounts().reduce((sum, bankAccount) => sum + bankAccount.getMonthlyRepaymentAmount(propertyId), 0);
|
9073
9072
|
}
|
9074
9073
|
getLVR(property) {
|
9075
|
-
return this.getPropertyBalanceAmount(property.id) / property.
|
9074
|
+
return this.getPropertyBalanceAmount(property.id) / property.valuation.marketValue;
|
9076
9075
|
}
|
9077
9076
|
/**
|
9078
9077
|
* @TODO Alex/Vik: maybe we should get it from jwtToken or think about some localStorageService?
|
@@ -14534,6 +14533,9 @@ class PropertyService extends RestService$1 {
|
|
14534
14533
|
updatedProperty.corelogicLastRequest = new Date();
|
14535
14534
|
this.updateCache([updatedProperty], 'put');
|
14536
14535
|
return stats;
|
14536
|
+
}), catchError((error) => {
|
14537
|
+
this.handleError(error);
|
14538
|
+
return of({ growthPercent: 0, lowMarketValue: 0, marketValue: 0, highMarketValue: 0 });
|
14537
14539
|
}));
|
14538
14540
|
}
|
14539
14541
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PropertyService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
@@ -23310,7 +23312,6 @@ class PropertyForecastForm extends AbstractForm {
|
|
23310
23312
|
const noIncome = movements.filterBy('propertyCategory.id', noIncomeCategories).length === movements.length;
|
23311
23313
|
super({
|
23312
23314
|
financialYear: new UntypedFormControl({ value: forecast.financialYear, disabled: true }),
|
23313
|
-
marketValue: new UntypedFormControl(forecast.marketValue, Validators.required),
|
23314
23315
|
income: new UntypedFormControl({ value: forecast.income, disabled: noIncome }, Validators.required),
|
23315
23316
|
expense: new UntypedFormControl(forecast.expense, Validators.required),
|
23316
23317
|
interest: new UntypedFormControl(forecast.interest, Validators.required),
|
@@ -23326,30 +23327,33 @@ class PropertyForecastForm extends AbstractForm {
|
|
23326
23327
|
class PropertyAddForm extends AbstractForm {
|
23327
23328
|
constructor() {
|
23328
23329
|
super({
|
23329
|
-
address: new
|
23330
|
-
purchasePrice: new
|
23331
|
-
contractDate: new
|
23330
|
+
address: new FormControl(null, Validators.required),
|
23331
|
+
purchasePrice: new FormControl(null, Validators.required),
|
23332
|
+
contractDate: new FormControl(null, [
|
23332
23333
|
Validators.required,
|
23333
23334
|
maxDateValidator(new FinancialYear().endDate, 'You cannot add a property with a contract date in future financial years.')
|
23334
23335
|
]),
|
23335
|
-
settlementDate: new
|
23336
|
-
|
23337
|
-
|
23338
|
-
|
23339
|
-
shares: new UntypedFormArray([
|
23340
|
-
new PropertyShareForm()
|
23341
|
-
]),
|
23342
|
-
categoryMovements: new UntypedFormArray([
|
23343
|
-
new PropertyCategoryMovementForm()
|
23344
|
-
])
|
23336
|
+
settlementDate: new FormControl(null, Validators.required),
|
23337
|
+
share: new PropertyShareForm(),
|
23338
|
+
forecast: new PropertyForecastForm(),
|
23339
|
+
category: new FormControl(null, Validators.required)
|
23345
23340
|
}, plainToClass(Property, {}));
|
23346
|
-
|
23347
|
-
|
23348
|
-
|
23349
|
-
this.get('
|
23350
|
-
|
23341
|
+
this.listenEvents();
|
23342
|
+
}
|
23343
|
+
get forecastForm() {
|
23344
|
+
return this.get('forecast');
|
23345
|
+
}
|
23346
|
+
submit() {
|
23347
|
+
return super.submit({
|
23348
|
+
shares: [this.value.share],
|
23349
|
+
forecasts: [this.forecastForm.submit()]
|
23351
23350
|
});
|
23352
|
-
|
23351
|
+
}
|
23352
|
+
listenEvents() {
|
23353
|
+
this.listenCategoryChanges();
|
23354
|
+
}
|
23355
|
+
listenCategoryChanges() {
|
23356
|
+
this.get('category').valueChanges.subscribe((category) => {
|
23353
23357
|
if (category.isShared()) {
|
23354
23358
|
this.forecastForm.get('claimPercent').enable();
|
23355
23359
|
}
|
@@ -23366,21 +23370,6 @@ class PropertyAddForm extends AbstractForm {
|
|
23366
23370
|
}
|
23367
23371
|
});
|
23368
23372
|
}
|
23369
|
-
get valuationForm() {
|
23370
|
-
return this.categoryMovementForm.get('valuation');
|
23371
|
-
}
|
23372
|
-
get forecastForm() {
|
23373
|
-
// [0] because for property add form we have always 1 forecast form inside
|
23374
|
-
return this.get('forecasts').controls[0];
|
23375
|
-
}
|
23376
|
-
get shareForm() {
|
23377
|
-
// [0] because for property add form we have always 1 forecast form inside
|
23378
|
-
return this.get('shares').controls[0];
|
23379
|
-
}
|
23380
|
-
get categoryMovementForm() {
|
23381
|
-
// [0] because for property add form we always have 1 category movement form inside
|
23382
|
-
return this.get('categoryMovements').controls[0];
|
23383
|
-
}
|
23384
23373
|
}
|
23385
23374
|
|
23386
23375
|
class MyTaxBusinessDetailsForm extends AbstractForm {
|