taxtank-core 2.0.66 → 2.0.67

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.
@@ -9754,7 +9754,7 @@ class ClientPortfolioReportCollection extends Collection {
9754
9754
 
9755
9755
  class FinancialGoalCollection extends Collection {
9756
9756
  getActive() {
9757
- return this.filterBy('status', FinancialGoalStatusEnum.ACTIVE);
9757
+ return this.filterBy('status', [FinancialGoalStatusEnum.ACTIVE, FinancialGoalStatusEnum.PAUSE]);
9758
9758
  }
9759
9759
  }
9760
9760
 
@@ -11504,12 +11504,15 @@ class FinancialGoal extends AbstractModel {
11504
11504
  constructor() {
11505
11505
  super(...arguments);
11506
11506
  this.startDate = moment().startOf('day').toDate();
11507
- this.paymentFrequency = DailyFrequencyEnum.MONTHLY;
11508
- this.inCalendar = true;
11507
+ this.inCalendar = false;
11508
+ this.properties = [];
11509
11509
  }
11510
11510
  isCompleted() {
11511
11511
  return this.status === FinancialGoalStatusEnum.COMPLETE;
11512
11512
  }
11513
+ isPropertyType() {
11514
+ return [FinancialGoalTypeEnum.PROPERTY_EQUITY, FinancialGoalTypeEnum.PROPERTY_LVR].includes(this.type);
11515
+ }
11513
11516
  /**
11514
11517
  * today's forecasted progress
11515
11518
  */
@@ -11523,6 +11526,9 @@ class FinancialGoal extends AbstractModel {
11523
11526
  * How much user saved so far.
11524
11527
  */
11525
11528
  get progress() {
11529
+ if (this.isPropertyType()) {
11530
+ return 0;
11531
+ }
11526
11532
  return this.isCompleted()
11527
11533
  ? Math.abs(this.finalValue - this.initialValue)
11528
11534
  : Math.abs(this.bankAccount.currentBalance - this.initialValue);
@@ -23265,7 +23271,7 @@ function greaterThanControlValidator(controlName) {
23265
23271
  const group = control.parent;
23266
23272
  const fieldToCompare = group.get(controlName);
23267
23273
  const isLessThan = Number(fieldToCompare.value) > Number(control.value);
23268
- return isLessThan ? { min: { min: fieldToCompare.value, actual: control.value } } : null;
23274
+ return isLessThan ? { greaterThanControl: { min: fieldToCompare.value, actual: control.value } } : null;
23269
23275
  };
23270
23276
  }
23271
23277
 
@@ -23455,34 +23461,34 @@ const END_DATE_VALIDATION_ERROR = 'Target date must be more than start date';
23455
23461
  class FinancialGoalForm extends AbstractForm {
23456
23462
  constructor(goal = plainToClass(FinancialGoal, {})) {
23457
23463
  super({
23458
- type: new FormControl({
23459
- value: goal.type ?? FinancialGoalTypeEnum.DEBIT,
23460
- disabled: !!goal.id
23461
- }, Validators.required),
23464
+ type: new FormControl({ value: goal.type ?? FinancialGoalTypeEnum.DEBIT, disabled: !!goal.id }, Validators.required),
23462
23465
  name: new FormControl(goal.name, Validators.required),
23463
23466
  bankAccount: new FormControl({ value: goal.bankAccount, disabled: !!goal.id }, [
23464
- conditionalValidator(() => [FinancialGoalTypeEnum.CREDIT, FinancialGoalTypeEnum.DEBIT].includes(this.value.type), Validators.required),
23467
+ conditionalValidator(() => !this.isPropertyType(), Validators.required),
23465
23468
  ]),
23466
23469
  targetValue: new FormControl(goal.targetValue, [
23467
- conditionalValidator(() => this.value.type === FinancialGoalTypeEnum.DEBIT, Validators.min(0)),
23468
- conditionalValidator(() => this.value.type === FinancialGoalTypeEnum.CREDIT, Validators.max(0)),
23469
23470
  greaterThanControlValidator('initialValue'),
23470
23471
  Validators.required
23471
23472
  ]),
23472
- initialValue: new FormControl({ value: goal.initialValue, disabled: true }, Validators.required),
23473
+ initialValue: new FormControl({ value: goal.initialValue, disabled: false }, Validators.required),
23473
23474
  startDate: new FormControl({ value: goal.startDate, disabled: true }),
23474
23475
  endDate: new FormControl(goal.endDate, [Validators.required, minDateValidator(goal.startDate, END_DATE_VALIDATION_ERROR)]),
23475
- paymentFrequency: new FormControl(goal.paymentFrequency, Validators.required),
23476
- paymentAmount: new FormControl(goal.paymentAmount, Validators.required),
23476
+ paymentFrequency: new FormControl(goal.paymentFrequency, [
23477
+ conditionalValidator(() => !this.isPropertyType(), Validators.required),
23478
+ ]),
23479
+ paymentAmount: new FormControl(goal.paymentAmount, [
23480
+ conditionalValidator(() => !this.isPropertyType(), Validators.required),
23481
+ ]),
23477
23482
  inCalendar: new FormControl(goal.inCalendar),
23478
23483
  file: new FormControl(goal.file),
23479
23484
  description: new FormControl(goal.description),
23485
+ properties: new FormControl(goal.properties, [
23486
+ conditionalValidator(() => this.isPropertyType(), Validators.required),
23487
+ ]),
23480
23488
  }, goal);
23481
23489
  this.includeDisabledFields = true;
23482
23490
  this.bankAccountTypes = [];
23483
- this.isDebit = true;
23484
23491
  this.bankAccountTypes = this.getBankAccountTypes(goal.type);
23485
- this.isDebit = this.getIsDebit(goal.type);
23486
23492
  this.listenEvents();
23487
23493
  }
23488
23494
  listenEvents() {
@@ -23490,11 +23496,19 @@ class FinancialGoalForm extends AbstractForm {
23490
23496
  this.listenBankAccountChanges();
23491
23497
  this.listenPaymentChanges();
23492
23498
  }
23499
+ isPropertyType() {
23500
+ return [FinancialGoalTypeEnum.PROPERTY_EQUITY, FinancialGoalTypeEnum.PROPERTY_LVR].includes(this.value.type);
23501
+ }
23493
23502
  listenTypeChanges() {
23494
23503
  this.get('type').valueChanges.subscribe((type) => {
23495
23504
  this.get('bankAccount').setValue(null, { onlySelf: true });
23505
+ this.get('properties').setValue([], { onlySelf: true });
23506
+ if (this.isPropertyType()) {
23507
+ this.get('inCalendar').setValue(false, { onlySelf: true });
23508
+ this.get('paymentFrequency').setValue(false, { onlySelf: true });
23509
+ this.get('paymentAmount').setValue(false, { onlySelf: true });
23510
+ }
23496
23511
  this.bankAccountTypes = this.getBankAccountTypes(type);
23497
- this.isDebit = this.getIsDebit(type);
23498
23512
  });
23499
23513
  }
23500
23514
  /**
@@ -23563,13 +23577,12 @@ class FinancialGoalForm extends AbstractForm {
23563
23577
  switch (type) {
23564
23578
  case FinancialGoalTypeEnum.CREDIT:
23565
23579
  return [BankAccountTypeEnum.MORTGAGE, BankAccountTypeEnum.LOAN, BankAccountTypeEnum.CREDIT_CARD];
23566
- default:
23580
+ case FinancialGoalTypeEnum.DEBIT:
23567
23581
  return [BankAccountTypeEnum.TRANSACTION, BankAccountTypeEnum.SAVINGS, BankAccountTypeEnum.OFFSET];
23582
+ default:
23583
+ return [];
23568
23584
  }
23569
23585
  }
23570
- getIsDebit(type) {
23571
- return type !== FinancialGoalTypeEnum.CREDIT;
23572
- }
23573
23586
  }
23574
23587
 
23575
23588
  class FirmForm extends AbstractForm {