Skip to content

Commit

Permalink
[Edit child] The 'ЗБЕРЕГТИ' button stays enabled when mandatory 'По-б…
Browse files Browse the repository at this point in the history
…атькові' field is empty #962 (#974)

* enable save btn for empty middleName

* enable save btn for empty middleName

* fix

* fix

* fix

* fix

* fix

* fix
  • Loading branch information
Olya-web7 authored Mar 18, 2022
1 parent 8737148 commit d3f1669
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ <h3 class="wrapper-title">{{(editMode) ? 'РЕДАГУВАТИ' : 'ДОДАТИ'
<div fxLayout="row" fxLayoutAlign="center center" class="footer">
<a [routerLink]="'/personal-cabinet/parent/info'"><button mat-raised-button
class="btn btn-cancel">СКАСУВАТИ</button></a>
<button *ngIf='!editMode' [disabled]="!isAgreed || isEmpty" class="btn" mat-button type="submit"
<button *ngIf='!editMode' [disabled]="!isAgreed" class="btn" mat-button type="submit"
(click)="onSubmit()">ЗБЕРЕГТИ</button>
<button *ngIf='editMode' [disabled]="isEmpty" class="btn" mat-button type="submit"

(click)="onSubmit()">ЗБЕРЕГТИ</button>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,19 @@ export class CreateChildComponent extends CreateFormComponent implements OnInit,
if (socialGroups.length === 0) {
this.store.dispatch(new GetSocialGroup());
}
});

this.AgreementFormControl.valueChanges.pipe(
takeUntil(this.destroy$),
).subscribe((val: boolean) => this.isAgreed = val);

this.ChildrenFormArray.valueChanges.pipe(
takeUntil(this.destroy$),
).subscribe((val: boolean) => {
this.isEmpty = !val[0].lastName || !val[0].firstName || !val[0].middleName;
});
}

addNavPath(): void {
});

this.AgreementFormControl.valueChanges.pipe(
takeUntil(this.destroy$),
).subscribe((val: boolean) => this.isAgreed = val);

this.ChildrenFormArray.valueChanges.pipe(
takeUntil(this.destroy$),
).subscribe((val: FormGroup) =>
this.isEmpty = !val[0].lastName || !val[0].firstName || !val[0].middleName || !val[0].dateOfBirth);
}

addNavPath(): void {
this.store.dispatch(new AddNavPath(this.navigationBarService.creatNavPaths(
{ name: NavBarName.PersonalCabinetParent, path: '/personal-cabinet/parent/info', isActive: false, disable: false },
{ name: this.editMode ? NavBarName.EditInformationAboutChild : NavBarName.AddInformationAboutChild, isActive: false, disable: true },
Expand Down

0 comments on commit d3f1669

Please sign in to comment.