taxtank-core 1.0.8 → 1.0.9

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.
@@ -2320,8 +2320,8 @@ class PropertyCategoryMovementCollection extends Collection {
2320
2320
  return this.filterBy('property.id', property.id)
2321
2321
  .filterByFinancialYear('fromDate', 'toDate', new FinancialYear(forecast.financialYear));
2322
2322
  }
2323
- hasCategory(categoryId) {
2324
- return !!this.findBy('propertyCategory.id', categoryId);
2323
+ isShared() {
2324
+ return !!this.findBy('propertyCategory.isPropertyShare', true);
2325
2325
  }
2326
2326
  /**
2327
2327
  * active movement by property based on selected year
@@ -23352,7 +23352,9 @@ class PropertyForecastForm extends AbstractForm {
23352
23352
  * @param forecast
23353
23353
  * @param movements property could have multiple categories within forecast year, based on categories we hide/show some fields
23354
23354
  */
23355
- constructor(forecast = plainToClass(PropertyForecast, {}), movements = new PropertyCategoryMovementCollection()) {
23355
+ constructor(forecast = plainToClass(PropertyForecast, {}),
23356
+ // @TODO why collection? forecast can be related with just one movement
23357
+ movements = new PropertyCategoryMovementCollection()) {
23356
23358
  const noIncomeCategories = [PropertyCategoryListEnum.VACANT_LAND, PropertyCategoryListEnum.OWNER_OCCUPIED];
23357
23359
  const noIncome = movements.filterBy('propertyCategory.id', noIncomeCategories).length === movements.length;
23358
23360
  super({
@@ -23361,7 +23363,7 @@ class PropertyForecastForm extends AbstractForm {
23361
23363
  expense: new UntypedFormControl(forecast.expense, Validators.required),
23362
23364
  interest: new UntypedFormControl(forecast.interest, Validators.required),
23363
23365
  depreciation: new UntypedFormControl({ value: forecast.depreciation, disabled: noIncome }, Validators.required),
23364
- claimPercent: new UntypedFormControl({ value: forecast.claimPercent, disabled: !movements.hasCategory(PropertyCategoryListEnum.SHARED) }, [Validators.min(0), Validators.max(100), Validators.required])
23366
+ claimPercent: new UntypedFormControl({ value: forecast.claimPercent, disabled: !movements.isShared() }, [Validators.min(0), Validators.max(100), Validators.required])
23365
23367
  }, forecast);
23366
23368
  }
23367
23369
  }