diff --git a/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.html b/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.html
index e12cd5e8e..4049ae1ca 100644
--- a/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.html
+++ b/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.html
@@ -62,6 +62,22 @@
}
+
+ @if (!nomineeOnly && clientFamilyMembers.length > 0 && !hasMother) {
+
+ error_outline
+ Mother is required.
+
+ }
+
+
+ @if (!nomineeOnly && clientFamilyMembers.length > 0 && !hasFather && !hasCaretaker) {
+
+ error_outline
+ Either Father or a Caretaker is required.
+
+ }
+
@if (!nomineeOnly && isMarried && !hasSpouse) {
diff --git a/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.ts b/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.ts
index b322a56b1..d324ac254 100644
--- a/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.ts
+++ b/src/app/clients/client-stepper/client-family-members-step/client-family-members-step.component.ts
@@ -223,6 +223,33 @@ export class ClientFamilyMembersStepComponent implements OnInit {
return this.clientFamilyMembers.length > 0;
}
+ /** True if a family member with the given relationship (case-insensitive) has been added */
+ private hasRelationship(name: string): boolean {
+ const target = name.toLowerCase();
+ return this.clientFamilyMembers.some((m: any) => {
+ const resolved = this.getRelName(m.relationshipId ?? m.relationship).toLowerCase();
+ if (resolved === target) return true;
+ return typeof m.relationship === 'string' && m.relationship.toLowerCase() === target;
+ });
+ }
+
+ get hasMother(): boolean {
+ return this.hasRelationship('mother');
+ }
+
+ get hasFather(): boolean {
+ return this.hasRelationship('father');
+ }
+
+ get hasCaretaker(): boolean {
+ return this.hasRelationship('caretaker');
+ }
+
+ /** Mother is always required; Father is required unless a Caretaker has been added instead. */
+ get familyRelationshipRulesMet(): boolean {
+ return this.hasMother && (this.hasFather || this.hasCaretaker);
+ }
+
/** Check if client's marital status is "Married" */
get isMarried(): boolean {
if (!this.maritalStatusId || !this.maritalStatusOptions?.length) return false;
diff --git a/src/app/clients/create-client/create-client.component.ts b/src/app/clients/create-client/create-client.component.ts
index 8a0e00863..a71575059 100644
--- a/src/app/clients/create-client/create-client.component.ts
+++ b/src/app/clients/create-client/create-client.component.ts
@@ -238,8 +238,8 @@ export class CreateClientComponent {
return this.isAddressStepValid();
}
if (idx === 3) {
- // Family tab — relations are optional, always allow.
- return true;
+ // Family tab — Mother is required, and either Father or a Caretaker.
+ return !this.clientFamilyMembersStep || this.clientFamilyMembersStep.familyRelationshipRulesMet;
}
}
return true;
@@ -273,6 +273,11 @@ export class CreateClientComponent {
return `Please fill/correct: ${labels.join(', ')}.`;
}
}
+ if (idx === 3 && this.legalFormType === 1 && 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.';
}
@@ -569,6 +574,21 @@ export class CreateClientComponent {
this.selectedTabIndex = 3;
return;
}
+ // Validate: Mother required, and either Father or a Caretaker (Individual clients)
+ if (
+ this.legalFormType === 1 &&
+ this.clientFamilyMembersStep &&
+ !this.clientFamilyMembersStep.familyRelationshipRulesMet
+ ) {
+ const step = this.clientFamilyMembersStep;
+ if (!step.hasMother) {
+ this.validationError = 'Mother is required as a family member.';
+ } else {
+ this.validationError = 'Either Father or a Caretaker is required as a family member.';
+ }
+ this.selectedTabIndex = 3;
+ return;
+ }
this.validationError = '';
if (this.createdClientId) {
diff --git a/src/app/clients/edit-client/edit-client.component.ts b/src/app/clients/edit-client/edit-client.component.ts
index fbfd360f7..b9c9f641e 100644
--- a/src/app/clients/edit-client/edit-client.component.ts
+++ b/src/app/clients/edit-client/edit-client.component.ts
@@ -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.';
}