UI: fixed country autocomplete and zip error message

This commit is contained in:
rusikv 2024-09-13 11:41:01 +03:00
parent 6e76509619
commit 278124746c
2 changed files with 5 additions and 5 deletions

View File

@ -20,22 +20,22 @@
formControlName="country" formControlName="country"
(selectCountryCode)="changeCountry($event)"> (selectCountryCode)="changeCountry($event)">
</tb-country-autocomplete> </tb-country-autocomplete>
<div fxLayout.gt-sm="row" fxLayoutGap.gt-sm="10px"> <div class="tb-form-row column-xs tb-standard-fields no-border no-padding">
<mat-form-field class="mat-block"> <mat-form-field class="flex">
<mat-label translate>contact.city</mat-label> <mat-label translate>contact.city</mat-label>
<input matInput formControlName="city"> <input matInput formControlName="city">
<mat-error *ngIf="parentForm.get('city').hasError('maxlength')"> <mat-error *ngIf="parentForm.get('city').hasError('maxlength')">
{{ 'contact.city-max-length' | translate }} {{ 'contact.city-max-length' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="mat-block"> <mat-form-field class="flex">
<mat-label translate>contact.state</mat-label> <mat-label translate>contact.state</mat-label>
<input matInput formControlName="state"> <input matInput formControlName="state">
<mat-error *ngIf="parentForm.get('state').hasError('maxlength')"> <mat-error *ngIf="parentForm.get('state').hasError('maxlength')">
{{ 'contact.state-max-length' | translate }} {{ 'contact.state-max-length' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="mat-block"> <mat-form-field class="flex">
<mat-label translate>contact.postal-code</mat-label> <mat-label translate>contact.postal-code</mat-label>
<input matInput formControlName="zip"> <input matInput formControlName="zip">
<mat-error *ngIf="parentForm.get('zip').hasError('pattern')"> <mat-error *ngIf="parentForm.get('zip').hasError('pattern')">

View File

@ -200,7 +200,7 @@ export class CountryAutocompleteComponent implements OnInit, ControlValueAccesso
private updateView(value: Country | null) { private updateView(value: Country | null) {
if (this.modelValue?.name !== value?.name) { if (this.modelValue?.name !== value?.name) {
this.modelValue = value; this.modelValue = value;
this.propagateChange(this.modelValue); this.propagateChange(this.modelValue?.name);
if (value) { if (value) {
this.selectCountryCode.emit(value.iso2); this.selectCountryCode.emit(value.iso2);
} }