feat(loan-products): add loan interest rate register UI

- Add Loan Interest Rate Register screen with CIBIL adjustment and edit-register views, backed by rate-register service and model
- Wire the new screen into products routing and the products menu
- Update loan product details and advance limit/tenure steps

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Sonali Likhitkar
2026-10-05 16:20:36 +05:30
co-authored by Claude Sonnet 5.5
parent 283ab2f733
commit 7c868ae073
16 changed files with 2252 additions and 11 deletions
@@ -0,0 +1,166 @@
<!--
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="ca" *ngIf="register">
<div class="ca__header">
<div class="ca__header-icon">CS</div>
<div class="ca__header-text">
<h2>CIBIL / credit score adjustment</h2>
<p>Applied on top of the chart rate at loan sanction · reused across all loan products linked to this register</p>
</div>
<button mat-stroked-button (click)="backToRegister()">← Back to register</button>
</div>
<div class="ca__body">
<div class="ca__left">
<div class="ca__card">
<div class="ca__card-head">
<div class="ca__card-title">Credit score slabs</div>
<button mat-stroked-button class="ca__dash-btn"><i class="fas fa-plus"></i> Add slab</button>
</div>
<table class="ca__table">
<thead>
<tr>
<th>#</th>
<th class="ca__num">Score from</th>
<th class="ca__num">Score to</th>
<th>Risk tier</th>
<th>Type</th>
<th class="ca__num">Adjustment</th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let slab of register.cibilSlabs; let i = index" [class.ca__row-alt]="i % 2 === 1">
<td>{{ i + 1 }}</td>
<td class="ca__num">{{ slab.from }}</td>
<td class="ca__num">{{ slab.to }}</td>
<td>
<span [class]="tierClass(slab.tier)">{{ slab.tier }}</span>
</td>
<td>{{ slab.type }}</td>
<td class="ca__num">
<span [class]="adjustmentClass(slab.adjustmentPct)">{{ formatPct(slab.adjustmentPct) }}</span>
</td>
<td class="ca__dots">⋯</td>
</tr>
</tbody>
</table>
</div>
<div class="ca__card">
<div class="ca__card-body">
<div class="ca__card-title">Fallback behaviour</div>
<div class="ca__fallback-grid">
<div class="ca__field">
<label>NO CIBIL AVAILABLE</label>
<select [(ngModel)]="register.fallbackNoCibilSlab">
<option *ngFor="let slab of register.cibilSlabs; let i = index" [value]="i + 1">
Use slab {{ i + 1 }} ({{ slab.tier }}, {{ formatPct(slab.adjustmentPct) }})
</option>
</select>
</div>
<div class="ca__field">
<label>CIBIL BELOW MIN SLAB</label>
<select [(ngModel)]="register.fallbackBelowMin">
<option value="use-min-slab">Use minimum slab adjustment</option>
<option value="block">Block loan — manual approval</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="ca__right">
<div class="ca__card">
<div class="ca__card-head">
<div class="ca__card-title">Live preview</div>
<div class="ca__card-hint">pick a scenario</div>
</div>
<div class="ca__card-body">
<div class="ca__preview-grid">
<div class="ca__field">
<label>PRODUCT</label>
<select [(ngModel)]="previewProductSrNo">
<option *ngFor="let row of register.rows" [value]="row.srNo">{{ row.particulars }}</option>
</select>
</div>
<div class="ca__field">
<label>LOAN AMOUNT</label>
<input type="number" [(ngModel)]="previewAmount" />
</div>
<div class="ca__field">
<label>CIBIL SCORE</label>
<input type="number" min="0" max="900" [(ngModel)]="previewCibil" />
</div>
<div class="ca__field">
<label>TENURE (MONTHS)</label>
<input type="number" [(ngModel)]="previewTenureMonths" />
</div>
</div>
<div class="ca__derivation">
<div class="ca__derivation-label">RATE DERIVATION</div>
<div class="ca__derivation-row">
<span>Chart cell — {{ productLabel(previewProductSrNo) }}</span>
<span class="ca__derivation-val">{{
chartCell() !== null ? (chartCell() | number: '1.2-2') + '%' : 'N.A.'
}}</span>
</div>
<div class="ca__derivation-row">
<span>CIBIL {{ previewCibil }} ({{ cibilSlab()?.tier ?? '—' }})</span>
<span
class="ca__derivation-val"
[class.ca__derivation-val--pos]="(cibilSlab()?.adjustmentPct ?? 0) < 0"
[class.ca__derivation-val--neg]="(cibilSlab()?.adjustmentPct ?? 0) > 0"
>
{{ formatPct(cibilSlab()?.adjustmentPct ?? 0) }}
</span>
</div>
<div class="ca__derivation-row ca__derivation-row--muted">
<span>Product floor / ceiling</span>
<span>no clamp</span>
</div>
<div class="ca__divider"></div>
<div class="ca__final">
<span>Final rate</span>
<span class="ca__final-val">{{ finalRate() }}</span>
</div>
</div>
</div>
</div>
<div class="ca__card">
<div class="ca__card-body">
<div class="ca__card-title">What changes if…</div>
<div class="ca__scenarios">
<div class="ca__scenario">
<span>CIBIL = 700</span>
<span>{{ rateFor(700) }}</span>
</div>
<div class="ca__scenario">
<span>CIBIL = 870</span>
<span class="ca__scenario-val--pos">{{ rateFor(870) }}</span>
</div>
<div class="ca__scenario">
<span>No CIBIL fetched</span>
<span class="ca__scenario-val--warn">{{ rateForFallback() }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ca__footer">
<button mat-stroked-button (click)="backToRegister()">← Register</button>
<div class="ca__footer-note">Changes apply to new sanctions once the register is approved</div>
<button mat-flat-button color="primary" (click)="save()">Save adjustments</button>
</div>
</div>
@@ -0,0 +1,344 @@
/**
* 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/.
*/
.ca {
background: #f8fafc;
min-height: calc(100vh - 160px);
padding: 20px 32px;
display: flex;
flex-direction: column;
gap: 16px;
&__header {
display: flex;
align-items: center;
gap: 14px;
padding: 20px 24px;
background: white;
border: 1px solid #e2e8f0;
border-radius: 10px;
}
&__header-icon {
width: 40px;
height: 40px;
border-radius: 9px;
background: #dbeafe;
color: #1d4ed8;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
font-weight: 700;
}
&__header-text {
flex: 1;
h2 {
margin: 0;
font-size: 20px;
font-weight: 600;
}
p {
margin: 3px 0 0;
font-size: 12px;
color: #64748b;
}
}
&__body {
display: grid;
grid-template-columns: 1.3fr 1fr;
gap: 16px;
}
&__left,
&__right {
display: flex;
flex-direction: column;
gap: 14px;
}
&__card {
background: white;
border: 1px solid #e2e8f0;
border-radius: 10px;
overflow: hidden;
}
&__card-head {
padding: 12px 16px;
border-bottom: 1px solid #f1f5f9;
display: flex;
align-items: center;
gap: 10px;
}
&__card-title {
font-size: 14px;
font-weight: 600;
}
&__card-hint {
margin-left: auto;
font-size: 11px;
color: #64748b;
}
&__card-body {
padding: 14px 18px;
display: flex;
flex-direction: column;
gap: 12px;
}
&__dash-btn {
margin-left: auto;
height: 28px;
font-size: 11px;
font-weight: 600;
color: #1d4ed8;
border: 1px dashed #1d4ed8;
i {
margin-right: 3px;
}
}
&__table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
thead tr {
background: #f8fafc;
color: #64748b;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.3px;
th {
text-align: left;
padding: 9px 14px;
font-weight: 600;
}
}
tbody tr {
border-top: 1px solid #f1f5f9;
td {
padding: 11px 14px;
}
}
}
&__row-alt {
background: #fafbfc;
}
&__num {
text-align: right;
}
&__dots {
text-align: center;
color: #94a3b8;
cursor: pointer;
}
&__fallback-grid,
&__preview-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
}
&__field {
display: flex;
flex-direction: column;
label {
font-size: 11px;
color: #64748b;
font-weight: 600;
letter-spacing: 0.3px;
margin-bottom: 4px;
}
input,
select {
height: 36px;
border: 1px solid #cbd5e1;
background: white;
border-radius: 6px;
padding: 0 12px;
font-size: 13px;
color: #0f172a;
font-family: inherit;
&:focus {
outline: 2px solid #1d4ed8;
outline-offset: -1px;
}
}
}
&__derivation {
padding: 12px 14px;
background: #f8fafc;
border-radius: 8px;
}
&__derivation-label {
font-size: 11px;
color: #64748b;
font-weight: 600;
letter-spacing: 0.3px;
margin-bottom: 8px;
}
&__derivation-row {
display: flex;
justify-content: space-between;
font-size: 12px;
padding: 3px 0;
&--muted {
color: #64748b;
}
}
&__derivation-val {
font-weight: 600;
&--pos {
color: #059669;
}
&--neg {
color: #dc2626;
}
}
&__divider {
height: 1px;
background: #e2e8f0;
margin: 8px 0;
}
&__final {
display: flex;
justify-content: space-between;
align-items: center;
span:first-child {
font-size: 12px;
font-weight: 600;
}
}
&__final-val {
font-size: 20px;
font-weight: 700;
color: #1d4ed8;
}
&__scenarios {
display: flex;
flex-direction: column;
gap: 8px;
font-size: 12px;
color: #334155;
}
&__scenario {
padding: 8px 10px;
background: #f8fafc;
border-radius: 6px;
display: flex;
justify-content: space-between;
span:last-child {
font-weight: 600;
}
}
&__scenario-val--pos {
color: #059669;
}
&__scenario-val--warn {
color: #d97706;
}
&__footer {
background: white;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 10px 16px;
display: flex;
align-items: center;
justify-content: space-between;
}
&__footer-note {
font-size: 11px;
color: #64748b;
}
}
.tier {
padding: 3px 8px;
border-radius: 4px;
font-size: 11px;
font-weight: 600;
&--poor {
background: #fee2e2;
color: #991b1b;
}
&--fair {
background: #fef3c7;
color: #92400e;
}
&--good {
background: #dbeafe;
color: #1e40af;
}
&--vgood {
background: #dcfce7;
color: #166534;
}
&--excellent {
background: #d1fae5;
color: #065f46;
}
}
.adj {
font-weight: 600;
&--negative {
color: #059669;
}
&--positive {
color: #d97706;
}
&--high {
color: #dc2626;
}
}
@@ -0,0 +1,162 @@
/**
* 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, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { RateRegisterService } from '../rate-register.service';
import { CibilSlab, RateRegister } from '../models/rate-register.model';
/**
* CIBIL/credit-score adjustment editor for a Rate Register — slab table, fallback behaviour
* and a live preview that resolves {product, loan amount, CIBIL} down to the final rate.
*/
@Component({
selector: 'mifosx-cibil-adjustment',
templateUrl: './cibil-adjustment.component.html',
styleUrls: ['./cibil-adjustment.component.scss'],
imports: [
CommonModule,
FormsModule,
MatButtonModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule
]
})
export class CibilAdjustmentComponent implements OnInit {
private readonly service = inject(RateRegisterService);
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
register!: RateRegister;
// Live preview inputs.
previewProductSrNo = 7; // House Purchase / Construction
previewAmount = 2500000;
previewCibil = 820;
previewTenureMonths = 120;
ngOnInit(): void {
const idParam = this.route.snapshot.queryParamMap.get('id');
const id = idParam ? Number(idParam) : null;
this.service.list().subscribe((all) => {
this.register = (id ? all.find((r) => r.id === id) : undefined) ?? this.service.getActiveOrFirstDraft();
});
}
tierClass(tier: CibilSlab['tier']): string {
const map: Record<string, string> = {
Poor: 'tier tier--poor',
Fair: 'tier tier--fair',
Good: 'tier tier--good',
'V. Good': 'tier tier--vgood',
Excellent: 'tier tier--excellent'
};
return map[tier] ?? 'tier';
}
adjustmentClass(pct: number): string {
if (pct < 0) {
return 'adj adj--negative';
}
if (pct > 0) {
return pct >= 1 ? 'adj adj--high' : 'adj adj--positive';
}
return 'adj';
}
formatPct(pct: number): string {
if (pct === 0) {
return '0.00%';
}
const sign = pct > 0 ? '+' : '−';
return `${sign}${Math.abs(pct).toFixed(2)}%`;
}
/** Looks up the chart cell for the currently previewed scenario. */
private chartRateFor(productSrNo: number, amount: number): number | null {
const row = this.register.rows.find((r) => r.srNo === productSrNo);
if (!row) {
return null;
}
for (let i = 0; i < this.register.slabs.length; i++) {
const slab = this.register.slabs[i];
const upto = slab.amountUpto;
if (upto === null || amount <= upto) {
const cell = row.rates[i];
if (cell === null) {
return null;
}
if (typeof cell === 'string') {
// Formula cell — in a real derive we'd resolve against the pledged deposit's rate.
return null;
}
return cell;
}
}
return null;
}
private cibilAdjustmentFor(score: number): CibilSlab | null {
return this.register.cibilSlabs.find((s) => score >= s.from && score <= s.to) ?? null;
}
chartCell(): number | null {
return this.chartRateFor(this.previewProductSrNo, this.previewAmount);
}
cibilSlab(): CibilSlab | null {
return this.cibilAdjustmentFor(this.previewCibil);
}
finalRate(): string {
const base = this.chartCell();
const slab = this.cibilSlab();
if (base === null) {
return 'N.A.';
}
const adjustment = slab?.adjustmentPct ?? 0;
return `${(base + adjustment).toFixed(2)}% p.a.`;
}
productLabel(srNo: number): string {
return this.register.rows.find((r) => r.srNo === srNo)?.particulars ?? '—';
}
rateFor(cibil: number): string {
const base = this.chartRateFor(this.previewProductSrNo, this.previewAmount);
if (base === null) {
return 'N.A.';
}
const slab = this.cibilAdjustmentFor(cibil);
return `${(base + (slab?.adjustmentPct ?? 0)).toFixed(2)}%`;
}
rateForFallback(): string {
const base = this.chartRateFor(this.previewProductSrNo, this.previewAmount);
if (base === null) {
return 'N.A.';
}
const fallback = this.register.cibilSlabs[this.register.fallbackNoCibilSlab - 1];
return `${(base + (fallback?.adjustmentPct ?? 0)).toFixed(2)}%`;
}
backToRegister(): void {
this.router.navigate(['/products/loan-interest-rate-register/edit'], { queryParams: { id: this.register.id } });
}
save(): void {
this.backToRegister();
}
}
@@ -0,0 +1,114 @@
<!--
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="er" *ngIf="register">
<div class="er__meta-bar">
<div class="er__field">
<label>REGISTER NAME</label>
<input type="text" [(ngModel)]="register.name" />
</div>
<div class="er__field er__field--date">
<label>EFFECTIVE FROM</label>
<input type="date" [(ngModel)]="register.effectiveFrom" />
</div>
<div class="er__field er__field--date">
<label>EFFECTIVE TO</label>
<input type="date" [(ngModel)]="register.effectiveTo" />
</div>
<div class="er__field er__field--curr">
<label>CURRENCY</label>
<select [(ngModel)]="register.currency">
<option value="INR">INR</option>
<option value="USD">USD</option>
</select>
</div>
<button mat-stroked-button class="er__meta-btn"><i class="fas fa-arrow-down"></i> Import</button>
<button mat-stroked-button class="er__meta-btn"><i class="fas fa-arrow-up"></i> Export</button>
</div>
<div class="er__grid-card">
<div class="er__grid-head">
<div class="er__grid-title">Rate chart grid</div>
<div class="er__grid-sub">
{{ rows.length }} products × {{ slabs.length }} amount slabs · click any cell to edit
</div>
<div class="er__grid-actions">
<button mat-stroked-button class="er__dash-btn" (click)="addProduct()">
<i class="fas fa-plus"></i> Add product
</button>
<button mat-stroked-button class="er__dash-btn" (click)="addSlab()">
<i class="fas fa-plus"></i> Add slab
</button>
</div>
</div>
<div class="er__grid-scroll">
<table class="er__grid">
<thead>
<tr>
<th class="er__col-particulars">Particulars</th>
<th *ngFor="let slab of slabs" class="er__col-rate">{{ slab.label }}</th>
</tr>
</thead>
<tbody>
<tr
*ngFor="let row of rows; let i = index"
[class.er__row-alt]="i % 2 === 1"
[class.er__row--formula]="isFormulaRow(row)"
>
<td class="er__col-particulars">
<span class="er__srno">{{ row.srNo }}</span
>{{ row.particulars }}
</td>
<td
*ngFor="let cell of row.rates; let j = index"
class="er__col-rate er__cell"
[class.er__cell--na]="isNa(cell)"
[class.er__cell--formula]="isFormulaRow(row)"
[class.er__cell--editing]="isEditing(i, j)"
(click)="!isEditing(i, j) && startEdit(i, j, cell)"
>
<input
*ngIf="isEditing(i, j); else cellView"
#cellInput
type="text"
class="er__cell-input"
[(ngModel)]="editValue"
(blur)="saveEdit(i, j)"
(keydown.enter)="saveEdit(i, j)"
(keydown.escape)="cancelEdit()"
/>
<ng-template #cellView>{{ display(cell) }}</ng-template>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="er__cibil-strip" (click)="editCibil()">
<div class="er__cibil-badge">CS</div>
<div class="er__cibil-text">
<div class="er__cibil-title">CIBIL / credit score adjustment</div>
<div class="er__cibil-sub">
{{ register.cibilSlabs.length }} slabs · +1.00% (poor) to −0.20% (excellent) · applied on top of chart rate
</div>
</div>
<a class="er__cibil-edit">Edit →</a>
</div>
<div class="er__footer">
<button mat-stroked-button (click)="backToList()">Cancel</button>
<div class="er__footer-note">Rates in % p.a. · N.A. = slab not offered · formulas resolved at sanction</div>
<div class="er__footer-actions">
<button mat-stroked-button>Save draft</button>
<button mat-flat-button class="er__submit" (click)="submitForApproval()">
<i class="fas fa-check"></i> Submit for approval
</button>
</div>
</div>
</div>
@@ -0,0 +1,323 @@
/**
* 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/.
*/
.er {
background: #f8fafc;
min-height: calc(100vh - 160px);
padding: 20px 24px;
display: flex;
flex-direction: column;
gap: 12px;
&__meta-bar {
background: white;
border: 1px solid #e2e8f0;
border-radius: 9px;
padding: 12px 14px;
display: flex;
gap: 10px;
align-items: flex-end;
}
&__field {
display: flex;
flex-direction: column;
flex: 1.5;
label {
font-size: 10px;
color: #64748b;
font-weight: 600;
letter-spacing: 0.3px;
margin-bottom: 3px;
}
input,
select {
height: 32px;
border: 1px solid #cbd5e1;
background: white;
border-radius: 6px;
padding: 0 10px;
font-size: 13px;
font-family: inherit;
color: #0f172a;
&:focus {
outline: 2px solid #1d4ed8;
outline-offset: -1px;
}
}
&--date {
flex: 0.9;
}
&--curr {
flex: 0.5;
}
}
&__meta-btn {
height: 32px;
font-size: 11px;
i {
margin-right: 4px;
}
}
&__grid-card {
background: white;
border: 1px solid #e2e8f0;
border-radius: 9px;
overflow: hidden;
display: flex;
flex-direction: column;
flex: 1;
min-height: 500px;
}
&__grid-head {
padding: 8px 14px;
background: #f8fafc;
border-bottom: 1px solid #e2e8f0;
display: flex;
align-items: center;
gap: 10px;
}
&__grid-title {
font-size: 12px;
font-weight: 600;
}
&__grid-sub {
font-size: 10px;
color: #64748b;
}
&__grid-actions {
margin-left: auto;
display: flex;
gap: 6px;
}
&__dash-btn {
height: 26px;
font-size: 10px;
font-weight: 600;
color: #1d4ed8;
border: 1px dashed #1d4ed8;
i {
margin-right: 3px;
}
}
&__grid-scroll {
overflow: auto;
flex: 1;
}
&__grid {
width: 100%;
border-collapse: separate;
border-spacing: 0;
font-size: 11px;
thead tr {
background: #f8fafc;
color: #475569;
font-size: 9px;
text-transform: uppercase;
letter-spacing: 0.3px;
th {
padding: 8px 7px;
font-weight: 600;
position: sticky;
top: 0;
background: #f8fafc;
border-bottom: 1px solid #e2e8f0;
z-index: 2;
white-space: nowrap;
}
}
tbody tr {
border-top: 1px solid #f1f5f9;
}
td {
padding: 7px;
text-align: right;
cursor: text;
&:first-child {
text-align: left;
}
}
}
&__col-particulars {
position: sticky;
left: 0;
background: white;
border-right: 1px solid #e2e8f0;
font-weight: 500;
min-width: 240px;
text-align: left !important;
padding-left: 12px !important;
}
&__row-alt &__col-particulars {
background: #fafbfc;
}
&__row-alt {
background: #fafbfc;
}
&__row--formula {
.er__col-particulars {
background: #eff6ff;
color: #1d4ed8;
font-weight: 600;
}
}
&__srno {
color: #94a3b8;
margin-right: 6px;
}
&__cell {
cursor: cell;
transition: background-color 0.1s;
&:hover {
background: #f1f5f9;
outline: 1px solid #cbd5e1;
outline-offset: -1px;
}
&--na {
color: #cbd5e1;
}
&--formula {
background: #eff6ff;
color: #1d4ed8;
font-weight: 600;
}
&--editing {
padding: 0 !important;
background: #fef9c3 !important;
outline: 2px solid #1d4ed8 !important;
outline-offset: -2px;
}
}
&__cell-input {
width: 100%;
height: 100%;
min-height: 28px;
border: none;
outline: none;
background: transparent;
padding: 7px;
font-size: 11px;
text-align: right;
font-family: inherit;
color: #0f172a;
box-sizing: border-box;
}
&__cibil-strip {
background: white;
border: 1px solid #e2e8f0;
border-radius: 9px;
padding: 9px 14px;
display: flex;
align-items: center;
gap: 10px;
cursor: pointer;
transition: background-color 0.1s;
&:hover {
background: #f8fafc;
}
}
&__cibil-badge {
width: 24px;
height: 24px;
border-radius: 12px;
background: #dbeafe;
color: #1d4ed8;
display: flex;
align-items: center;
justify-content: center;
font-size: 11px;
font-weight: 700;
}
&__cibil-text {
flex: 1;
}
&__cibil-title {
font-size: 12px;
font-weight: 600;
}
&__cibil-sub {
font-size: 10px;
color: #64748b;
margin-top: 1px;
}
&__cibil-edit {
font-size: 11px;
font-weight: 600;
color: #1d4ed8;
cursor: pointer;
}
&__footer {
background: white;
border: 1px solid #e2e8f0;
border-radius: 9px;
padding: 10px 14px;
display: flex;
align-items: center;
justify-content: space-between;
}
&__footer-note {
font-size: 11px;
color: #64748b;
}
&__footer-actions {
display: flex;
gap: 6px;
}
&__submit {
background: #059669 !important;
color: white !important;
font-weight: 600;
i {
margin-right: 4px;
}
}
}
@@ -0,0 +1,196 @@
/**
* 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, ElementRef, OnInit, ViewChild, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { MatIconModule } from '@angular/material/icon';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
import { RateRegisterService } from '../rate-register.service';
import { RateCell, RateChartRow, RateRegister, SlabColumn } from '../models/rate-register.model';
/**
* Grid editor for one Loan Interest Rate Register — Excel-shaped: 34 products as rows and 10
* amount slabs as columns. Cells can hold a plain rate, N.A., or a formula ("1% + FD"). All
* data today comes from {@link RateRegisterService}; wire-up to the real API comes later.
*/
@Component({
selector: 'mifosx-edit-register',
templateUrl: './edit-register.component.html',
styleUrls: ['./edit-register.component.scss'],
imports: [
CommonModule,
FormsModule,
RouterLink,
MatButtonModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
MatIconModule,
MatDatepickerModule,
MatNativeDateModule
]
})
export class EditRegisterComponent implements OnInit {
private readonly service = inject(RateRegisterService);
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
register!: RateRegister;
slabs: SlabColumn[] = [];
rows: RateChartRow[] = [];
/** The cell currently being edited (row/column indices into the grid), or null when nothing is open. */
editing: { row: number; col: number } | null = null;
editValue = '';
@ViewChild('cellInput') cellInput?: ElementRef<HTMLInputElement>;
ngOnInit(): void {
const idParam = this.route.snapshot.queryParamMap.get('id');
const id = idParam ? Number(idParam) : null;
this.service.list().subscribe((all) => {
this.register = (id ? all.find((r) => r.id === id) : undefined) ?? this.service.getActiveOrFirstDraft();
this.slabs = this.register.slabs;
this.rows = this.register.rows;
});
}
/** Formatted display for a cell. */
display(cell: RateCell): string {
if (cell === null) {
return 'N.A.';
}
if (typeof cell === 'string') {
return cell;
}
return cell.toFixed(2);
}
isFormulaRow(row: RateChartRow): boolean {
return !!row.isFormula;
}
isNa(cell: RateCell): boolean {
return cell === null;
}
/** Click on a cell → open it as an editable input, pre-filled with the current value. */
startEdit(rowIdx: number, colIdx: number, current: RateCell): void {
this.editing = { row: rowIdx, col: colIdx };
if (current === null) {
this.editValue = '';
} else if (typeof current === 'string') {
this.editValue = current;
} else {
this.editValue = current.toString();
}
// Let the view render the input, then focus and select its contents.
setTimeout(() => {
const el = this.cellInput?.nativeElement;
if (el) {
el.focus();
el.select();
}
}, 0);
}
isEditing(rowIdx: number, colIdx: number): boolean {
return !!this.editing && this.editing.row === rowIdx && this.editing.col === colIdx;
}
/**
* Save the cell:
* - empty / "N.A." / "NA" → the slab is marked unavailable
* - value with letters, "%" or "+" → persisted as a formula string ("1% + FD")
* - plain number → stored as a number so it formats as a %
*/
saveEdit(rowIdx: number, colIdx: number): void {
if (!this.editing) {
return;
}
const raw = this.editValue.trim();
let next: RateCell;
if (!raw || raw.toLowerCase() === 'n.a.' || raw.toLowerCase() === 'na') {
next = null;
} else if (/[a-zA-Z+%]/.test(raw)) {
next = raw;
} else {
const num = Number(raw);
next = Number.isFinite(num) ? num : this.rows[rowIdx].rates[colIdx];
}
this.rows[rowIdx].rates[colIdx] = next;
this.rows[rowIdx].isFormula = this.rows[rowIdx].rates.some((c) => typeof c === 'string');
this.editing = null;
}
cancelEdit(): void {
this.editing = null;
}
/** Append a new empty product row at the bottom of the grid. */
addProduct(): void {
const name = window.prompt('New product name', 'New product');
if (!name) {
return;
}
const next = this.rows.length > 0 ? Math.max(...this.rows.map((r) => r.srNo)) + 1 : 1;
this.rows.push({
srNo: next,
particulars: name.trim(),
rates: Array(this.slabs.length).fill(null),
isFormula: false
});
}
/** Append a new amount slab column; every existing row grows by one blank cell. */
addSlab(): void {
const label = window.prompt('Slab label (e.g. "Upto 50,00,000" or "> 50,00,000")', 'New slab');
if (!label) {
return;
}
const amountText = window.prompt('Amount upper bound in ₹ (leave blank for no cap)', '');
const amountUpto = amountText && amountText.trim() ? Number(amountText) : null;
this.slabs.push({
key: `s_${Date.now()}`,
label: label.trim(),
amountUpto: amountUpto !== null && !Number.isFinite(amountUpto) ? null : amountUpto
});
this.rows.forEach((r) => r.rates.push(null));
}
editCibil(): void {
this.router.navigate(['/products/loan-interest-rate-register/cibil'], { queryParams: { id: this.register.id } });
}
backToList(): void {
this.router.navigate(['/products/loan-interest-rate-register']);
}
submitForApproval(): void {
this.register.status = 'Active';
this.router.navigate(['/products/loan-interest-rate-register']);
}
statusChipClass(): string {
switch (this.register?.status) {
case 'Active':
return 'chip chip--active';
case 'Draft':
return 'chip chip--draft';
default:
return 'chip chip--expired';
}
}
}
@@ -0,0 +1,83 @@
<!--
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="lirr">
<div class="lirr__header">
<div class="lirr__header-icon"><i class="fas fa-percentage"></i></div>
<div class="lirr__header-text">
<h2>Loan Interest Rate Register</h2>
<p>Central CIBIL-based rate chart used across all loan products</p>
</div>
<button mat-stroked-button class="lirr__excel-btn">
<i class="fas fa-exchange-alt"></i>
Excel
</button>
<button mat-flat-button color="primary" class="lirr__create-btn" (click)="create()">
<i class="fas fa-plus"></i>
Create register
</button>
</div>
<div class="lirr__body">
<div class="lirr__kpi-grid">
<div class="lirr__kpi">
<div class="lirr__kpi-label">ACTIVE REGISTER</div>
<div class="lirr__kpi-value">{{ active?.name ?? 'None' }}</div>
<div class="lirr__kpi-sub lirr__kpi-sub--ok">Effective {{ activeWindow() }}</div>
</div>
<div class="lirr__kpi">
<div class="lirr__kpi-label">SLABS</div>
<div class="lirr__kpi-value">10 amount slabs</div>
<div class="lirr__kpi-sub">₹10k → &gt; ₹25L</div>
</div>
<div class="lirr__kpi">
<div class="lirr__kpi-label">CIBIL ADJUSTMENTS</div>
<div class="lirr__kpi-value">{{ active?.cibilSlabs?.length ?? 0 }} slabs</div>
<div class="lirr__kpi-sub">+1.00% → −0.20%</div>
</div>
</div>
<div class="lirr__table-card">
<div class="lirr__table-head">
<div class="lirr__table-title">All registers</div>
</div>
<table class="lirr__table">
<thead>
<tr>
<th>Name</th>
<th>Effective from</th>
<th>Effective to</th>
<th>Status</th>
<th>Created by</th>
<th>Last modified</th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let r of registers" [class.lirr__row--active]="r.status === 'Active'" (click)="edit(r)">
<td>
<div class="lirr__name">{{ r.name }}</div>
<div class="lirr__name-sub" *ngIf="r.note">{{ r.note }}</div>
</td>
<td>{{ r.effectiveFrom | date: 'dd MMM yyyy' }}</td>
<td>{{ r.effectiveTo ? (r.effectiveTo | date: 'dd MMM yyyy') : '—' }}</td>
<td>
<span [class]="statusChipClass(r.status)">{{ r.status === 'Active' ? '● Active' : r.status }}</span>
</td>
<td>{{ r.createdBy }}</td>
<td>{{ r.lastModified | date: 'dd MMM yyyy' }}</td>
<td class="lirr__row-actions">{{ r.status === 'Draft' ? 'Edit · Submit' : 'View' }}</td>
</tr>
</tbody>
</table>
<div class="lirr__table-foot">
<div>Showing 1–{{ registers.length }} of {{ registers.length }}</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,212 @@
/**
* 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/.
*/
.lirr {
background: #f8fafc;
min-height: calc(100vh - 160px);
&__header {
display: flex;
align-items: center;
gap: 14px;
padding: 22px 32px 14px;
background: white;
border-bottom: 1px solid #e2e8f0;
}
&__header-icon {
width: 40px;
height: 40px;
border-radius: 9px;
background: #eff6ff;
color: #1d4ed8;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
}
&__header-text {
flex: 1;
h2 {
margin: 0;
font-size: 20px;
font-weight: 600;
}
p {
margin: 3px 0 0;
font-size: 12px;
color: #64748b;
}
}
&__excel-btn,
&__create-btn {
i {
margin-right: 6px;
}
}
&__body {
padding: 20px 32px;
}
&__kpi-grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 12px;
margin-bottom: 18px;
}
&__kpi {
background: white;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 14px 16px;
}
&__kpi-label {
font-size: 11px;
color: #64748b;
font-weight: 600;
letter-spacing: 0.3px;
}
&__kpi-value {
font-size: 18px;
font-weight: 600;
margin-top: 4px;
}
&__kpi-sub {
font-size: 11px;
color: #64748b;
margin-top: 4px;
&--ok {
color: #059669;
}
}
&__table-card {
background: white;
border: 1px solid #e2e8f0;
border-radius: 10px;
overflow: hidden;
}
&__table-head {
padding: 12px 20px;
border-bottom: 1px solid #f1f5f9;
display: flex;
align-items: center;
}
&__table-title {
font-size: 14px;
font-weight: 600;
}
&__table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
thead {
background: #f8fafc;
color: #64748b;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.3px;
th {
text-align: left;
padding: 10px 12px;
font-weight: 600;
&:first-child {
padding-left: 20px;
}
}
}
tbody tr {
border-top: 1px solid #f1f5f9;
cursor: pointer;
transition: background-color 0.1s;
&:hover {
background: #f8fafc;
}
td {
padding: 12px;
&:first-child {
padding-left: 20px;
}
}
}
}
&__row--active {
background: #f0fdf4;
}
&__name {
font-weight: 600;
}
&__name-sub {
font-size: 11px;
color: #64748b;
margin-top: 2px;
}
&__row-actions {
text-align: right;
color: #64748b;
padding-right: 20px !important;
}
&__table-foot {
padding: 10px 20px;
border-top: 1px solid #f1f5f9;
font-size: 12px;
color: #64748b;
}
}
.chip {
padding: 3px 10px;
border-radius: 10px;
font-size: 11px;
font-weight: 600;
&--active {
background: #dcfce7;
color: #166534;
}
&--draft {
background: #fef3c7;
color: #92400e;
}
&--expired {
background: #f1f5f9;
color: #475569;
}
&--scheduled {
background: #e0e7ff;
color: #3730a3;
}
}
@@ -0,0 +1,78 @@
/**
* 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, OnInit, inject } from '@angular/core';
import { DatePipe } from '@angular/common';
import { Router } from '@angular/router';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { RateRegisterService } from './rate-register.service';
import { RateRegister } from './models/rate-register.model';
/**
* List screen for the central Loan Interest Rate Register — three KPI cards followed by the
* registers table (name, effective window, status, author, last modified).
*/
@Component({
selector: 'mifosx-loan-interest-rate-register',
templateUrl: './loan-interest-rate-register.component.html',
styleUrls: ['./loan-interest-rate-register.component.scss'],
imports: [
...STANDALONE_SHARED_IMPORTS,
DatePipe
]
})
export class LoanInterestRateRegisterComponent implements OnInit {
private readonly service = inject(RateRegisterService);
private readonly router = inject(Router);
registers: RateRegister[] = [];
active?: RateRegister;
ngOnInit(): void {
this.service.list().subscribe((rows) => {
this.registers = rows;
this.active = rows.find((r) => r.status === 'Active');
});
}
edit(register: RateRegister): void {
this.router.navigate(['/products/loan-interest-rate-register/edit'], { queryParams: { id: register.id } });
}
create(): void {
this.router.navigate(['/products/loan-interest-rate-register/edit']);
}
statusChipClass(status: RateRegister['status']): string {
switch (status) {
case 'Active':
return 'chip chip--active';
case 'Draft':
return 'chip chip--draft';
case 'Expired':
return 'chip chip--expired';
default:
return 'chip chip--scheduled';
}
}
activeWindow(): string {
if (!this.active) {
return '—';
}
return `${this.formatShort(this.active.effectiveFrom)} → ${this.formatShort(this.active.effectiveTo)}`;
}
private formatShort(iso: string | null): string {
if (!iso) {
return '—';
}
const d = new Date(iso);
return d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: '2-digit' });
}
}
@@ -0,0 +1,52 @@
/**
* 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/.
*/
export type RegisterStatus = 'Active' | 'Draft' | 'Expired' | 'Scheduled';
export interface SlabColumn {
key: string;
label: string;
amountUpto: number | null;
}
/** A single rate cell: number for a %, string for a formula ("1% + FD"), null for N.A. */
export type RateCell = number | string | null;
export interface RateChartRow {
srNo: number;
particulars: string;
isFormula?: boolean;
rates: RateCell[];
}
export type RiskTier = 'Poor' | 'Fair' | 'Good' | 'V. Good' | 'Excellent';
export interface CibilSlab {
from: number;
to: number;
tier: RiskTier;
type: 'Flat';
adjustmentPct: number;
}
export interface RateRegister {
id: number;
name: string;
effectiveFrom: string;
effectiveTo: string | null;
currency: string;
status: RegisterStatus;
createdBy: string;
lastModified: string;
note?: string;
slabs: SlabColumn[];
rows: RateChartRow[];
cibilSlabs: CibilSlab[];
fallbackNoCibilSlab: number;
fallbackBelowMin: 'use-min-slab' | 'block';
}
@@ -0,0 +1,457 @@
/**
* 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 { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { CibilSlab, RateChartRow, RateRegister, SlabColumn } from './models/rate-register.model';
/**
* In-memory stand-in for the central Loan Interest Rate Register.
*
* Mirrors the Excel chart the bank's Board approves each quarter (34 products × 10 amount slabs).
* Backing API will land later; today the service only serves the demo data in memory so the
* screens can be driven end-to-end without a server.
*/
@Injectable({ providedIn: 'root' })
export class RateRegisterService {
private readonly slabs: SlabColumn[] = [
{ key: 's1', label: 'Upto 10,000', amountUpto: 10000 },
{ key: 's2', label: 'Upto 25,000', amountUpto: 25000 },
{ key: 's3', label: 'Upto 1,00,000', amountUpto: 100000 },
{ key: 's4', label: 'Upto 2,00,000', amountUpto: 200000 },
{ key: 's5', label: 'Upto 5,00,000', amountUpto: 500000 },
{ key: 's6', label: 'Upto 10,00,000', amountUpto: 1000000 },
{ key: 's7', label: 'Upto 15,00,000', amountUpto: 1500000 },
{ key: 's8', label: 'Upto 20,00,000', amountUpto: 2000000 },
{ key: 's9', label: 'Upto 25,00,000', amountUpto: 2500000 },
{ key: 's10', label: '> 25,00,000', amountUpto: null }
];
// Values taken from the bank's approved Interest Rate of Loans register.
private readonly rows: RateChartRow[] = [
this.row(1, 'Consumer Loan', [
18,
18,
15,
13,
null,
null,
null,
null,
null,
null
]),
this.row(
2,
'Self Employment Loan',
[
18,
18,
15,
13,
12.5,
12,
11.5,
11,
10.5,
10.5
]
),
this.row(
3,
'Business Term Loan for running',
[
18,
18,
15,
13,
12.5,
11,
10.5,
10,
9.5,
9.5
]
),
this.row(
4,
'Cash Credit',
[
18,
18,
15,
13,
13,
11,
10.5,
10,
9.5,
9.5
]
),
this.row(
5,
'Limit (OD) on property — MSME',
[
18,
18,
15,
13,
13,
11,
10.5,
10,
9.5,
9.5
]
),
this.row(
6,
'Limit (OD) on property — Personal',
[
18,
18,
15,
14,
13.5,
12,
11.5,
11,
10.5,
10.5
]
),
this.row(7, 'House Purchase / Construction', [
null,
null,
15,
12,
12,
9.25,
8.75,
8.25,
8,
8
]),
this.row(8, 'House Repairing / Renovation', [
null,
null,
15,
14,
14,
13,
12,
11,
10.5,
10
]),
this.row(
9,
'Commercial Real Estate Loan',
[
18,
18,
15,
13,
12.5,
12,
11,
10.5,
10.5,
10
]
),
this.row(10, 'Loan against Jewellery', this.flat(10.8)),
this.row(11, 'Loan against Warehouse Receipt (A)', this.flat(13)),
this.row(
12,
'Loan against Warehouse Receipt (B)',
[
10.5,
10.5,
10.5,
10.5,
10.5,
10.5,
10,
10,
10,
9
]
),
this.row(13, 'Agriculture Loan', [
null,
null,
15,
12,
12,
12,
11.75,
11.5,
11.25,
11
]),
this.row(14, 'Personal Loan (Unsecured)', [
18,
18,
16,
15,
null,
null,
null,
null,
null,
null
]),
this.row(
15,
'Personal Loan (Secured / Property)',
[
18,
18,
16,
15,
15,
13,
12,
11.5,
11,
11
]
),
this.row(16, 'Two Wheeler Loan', this.flat(13)),
this.row(17, 'Car Loan (4-Wheel Domestic)', [
null,
null,
10,
9.5,
9.5,
8.75,
8.5,
8.35,
8.25,
8.25
]),
this.row(18, 'Old Car Loan (4-Wheel Domestic)', [
null,
null,
13,
12.5,
12.5,
12,
11.5,
11,
10.5,
10.5
]),
this.row(19, 'Vehicle Loan (Commercial & Three-wheeler)', [
null,
null,
13,
12,
12,
10.5,
10,
10,
10,
10
]),
this.row(20, 'Old Vehicle Loan (Commercial)', [
null,
null,
15,
14,
14,
13.5,
13.5,
13,
12.5,
12.5
]),
this.row(
21,
'Machinery & Plant Loan',
[
18,
18,
15,
13,
12.5,
12,
11,
10.5,
10.5,
10
]
),
this.row(
22,
'Office Chamber / Equipment Loan',
[
18,
18,
15,
13,
12.5,
12,
11,
10.5,
10.5,
10
]
),
this.formulaRow(23, 'Loan against F.D.R.', [
'1% + FD',
'1% + FD',
'1% + FD',
'1% + FD',
'1% + FD',
'1% + FD',
'0.75% + FD',
'0.50% + FD',
'0.50% + FD',
'0.50% + FD'
]),
this.row(24, 'Loan against Daily Deposit & Gold', this.flat(10)),
this.formulaRow(25, 'Loan against Recurring Deposit', Array(10).fill('1% + RD')),
this.row(26, 'Loan against Staff Service Fund', this.flat(7)),
this.row(27, 'Over Draft A/c', this.flat(null)),
this.row(28, 'Loan on LIC Policy', this.flat(null)),
this.row(29, 'Loan on KVP / NSC', this.flat(null)),
this.row(30, 'Bill Discount', this.flat(null)),
this.row(31, 'Temporary Limit', this.flat(15)),
this.row(32, 'Bank Guarantee (commission)', this.flat(0.25)),
this.row(33, 'Sugam Vyapar Loan', this.flat(null)),
this.row(34, 'OD to Staff (upto 2 lakh)', this.flat(null))
];
private readonly cibilSlabs: CibilSlab[] = [
{ from: 0, to: 649, tier: 'Poor', type: 'Flat', adjustmentPct: 1.0 },
{ from: 650, to: 749, tier: 'Fair', type: 'Flat', adjustmentPct: 0.5 },
{ from: 750, to: 799, tier: 'Good', type: 'Flat', adjustmentPct: 0 },
{ from: 800, to: 850, tier: 'V. Good', type: 'Flat', adjustmentPct: -0.1 },
{ from: 851, to: 900, tier: 'Excellent', type: 'Flat', adjustmentPct: -0.2 }
];
private readonly registers: RateRegister[] = [
{
id: 1001,
name: 'Q1 2027 Rates',
effectiveFrom: '2027-01-01',
effectiveTo: '2027-03-31',
currency: 'INR',
status: 'Draft',
createdBy: 'Sonali',
lastModified: '2026-10-01',
note: 'Scheduled · future effective',
slabs: this.slabs,
rows: this.rows,
cibilSlabs: this.cibilSlabs,
fallbackNoCibilSlab: 2,
fallbackBelowMin: 'block'
},
{
id: 1002,
name: 'Interest Rate of Loans — Oct 2026',
effectiveFrom: '2026-10-01',
effectiveTo: '2026-12-31',
currency: 'INR',
status: 'Active',
createdBy: 'Admin',
lastModified: '2026-09-25',
note: 'Approved by Board on 25 Sep',
slabs: this.slabs,
rows: this.rows,
cibilSlabs: this.cibilSlabs,
fallbackNoCibilSlab: 2,
fallbackBelowMin: 'block'
},
{
id: 1003,
name: 'Q3 2026 Rates',
effectiveFrom: '2026-07-01',
effectiveTo: '2026-09-30',
currency: 'INR',
status: 'Expired',
createdBy: 'Admin',
lastModified: '2026-06-15',
slabs: this.slabs,
rows: this.rows,
cibilSlabs: this.cibilSlabs,
fallbackNoCibilSlab: 2,
fallbackBelowMin: 'block'
},
{
id: 1004,
name: 'Q2 2026 Rates',
effectiveFrom: '2026-04-01',
effectiveTo: '2026-06-30',
currency: 'INR',
status: 'Expired',
createdBy: 'Admin',
lastModified: '2026-03-10',
slabs: this.slabs,
rows: this.rows,
cibilSlabs: this.cibilSlabs,
fallbackNoCibilSlab: 2,
fallbackBelowMin: 'block'
},
{
id: 1005,
name: 'Q1 2026 Rates',
effectiveFrom: '2026-01-01',
effectiveTo: '2026-03-31',
currency: 'INR',
status: 'Expired',
createdBy: 'Admin',
lastModified: '2025-12-20',
slabs: this.slabs,
rows: this.rows,
cibilSlabs: this.cibilSlabs,
fallbackNoCibilSlab: 2,
fallbackBelowMin: 'block'
}
];
list(): Observable<RateRegister[]> {
return of(this.registers);
}
get(id: number): Observable<RateRegister | undefined> {
return of(this.registers.find((r) => r.id === id));
}
/** The one shown by default on list → edit navigation. */
getActiveOrFirstDraft(): RateRegister {
return (
this.registers.find((r) => r.status === 'Draft') ??
this.registers.find((r) => r.status === 'Active') ??
this.registers[0]
);
}
getSlabColumns(): SlabColumn[] {
return this.slabs;
}
getCibilSlabs(): CibilSlab[] {
return this.cibilSlabs;
}
private row(srNo: number, particulars: string, rates: (number | null)[]): RateChartRow {
return { srNo, particulars, rates };
}
private formulaRow(srNo: number, particulars: string, rates: string[]): RateChartRow {
return { srNo, particulars, isFormula: true, rates };
}
private flat(value: number | null): (number | null)[] {
return Array(10).fill(value);
}
}
@@ -58,7 +58,7 @@ export class LoanProductAdvanceLimitTenureStepComponent {
readonly appropriationOrderOptions = [
{ id: 'charges_penal_interest_principal', label: 'Charges → Penal → Interest → Principal' },
{ id: 'penal_interest_principal_charges', label: 'Penal → Interest → Principal → Charges' }
{ id: 'principal_interest_penal_charges', label: 'Principal → Interest → Penal → Charges' }
];
readonly yesNoOptions = [
@@ -103,8 +103,8 @@
<mat-label>{{ 'labels.inputs.Start Date' | translate }}</mat-label>
<input
matInput
[min]="minDate"
[max]="maxDate"
[min]="startDateMin"
[max]="startDateMax"
[matDatepicker]="startDatePicker"
matTooltip="{{ 'tooltips.loan product will be active and available to clients' | translate }}"
formControlName="startDate"
@@ -117,7 +117,7 @@
<mat-label>{{ 'labels.inputs.Close Date' | translate }}</mat-label>
<input
matInput
[min]="minDate"
[min]="closeDateMin"
[max]="maxDate"
[matDatepicker]="closeDatePicker"
matTooltip="{{ 'tooltips.loan product will become inactive and unavailable to clients' | translate }}"
@@ -42,6 +42,14 @@ export class LoanProductDetailsStepComponent implements OnInit {
minDate = new Date(2000, 0, 1);
maxDate = new Date(new Date().setFullYear(new Date().getFullYear() + 10));
// Start Date policy: a new product must start on the current day — the picker allows only today
// (neither past nor future). Widened for an existing product so its saved start date stays valid.
startDateMin: Date = new Date();
startDateMax: Date = new Date();
// Close (End) Date accepts only future dates — default min is tomorrow; widened for an existing product.
closeDateMin: Date = new Date();
/**
* @param {FormBuilder} formBuilder Form Builder.
* @param {Dates} dateUtils Date Utils.
@@ -75,11 +83,25 @@ export class LoanProductDetailsStepComponent implements OnInit {
// A loan / advance is an asset of the bank, so its ledger GL is always an asset account.
this.assetAccountOptions = this.loanProductsTemplate?.accountingMappingOptions?.assetAccountOptions ?? [];
// Start Date: default to today for a new product and lock the picker to the current day.
// An existing product keeps the wider range so its saved date remains selectable/valid.
if (this.isExistingProduct) {
this.startDateMin = this.minDate;
this.startDateMax = this.maxDate;
this.closeDateMin = this.minDate;
} else {
this.startDateMin = new Date();
this.startDateMax = new Date();
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
this.closeDateMin = tomorrow;
}
this.loanProductDetailsForm.patchValue({
name: this.loanProductsTemplate.name,
shortName: this.loanProductsTemplate.shortName,
description: this.loanProductsTemplate.description,
startDate: this.loanProductsTemplate.startDate && new Date(this.loanProductsTemplate.startDate),
startDate: this.loanProductsTemplate.startDate ? new Date(this.loanProductsTemplate.startDate) : new Date(),
closeDate: this.loanProductsTemplate.closeDate && new Date(this.loanProductsTemplate.closeDate)
});
}
@@ -130,12 +152,8 @@ export class LoanProductDetailsStepComponent implements OnInit {
];
readonly prioritySectorOptions = [
{ id: 'no', label: 'No' },
{ id: 'agriculture', label: 'Agriculture' },
{ id: 'msme', label: 'MSME' },
{ id: 'weaker_sections', label: 'Weaker Sections' },
{ id: 'education', label: 'Education' },
{ id: 'housing', label: 'Housing' }
{ id: 'yes', label: 'Yes' },
{ id: 'no', label: 'No' }
];
readonly cibilAccountTypeOptions = [
@@ -106,6 +106,9 @@ import { ChargesTemplateAndResolver } from './charges/charges-template-and-resol
import { EditFixedDepositProductComponent } from './fixed-deposit-products/edit-fixed-deposit-product/edit-fixed-deposit-product.component';
import { FixedDepositProductAndTemplateResolver } from './fixed-deposit-products/edit-fixed-deposit-product/fixed-deposit-product-and-template.resolver';
import { BaseFdInterestRateChartComponent } from './fixed-deposit-products/base-fd-interest-rate-chart/base-fd-interest-rate-chart.component';
import { LoanInterestRateRegisterComponent } from './loan-interest-rate-register/loan-interest-rate-register.component';
import { EditRegisterComponent } from './loan-interest-rate-register/edit-register/edit-register.component';
import { CibilAdjustmentComponent } from './loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component';
import { CollateralResolver } from './collaterals/collateral.resolver';
import { CollateralsResolver } from './collaterals/collaterals.resolver';
import { CollateralTemplateResolver } from './collaterals/collaterals-template.resolver';
@@ -894,6 +897,26 @@ const routes: Routes = [
}
]
},
{
path: 'loan-interest-rate-register',
data: { title: 'Loan Interest Rate Register', breadcrumb: 'Loan Interest Rate Register' },
children: [
{
path: '',
component: LoanInterestRateRegisterComponent
},
{
path: 'edit',
component: EditRegisterComponent,
data: { title: 'Edit Register', breadcrumb: 'Edit' }
},
{
path: 'cibil',
component: CibilAdjustmentComponent,
data: { title: 'CIBIL Adjustment', breadcrumb: 'CIBIL Adjustment' }
}
]
},
{
path: 'charges',
data: { title: 'Charges', breadcrumb: 'Charges' },
+13
View File
@@ -106,6 +106,19 @@
</a>
</div>
<div>
<a class="pd-card" [routerLink]="['loan-interest-rate-register']" *mifosxHasPermission="'READ_LOANPRODUCT'">
<div class="pd-card__icon pd-card__icon--blue">
<i class="fas fa-percentage"></i>
</div>
<div class="pd-card__body">
<h3 class="pd-card__title">Loan Interest Rate Register</h3>
<p class="pd-card__desc">Maintain central CIBIL-based interest rates for all loan products</p>
</div>
<i class="fas fa-chevron-right pd-card__arrow"></i>
</a>
</div>
<div #recurringDepositProducts>
<a
class="pd-card"