From 5f9b5054c4eacb653d01eda829105f5ef93a4e76 Mon Sep 17 00:00:00 2001 From: Olya Date: Mon, 4 Apr 2022 11:58:32 +0200 Subject: [PATCH] =?UTF-8?q?['=D0=A0=D0=B5=D0=B4=D0=B0=D0=B3=D1=83=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8F=20=D0=B7=D0=B0=D0=BA=D0=BB=D0=B0=D0=B4?= =?UTF-8?q?=D1=83'=20page]=20Incorrect=20validation=20of=20the=20'=D0=92?= =?UTF-8?q?=D1=83=D0=BB=D0=B8=D1=86=D1=8F'=20field=20with=20correct=20data?= =?UTF-8?q?=20#900=20(#1028)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix * fix * fix --- src/app/shared/constants/regex-constants.ts | 2 -- .../create-contacts-form.component.ts | 13 +++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/shared/constants/regex-constants.ts b/src/app/shared/constants/regex-constants.ts index 744279e8ad..7782001623 100644 --- a/src/app/shared/constants/regex-constants.ts +++ b/src/app/shared/constants/regex-constants.ts @@ -8,6 +8,4 @@ export const DATE_REGEX: RegExp = /[^0-9./-]*/g; export const NAME_REGEX: RegExp = /^[А-Яа-яЇїІіЄєЁёҐґ'’-]*$/; export const BIRTH_CERTIFICATE_REGEX: RegExp = /^[A-Za-zА-Яа-яЇїІіЄєЁёҐґ'’\s\d-№]*$/; export const WEB_INST_FB_REGEX: RegExp = /^[А-Яа-яЇїІіЄєЁёҐґ'’.,\d\/-]*$/; - export const EDRPOUIPN_REGEX: RegExp = /^[A-Za-zА-Яа-яЇїІіЄєЁёҐґ'’`.,\s\d-№]*$/; - diff --git a/src/app/shell/personal-cabinet/provider/create-provider/create-contacts-form/create-contacts-form.component.ts b/src/app/shell/personal-cabinet/provider/create-provider/create-contacts-form/create-contacts-form.component.ts index b82cd0d6fe..2aee8cce4f 100644 --- a/src/app/shell/personal-cabinet/provider/create-provider/create-contacts-form/create-contacts-form.component.ts +++ b/src/app/shell/personal-cabinet/provider/create-provider/create-contacts-form/create-contacts-form.component.ts @@ -70,7 +70,8 @@ export class CreateContactsFormComponent implements OnInit, OnDestroy { this.ActualAddressFormGroup.enable(); this.ActualAddressFormGroup.markAsUntouched(); this.setValidators(); - this.provider?.actualAddress && this.ActualAddressFormGroup.get('id').setValue(this.provider.actualAddress.id); + this.provider?.actualAddress && this.ActualAddressFormGroup.get('id') + .setValue(this.provider.actualAddress.id); } }); } @@ -78,11 +79,15 @@ export class CreateContactsFormComponent implements OnInit, OnDestroy { * This method add validators to teh form-group when actual address is not teh same as legal address */ private setValidators(): void { - const addValidator = (formControlTitle: string) => (formControlTitle !== 'buildingNumber') ? Validators.pattern(TEXT_REGEX) : Validators.pattern(TEXT_WITH_DIGITS_REGEX); + const addValidator = (formControlTitle: string) => (formControlTitle === 'buildingNumber' + || formControlTitle === 'street') + ? Validators.pattern(TEXT_WITH_DIGITS_REGEX) + : Validators.pattern(TEXT_REGEX); Object.keys(this.ActualAddressFormGroup.controls).forEach((formControlTitle: string) => { - this.ActualAddressFormGroup.get(formControlTitle).setValidators([addValidator(formControlTitle), Validators.required]); - }); + this.ActualAddressFormGroup.get(formControlTitle) + .setValidators([addValidator(formControlTitle), Validators.required]); + }); } ngOnDestroy(): void {