Client-stepper: pre-fill existing KYC/address proofs in edit, fix identifier saves
Edit-mode now shows the previously selected KYC document type + uploaded file thumbnail
(loads from /clients/{id}/identifiers + /client_identifiers/{id}/documents). Same for
address proof on the India address step. Closes the gap where editing a client showed
an empty file picker even when proof had been uploaded on create.
Identifier-save hardened across all three callsites (create-client, edit-client,
identities-tab.createIdentifierWithDocs) - the KYC chip picker proofId is a CODE
string ('AADHAAR'), but backend ClientIdentifierRequest.documentTypeId is Long, which
Spring rejects with HttpMessageNotReadableException -> 400. resolveDocumentTypeId
helper looks up the code against /kyc/proof-types?type=id and substitutes the numeric
CodeValue id before posting. Skips silently for constitution-specific non-individual
docs that have no CodeValue mapping.
KYC payload normalises panNumber / enterprisePan / gstinNumber / cinNumber via
toUpperCase + whitespace strip so user-typed lowercase or trailing spaces don't trip
the backend regex (validation.msg.CLIENTKYC.panNumber.does.not.match.regexp).
State name match in client-address save now normalises both sides (lowercase, collapse
underscores + spaces) so legacy MADHYA_PRADESH resolves to 'Madhya Pradesh' returned
by api.postalpincode.in. Backed by tenant migration 0297.
Identities-tab resolver flattened - was returning identifiers before the per-row
forkJoin(getClientIdentificationDocuments) completed, so the view rendered empty
documents arrays. Now uses switchMap + forkJoin so the resolver awaits completion.
Also bundles concurrent work-in-progress on letter-mgmt, organization, users,
bank-calendar, shell, nominee/notes/identifier dialogs, and theming.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
325228c514
commit
83ea57ccf0
@@ -295,9 +295,11 @@ export class NomineeTabComponent implements OnInit {
|
||||
this.searching = true;
|
||||
this.searchTimer = setTimeout(() => {
|
||||
// Nominee picker (post-create tab): nominees must be natural persons.
|
||||
// The host client is excluded from results so they can't be picked as
|
||||
// their own nominee.
|
||||
this.clientsService.searchByText(text, 0, 8, '', '', true, 'INDIVIDUAL').subscribe({
|
||||
next: (data: any) => {
|
||||
this.searchResults = data?.content || [];
|
||||
this.searchResults = (data?.content || []).filter((c: any) => !this.isSelfClient(c?.id));
|
||||
this.searching = false;
|
||||
this.clientsService.enrichSearchResults(this.searchResults);
|
||||
},
|
||||
@@ -316,7 +318,21 @@ export class NomineeTabComponent implements OnInit {
|
||||
}, 200);
|
||||
}
|
||||
|
||||
/** Self-check: prevent a client from being added as their own nominee/guardian. */
|
||||
isSelfClient(clientId: number | string | null | undefined): boolean {
|
||||
if (this.clientId == null || clientId == null) return false;
|
||||
return String(this.clientId) === String(clientId);
|
||||
}
|
||||
|
||||
/** Inline error shown above the picker when the user tries to pick themselves. */
|
||||
selfSelectError = '';
|
||||
|
||||
selectClient(client: any): void {
|
||||
if (this.isSelfClient(client?.id)) {
|
||||
this.selfSelectError = `You can't link this client as their own nominee. Please pick a different person.`;
|
||||
return;
|
||||
}
|
||||
this.selfSelectError = '';
|
||||
this.selectedClient = client;
|
||||
this.searchResults = [];
|
||||
this.searchText = '';
|
||||
@@ -414,9 +430,10 @@ export class NomineeTabComponent implements OnInit {
|
||||
this.guardianSearching = true;
|
||||
this.guardianSearchTimer = setTimeout(() => {
|
||||
// Guardian picker (post-create tab): guardians must be natural persons.
|
||||
// The host client is filtered out so they can't be picked as their own guardian.
|
||||
this.clientsService.searchByText(text, 0, 8, '', '', true, 'INDIVIDUAL').subscribe({
|
||||
next: (data: any) => {
|
||||
this.guardianSearchResults = data?.content || [];
|
||||
this.guardianSearchResults = (data?.content || []).filter((c: any) => !this.isSelfClient(c?.id));
|
||||
this.guardianSearching = false;
|
||||
this.clientsService.enrichSearchResults(this.guardianSearchResults);
|
||||
},
|
||||
@@ -428,7 +445,15 @@ export class NomineeTabComponent implements OnInit {
|
||||
}, 400);
|
||||
}
|
||||
|
||||
/** Inline error shown above the guardian picker when self-select is attempted. */
|
||||
guardianSelfSelectError = '';
|
||||
|
||||
selectGuardian(client: any): void {
|
||||
if (this.isSelfClient(client?.id)) {
|
||||
this.guardianSelfSelectError = `You can't link this client as their own guardian. Please pick a different person.`;
|
||||
return;
|
||||
}
|
||||
this.guardianSelfSelectError = '';
|
||||
this.selectedGuardian = client;
|
||||
this.guardianSearchResults = [];
|
||||
this.guardianSearchText = '';
|
||||
|
||||
Reference in New Issue
Block a user