feat(clients): require Mother + Father/Caretaker as family members before activation

- Add hasMother/hasFather/hasCaretaker/familyRelationshipRulesMet to
  ClientFamilyMembersStepComponent, matched against the RELATIONSHIP code value label.
- Show two independent inline error banners (never merged into one message) when Mother, or
  both Father and Caretaker, are missing.
- Gate "Save & Next" and final Submit on this rule in both the create and edit client flows —
  the edit flow previously treated the Family tab as unconditionally optional.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-28 12:36:30 +05:30
co-authored by Claude Sonnet 5
parent 2e4187c3d2
commit 5fd7e1890e
4 changed files with 79 additions and 4 deletions
@@ -287,14 +287,20 @@ export class EditClientComponent {
if (this.legalFormType === 2) {
if (idx === 2) return true; // Scheme & Sector — opt-in
if (idx === 3) return this.isAddressStepValid();
if (idx === 4) return true; // Family — optional
if (idx === 4) return true; // Family — not applicable to non-individual entities
} else {
if (idx === 2) return this.isAddressStepValid();
if (idx === 3) return true; // Family — optional
if (idx === 3) return this.isFamilyStepValid(); // Mother required, plus Father or a Caretaker
}
return true;
}
/** Mother is required, and either Father or a Caretaker, for individual clients. */
private isFamilyStepValid(): boolean {
const step = this.clientFamilyMembersStep;
return !step || step.familyRelationshipRulesMet;
}
private isAddressStepValid(): boolean {
const step = this.clientIndiaAddressStep;
if (!step) return true;
@@ -318,6 +324,12 @@ export class EditClientComponent {
return `Please fill/correct: ${labels.join(', ')}.`;
}
}
const familyTabIndex = this.legalFormType === 2 ? 4 : 3;
if (this.selectedTabIndex === familyTabIndex && this.legalFormType !== 2 && this.clientFamilyMembersStep) {
const step = this.clientFamilyMembersStep;
if (!step.hasMother) return 'Mother is required as a family member.';
if (!step.hasFather && !step.hasCaretaker) return 'Either Father or a Caretaker is required as a family member.';
}
return 'Please fill all mandatory fields on this tab to continue.';
}