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
@@ -11,8 +11,8 @@ import { Injectable, inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable, forkJoin, from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Observable, forkJoin, of } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
|
||||
/** Custom Services */
|
||||
import { ClientsService } from '../clients.service';
|
||||
@@ -25,25 +25,24 @@ export class ClientIdentitiesResolver {
|
||||
private clientsService = inject(ClientsService);
|
||||
|
||||
/**
|
||||
* Returns the Client Identities data.
|
||||
* @returns {Observable<any>}
|
||||
* Returns the Client Identities data with each identifier's attached documents
|
||||
* already populated. We previously fired the per-identifier document fetches inside a
|
||||
* non-blocking `subscribe`, so the resolver returned BEFORE the documents arrived and
|
||||
* the view rendered with empty `documents` arrays.
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const clientId = route.parent.paramMap.get('clientId');
|
||||
let identitiesData: any;
|
||||
return this.clientsService.getClientIdentifiers(clientId).pipe(
|
||||
map((identities: any) => {
|
||||
identitiesData = identities;
|
||||
const docObservable: Observable<any>[] = [];
|
||||
identities.forEach((identity: any) => {
|
||||
docObservable.push(this.clientsService.getClientIdentificationDocuments(identity.id));
|
||||
});
|
||||
forkJoin(docObservable).subscribe((documents) => {
|
||||
documents.forEach((document, index) => {
|
||||
identitiesData[index].documents = document;
|
||||
});
|
||||
});
|
||||
return identitiesData;
|
||||
switchMap((identities: any[]) => {
|
||||
if (!identities || identities.length === 0) {
|
||||
return of(identities || []);
|
||||
}
|
||||
const enriched$ = identities.map((identity: any) =>
|
||||
this.clientsService
|
||||
.getClientIdentificationDocuments(identity.id)
|
||||
.pipe(map((documents: any) => ({ ...identity, documents })))
|
||||
);
|
||||
return forkJoin(enriched$);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user