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 }}