taxtank-core 2.1.68 → 2.1.70

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.
@@ -25679,21 +25679,30 @@ class BankAccountForm extends BankAccountAllocationForm {
25679
25679
  }
25680
25680
 
25681
25681
  class BankAccountsFilterForm extends AbstractForm {
25682
- constructor() {
25682
+ constructor(bankAccounts) {
25683
25683
  super({
25684
25684
  tankType: new FormControl(),
25685
25685
  property: new FormControl(),
25686
25686
  isActive: new FormControl(true),
25687
25687
  searchQuery: new FormControl(''),
25688
- currencyType: new FormControl(CurrencyTypeEnum.ALL),
25688
+ currencyType: new FormControl({
25689
+ value: CurrencyTypeEnum.ALL,
25690
+ disabled: bankAccounts.items.every(bankAccount => !bankAccount.isForeign),
25691
+ }),
25689
25692
  currencies: new FormControl({ value: [], disabled: true }),
25690
25693
  });
25694
+ this.bankAccounts = bankAccounts;
25691
25695
  this.listenFormControlsChanges();
25692
25696
  }
25693
25697
  listenFormControlsChanges() {
25694
25698
  this.get('currencyType').valueChanges.subscribe((value) => {
25695
- value === CurrencyTypeEnum.FOREIGN ? this.get('currencies').enable() : this.get('currencies').disable();
25696
- this.get('currencies').reset();
25699
+ if (value === CurrencyTypeEnum.FOREIGN) {
25700
+ this.get('currencies').enable();
25701
+ this.get('currencies').setValue(this.bankAccounts.uniqMapBy('currency'));
25702
+ }
25703
+ else {
25704
+ this.get('currencies').disable();
25705
+ }
25697
25706
  });
25698
25707
  // don't filter by single property when tank type changed
25699
25708
  this.get('tankType').valueChanges