taxtank-core 2.1.67 → 2.1.69

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