taxtank-core 2.0.72 → 2.0.73
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/fesm2022/taxtank-core.mjs +23 -6
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -11556,6 +11556,9 @@ class FinancialGoal extends AbstractModel {
|
|
|
11556
11556
|
isCompleted() {
|
|
11557
11557
|
return this.status === FinancialGoalStatusEnum.COMPLETE;
|
|
11558
11558
|
}
|
|
11559
|
+
isAchieved() {
|
|
11560
|
+
return this.progress >= this.target;
|
|
11561
|
+
}
|
|
11559
11562
|
isPropertyType() {
|
|
11560
11563
|
return [FinancialGoalTypeEnum.PROPERTY_EQUITY, FinancialGoalTypeEnum.PROPERTY_LVR].includes(this.type);
|
|
11561
11564
|
}
|
|
@@ -11575,36 +11578,50 @@ class FinancialGoal extends AbstractModel {
|
|
|
11575
11578
|
* How much user saved so far.
|
|
11576
11579
|
*/
|
|
11577
11580
|
get progress() {
|
|
11578
|
-
|
|
11581
|
+
let progress = this.currentValue - this.initialValue;
|
|
11582
|
+
if (this.isLvr()) {
|
|
11583
|
+
progress = this.initialValue - this.currentValue;
|
|
11584
|
+
}
|
|
11585
|
+
return round(progress, 2);
|
|
11579
11586
|
}
|
|
11580
11587
|
/**
|
|
11581
11588
|
* How much is left to reach the goal from the current balance.
|
|
11582
11589
|
*/
|
|
11583
11590
|
get remaining() {
|
|
11584
|
-
|
|
11591
|
+
if (this.isCompleted() || this.isAchieved()) {
|
|
11592
|
+
return 0;
|
|
11593
|
+
}
|
|
11594
|
+
return round(this.target - this.progress, 2);
|
|
11585
11595
|
}
|
|
11586
11596
|
/**
|
|
11587
11597
|
* How much needs to deposit to achieve the goal from the start
|
|
11588
11598
|
*/
|
|
11589
11599
|
get target() {
|
|
11590
|
-
|
|
11600
|
+
let target = this.targetValue - this.initialValue;
|
|
11601
|
+
if (this.isLvr()) {
|
|
11602
|
+
target = this.initialValue - this.targetValue;
|
|
11603
|
+
}
|
|
11604
|
+
return round(target, 2);
|
|
11591
11605
|
}
|
|
11592
11606
|
/**
|
|
11593
11607
|
* How much of the goal is reached in percents.
|
|
11594
11608
|
*/
|
|
11595
11609
|
get progressPercent() {
|
|
11596
|
-
return this.progress / this.target;
|
|
11610
|
+
return round(this.progress / this.target, 2);
|
|
11597
11611
|
}
|
|
11598
11612
|
getBadge() {
|
|
11613
|
+
if (this.isPropertyType() && this.status === FinancialGoalStatusEnum.ACTIVE && this.progress > 0 && !this.isAchieved()) {
|
|
11614
|
+
return new Badge('Active', BadgeColorEnum.GREEN);
|
|
11615
|
+
}
|
|
11599
11616
|
switch (true) {
|
|
11600
11617
|
case this.status === FinancialGoalStatusEnum.PAUSE:
|
|
11601
11618
|
return new Badge('Paused', BadgeColorEnum.GOLD);
|
|
11602
11619
|
case this.status === FinancialGoalStatusEnum.COMPLETE:
|
|
11603
11620
|
return new Badge('Completed', BadgeColorEnum.GREEN);
|
|
11621
|
+
case this.isAchieved():
|
|
11622
|
+
return new Badge('Achieved', BadgeColorEnum.GREEN);
|
|
11604
11623
|
case this.forecast === 0:
|
|
11605
11624
|
return this.progress ? new Badge(`Ahead`, BadgeColorEnum.GREEN) : new Badge(`On track`, BadgeColorEnum.PRIMARY);
|
|
11606
|
-
case this.progress >= this.target:
|
|
11607
|
-
return new Badge('Achieved', BadgeColorEnum.GREEN);
|
|
11608
11625
|
case this.forecastPercent >= 1.05:
|
|
11609
11626
|
return new Badge(`Ahead by ${this.forecastPercent} %`, BadgeColorEnum.GREEN);
|
|
11610
11627
|
case this.forecastPercent >= 0.95 && this.forecastPercent <= 1.05:
|