fix(clients): rebuild CKYC document upload as a popup with full proof details

The CKYC tab's document cards now open a dedicated dialog (with client-side
preview) instead of expanding inline, collecting document type, number, and
issue/expiry dates the same way client creation does. Fixes several bugs
found along the way:

- Uploading a document type that's valid for both identity and address
  (Aadhaar, Passport, etc.) no longer 404s or 500s — the "no such endpoint"
  and case-sensitive ClientIdentifierStatus.valueOf("Active") crashes are
  both resolved.
- Edit Client's Identity-proof and Address-proof steps no longer show each
  other's document when both are dual-purpose OVD types, and no longer show
  stale/mismatched front-back scans after a document type change.
- Address-proof's own document preview never showed a document at all when
  no m_client_kyc record existed yet.

Document number and issue/expiry dates are persisted on the identifier
(documentKey + a shared "Issue date: ..., Expiry date: ..." description
convention) and read back by both the CKYC tab and Edit Client so the same
details appear everywhere.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 11:39:14 +05:30
co-authored by Claude Sonnet 5
parent ab58d7f74c
commit 31e99b1363
13 changed files with 1364 additions and 371 deletions
@@ -1035,6 +1035,15 @@ export class EditClientComponent {
this.saveAddressProof(clientId);
}
/** "Issue date: yyyy-MM-dd, Expiry date: yyyy-MM-dd" — same convention the CKYC tab and
* client-india-address-step's own "load existing" parsing both read back. */
private buildProofDescription(issueDate: string | null | undefined, expiryDate: string | null | undefined): string {
const parts: string[] = [];
if (issueDate) parts.push(`Issue date: ${issueDate}`);
if (expiryDate) parts.push(`Expiry date: ${expiryDate}`);
return parts.join(', ');
}
/**
* Save the address-proof picked on the permanent tab as a client identifier
* + upload each selected file as a document attached to that identifier.
@@ -1050,9 +1059,9 @@ export class EditClientComponent {
const proofName = payload.proof?.name || 'Address Proof';
const identifierData: any = {
documentTypeId: payload.proofId,
status: 'Active',
status: 'ACTIVE',
documentKey: payload.documentKey || `${proofName} - ${clientId}`,
description: payload.issueDate ? `Issue date: ${payload.issueDate}` : ''
description: this.buildProofDescription(payload.issueDate, payload.expiryDate)
};
this.clientsService.addClientIdentifier(clientId, identifierData).subscribe({
@@ -1105,7 +1114,7 @@ export class EditClientComponent {
const existingId = this.clientKycStep?.existingKycIdentifierId;
if (existingId) {
this.resolveDocumentTypeId(payload.proofId, proofName).subscribe((documentTypeId: number | null) => {
const update: any = { documentKey: payload.documentKey || `${proofName} - ${clientId}`, status: 'Active' };
const update: any = { documentKey: payload.documentKey || `${proofName} - ${clientId}`, status: 'ACTIVE' };
if (documentTypeId != null) {
update.documentTypeId = documentTypeId;
}
@@ -1128,7 +1137,7 @@ export class EditClientComponent {
}
const identifierData: any = {
documentTypeId,
status: 'Active',
status: 'ACTIVE',
documentKey: payload.documentKey || `${proofName} - ${clientId}`,
description: 'KYC document'
};