diff --git a/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.html b/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.html index 3da32ef479..d82091b18f 100644 --- a/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.html +++ b/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.html @@ -6,6 +6,7 @@ + @@ -47,4 +48,10 @@ "Перевірте введені данні.
Використовуйте будь ласка тільки кирилицю, цифри та символи ( ' - / , . )"
+
+ + + + "Це поле має містити від {{ minCharachters }} до {{ maxCharachters }} символів" + \ No newline at end of file diff --git a/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.ts b/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.ts index c45887cc96..12d2b5957a 100644 --- a/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.ts +++ b/src/app/shared/components/validation-hint-for-input/validation-hint-for-input.component.ts @@ -11,7 +11,9 @@ export class ValidationHintForInputComponent { @Input() isEmailCheck: boolean; @Input() isEmptyCheck: boolean; @Input() minLength: boolean; + @Input() maxLength: boolean; @Input() minCharachters: number; + @Input() maxCharachters: number; @Input() forbiddenCharacter: string; constructor() { diff --git a/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.html b/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.html index 2c617cc42a..e64195128d 100644 --- a/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.html +++ b/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.html @@ -13,6 +13,13 @@ [invalid]="ChildFormGroup.get('lastName').invalid && ChildFormGroup.get('lastName').touched" [forbiddenCharacter]="ChildFormGroup.get('lastName').errors?.pattern?.requiredPattern"> + + @@ -26,6 +33,13 @@ [invalid]="ChildFormGroup.get('firstName').invalid && ChildFormGroup.get('firstName').touched" [forbiddenCharacter]="ChildFormGroup.get('firstName').errors?.pattern?.requiredPattern"> + + @@ -39,6 +53,13 @@ [invalid]="ChildFormGroup.get('middleName').invalid && ChildFormGroup.get('middleName').touched" [forbiddenCharacter]="ChildFormGroup.get('middleName').errors?.pattern?.requiredPattern"> + + @@ -74,11 +95,33 @@ + + + + + + + + diff --git a/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.spec.ts b/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.spec.ts index 671abcaba6..79276edb04 100644 --- a/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.spec.ts +++ b/src/app/shell/personal-cabinet/parent/create-child/child-form/child-form.component.spec.ts @@ -72,6 +72,8 @@ class MockValidationHintForInputComponent { @Input() isEmailCheck: boolean; @Input() isEmptyCheck: boolean; @Input() minLength: boolean; + @Input() maxLength: boolean; @Input() minCharachters: number; + @Input() maxCharachters: number; @Input() forbiddenCharacter: string; } diff --git a/src/app/shell/personal-cabinet/parent/create-child/create-child.component.ts b/src/app/shell/personal-cabinet/parent/create-child/create-child.component.ts index b0958b1e77..527e2a55dc 100644 --- a/src/app/shell/personal-cabinet/parent/create-child/create-child.component.ts +++ b/src/app/shell/personal-cabinet/parent/create-child/create-child.component.ts @@ -15,7 +15,7 @@ import { MetaDataState } from 'src/app/shared/store/meta-data.state'; import { AddNavPath } from 'src/app/shared/store/navigation.actions'; import { RegistrationState } from 'src/app/shared/store/registration.state'; import { CreateChildren, UpdateChild } from 'src/app/shared/store/user.actions'; -import { TEXT_REGEX } from 'src/app/shared/constants/regex-constants'; +import { TEXT_REGEX, TEXT_WITH_DIGITS_REGEX } from 'src/app/shared/constants/regex-constants'; import { Constants } from 'src/app/shared/constants/constants'; import { CreateFormComponent } from '../../create-form/create-form.component'; @@ -90,15 +90,38 @@ export class CreateChildComponent extends CreateFormComponent implements OnInit, */ private newForm(child?: Child): FormGroup { const childFormGroup = this.fb.group({ - lastName: new FormControl('', [Validators.required, Validators.pattern(TEXT_REGEX)]), - firstName: new FormControl('', [Validators.required, Validators.pattern(TEXT_REGEX)]), - middleName: new FormControl('', [Validators.required, Validators.pattern(TEXT_REGEX)]), + lastName: new FormControl('', [ + Validators.required, + Validators.pattern(TEXT_REGEX), + Validators.minLength(1), + Validators.maxLength(30) + ]), + firstName: new FormControl('', [ + Validators.required, + Validators.pattern(TEXT_REGEX), + Validators.minLength(1), + Validators.maxLength(30) + ]), + middleName: new FormControl('', [ + Validators.required, + Validators.pattern(TEXT_REGEX), + Validators.minLength(1), + Validators.maxLength(30) + ]), dateOfBirth: new FormControl('', Validators.required), gender: new FormControl('', Validators.required), socialGroupId: new FormControl(Constants.SOCIAL_GROUP_ID_ABSENT_VALUE), - placeOfStudy: new FormControl(''), - placeOfLiving: new FormControl(''), + placeOfLiving: new FormControl('', [ + Validators.pattern(TEXT_WITH_DIGITS_REGEX), + Validators.minLength(10), + Validators.maxLength(256) + ]), certificateOfBirth: new FormControl(''), + placeOfStudy: new FormControl('', [ + Validators.pattern(TEXT_WITH_DIGITS_REGEX), + Validators.minLength(10), + Validators.maxLength(256) + ]) }); this.subscribeOnDirtyForm(childFormGroup);