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:
Aditya
2026-05-20 12:40:58 +05:30
co-authored by Claude Opus 4.7
parent 325228c514
commit 83ea57ccf0
84 changed files with 10281 additions and 1194 deletions
@@ -20,6 +20,7 @@ import {
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadBalanceCertificatePdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
export type BalanceAccountType = 'SAVINGS' | 'CURRENT' | 'FIXED_DEPOSIT' | 'RD' | 'NRE' | 'NRO';
@@ -60,6 +61,7 @@ export interface BalanceCertificateRecord {
export class BalanceCertificateComponent implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
// ── Filters ──
search = '';
@@ -126,8 +128,14 @@ export class BalanceCertificateComponent implements OnInit {
}
downloadCertificate(r: BalanceCertificateRecord): void {
downloadBalanceCertificatePdf(r, this.asOnDate);
this.snack.open(`Balance Certificate (${r.accountNo}) downloaded.`, 'OK', { duration: 2400 });
this.dscSign.promptThenDownload(
{
title: 'Balance Certificate',
reference: `${r.accountNo} · ${r.customerName} · as on ${this.asOnDate}`,
filename: `Balance-Certificate-${r.accountNo}-${this.asOnDate}.pdf`
},
(dsc) => downloadBalanceCertificatePdf(r, this.asOnDate, dsc)
);
}
}
@@ -15,6 +15,8 @@
import { jsPDF } from 'jspdf';
import { BankUserDsc } from 'app/users/dsc/dsc.model';
import { FyInterestBreakup, LoanInterestRecord } from './loan-interest/loan-interest.component';
import { ShareCertificateRecord } from './share-certificate/share-certificate.component';
import { BalanceCertificateRecord } from './balance-certificate/balance-certificate.component';
@@ -394,6 +396,73 @@ function newCtx(accent: [number, number, number]): PdfCtx {
};
}
/**
* Paint a "Digitally Signed" stamp + auditor footer line on the final page of
* the given doc. Stamp = green-bordered rounded box on the bottom-right with
* a ✓ icon, the signer's common name, masked DSC serial, and signing time.
* Audit line = thin teal strip under the existing footer with the same info
* in monospace, so the certificate also reads cleanly when printed in B/W.
*
* Call this just before `doc.save(...)` — it doesn't add a new page.
*/
export function paintDscSignatureStamp(doc: jsPDF, dsc: BankUserDsc): void {
const pageW = doc.internal.pageSize.getWidth();
const pageH = doc.internal.pageSize.getHeight();
const margin = 20;
const signedAt = new Date();
const pad = (n: number) => String(n).padStart(2, '0');
const ts = `${signedAt.getFullYear()}-${pad(signedAt.getMonth() + 1)}-${pad(signedAt.getDate())} ${pad(signedAt.getHours())}:${pad(signedAt.getMinutes())}:${pad(signedAt.getSeconds())}`;
// ── Bottom-right rounded green stamp ──
const sW = 68;
const sH = 22;
const sX = pageW - margin - sW;
const sY = pageH - margin - sH - 4;
// Tint background + green border (slight rounding gives it a "stamped" feel)
doc.setFillColor(220, 252, 231); // green-100
doc.setDrawColor(21, 128, 61); // green-700
doc.setLineWidth(0.6);
doc.roundedRect(sX, sY, sW, sH, 2, 2, 'FD');
// ✓ icon + heading
doc.setFont('helvetica', 'bold');
doc.setFontSize(9);
doc.setTextColor(21, 128, 61);
doc.text('✓ DIGITALLY SIGNED', sX + 3, sY + 5);
// Signer name (Common Name)
doc.setFont('helvetica', 'bold');
doc.setFontSize(8.5);
doc.setTextColor(15, 23, 42);
doc.text(dsc.commonName, sX + 3, sY + 10);
// DSC serial (masked) + type
doc.setFont('courier', 'normal');
doc.setFontSize(7);
doc.setTextColor(71, 85, 105);
doc.text(`DSC ${dsc.dscSerialNoMasked}`, sX + 3, sY + 14);
doc.setFont('helvetica', 'normal');
doc.setFontSize(6.5);
doc.setTextColor(100, 116, 139);
doc.text(dsc.dscType, sX + 3, sY + 17.5);
doc.text(`Signed at ${ts}`, sX + 3, sY + 20.5);
// ── Audit footer line (thin teal strip just below the existing footer) ──
const fY = pageH - margin + 2;
doc.setFillColor(204, 251, 241); // teal-100
doc.rect(margin, fY, pageW - margin * 2, 4, 'F');
doc.setFont('courier', 'normal');
doc.setFontSize(7);
doc.setTextColor(13, 148, 136); // teal-600
doc.text(
`[SIGNED] ${dsc.commonName} · DSC ${dsc.dscSerialNoMasked} · Issued by ${dsc.issuedBy.slice(0, 38)} · ${ts}`,
margin + 2,
fY + 2.8
);
}
// ───────────────────── Loan Interest Certificate ─────────────────────
export function buildLoanInterestPdf(record: LoanInterestRecord, fy: FyInterestBreakup): jsPDF {
const c = newCtx(ACCENT_BLUE);
@@ -467,8 +536,9 @@ export function buildLoanInterestPdf(record: LoanInterestRecord, fy: FyInterestB
return c.doc;
}
export function downloadLoanInterestPdf(record: LoanInterestRecord, fy: FyInterestBreakup): void {
export function downloadLoanInterestPdf(record: LoanInterestRecord, fy: FyInterestBreakup, dsc?: BankUserDsc): void {
const doc = buildLoanInterestPdf(record, fy);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`Interest-Certificate-${record.accountNo}-${fy.fy.replace(/\s+/g, '')}.pdf`);
}
@@ -552,8 +622,9 @@ export function buildShareCertificatePdf(r: ShareCertificateRecord): jsPDF {
return c.doc;
}
export function downloadShareCertificatePdf(r: ShareCertificateRecord): void {
export function downloadShareCertificatePdf(r: ShareCertificateRecord, dsc?: BankUserDsc): void {
const doc = buildShareCertificatePdf(r);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`Share-Certificate-${r.certificateNo}.pdf`);
}
@@ -645,8 +716,9 @@ export function buildBalanceCertificatePdf(r: BalanceCertificateRecord, asOnDate
return c.doc;
}
export function downloadBalanceCertificatePdf(r: BalanceCertificateRecord, asOnDate: string): void {
export function downloadBalanceCertificatePdf(r: BalanceCertificateRecord, asOnDate: string, dsc?: BankUserDsc): void {
const doc = buildBalanceCertificatePdf(r, asOnDate);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`Balance-Certificate-${r.accountNo}-${asOnDate}.pdf`);
}
@@ -736,8 +808,9 @@ export function buildForm60Pdf(r: Form60Record): jsPDF {
return c.doc;
}
export function downloadForm60Pdf(r: Form60Record): void {
export function downloadForm60Pdf(r: Form60Record, dsc?: BankUserDsc): void {
const doc = buildForm60Pdf(r);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`Form-60-${r.customerId}.pdf`);
}
@@ -830,8 +903,9 @@ export function buildForm15ghPdf(r: Form15ghRecord, kind: Form15Kind): jsPDF {
return c.doc;
}
export function downloadForm15ghPdf(r: Form15ghRecord, kind: Form15Kind): void {
export function downloadForm15ghPdf(r: Form15ghRecord, kind: Form15Kind, dsc?: BankUserDsc): void {
const doc = buildForm15ghPdf(r, kind);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`Form-${kind}-${r.customerId}-${r.fy.replace(/\s+/g, '')}.pdf`);
}
@@ -922,8 +996,9 @@ export function buildHypothecationPdf(r: HypothecationRecord): jsPDF {
return c.doc;
}
export function downloadHypothecationPdf(r: HypothecationRecord): void {
export function downloadHypothecationPdf(r: HypothecationRecord, dsc?: BankUserDsc): void {
const doc = buildHypothecationPdf(r);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`Hypothecation-${r.certificateNo}.pdf`);
}
@@ -1052,7 +1127,8 @@ export function buildNocPdf(r: NocRecord): jsPDF {
return c.doc;
}
export function downloadNocPdf(r: NocRecord): void {
export function downloadNocPdf(r: NocRecord, dsc?: BankUserDsc): void {
const doc = buildNocPdf(r);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`NOC-${r.nocNo}.pdf`);
}
@@ -20,6 +20,7 @@ import {
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadForm15ghPdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
export type Form15Kind = '15G' | '15H';
export type Form15Status = 'FILED' | 'PENDING';
@@ -60,6 +61,7 @@ export interface Form15ghRecord {
export class Form15ghComponent implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
// ── Filters ──
search = '';
@@ -141,8 +143,15 @@ export class Form15ghComponent implements OnInit {
}
downloadCertificate(r: Form15ghRecord): void {
downloadForm15ghPdf(r, this.formKind(r));
this.snack.open(`Form ${this.formKind(r)} for ${r.customerName} downloaded.`, 'OK', { duration: 2400 });
const kind = this.formKind(r);
this.dscSign.promptThenDownload(
{
title: `Form ${kind} Declaration`,
reference: `${r.customerId} · ${r.customerName} · ${r.fy}`,
filename: `Form-${kind}-${r.customerId}-${r.fy.replace(/\s+/g, '')}.pdf`
},
(dsc) => downloadForm15ghPdf(r, kind, dsc)
);
}
}
@@ -20,6 +20,7 @@ import {
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadForm60Pdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
export type Form60IdProofType = 'AADHAAR' | 'VOTER_ID' | 'DRIVING_LICENSE' | 'PASSPORT' | 'RATION';
@@ -59,6 +60,7 @@ export interface Form60Record {
export class Form60Component implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
// ── Filters ──
search = '';
@@ -142,8 +144,14 @@ export class Form60Component implements OnInit {
});
return;
}
downloadForm60Pdf(r);
this.snack.open(`Form 60 for ${r.customerName} downloaded.`, 'OK', { duration: 2400 });
this.dscSign.promptThenDownload(
{
title: 'Form 60 Declaration',
reference: `${r.customerId} · ${r.customerName}`,
filename: `Form60-${r.customerId}.pdf`
},
(dsc) => downloadForm60Pdf(r, dsc)
);
}
}
@@ -20,6 +20,7 @@ import {
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadHypothecationPdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
export type HypoAssetType = 'VEHICLE' | 'PLANT_MACHINERY' | 'STOCK_DEBTORS' | 'GOLD' | 'EQUIPMENT';
export type HypoStatus = 'ACTIVE' | 'CLOSED' | 'NOC_ISSUED';
@@ -63,6 +64,7 @@ export interface HypothecationRecord {
export class HypothecationCertificateComponent implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
search = '';
assetFilter: '' | HypoAssetType = '';
@@ -133,10 +135,14 @@ export class HypothecationCertificateComponent implements OnInit {
}
downloadCertificate(r: HypothecationRecord): void {
downloadHypothecationPdf(r);
this.snack.open(`Hypothecation Certificate ${r.certificateNo} downloaded.`, 'OK', {
duration: 2400
});
this.dscSign.promptThenDownload(
{
title: 'Hypothecation Certificate',
reference: `${r.certificateNo} · ${r.accountNo} · ${r.customerName}`,
filename: `Hypothecation-Certificate-${r.certificateNo}.pdf`
},
(dsc) => downloadHypothecationPdf(r, dsc)
);
}
}
@@ -20,6 +20,7 @@ import {
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadLoanInterestPdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
export type LoanProductType = 'HOUSING' | 'PERSONAL' | 'AUTO' | 'EDUCATION' | 'GOLD' | 'BUSINESS';
@@ -62,6 +63,7 @@ export interface LoanInterestRecord {
export class LoanInterestCertificateComponent implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
// ── Filters ──
search = '';
@@ -161,8 +163,14 @@ export class LoanInterestCertificateComponent implements OnInit {
this.snack.open('No interest data on file for the selected financial year.', 'OK', { duration: 2500 });
return;
}
downloadLoanInterestPdf(l, fy);
this.snack.open(`Interest Certificate (${fy.fy}) downloaded.`, 'OK', { duration: 2400 });
this.dscSign.promptThenDownload(
{
title: 'Interest Certificate',
reference: `${l.accountNo} · ${l.customerName} · ${fy.fy}`,
filename: `Interest-Certificate-${l.accountNo}-${fy.fy.replace(/\s+/g, '')}.pdf`
},
(dsc) => downloadLoanInterestPdf(l, fy, dsc)
);
}
}
@@ -20,6 +20,7 @@ import {
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadNocPdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
export type NocLoanType = 'AUTO' | 'HOUSING' | 'PERSONAL' | 'EDUCATION' | 'GOLD' | 'BUSINESS' | 'CC' | 'OD';
@@ -67,6 +68,7 @@ export interface NocRecord {
export class NocCertificateComponent implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
// ── Filters ──
search = '';
@@ -158,8 +160,14 @@ export class NocCertificateComponent implements OnInit {
);
return;
}
downloadNocPdf(r);
this.snack.open(`NOC ${r.nocNo} downloaded.`, 'OK', { duration: 2400 });
this.dscSign.promptThenDownload(
{
title: 'No-Objection Certificate (NOC)',
reference: `${r.nocNo} · ${r.accountNo} · ${r.customerName}`,
filename: `NOC-${r.nocNo}.pdf`
},
(dsc) => downloadNocPdf(r, dsc)
);
}
}
@@ -20,6 +20,7 @@ import {
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadShareCertificatePdf } from '../certificate-pdf';
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
export type ShareClass = 'ORDINARY' | 'PREFERENCE';
@@ -58,6 +59,7 @@ export interface ShareCertificateRecord {
export class ShareCertificateComponent implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
private dscSign = inject(DscSignService);
// ── Filters ──
search = '';
@@ -132,8 +134,14 @@ export class ShareCertificateComponent implements OnInit {
}
downloadCertificate(r: ShareCertificateRecord): void {
downloadShareCertificatePdf(r);
this.snack.open(`Share Certificate ${r.certificateNo} downloaded.`, 'OK', { duration: 2400 });
this.dscSign.promptThenDownload(
{
title: 'Share Certificate',
reference: `${r.certificateNo} · Folio ${r.folioNo} · ${r.memberName}`,
filename: `Share-Certificate-${r.certificateNo}.pdf`
},
(dsc) => downloadShareCertificatePdf(r, dsc)
);
}
}
@@ -0,0 +1,209 @@
<!--
Copyright since 2025 Mifos Initiative
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<div class="dsd-root">
<!-- HEADER -->
<div class="dsd-head">
<div class="dsd-head-l">
<fa-icon icon="file-signature" class="dsd-head-ic"></fa-icon>
<div>
<h2 class="dsd-head-t">Sign &amp; Download</h2>
<div class="dsd-head-s">{{ data.title }} &middot; {{ data.reference }}</div>
</div>
</div>
<div class="dsd-head-r">
<div class="dsd-who" matTooltip="Signed-in operator">
<fa-icon icon="user-shield" class="dsd-who-ic"></fa-icon>
<div class="dsd-who-txt">
<span class="dsd-who-name">{{ displayName }}</span>
<span class="dsd-who-uname mono">&#64;{{ username }}</span>
</div>
</div>
<button type="button" class="dsd-x" (click)="cancel()" matTooltip="Close">
<fa-icon icon="times"></fa-icon>
</button>
</div>
</div>
<!-- LOADING — fetching /v1/dsc/me -->
@if (loading) {
<div class="dsd-body dsd-body--loading">
<div class="dsd-status-row">
<span class="dsd-status-pill dsd-status-pill--muted">
<fa-icon icon="spinner" class="fa-spin"></fa-icon>
Checking DSC mapping&hellip;
</span>
<span class="dsd-status-meta">Looking up the certificate mapped to {{ username }}.</span>
</div>
<div class="dsd-skeleton">
<div class="dsd-skel dsd-skel--h"></div>
<div class="dsd-skel-grid">
<div class="dsd-skel"></div>
<div class="dsd-skel"></div>
<div class="dsd-skel"></div>
<div class="dsd-skel"></div>
</div>
</div>
</div>
}
<!-- MAPPED — DSC DETAILS + SIGN -->
@if (!loading && dscMapped && dsc) {
<div class="dsd-body">
<div class="dsd-status-row">
<span class="dsd-status-pill dsd-status-pill--ok">
<fa-icon icon="check-circle"></fa-icon>
DSC Mapped
</span>
<span class="dsd-status-meta">Your DSC is ready to digitally sign this document.</span>
</div>
<!-- DSC details card -->
<div class="dsd-card">
<div class="dsd-card-h">
<fa-icon icon="id-card" class="dsd-card-h-ic"></fa-icon>
<div>
<div class="dsd-card-name">{{ dsc.commonName }}</div>
<div class="dsd-card-type">{{ dsc.dscType }}</div>
</div>
<span
class="dsd-cert-pill"
[class.dsd-cert-pill--ok]="dsc.certStatus === 'ACTIVE'"
[class.dsd-cert-pill--warn]="dsc.certStatus === 'EXPIRED'"
[class.dsd-cert-pill--bad]="dsc.certStatus === 'REVOKED'"
>
{{ dsc.certStatus }}
</span>
</div>
<div class="dsd-card-grid">
<div>
<span class="dsd-card-l">Issued To</span>
<span class="dsd-card-v">{{ dsc.issuedTo }}</span>
</div>
<div>
<span class="dsd-card-l">Issued By</span>
<span class="dsd-card-v">{{ dsc.issuedBy }}</span>
</div>
<div>
<span class="dsd-card-l">Serial No.</span>
<span class="dsd-card-v mono">{{ dsc.dscSerialNoMasked }}</span>
</div>
<div>
<span class="dsd-card-l">Mapped On</span>
<span class="dsd-card-v">{{ dsc.dateOfSubmission | date: 'd MMM y' }}</span>
</div>
<div class="dsd-span-2">
<span class="dsd-card-l">Expires On</span>
<span class="dsd-card-v">
{{ dsc.dscExpiryDate | date: 'd MMM y' }}
@if (daysToExpiry > 0) {
<span
class="dsd-expiry-chip"
[class.dsd-expiry-chip--warn]="isExpiringSoon"
[class.dsd-expiry-chip--ok]="!isExpiringSoon"
>
{{ daysToExpiry }} days left
</span>
} @else {
<span class="dsd-expiry-chip dsd-expiry-chip--bad">Expired</span>
}
</span>
</div>
</div>
</div>
<!-- File preview chip -->
<div class="dsd-file-chip">
<fa-icon icon="file-invoice" class="dsd-file-ic"></fa-icon>
<div class="dsd-file-info">
<div class="dsd-file-l">File to sign &amp; download</div>
<div class="dsd-file-v mono">{{ data.filename }}</div>
</div>
</div>
<!-- Primary actions -->
<div class="dsd-actions">
<button type="button" class="dsd-btn dsd-btn--ghost" (click)="skipSign()">
<fa-icon icon="download"></fa-icon>
Download unsigned
</button>
<button type="button" class="dsd-btn dsd-btn--primary" (click)="signAndDownload()">
<fa-icon icon="file-signature"></fa-icon>
Sign &amp; Download
</button>
</div>
</div>
}
<!-- NOT MAPPED — MAP DSC FLOW -->
@if (!loading && !dscMapped) {
<div class="dsd-body">
<div class="dsd-status-row">
<span class="dsd-status-pill dsd-status-pill--warn">
<fa-icon icon="exclamation-triangle"></fa-icon>
DSC Not Mapped
</span>
<span class="dsd-status-meta">
No active Digital Signature Certificate is mapped to <strong>{{ displayName }}</strong> (<span class="mono"
>&#64;{{ username }}</span
>).
</span>
</div>
<!-- Operator card — surfaces who the missing DSC belongs to -->
<div class="dsd-op-card">
<div class="dsd-op-avatar">
<fa-icon icon="user-shield"></fa-icon>
</div>
<div class="dsd-op-body">
<div class="dsd-op-name">{{ displayName }}</div>
<div class="dsd-op-meta">
<span class="mono">&#64;{{ username }}</span>
<span class="dsd-op-sep">&middot;</span>
<span>Signed-in operator</span>
</div>
@if (inactiveDsc) {
<div class="dsd-op-prev">
<fa-icon icon="history"></fa-icon>
Last DSC on file: <strong>{{ inactiveDsc.commonName }}</strong>
<span class="mono">({{ inactiveDsc.dscSerialNoMasked }})</span>
&mdash; <em>{{ inactiveDsc.certStatus }}</em>
@if (inactiveDsc.dscExpiryDate) {
on {{ inactiveDsc.dscExpiryDate | date: 'd MMM y' }}
}
</div>
}
</div>
</div>
<div class="dsd-empty">
<fa-icon icon="id-card" class="dsd-empty-ic"></fa-icon>
<div>
<strong>Why map a DSC?</strong>
<p>
A digitally signed PDF carries cryptographic proof of authorship and tamper-evidence for regulators,
auditors, and customers. Map your Class 3 Individual DSC once &mdash; then sign every certificate / notice
you issue from this terminal.
</p>
</div>
</div>
<div class="dsd-actions">
<button type="button" class="dsd-btn dsd-btn--ghost" (click)="skipSign()">
<fa-icon icon="download"></fa-icon>
Download unsigned for now
</button>
<button type="button" class="dsd-btn dsd-btn--primary" (click)="mapDsc()">
<fa-icon icon="plus"></fa-icon>
Map DSC for {{ username }}
</button>
</div>
</div>
}
</div>
@@ -0,0 +1,609 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
:host {
--dsd-blue: #1d4ed8;
--dsd-blue-d: #1e40af;
--dsd-blue-l: #eff6ff;
--dsd-blue-tint: #dbeafe;
--dsd-green: #15803d;
--dsd-green-l: #dcfce7;
--dsd-amber: #d97706;
--dsd-amber-l: #fef3c7;
--dsd-red: #b91c1c;
--dsd-red-l: #fee2e2;
--dsd-red-tint: #fecaca;
--dsd-purple: #6d28d9;
--dsd-purple-l: #ede9fe;
--dsd-g50: #f8fafc;
--dsd-g100: #f1f5f9;
--dsd-g200: #e2e8f0;
--dsd-g300: #cbd5e1;
--dsd-g500: #64748b;
--dsd-g700: #334155;
--dsd-g900: #0f172a;
display: block;
}
.dsd-root {
background: #fff;
padding: 16px 20px 18px;
width: 100%;
max-width: 580px;
max-height: 90vh;
display: flex;
flex-direction: column;
gap: 16px;
overflow: hidden;
}
.mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* ───────── Header ───────── */
.dsd-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
padding-bottom: 12px;
border-bottom: 1px solid var(--dsd-g200);
}
.dsd-head-l {
display: flex;
align-items: center;
gap: 12px;
}
.dsd-head-ic {
width: 40px;
height: 40px;
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 12px;
background: var(--dsd-purple);
color: #fff;
font-size: 17px;
}
.dsd-head-t {
margin: 0;
font-size: 16px;
font-weight: 800;
color: var(--dsd-g900);
line-height: 1.2;
}
.dsd-head-s {
margin-top: 3px;
font-size: 11.5px;
color: var(--dsd-g500);
}
.dsd-head-r {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.dsd-who {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 5px 10px 5px 7px;
border-radius: 999px;
background: var(--dsd-blue-l);
border: 1px solid var(--dsd-blue-tint);
max-width: 200px;
}
.dsd-who-ic {
width: 24px;
height: 24px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: var(--dsd-blue-d);
color: #fff;
font-size: 11px;
flex-shrink: 0;
}
.dsd-who-txt {
display: flex;
flex-direction: column;
line-height: 1.1;
min-width: 0;
}
.dsd-who-name {
font-size: 11.5px;
font-weight: 700;
color: var(--dsd-g900);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dsd-who-uname {
font-size: 10px;
color: var(--dsd-blue-d);
margin-top: 1px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dsd-x {
width: 32px;
height: 32px;
border-radius: 999px;
border: 1px solid var(--dsd-g200);
background: #fff;
color: var(--dsd-g500);
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 13px;
flex-shrink: 0;
transition: all 0.12s ease;
&:hover {
background: var(--dsd-red-l);
color: var(--dsd-red);
border-color: var(--dsd-red-tint);
}
}
/* ───────── Body ───────── */
.dsd-body {
display: flex;
flex-direction: column;
gap: 14px;
overflow-y: auto;
padding-right: 2px;
}
/* Status row at the top of body */
.dsd-status-row {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.dsd-status-pill {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 11px;
border-radius: 999px;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.04em;
text-transform: uppercase;
fa-icon {
font-size: 10px;
}
&--ok {
background: var(--dsd-green-l);
color: var(--dsd-green);
border: 1px solid #bbf7d0;
}
&--warn {
background: var(--dsd-amber-l);
color: var(--dsd-amber);
border: 1px solid #fde68a;
}
&--muted {
background: var(--dsd-blue-l);
color: var(--dsd-blue-d);
border: 1px solid var(--dsd-blue-tint);
}
}
.dsd-status-meta {
font-size: 12px;
color: var(--dsd-g500);
}
/* ───────── DSC details card ───────── */
.dsd-card {
border: 1px solid var(--dsd-g200);
border-radius: 12px;
background: linear-gradient(180deg, #fafbff 0%, #fff 60%);
overflow: hidden;
}
.dsd-card-h {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 14px;
border-bottom: 1px solid var(--dsd-g200);
background: var(--dsd-purple-l);
}
.dsd-card-h-ic {
width: 32px;
height: 32px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 9px;
background: var(--dsd-purple);
color: #fff;
font-size: 14px;
flex-shrink: 0;
}
.dsd-card-name {
font-size: 14px;
font-weight: 800;
color: var(--dsd-g900);
line-height: 1.2;
}
.dsd-card-type {
font-size: 11px;
color: var(--dsd-g500);
margin-top: 2px;
}
.dsd-cert-pill {
margin-left: auto;
padding: 3px 10px;
border-radius: 999px;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.05em;
text-transform: uppercase;
background: var(--dsd-g100);
color: var(--dsd-g700);
&--ok {
background: var(--dsd-green-l);
color: var(--dsd-green);
}
&--warn {
background: var(--dsd-amber-l);
color: var(--dsd-amber);
}
&--bad {
background: var(--dsd-red-l);
color: var(--dsd-red);
}
}
.dsd-card-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px 14px;
padding: 12px 14px;
}
.dsd-span-2 {
grid-column: 1 / -1;
}
.dsd-card-l {
display: block;
font-size: 9.5px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--dsd-g500);
margin-bottom: 2px;
}
.dsd-card-v {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 12.5px;
font-weight: 600;
color: var(--dsd-g900);
word-break: break-word;
}
.dsd-expiry-chip {
padding: 2px 8px;
border-radius: 999px;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
&--ok {
background: var(--dsd-green-l);
color: var(--dsd-green);
}
&--warn {
background: var(--dsd-amber-l);
color: var(--dsd-amber);
}
&--bad {
background: var(--dsd-red-l);
color: var(--dsd-red);
}
}
/* ───────── File chip ───────── */
.dsd-file-chip {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 14px;
border-radius: 10px;
background: var(--dsd-blue-l);
border: 1px solid var(--dsd-blue-tint);
}
.dsd-file-ic {
width: 32px;
height: 32px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 9px;
background: var(--dsd-blue-d);
color: #fff;
font-size: 13px;
flex-shrink: 0;
}
.dsd-file-info {
min-width: 0;
flex: 1;
}
.dsd-file-l {
font-size: 10px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--dsd-blue-d);
}
.dsd-file-v {
font-size: 12.5px;
font-weight: 700;
color: var(--dsd-g900);
word-break: break-all;
margin-top: 2px;
}
/* ───────── Empty (not-mapped) state ───────── */
.dsd-empty {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 14px 16px;
border: 1px dashed var(--dsd-g300);
border-radius: 10px;
background: var(--dsd-g50);
color: var(--dsd-g700);
p {
margin: 6px 0 0;
font-size: 12.5px;
color: var(--dsd-g500);
line-height: 1.5;
}
}
.dsd-empty-ic {
width: 36px;
height: 36px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
background: var(--dsd-purple-l);
color: var(--dsd-purple);
font-size: 16px;
flex-shrink: 0;
}
/* ───────── Footer actions ───────── */
.dsd-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
padding-top: 6px;
}
.dsd-btn {
display: inline-flex;
align-items: center;
gap: 8px;
height: 38px;
padding: 0 18px;
border-radius: 9px;
border: 1px solid var(--dsd-g200);
background: #fff;
color: var(--dsd-g700);
font-size: 13px;
font-weight: 700;
letter-spacing: 0.01em;
cursor: pointer;
transition: all 0.12s ease;
fa-icon {
font-size: 12px;
}
&--ghost {
background: #fff;
color: var(--dsd-g700);
border-color: var(--dsd-g200);
fa-icon {
color: var(--dsd-g500);
}
&:hover {
background: var(--dsd-g50);
border-color: var(--dsd-g300);
color: var(--dsd-g900);
}
}
&--primary {
background: linear-gradient(135deg, var(--dsd-purple) 0%, var(--dsd-blue-d) 100%);
color: #fff;
border-color: var(--dsd-blue-d);
box-shadow: 0 2px 6px -2px rgb(29 78 216 / 35%);
fa-icon {
color: #fff;
}
&:hover {
background: linear-gradient(135deg, #5b21b6 0%, #1e3a8a 100%);
box-shadow: 0 4px 12px -3px rgb(29 78 216 / 45%);
}
}
}
/* ───────── Loading skeleton ───────── */
.dsd-body--loading {
min-height: 120px;
}
.dsd-skeleton {
display: flex;
flex-direction: column;
gap: 10px;
padding: 4px 2px;
}
.dsd-skel {
height: 14px;
border-radius: 6px;
background: linear-gradient(90deg, var(--dsd-g100) 0%, var(--dsd-g200) 50%, var(--dsd-g100) 100%);
background-size: 200% 100%;
animation: dsd-shimmer 1.4s linear infinite;
&--h {
height: 28px;
border-radius: 8px;
width: 60%;
}
}
.dsd-skel-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px 14px;
.dsd-skel {
height: 32px;
border-radius: 8px;
}
}
@keyframes dsd-shimmer {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
/* ───────── Operator card (not-mapped state) ───────── */
.dsd-op-card {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 12px 14px;
border-radius: 12px;
background: linear-gradient(135deg, #eef2ff 0%, var(--dsd-blue-l) 100%);
border: 1px solid var(--dsd-blue-tint);
}
.dsd-op-avatar {
width: 38px;
height: 38px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--dsd-blue-d) 0%, var(--dsd-purple) 100%);
color: #fff;
font-size: 16px;
flex-shrink: 0;
box-shadow: 0 2px 6px -2px rgb(29 78 216 / 40%);
}
.dsd-op-body {
flex: 1;
min-width: 0;
}
.dsd-op-name {
font-size: 13.5px;
font-weight: 800;
color: var(--dsd-g900);
line-height: 1.2;
}
.dsd-op-meta {
display: inline-flex;
align-items: center;
gap: 6px;
margin-top: 2px;
font-size: 11px;
color: var(--dsd-g500);
font-weight: 600;
}
.dsd-op-sep {
color: var(--dsd-g300);
}
.dsd-op-prev {
margin-top: 8px;
padding-top: 8px;
border-top: 1px dashed var(--dsd-blue-tint);
font-size: 11.5px;
color: var(--dsd-g700);
fa-icon {
color: var(--dsd-amber);
margin-right: 6px;
}
strong {
color: var(--dsd-g900);
}
em {
font-style: normal;
font-weight: 700;
color: var(--dsd-amber);
}
}
@@ -0,0 +1,140 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Component, inject, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { MatTooltip } from '@angular/material/tooltip';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Router } from '@angular/router';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { AuthenticationService } from 'app/core/authentication/authentication.service';
import { DscService } from 'app/users/dsc/dsc.service';
import { BankUserDsc } from 'app/users/dsc/dsc.model';
export interface DscSignDialogData {
/** Short title shown in the dialog header, e.g. "Interest Certificate". */
title: string;
/** Reference line shown under the title, e.g. account no / customer ID. */
reference: string;
/** Filename that will be downloaded — shown so the user knows what they're getting. */
filename: string;
}
export type DscSignDialogAction = 'sign' | 'skip' | 'map' | 'cancel';
export interface DscSignDialogResult {
action: DscSignDialogAction;
/** Populated when action === 'sign' — the DSC used for signing. */
dsc?: BankUserDsc;
}
@Component({
selector: 'mifosx-dsc-sign-dialog',
templateUrl: './dsc-sign-dialog.component.html',
styleUrls: ['./dsc-sign-dialog.component.scss'],
imports: [
...STANDALONE_SHARED_IMPORTS,
CommonModule,
FaIconComponent,
MatTooltip
]
})
export class DscSignDialogComponent implements OnInit {
private dialogRef = inject(MatDialogRef<DscSignDialogComponent, DscSignDialogResult>);
private snack = inject(MatSnackBar);
private router = inject(Router);
private authService = inject(AuthenticationService);
private dscService = inject(DscService);
data: DscSignDialogData = inject(MAT_DIALOG_DATA);
/** Logged-in operator's username — shown on the "not mapped" state. */
username = '';
/** Operator's full name from credentials, if available. */
displayName = '';
/** Loading flag while we hit /v1/dsc/me. */
loading = true;
/** Active DSC on file for the current user — null if none / API error. */
dsc: BankUserDsc | null = null;
/** Most recent DSC if mapped but expired/revoked — shown as a hint. */
inactiveDsc: BankUserDsc | null = null;
ngOnInit(): void {
const creds = this.authService.getCredentials();
this.username = creds?.username || 'unknown user';
// Prefer the staff display name (e.g. "Aditya Sharma") over the bare username,
// falling back to the username when no staff record is linked to the user.
this.displayName = creds?.staffDisplayName?.trim() || this.username;
this.dscService.listMyDscs().subscribe({
next: (rows) => {
const active = (rows || []).find((r) => r.certStatus === 'ACTIVE');
const fallback = (rows || []).find((r) => !!r);
this.dsc = active || null;
this.inactiveDsc = active ? null : fallback || null;
this.loading = false;
},
error: () => {
// Endpoint missing / 404 / network — treat as "not mapped" so the user
// can still choose to download unsigned or kick off the map flow.
this.dsc = null;
this.inactiveDsc = null;
this.loading = false;
}
});
}
/** True once we know the answer AND there's an active DSC on file. */
get dscMapped(): boolean {
return !this.loading && this.dsc !== null;
}
/** Days remaining until the DSC expires (negative = already expired). */
get daysToExpiry(): number {
if (!this.dsc) return 0;
const exp = new Date(this.dsc.dscExpiryDate);
const today = new Date();
return Math.floor((exp.getTime() - today.getTime()) / (1000 * 60 * 60 * 24));
}
get isExpiringSoon(): boolean {
return this.daysToExpiry > 0 && this.daysToExpiry < 60;
}
// ── Actions ──
signAndDownload(): void {
if (!this.dsc) return;
this.dialogRef.close({ action: 'sign', dsc: this.dsc });
}
skipSign(): void {
this.dialogRef.close({ action: 'skip' });
}
mapDsc(): void {
this.snack.open('Opening DSC enrollment — please connect your DSC token.', 'OK', { duration: 3000 });
this.dialogRef.close({ action: 'map' });
// The DSC enrollment dialog lives under the user-profile / access-control flow.
// Best-effort navigation; silently ignore if the route isn't registered.
this.router.navigate(['/access-control']).catch(() => {
this.router.navigate(['/users']).catch(() => {
/* silent */
});
});
}
cancel(): void {
this.dialogRef.close({ action: 'cancel' });
}
}
@@ -0,0 +1,74 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { inject, Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { BankUserDsc } from 'app/users/dsc/dsc.model';
import { DscSignDialogComponent, DscSignDialogData, DscSignDialogResult } from './dsc-sign-dialog.component';
/**
* Bridges every Letter-Mgmt download button → DSC sign-or-skip dialog → PDF
* download. Components pass the file context and a single callback that knows
* how to build the PDF (with the dsc passed through to the PDF builder if the
* user chose to sign).
*/
@Injectable({ providedIn: 'root' })
export class DscSignService {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
/**
* Opens the DSC sign dialog. The callback fires with `{ dsc }` when the
* user signs, with `{ dsc: undefined }` when they skip, and is NEVER called
* for cancel / map (we route map to the enrollment screen separately).
*
* Components call it like:
* this.dscSign.promptThenDownload(
* { title: 'Interest Certificate', reference: 'LN10029384 · FY 2024-25',
* filename: 'Interest-Certificate-LN10029384-FY2024-25.pdf' },
* (dsc) => downloadLoanInterestPdf(record, fy, dsc)
* );
*/
promptThenDownload(ctx: DscSignDialogData, doDownload: (dsc?: BankUserDsc) => void): void {
const ref = this.dialog.open<DscSignDialogComponent, DscSignDialogData, DscSignDialogResult>(
DscSignDialogComponent,
{
width: '620px',
maxWidth: '94vw',
maxHeight: '90vh',
autoFocus: false,
panelClass: 'dsd-dialog',
data: ctx
}
);
ref.afterClosed().subscribe((result) => {
if (!result) return;
switch (result.action) {
case 'sign':
doDownload(result.dsc);
this.snack.open(`Signed & downloaded · ${result.dsc?.commonName ?? 'DSC'} · ${ctx.filename}`, 'OK', {
duration: 3000
});
break;
case 'skip':
doDownload(undefined);
this.snack.open(`Downloaded unsigned · ${ctx.filename}`, 'OK', { duration: 2400 });
break;
case 'map':
case 'cancel':
default:
// Map handled inside the dialog; cancel = no-op.
break;
}
});
}
}
+3 -1
View File
@@ -23,6 +23,7 @@ import { Form15ghComponent } from './certificates/form-15gh/form-15gh.component'
import { HypothecationCertificateComponent } from './certificates/hypothecation/hypothecation.component';
import { NocCertificateComponent } from './certificates/noc/noc.component';
import { CertificatePreviewDialogComponent } from './certificates/certificate-preview-dialog/certificate-preview-dialog.component';
import { DscSignDialogComponent } from './dsc-sign-dialog/dsc-sign-dialog.component';
@NgModule({
imports: [
@@ -40,7 +41,8 @@ import { CertificatePreviewDialogComponent } from './certificates/certificate-pr
Form15ghComponent,
HypothecationCertificateComponent,
NocCertificateComponent,
CertificatePreviewDialogComponent
CertificatePreviewDialogComponent,
DscSignDialogComponent
]
})
export class LetterMgmtModule {}
+18 -5
View File
@@ -15,8 +15,11 @@ import { MatMenu, MatMenuContent, MatMenuItem, MatMenuTrigger } from '@angular/m
import { MatSnackBar } from '@angular/material/snack-bar';
import { MatTooltip } from '@angular/material/tooltip';
import { jsPDF } from 'jspdf';
import { BankUserDsc } from 'app/users/dsc/dsc.model';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { paintDscSignatureStamp } from '../certificates/certificate-pdf';
import {
NoticeHistoryDialogComponent,
NoticeHistoryDialogData
@@ -26,6 +29,7 @@ import {
NoticePreviewDialogData
} from './notice-preview-dialog/notice-preview-dialog.component';
import { CallContactDialogComponent, CallContactDialogData } from './call-contact-dialog/call-contact-dialog.component';
import { DscSignService } from '../dsc-sign-dialog/dsc-sign.service';
import {
SpeedPostDialogComponent,
SpeedPostDialogData,
@@ -140,6 +144,7 @@ export interface OverdueLoan {
export class NoticeComponent implements OnInit {
private snack = inject(MatSnackBar);
private dialog = inject(MatDialog);
private dscSign = inject(DscSignService);
// ─── Filters ───
search = '';
@@ -450,10 +455,16 @@ export class NoticeComponent implements OnInit {
this.downloadNoticeFile(loan, latest);
}
/** Generates and downloads the notice PDF using jsPDF. */
/** Prompts for DSC signing, then generates and downloads the notice PDF. */
downloadNoticeFile(loan: OverdueLoan, notice: NoticeEvent): void {
downloadNoticePdf(loan, notice);
this.snack.open(`Notice ${notice.id} downloaded as PDF.`, 'OK', { duration: 2200 });
this.dscSign.promptThenDownload(
{
title: `${this.stageLabel(notice.stage)} Notice`,
reference: `${loan.accountNo} · ${loan.customerName}`,
filename: `${notice.id}-${loan.accountNo}-Notice.pdf`
},
(dsc) => downloadNoticePdf(loan, notice, dsc)
);
}
/**
@@ -1083,9 +1094,11 @@ function formatLongDate(iso: string): string {
return d.toLocaleDateString('en-IN', { day: 'numeric', month: 'long', year: 'numeric' });
}
/** Convenience: build the PDF and trigger a download with a sensible filename. */
export function downloadNoticePdf(loan: OverdueLoan, notice: NoticeEvent): void {
/** Convenience: build the PDF and trigger a download with a sensible filename.
Pass a `dsc` to stamp the document with a DSC signature block. */
export function downloadNoticePdf(loan: OverdueLoan, notice: NoticeEvent, dsc?: BankUserDsc): void {
const doc = buildNoticePdf(loan, notice);
if (dsc) paintDscSignatureStamp(doc, dsc);
doc.save(`${notice.id}-${loan.accountNo}-Notice.pdf`);
}