feat: update kyc tab, branch day register, and dormancy reports
This commit is contained in:
@@ -1079,12 +1079,15 @@ export class EditClientComponent {
|
||||
*/
|
||||
private saveKycDocProof(clientId: string) {
|
||||
const payload = this.clientKycStep?.kycDocPayload;
|
||||
if (!payload?.proofId || !payload?.files?.length) return;
|
||||
// A document number corrected without re-scanning the document is still a change worth
|
||||
// saving, so this no longer requires files — it used to return here and the new number was
|
||||
// silently dropped.
|
||||
if (!payload?.proofId) return;
|
||||
|
||||
const proofName = payload.proof?.name || 'KYC Document';
|
||||
|
||||
const uploadFiles = (identifierId: string) => {
|
||||
for (const entry of payload.files) {
|
||||
for (const entry of payload.files || []) {
|
||||
const formData = new FormData();
|
||||
formData.append('name', `${proofName} — ${entry.slot}`);
|
||||
formData.append('file', entry.file);
|
||||
@@ -1092,8 +1095,26 @@ export class EditClientComponent {
|
||||
}
|
||||
};
|
||||
|
||||
if (this.clientKycStep?.existingKycIdentifierId) {
|
||||
uploadFiles(this.clientKycStep.existingKycIdentifierId);
|
||||
// A document already on file is updated in place, not posted again.
|
||||
//
|
||||
// Re-collecting a document used to create a second identifier carrying the same number and
|
||||
// the same scans, with nothing to say which of the two was current — the client in front of
|
||||
// this was left with two identical Aadhaar rows. The document the customer renewed is the
|
||||
// one already recorded, so its number and type are written back to that row and any new
|
||||
// scans are attached to it.
|
||||
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' };
|
||||
if (documentTypeId != null) {
|
||||
update.documentTypeId = documentTypeId;
|
||||
}
|
||||
this.clientsService.updateClientIdentifier(clientId, existingId, update).subscribe({
|
||||
// The scans go up either way: failing to rewrite the number must not cost the images.
|
||||
next: () => uploadFiles(existingId),
|
||||
error: () => uploadFiles(existingId)
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user