taxtank-core 0.30.142 → 0.30.143

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.
@@ -3807,7 +3807,7 @@ var UserRolesEnum;
3807
3807
  UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
3808
3808
  UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
3809
3809
  UserRolesEnum["HOLDING_TANK"] = "ROLE_USER_HOLDING";
3810
- UserRolesEnum["SWITCH_USER"] = "ROLE_PREVIOUS_ADMIN";
3810
+ UserRolesEnum["SWITCH_USER"] = "IS_IMPERSONATOR";
3811
3811
  })(UserRolesEnum || (UserRolesEnum = {}));
3812
3812
 
3813
3813
  const USER_WORK_POSITION = {
@@ -6008,13 +6008,9 @@ class BorrowingReport extends BorrowingReport$1 {
6008
6008
  * some fields calculated automatically until user filled them manually
6009
6009
  */
6010
6010
  static calculate(salaryForecasts, incomeSourceForecasts, clientDetails = plainToClass(AnnualClientDetails, {}), report = plainToClass(BorrowingReport, {})) {
6011
- if (!report.netSalary) {
6012
- report.netSalary = new Collection(salaryForecasts).sumBy('monthlyAmount')
6013
- + new IncomeSourceForecastCollection(incomeSourceForecasts).bonuses.sumBy('monthlyAmount');
6014
- }
6015
- if (!report.spouseNetSalary) {
6016
- report.spouseNetSalary = clientDetails.spouseMonthlyIncome;
6017
- }
6011
+ report.netSalary = report.netSalary ?? new Collection(salaryForecasts).sumBy('monthlyAmount')
6012
+ + new IncomeSourceForecastCollection(incomeSourceForecasts).bonuses.sumBy('monthlyAmount');
6013
+ report.spouseNetSalary = report.spouseNetSalary ?? clientDetails.spouseMonthlyIncome;
6018
6014
  return report;
6019
6015
  }
6020
6016
  /**
@@ -21858,23 +21854,26 @@ class PropertySaleExemptionsForm extends AbstractForm {
21858
21854
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4717608961/Borrowing+Power+Report+-+Property+Tank
21859
21855
  */
21860
21856
  class BorrowingReportForm extends AbstractForm {
21861
- constructor(report) {
21857
+ /**
21858
+ * extra params are auto-calculated numbers used if user didn't specify manual numbers
21859
+ */
21860
+ constructor(report = plainToClass(BorrowingReport, {}), netSalary, spouseNetSalary) {
21862
21861
  super({
21863
21862
  netRentIncome: new FormControl(report.netRentIncome, Validators.required),
21864
21863
  loanRepaymentAmount: new FormControl(report.loanRepaymentAmount, Validators.required),
21865
- netSalary: new FormControl(report.netSalary),
21866
- spouseNetSalary: new FormControl(report.spouseNetSalary),
21864
+ netSalary: new FormControl(report.netSalary ?? netSalary),
21865
+ spouseNetSalary: new FormControl(report.spouseNetSalary ?? spouseNetSalary),
21867
21866
  otherLiabilities: new FormControl(report.otherLiabilities, Validators.required),
21868
21867
  livingExpenses: new FormControl(report.livingExpenses, Validators.required),
21869
21868
  }, report);
21870
21869
  }
21871
21870
  /**
21872
- * some fields are auto-calculated, shouldn't be updated until changedby user
21871
+ * some fields are auto-calculated, shouldn't be updated until changed by user
21873
21872
  */
21874
21873
  submit(data = {}, includeDisabledFields = false) {
21875
21874
  return super.submit({
21876
- netSalary: this.fieldChanged('netSalary') ? this.get('netSalary').value : null,
21877
- spouseNetSalary: this.fieldChanged('spouseNetSalary') ? this.get('spouseNetSalary').value : null,
21875
+ netSalary: (this.model.netSalary || this.fieldChanged('netSalary')) ? this.get('netSalary').value : null,
21876
+ spouseNetSalary: (this.model.netSalary || this.fieldChanged('spouseNetSalary')) ? this.get('spouseNetSalary').value : null,
21878
21877
  }, includeDisabledFields);
21879
21878
  }
21880
21879
  }