feat(election,family): family member KYC display, collapsible cards, linked/manual badges, create-as-client flow
- nomination-apply: show full KYC for linked family members via nested forkJoin, accordion expand/collapse cards, owner chips on KYC headers, 'Create as Client' button for manual entries - family-members-tab: show Linked Client / Manual Entry badges, entry type in detail grid, 'Create as Client' button navigating with prefill state - create-client + client-general-step: accept prefillData @Input from navigation state, patch form fields from family member data - Add MPL-2.0 headers to all election module files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
822fa4c68d
commit
10b301c30c
@@ -97,6 +97,8 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
||||
@Input() clientTemplate: any;
|
||||
/** Existing client data for edit mode (null for create) */
|
||||
@Input() clientData: any = null;
|
||||
/** Pre-fill data from "Create as Client" on a manual family member */
|
||||
@Input() prefillData: any = null;
|
||||
/** Read-only mode — disables form editing until user clicks edit icon */
|
||||
@Input() readOnly = false;
|
||||
/** Create Client Form */
|
||||
@@ -415,9 +417,44 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
||||
this.buildDependencies();
|
||||
if (this.clientData) {
|
||||
this.prefillForEdit();
|
||||
} else if (this.prefillData) {
|
||||
this.prefillFromFamilyMember();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-fills the General step form from a manually-entered family member
|
||||
* when the user clicks "Create as Client" on the family members tab.
|
||||
*/
|
||||
private prefillFromFamilyMember(): void {
|
||||
const d = this.prefillData;
|
||||
if (!d) return;
|
||||
|
||||
// Parse DOB — Fineract returns [yyyy, mm, dd] array or ISO string
|
||||
let dob: Date | undefined;
|
||||
if (d.dateOfBirth) {
|
||||
if (Array.isArray(d.dateOfBirth)) {
|
||||
dob = new Date(d.dateOfBirth[0], d.dateOfBirth[1] - 1, d.dateOfBirth[2]);
|
||||
} else {
|
||||
const parsed = new Date(d.dateOfBirth);
|
||||
if (!isNaN(parsed.getTime())) dob = parsed;
|
||||
}
|
||||
}
|
||||
|
||||
// Patch base fields first
|
||||
this.createClientForm.patchValue({
|
||||
mobileNo: d.mobileNo || '',
|
||||
...(dob ? { dateOfBirth: dob } : {})
|
||||
});
|
||||
|
||||
// Name controls are added dynamically by buildDependencies via legalFormId — set after tick
|
||||
setTimeout(() => {
|
||||
if (this.createClientForm.get('firstname') && d.firstname) {
|
||||
this.createClientForm.get('firstname').setValue(d.firstname);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-fills the form with existing client data for edit mode.
|
||||
* Called AFTER buildDependencies so name controls already exist.
|
||||
|
||||
Reference in New Issue
Block a user