Skip to content

Commit

Permalink
Merge pull request #1975 from TimaQT/features/timaqt/EMBCESSMOD-5056
Browse files Browse the repository at this point in the history
EMBCESSMOD-5056: bug fixes
  • Loading branch information
ytqsl authored Mar 28, 2024
2 parents 3a5c7f1 + d70ffc9 commit f0ede4d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>


<app-household-members (ValidHouseholdMemebersIndicator)="ValidHouseholdMemebersIndicator($event)"></app-household-members>
<app-household-members (ValidSelectedHouseholdMembers)="ValidSelectedHouseholdMembers($event)" (ValidHouseholdMemebersIndicator)="ValidHouseholdMemebersIndicator($event)"></app-household-members>
<app-animals (ValidPetsIndicator)="ValidPetsIndicator($event)"></app-animals>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export class HouseholdMembersPetsComponent implements OnInit {


petsValid = false;
householdMembersValid = true;
householdMembersValid = false;
householdMembersQuantityValid = true;
tabMetaData: TabModel;

constructor(
Expand Down Expand Up @@ -52,15 +53,15 @@ export class HouseholdMembersPetsComponent implements OnInit {
}
ValidPetsIndicator(data): void { this.petsValid = data }
ValidHouseholdMemebersIndicator(data): void { this.householdMembersValid = data }
ValidSelectedHouseholdMembers(data): void { this.householdMembersQuantityValid = data }

private updateTabStatus() {
if (this.petsValid && this.householdMembersValid) {
if (this.petsValid && this.householdMembersValid && this.householdMembersQuantityValid) {
this.stepEssFileService.setTabStatus('household-members-pets', 'complete');
} else if (!this.petsValid || !this.householdMembersValid) {
this.stepEssFileService.setTabStatus('household-members-pets', 'incomplete');
}
else {
} else if (!this.petsValid && !this.householdMembersValid) {
this.stepEssFileService.setTabStatus('household-members-pets', 'not-started');
} else if (!this.petsValid || !this.householdMembersValid || !this.householdMembersQuantityValid) {
this.stepEssFileService.setTabStatus('household-members-pets', 'incomplete');
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export class HouseholdMembersComponent implements OnInit, OnDestroy {
tabUpdateSubscription: Subscription;
memberTipText: string;
tabMetaData: TabModel;
@Output() ValidHouseholdMemebersIndicator : any = new EventEmitter();
@Output() ValidHouseholdMemebersIndicator: any = new EventEmitter();
@Output() ValidSelectedHouseholdMembers: any = new EventEmitter();

constructor(
public stepEssFileService: StepEssFileService,
Expand All @@ -56,7 +57,7 @@ export class HouseholdMembersComponent implements OnInit, OnDestroy {
private householdService: HouseholdMembersService,
private wizardService: WizardService,
private appBaseService: AppBaseService
) {}
) { }

ngOnInit(): void {
this.memberTipText = this.appBaseService?.wizardProperties?.memberTipText;
Expand All @@ -82,6 +83,12 @@ export class HouseholdMembersComponent implements OnInit, OnDestroy {
}
}

if ((this.householdForm.get('hasHouseholdMembers').value === 'No' && (this.householdForm.get('houseHoldMember').valid)) || (this.householdForm.get('hasHouseholdMembers').value === 'Yes' && this.memberSource.value.length > 1)) {
this.ValidHouseholdMemebersIndicator.emit(true);
}
else
this.ValidHouseholdMemebersIndicator.emit(false);

// Displaying household member form in case 'haveHouseholdMembers' has been set to true
if (
this.stepEssFileService.haveHouseHoldMembers === 'Yes' &&
Expand All @@ -107,12 +114,19 @@ export class HouseholdMembersComponent implements OnInit, OnDestroy {
// Updates the status of the form according to changes
this.householdForm
.get('addMemberFormIndicator')
.valueChanges.subscribe(() => {this.updateOnVisibility();
this.ValidHouseholdMemebersIndicator.emit(this.householdForm.valid);
}
);
.valueChanges.subscribe(() => {
this.updateOnVisibility();
}
);


this.householdForm.valueChanges.subscribe(() => {
if ((this.householdForm.get('hasHouseholdMembers').value === 'No' && (this.householdForm.get('houseHoldMember').valid)) || (this.householdForm.get('hasHouseholdMembers').value === 'Yes' && this.memberSource.value.length > 1)) {
this.ValidHouseholdMemebersIndicator.emit(true);
} else
this.ValidHouseholdMemebersIndicator.emit(false);

})

this.tabMetaData = this.stepEssFileService.getNavLinks('household-members');
}
Expand Down Expand Up @@ -253,6 +267,7 @@ export class HouseholdMembersComponent implements OnInit, OnDestroy {
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.members.length;
this.ValidSelectedHouseholdMembers.emit(numSelected > 0);
return numSelected === numRows;
}

Expand Down

0 comments on commit f0ede4d

Please sign in to comment.