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:
co-authored by
Claude Opus 4.7
parent
325228c514
commit
83ea57ccf0
@@ -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 & Download</h2>
|
||||
<div class="dsd-head-s">{{ data.title }} · {{ 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">@{{ 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…
|
||||
</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 & 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 & 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"
|
||||
>@{{ 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">@{{ username }}</span>
|
||||
<span class="dsd-op-sep">·</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>
|
||||
— <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 — 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user