taxtank-core 1.0.8 → 1.0.11

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
@@ -16136,20 +16136,8 @@ class VehicleClaimService extends RestService$1 {
16136
16136
  }
16137
16137
  listenEvents() {
16138
16138
  this.eventDispatcherService.on([AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_UPDATED]).subscribe(() => {
16139
- // @TODO it prevents updateWorkUsage (because cache is empty), need to make all changes either on front or back
16140
- // this.refreshCache();
16141
- });
16142
- }
16143
- /**
16144
- * Update workUsage for all vehicle claims if logbook best period changed
16145
- * @TODO Vik: Best period move this and related logic to backend
16146
- */
16147
- updateWorkUsage(bestLogbooks) {
16148
- const batch$ = (this.cache ?? []).map((claim) => {
16149
- const claimToUpdate = plainToClass(VehicleClaim, Object.assign({}, claim, { workUsage: bestLogbooks.getWorkUsage(claim) }));
16150
- return this.put(claimToUpdate);
16139
+ this.refreshCache();
16151
16140
  });
16152
- return combineLatest(batch$);
16153
16141
  }
16154
16142
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: VehicleClaimService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
16155
16143
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: VehicleClaimService, providedIn: 'root' }); }
@@ -23352,7 +23340,9 @@ class PropertyForecastForm extends AbstractForm {
23352
23340
  * @param forecast
23353
23341
  * @param movements property could have multiple categories within forecast year, based on categories we hide/show some fields
23354
23342
  */
23355
- constructor(forecast = plainToClass(PropertyForecast, {}), movements = new PropertyCategoryMovementCollection()) {
23343
+ constructor(forecast = plainToClass(PropertyForecast, {}),
23344
+ // @TODO why collection? forecast can be related with just one movement
23345
+ movements = new PropertyCategoryMovementCollection()) {
23356
23346
  const noIncomeCategories = [PropertyCategoryListEnum.VACANT_LAND, PropertyCategoryListEnum.OWNER_OCCUPIED];
23357
23347
  const noIncome = movements.filterBy('propertyCategory.id', noIncomeCategories).length === movements.length;
23358
23348
  super({
@@ -23361,7 +23351,7 @@ class PropertyForecastForm extends AbstractForm {
23361
23351
  expense: new UntypedFormControl(forecast.expense, Validators.required),
23362
23352
  interest: new UntypedFormControl(forecast.interest, Validators.required),
23363
23353
  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])
23354
+ claimPercent: new UntypedFormControl({ value: forecast.claimPercent, disabled: !movements.isShared() }, [Validators.min(0), Validators.max(100), Validators.required])
23365
23355
  }, forecast);
23366
23356
  }
23367
23357
  }