From 56f13ade6736915d531f8c1ca76f1e7e9775eca4 Mon Sep 17 00:00:00 2001 From: Nitesh Yadav Date: Wed, 29 Jul 2026 11:32:41 +0530 Subject: [PATCH] fix(clients): latest-identifier ordering for KYC docs, show client ID in list Repeat KYC document uploads create a new client_identifier row rather than updating in place, so loadExistingKycIdentifier() must prefer the newest matching row instead of the first one returned by the API. Also swap the Clients list "Account No." column to show the client's numeric ID instead. Co-Authored-By: Claude Sonnet 5 --- .../client-kyc-step/client-kyc-step.component.ts | 9 +++++++-- src/app/clients/clients.component.html | 8 +++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/clients/client-stepper/client-kyc-step/client-kyc-step.component.ts b/src/app/clients/client-stepper/client-kyc-step/client-kyc-step.component.ts index ca2a98d05..13bfad537 100644 --- a/src/app/clients/client-stepper/client-kyc-step/client-kyc-step.component.ts +++ b/src/app/clients/client-stepper/client-kyc-step/client-kyc-step.component.ts @@ -955,12 +955,17 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy { const n = i?.documentType?.name?.toLowerCase(); return !!n && this.kycDocProofs.some((p) => p.name?.toLowerCase() === n); }; + // Re-uploading a KYC document creates a new identifier row rather than updating the + // old one in place (same pattern as OVD identifiers), so sort newest-first before + // picking — otherwise a repeat upload of the same document type would keep showing + // the ORIGINAL file forever, since .find() would always hit the oldest matching row. + const sorted = [...identifiers].sort((a: any, b: any) => (b?.id ?? 0) - (a?.id ?? 0)); // Pick by document-type name match first; otherwise the first identifier whose // type lives in the KYC proof list (avoid bleeding the address proof in here). const match = kycDocumentName - ? identifiers.find((i: any) => i?.documentType?.name?.toLowerCase() === kycDocumentName.toLowerCase()) + ? sorted.find((i: any) => i?.documentType?.name?.toLowerCase() === kycDocumentName.toLowerCase()) : null; - const identifier = match || identifiers.find(isKycType); + const identifier = match || sorted.find(isKycType); if (!identifier?.id) return; this.existingKycIdentifierId = identifier.id.toString(); diff --git a/src/app/clients/clients.component.html b/src/app/clients/clients.component.html index 73d4f6bcd..fee53218f 100644 --- a/src/app/clients/clients.component.html +++ b/src/app/clients/clients.component.html @@ -98,12 +98,10 @@ - + - {{ 'labels.inputs.Account No' | translate }} - - - + Client ID + {{ row.id }}