diff --git a/src/app/shared/components/filters-list/city-filter/city-filter.component.html b/src/app/shared/components/filters-list/city-filter/city-filter.component.html index eb10ec4895..25f4d98556 100644 --- a/src/app/shared/components/filters-list/city-filter/city-filter.component.html +++ b/src/app/shared/components/filters-list/city-filter/city-filter.component.html @@ -7,21 +7,18 @@ appTrimValue [formControl]="settlementSearchControl" [matAutocomplete]="auto" - (focusout)="onFocusOut()" - /> + (focusout)="onFocusOut($event)" /> + (optionSelected)="onSelectedCity($event)"> + [disabled]="codeficator.settlement === Constants.NO_SETTLEMENT"> {{ codeficator.settlement | translate }}
{{ codeficator.fullName }}
diff --git a/src/app/shared/components/filters-list/city-filter/city-filter.component.ts b/src/app/shared/components/filters-list/city-filter/city-filter.component.ts index 0a36175cd6..a571cd9aa9 100644 --- a/src/app/shared/components/filters-list/city-filter/city-filter.component.ts +++ b/src/app/shared/components/filters-list/city-filter/city-filter.component.ts @@ -92,12 +92,9 @@ export class CityFilterComponent implements OnInit, AfterViewInit, OnDestroy { * This method listen input FocusOut event and update search and settlement controls value * @param auto MatAutocomplete */ - public onFocusOut(): void { - if (!this.settlementSearchControl.value) { - const settlement = this.store.selectSnapshot(FilterState.settlement); - this.settlement = settlement; - this.settlementSearchControl.setValue(settlement.settlement, { emitEvent: false }); - this.codeficatorSearch = null; + public onFocusOut(event: FocusEvent): void { + if (!event.relatedTarget) { + this.settlementSearchControl.setValue(this.settlement.settlement); } }