Files
cbsnexora/src/app/letter-mgmt/certificates/balance-certificate/balance-certificate.component.ts
T
AdityaandClaude Opus 4.7 325228c514 feat: letter-mgmt module + digital UPI/IMPS/ATM-POS reports + header redesign
letter-mgmt (new module):
- Notice page: overdue loan list with filters, KPI strip, bulk actions,
  call disposition logging (Promise-to-Pay, Not Reachable, etc.), Speed
  Post dispatch dialog with consignment + post-office tracking,
  PDF preview + download, call-contact dialog with primary / alt /
  family / nominee numbers and per-contact disposition history.
- Certificates: Loan Interest, Share, Balance, Form 60 (no-PAN flow),
  Form 15G/H (auto age-based), Hypothecation, NOC - each with shared
  preview dialog (six tone variants) and jsPDF generator using a
  common letterhead / summary-grid / signature-seal helper.

digital:
- IMPS module: report (P2A/P2P/Aadhaar tabs) + entry form with
  MMID/mobile lookup, NPCI switch resolve-to-A/C+IFSC BANL flow,
  sender autocomplete, hide sender field for P2P/Aadhaar, charges +
  18% GST + waive checkbox, per-sender today-only history dialog.
- UPI report with app-mix tab and full transaction filtering.
- ATM/POS/ECOM hub with three ticket cards routing to today/status/cycle.
- NEFT/RTGS entry: sender-account autocomplete, charges + GST + waive,
  field reorder (sender before amount), NEFT cap / RTGS floor
  validation, History button opening per-sender today's transactions.
- NEFT/RTGS report: horizontal-bar trend leaderboard replacing tall bars.

shell + theme:
- Header redesigned with IBM Plex Sans 12/500 typography, 11-column grid
  per row, top-accent hover indicator, bordered cells via grid-gap.
- Live KPI ticker below menu (CASH, TXN TODAY, CLEARING IN/OUT, NPA,
  CASA, CD RATIO, RBI CIRC, REPO) with marquee scroll, pause-on-hover,
  brand-blue gradient, amber bottom strip, pulsing red LIVE chip.
- Sidebar 'KYC Management' -> 'KYC & ReKYC Management'.
- Letter Mgmt / certificate menu items wired with green icon hints for
  items that have a working page.

access-control:
- MFA card layout compacted; method header inlines back button + title.

icons:
- Register faTruck/TruckFast, faEllipsisV/H, faCommentDots.
- Add IBM Plex Sans Google Fonts import to index.html.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 10:09:06 +05:30

235 lines
7.4 KiB
TypeScript

/**
* 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 { FormsModule } from '@angular/forms';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { MatTooltip } from '@angular/material/tooltip';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import {
CertificatePreviewDialogComponent,
CertificatePreviewDialogData
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
import { downloadBalanceCertificatePdf } from '../certificate-pdf';
export type BalanceAccountType = 'SAVINGS' | 'CURRENT' | 'FIXED_DEPOSIT' | 'RD' | 'NRE' | 'NRO';
export interface BalanceCertificateRecord {
accountNo: string;
customerId: string;
customerName: string;
customerPan: string;
customerAddress: string;
branch: string;
accountType: BalanceAccountType;
productName: string;
openedOn: string;
/** Balance available as on the snapshot date. */
availableBalance: number;
/** Total ledger balance (incl. accrued interest, hold amounts). */
ledgerBalance: number;
/** Accrued but uncredited interest. */
accruedInterest: number;
/** Interest rate p.a. (for FDs / RD / interest-bearing accounts). */
interestRate?: number;
/** Joint-holder names if any. */
jointHolders?: string;
}
@Component({
selector: 'mifosx-balance-certificate',
templateUrl: './balance-certificate.component.html',
styleUrls: ['../certificates.shared.scss'],
imports: [
...STANDALONE_SHARED_IMPORTS,
CommonModule,
FormsModule,
FaIconComponent,
MatTooltip
]
})
export class BalanceCertificateComponent implements OnInit {
private dialog = inject(MatDialog);
private snack = inject(MatSnackBar);
// ── Filters ──
search = '';
accountTypeFilter: '' | BalanceAccountType = '';
/** Snapshot date for the balance "as on". */
asOnDate = todayIso();
records: BalanceCertificateRecord[] = [];
readonly accountTypeOptions: { value: BalanceAccountType; label: string }[] = [
{ value: 'SAVINGS', label: 'Savings' },
{ value: 'CURRENT', label: 'Current' },
{ value: 'FIXED_DEPOSIT', label: 'Fixed Deposit' },
{ value: 'RD', label: 'Recurring Deposit' },
{ value: 'NRE', label: 'NRE Savings' },
{ value: 'NRO', label: 'NRO Savings' }
];
ngOnInit(): void {
this.records = seedBalanceCertificates();
}
get filteredRecords(): BalanceCertificateRecord[] {
const q = this.search.trim().toLowerCase();
return this.records.filter((r) => {
if (this.accountTypeFilter && r.accountType !== this.accountTypeFilter) return false;
if (!q) return true;
return (
r.accountNo.toLowerCase().includes(q) ||
r.customerName.toLowerCase().includes(q) ||
r.customerId.toLowerCase().includes(q) ||
r.customerPan.toLowerCase().includes(q)
);
});
}
accountTypeLabel(t: BalanceAccountType): string {
return this.accountTypeOptions.find((o) => o.value === t)?.label || t;
}
totalBalance(): number {
return this.filteredRecords.reduce((s, r) => s + r.availableBalance, 0);
}
clearFilters(): void {
this.search = '';
this.accountTypeFilter = '';
this.asOnDate = todayIso();
}
viewCertificate(r: BalanceCertificateRecord): void {
const data: CertificatePreviewDialogData = {
kind: 'balance',
balance: { record: r, asOnDate: this.asOnDate }
};
this.dialog.open(CertificatePreviewDialogComponent, {
width: '880px',
maxWidth: '96vw',
maxHeight: '92vh',
autoFocus: false,
panelClass: 'cert-preview-dialog',
data
});
}
downloadCertificate(r: BalanceCertificateRecord): void {
downloadBalanceCertificatePdf(r, this.asOnDate);
this.snack.open(`Balance Certificate (${r.accountNo}) downloaded.`, 'OK', { duration: 2400 });
}
}
function todayIso(): string {
const d = new Date();
const pad = (n: number) => String(n).padStart(2, '0');
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
}
// ───────────────────── Mock seed (top-level export) ─────────────────────
export function seedBalanceCertificates(): BalanceCertificateRecord[] {
return [
{
accountNo: 'SB10029384',
customerId: 'CUST112233',
customerName: 'Rohan S. Mehta',
customerPan: 'ABCPM1234E',
customerAddress: 'Flat 902, Skyline Apt, Andheri (E), Mumbai 400069',
branch: 'Mumbai — Andheri (E)',
accountType: 'SAVINGS',
productName: 'Savings — Premium',
openedOn: '2018-04-22',
availableBalance: 482500,
ledgerBalance: 482500,
accruedInterest: 1820,
interestRate: 3.5,
jointHolders: 'Priya Mehta'
},
{
accountNo: 'CA20034112',
customerId: 'CUST334455',
customerName: 'Anita Verma',
customerPan: 'EFGHV5678A',
customerAddress: 'B-12, Connaught Pl, New Delhi 110001',
branch: 'New Delhi — Connaught Place',
accountType: 'CURRENT',
productName: 'Current — Business',
openedOn: '2019-08-11',
availableBalance: 1245300,
ledgerBalance: 1245300,
accruedInterest: 0
},
{
accountNo: 'FD50200077',
customerId: 'CUST556677',
customerName: 'Karthik Rao',
customerPan: 'PQRSR2233Z',
customerAddress: '24, MG Road, Bengaluru 560001',
branch: 'Bengaluru — MG Road',
accountType: 'FIXED_DEPOSIT',
productName: 'FD — Senior 18 months',
openedOn: '2024-02-15',
availableBalance: 500000,
ledgerBalance: 526500,
accruedInterest: 26500,
interestRate: 7.25
},
{
accountNo: 'RD60012345',
customerId: 'CUST667788',
customerName: 'Lakshmi Naidu',
customerPan: 'XYZAN7788Q',
customerAddress: 'Plot 14, Road No. 3, Banjara Hills, Hyderabad 500034',
branch: 'Hyderabad — Banjara Hills',
accountType: 'RD',
productName: 'Recurring Deposit — 24m',
openedOn: '2023-08-18',
availableBalance: 180000,
ledgerBalance: 188750,
accruedInterest: 8750,
interestRate: 6.85
},
{
accountNo: 'NRE70010023',
customerId: 'CUST889900',
customerName: 'Vikram Joshi',
customerPan: 'LMNOJ9988X',
customerAddress: 'Office 3B, Koregaon Park Road, Pune 411001',
branch: 'Pune — Koregaon Park',
accountType: 'NRE',
productName: 'NRE Savings — Premium',
openedOn: '2020-11-05',
availableBalance: 3850000,
ledgerBalance: 3850000,
accruedInterest: 12400,
interestRate: 3.5
},
{
accountNo: 'SB88990022',
customerId: 'CUST990011',
customerName: 'Arjun Banerjee',
customerPan: 'TUVWB4455F',
customerAddress: '42, Park Street, Kolkata 700016',
branch: 'Kolkata — Park Street',
accountType: 'SAVINGS',
productName: 'Savings — Regular',
openedOn: '2021-09-08',
availableBalance: 92300,
ledgerBalance: 92300,
accruedInterest: 450,
interestRate: 3.0
}
];
}