Merge branch 'feature/advanceLoanProduct' into merge/dds-advance-loan-into-dev-latest
Adds the Advance Loan Product UI on top of the DDS merge of dev-latest: - Advance loan product stepper steps (details, settings, terms) and create-loan-product changes - Loan interest rate register UI - Interest loan related UI Conflicts resolved: - src/assets/env.js: kept dev-latest. feature/advanceLoanProduct set the default tenant to 'default', cut the tenant list to 'default' only and forced 'default' into every browser's localStorage on load, which is a local testing setup and would hide the other tenants (utkarshbank, lincpay, utkarshnagari, testbank, humarwork, mybank). - src/environments/.env.ts: kept dev-latest's generated version/hash; the file is regenerated by `npm start`. Nothing from dev-latest or DDS is removed. Lines removed by this merge are only in loan-product files that neither dev-latest nor DDS touched (feature/advanceLoanProduct's own rewrite); products.service.ts only gains HttpContext in its @angular/common/http import. Verified with tsc -p src/tsconfig.app.json --noEmit, prettier, stylelint, eslint and the license header check on all merged files. Branch renamed from merge/dds-into-dev-latest, since it now carries both DDS and Advance Loan Product. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+96
@@ -0,0 +1,96 @@
|
|||||||
|
<!--
|
||||||
|
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__readonly-banner" *ngIf="!canEdit">
|
||||||
|
<i class="fas fa-lock"></i>
|
||||||
|
<div>
|
||||||
|
<div class="ca__readonly-title">Read-only — {{ register.status }}</div>
|
||||||
|
<div class="ca__readonly-sub">{{ readOnlyReason() }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ca__active-strip" *ngIf="active">
|
||||||
|
<span class="ca__active-dot">●</span>
|
||||||
|
<span class="ca__active-label">CURRENT ACTIVE</span>
|
||||||
|
<span class="ca__active-name">{{ active.name }}</span>
|
||||||
|
<span class="ca__active-sub">· effective {{ active.effectiveFrom }} → {{ active.effectiveTo || '—' }}</span>
|
||||||
|
<span class="ca__active-flag" *ngIf="isActiveRegister()">You are viewing the Active register</span>
|
||||||
|
<a class="ca__active-link" *ngIf="!isActiveRegister()" (click)="viewActive()">View active →</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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__card">
|
||||||
|
<div class="ca__card-head">
|
||||||
|
<div>
|
||||||
|
<div class="ca__card-title">Credit score slabs</div>
|
||||||
|
<div class="ca__card-sub">
|
||||||
|
Only the Adjustment % is editable · changes apply to new sanctions after the register is approved
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button *ngIf="canEdit" mat-stroked-button class="ca__dash-btn" (click)="addSlab()">
|
||||||
|
<i class="fas fa-plus"></i> Add slab
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="ca__editgrid">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="ca__col-ix">#</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 class="ca__col-del"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let slab of register.cibilSlabs; let i = index">
|
||||||
|
<td class="ca__col-ix">{{ i + 1 }}</td>
|
||||||
|
<td class="ca__num ca__cell-readonly">{{ slab.from }}</td>
|
||||||
|
<td class="ca__num ca__cell-readonly">{{ slab.to }}</td>
|
||||||
|
<td>
|
||||||
|
<span [class]="tierClass(slab.tier)">{{ slab.tier }}</span>
|
||||||
|
</td>
|
||||||
|
<td class="ca__cell-muted">{{ slab.type }}</td>
|
||||||
|
<td class="ca__num">
|
||||||
|
<div class="ca__adj-wrap">
|
||||||
|
<input
|
||||||
|
[class]="adjustInputClass(slab.adjustmentPct)"
|
||||||
|
type="number"
|
||||||
|
step="0.05"
|
||||||
|
[(ngModel)]="slab.adjustmentPct"
|
||||||
|
[readonly]="!canEdit"
|
||||||
|
/>
|
||||||
|
<span class="ca__adj-suffix">%</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="ca__col-del">
|
||||||
|
<button *ngIf="canEdit" type="button" class="ca__delete-btn" title="Delete slab" (click)="deleteSlab(i)">
|
||||||
|
<i class="fas fa-trash-alt"></i>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ca__footer">
|
||||||
|
<button mat-stroked-button (click)="backToRegister()">{{ canEdit ? 'Cancel' : 'Back to register' }}</button>
|
||||||
|
<button *ngIf="canEdit" mat-flat-button color="primary" (click)="save()">Save adjustments</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
+414
@@ -0,0 +1,414 @@
|
|||||||
|
/**
|
||||||
|
* 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: 24px 32px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
&__active-strip {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 10px 18px;
|
||||||
|
background: #ecfdf5;
|
||||||
|
border: 1px solid #a7f3d0;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-dot {
|
||||||
|
color: #059669;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-label {
|
||||||
|
font-size: 10px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-name {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #064e3b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-sub {
|
||||||
|
color: #047857;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-flag {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #047857;
|
||||||
|
background: #d1fae5;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-link {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #047857;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__readonly-banner {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px 18px;
|
||||||
|
background: #fef3c7;
|
||||||
|
border: 1px solid #fcd34d;
|
||||||
|
border-left: 4px solid #d97706;
|
||||||
|
border-radius: 10px;
|
||||||
|
color: #78350f;
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #d97706;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__readonly-title {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #78350f;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__readonly-sub {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #92400e;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
padding: 20px 24px;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__header-icon {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #dbeafe;
|
||||||
|
color: #1d4ed8;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__header-text {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 3px 0 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card {
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card-head {
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card-title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card-sub {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__dash-btn {
|
||||||
|
height: 32px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1d4ed8;
|
||||||
|
border: 1px dashed #1d4ed8;
|
||||||
|
padding: 0 14px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__num {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__col-ix {
|
||||||
|
width: 44px;
|
||||||
|
text-align: center;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__col-del {
|
||||||
|
width: 48px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__cell-muted {
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__cell-readonly {
|
||||||
|
color: #0f172a;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
padding: 0 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 4px 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Editable grid ---------------------------------------------------- */
|
||||||
|
|
||||||
|
.ca__editgrid {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
thead tr {
|
||||||
|
background: #f8fafc;
|
||||||
|
|
||||||
|
th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 10px 16px;
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.4px;
|
||||||
|
color: #64748b;
|
||||||
|
font-weight: 600;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
|
||||||
|
&.ca__num {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr {
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
transition: background 0.12s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
|
||||||
|
.ca__delete-btn {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 8px 12px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Borderless cell input — gets a visible border on hover/focus. */
|
||||||
|
.ca__ghost-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 32px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 0 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #0f172a;
|
||||||
|
font-family: inherit;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #e2e8f0;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #1d4ed8;
|
||||||
|
background: white;
|
||||||
|
box-shadow: 0 0 0 3px rgb(29 78 216 / 10%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--num {
|
||||||
|
text-align: right;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide number input spinners for a cleaner look. */
|
||||||
|
&[type='number']::-webkit-inner-spin-button,
|
||||||
|
&[type='number']::-webkit-outer-spin-button {
|
||||||
|
appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[type='number'] {
|
||||||
|
appearance: textfield;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Adjustment input — coloured by sign, with trailing % suffix. */
|
||||||
|
.ca__adj-wrap {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 2px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ca__adj-input {
|
||||||
|
width: 72px;
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
&--negative {
|
||||||
|
color: #059669;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--positive {
|
||||||
|
color: #d97706;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--high {
|
||||||
|
color: #dc2626;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ca__adj-suffix {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chip-shaped tier select — background matches the current tier. */
|
||||||
|
.ca__tier-select {
|
||||||
|
appearance: none;
|
||||||
|
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2364748b' d='M0 0l5 6 5-6z'/></svg>");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right 10px center;
|
||||||
|
padding: 4px 26px 4px 12px;
|
||||||
|
height: 28px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: inherit;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 3px rgb(29 78 216 / 15%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--vpoor {
|
||||||
|
background-color: #fecaca;
|
||||||
|
color: #7f1d1d;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--poor {
|
||||||
|
background-color: #fee2e2;
|
||||||
|
color: #991b1b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--fair {
|
||||||
|
background-color: #fef3c7;
|
||||||
|
color: #92400e;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--good {
|
||||||
|
background-color: #dbeafe;
|
||||||
|
color: #1e40af;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--excellent {
|
||||||
|
background-color: #d1fae5;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Trash button — hidden until row hover. */
|
||||||
|
.ca__delete-btn {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
background: transparent;
|
||||||
|
color: #94a3b8;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0;
|
||||||
|
transition:
|
||||||
|
opacity 0.12s ease,
|
||||||
|
color 0.12s ease,
|
||||||
|
border-color 0.12s ease,
|
||||||
|
background 0.12s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #fecaca;
|
||||||
|
background: #fef2f2;
|
||||||
|
color: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
/**
|
||||||
|
* 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 { RateRegisterService } from '../rate-register.service';
|
||||||
|
import { CibilSlab, RateRegister } from '../models/rate-register.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CIBIL / credit-score slab editor.
|
||||||
|
* Score range, tier and type are fixed per slab; only the Adjustment % is editable.
|
||||||
|
* New slabs can be appended (and removed) via Add slab / row trash.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-cibil-adjustment',
|
||||||
|
templateUrl: './cibil-adjustment.component.html',
|
||||||
|
styleUrls: ['./cibil-adjustment.component.scss'],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
MatButtonModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class CibilAdjustmentComponent implements OnInit {
|
||||||
|
private readonly service = inject(RateRegisterService);
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
|
||||||
|
register!: RateRegister;
|
||||||
|
active?: RateRegister;
|
||||||
|
|
||||||
|
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.active = this.service.getActive();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
isActiveRegister(): boolean {
|
||||||
|
return !!this.active && this.active.id === this.register?.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
viewActive(): void {
|
||||||
|
if (this.active) {
|
||||||
|
this.router.navigate(['/products/loan-interest-rate-register/cibil'], { queryParams: { id: this.active.id } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Only a Draft can be edited. Pending Approval / Active / Expired open read-only. */
|
||||||
|
get canEdit(): boolean {
|
||||||
|
return this.register?.status === 'Draft';
|
||||||
|
}
|
||||||
|
|
||||||
|
readOnlyReason(): string {
|
||||||
|
switch (this.register?.status) {
|
||||||
|
case 'Pending Approval':
|
||||||
|
return 'This version has been submitted and is awaiting checker approval. No further edits allowed.';
|
||||||
|
case 'Active':
|
||||||
|
return 'This is the current Active register. Click "Edit (new version)" on the list page to propose changes.';
|
||||||
|
case 'Expired':
|
||||||
|
return 'This is an inactive historical version. Read-only.';
|
||||||
|
default:
|
||||||
|
return 'Read-only.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tierClass(tier: CibilSlab['tier']): string {
|
||||||
|
const map: Record<string, string> = {
|
||||||
|
'V. Poor': 'tier tier--vpoor',
|
||||||
|
Poor: 'tier tier--poor',
|
||||||
|
Fair: 'tier tier--fair',
|
||||||
|
Good: 'tier tier--good',
|
||||||
|
Excellent: 'tier tier--excellent'
|
||||||
|
};
|
||||||
|
return map[tier] ?? 'tier';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Classes to colour the adjustment number by sign/magnitude. */
|
||||||
|
adjustInputClass(pct: number): string {
|
||||||
|
const base = 'ca__ghost-input ca__ghost-input--num ca__adj-input';
|
||||||
|
if (pct < 0) {
|
||||||
|
return `${base} ca__adj-input--negative`;
|
||||||
|
}
|
||||||
|
if (pct >= 1) {
|
||||||
|
return `${base} ca__adj-input--high`;
|
||||||
|
}
|
||||||
|
if (pct > 0) {
|
||||||
|
return `${base} ca__adj-input--positive`;
|
||||||
|
}
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Append a new slab continuing from the current highest "score to". */
|
||||||
|
addSlab(): void {
|
||||||
|
if (!this.canEdit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const lastTo = this.register.cibilSlabs.length ? Math.max(...this.register.cibilSlabs.map((s) => s.to)) : 0;
|
||||||
|
const from = Math.min(lastTo + 1, 900);
|
||||||
|
this.register.cibilSlabs.push({
|
||||||
|
from,
|
||||||
|
to: Math.min(from + 50, 900),
|
||||||
|
tier: 'Fair',
|
||||||
|
type: 'Flat',
|
||||||
|
adjustmentPct: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteSlab(index: number): void {
|
||||||
|
if (!this.canEdit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.register.cibilSlabs.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Edits are kept in the in-memory service (the register reference is shared). */
|
||||||
|
save(): void {
|
||||||
|
this.router.navigate(['/products/loan-interest-rate-register/edit'], { queryParams: { id: this.register.id } });
|
||||||
|
}
|
||||||
|
|
||||||
|
backToRegister(): void {
|
||||||
|
this.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
<!--
|
||||||
|
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__active-strip" *ngIf="active">
|
||||||
|
<span class="er__active-dot">●</span>
|
||||||
|
<span class="er__active-label">CURRENT ACTIVE</span>
|
||||||
|
<span class="er__active-name">{{ active.name }}</span>
|
||||||
|
<span class="er__active-sub">· effective {{ active.effectiveFrom }} → {{ active.effectiveTo || '—' }}</span>
|
||||||
|
<span class="er__active-flag" *ngIf="isActiveRegister()">You are viewing the Active register</span>
|
||||||
|
<a class="er__active-link" *ngIf="!isActiveRegister()" (click)="viewActive()">View active →</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="er__readonly-banner" *ngIf="!canEdit">
|
||||||
|
<i class="fas fa-lock"></i>
|
||||||
|
<div>
|
||||||
|
<div class="er__readonly-title">Read-only — {{ register.status }}</div>
|
||||||
|
<div class="er__readonly-sub">{{ readOnlyReason() }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="er__meta-bar">
|
||||||
|
<div class="er__field">
|
||||||
|
<label>REGISTER NAME</label>
|
||||||
|
<input type="text" [(ngModel)]="register.name" [readonly]="!canEdit" />
|
||||||
|
</div>
|
||||||
|
<div class="er__field er__field--date">
|
||||||
|
<label>EFFECTIVE FROM</label>
|
||||||
|
<input type="date" [(ngModel)]="register.effectiveFrom" [readonly]="!canEdit" />
|
||||||
|
</div>
|
||||||
|
<div class="er__field er__field--date">
|
||||||
|
<label>EFFECTIVE TO</label>
|
||||||
|
<input type="date" [(ngModel)]="register.effectiveTo" [readonly]="!canEdit" />
|
||||||
|
</div>
|
||||||
|
<div class="er__field er__field--curr">
|
||||||
|
<label>CURRENCY</label>
|
||||||
|
<select [(ngModel)]="register.currency" [disabled]="!canEdit">
|
||||||
|
<option value="INR">INR</option>
|
||||||
|
<option value="USD">USD</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<button mat-stroked-button class="er__meta-btn" *ngIf="canEdit"><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
|
||||||
|
<span *ngIf="canEdit">· click any cell to edit</span>
|
||||||
|
<span *ngIf="!canEdit">· read-only view</span>
|
||||||
|
</div>
|
||||||
|
<div class="er__grid-actions" *ngIf="canEdit">
|
||||||
|
<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)"
|
||||||
|
[class.er__cell--readonly]="!canEdit"
|
||||||
|
(click)="canEdit && !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 · +2.00% (very poor) to base (above 700) · 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()">{{ canEdit ? 'Cancel' : 'Back to list' }}</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" *ngIf="canEdit">
|
||||||
|
<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>
|
||||||
+417
@@ -0,0 +1,417 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
&__active-strip {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 10px 18px;
|
||||||
|
background: #ecfdf5;
|
||||||
|
border: 1px solid #a7f3d0;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-dot {
|
||||||
|
color: #059669;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-label {
|
||||||
|
font-size: 10px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-name {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #064e3b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-sub {
|
||||||
|
color: #047857;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-flag {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #047857;
|
||||||
|
background: #d1fae5;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__active-link {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #047857;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__readonly-banner {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px 18px;
|
||||||
|
background: #fef3c7;
|
||||||
|
border: 1px solid #fcd34d;
|
||||||
|
border-left: 4px solid #d97706;
|
||||||
|
border-radius: 9px;
|
||||||
|
color: #78350f;
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #d97706;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__readonly-title {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #78350f;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__readonly-sub {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #92400e;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__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;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--readonly {
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: transparent;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+238
@@ -0,0 +1,238 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
active?: 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.active = this.service.getActive();
|
||||||
|
this.slabs = this.register.slabs;
|
||||||
|
this.rows = this.register.rows;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
isActiveRegister(): boolean {
|
||||||
|
return !!this.active && this.active.id === this.register?.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Only a Draft can be edited. Pending Approval / Active / Expired open read-only. */
|
||||||
|
get canEdit(): boolean {
|
||||||
|
return this.register?.status === 'Draft';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Status label shown on the read-only banner. */
|
||||||
|
readOnlyReason(): string {
|
||||||
|
switch (this.register?.status) {
|
||||||
|
case 'Pending Approval':
|
||||||
|
return 'This version has been submitted and is awaiting checker approval. No further edits allowed.';
|
||||||
|
case 'Active':
|
||||||
|
return 'This is the current Active register. Click "Edit (new version)" on the list page to propose changes as a new Draft.';
|
||||||
|
case 'Expired':
|
||||||
|
return 'This is an inactive historical version. Read-only.';
|
||||||
|
default:
|
||||||
|
return 'Read-only.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
viewActive(): void {
|
||||||
|
if (this.active) {
|
||||||
|
this.router.navigate(['/products/loan-interest-rate-register/edit'], { queryParams: { id: this.active.id } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 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 {
|
||||||
|
if (!this.canEdit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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 {
|
||||||
|
if (!this.canEdit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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 {
|
||||||
|
if (!this.canEdit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Opens the Compare screen; the actual submit happens from there once the maker has reviewed the diff. */
|
||||||
|
submitForApproval(): void {
|
||||||
|
this.router.navigate(['/products/loan-interest-rate-register/preview'], { queryParams: { id: this.register.id } });
|
||||||
|
}
|
||||||
|
|
||||||
|
statusChipClass(): string {
|
||||||
|
switch (this.register?.status) {
|
||||||
|
case 'Active':
|
||||||
|
return 'chip chip--active';
|
||||||
|
case 'Draft':
|
||||||
|
return 'chip chip--draft';
|
||||||
|
case 'Pending Approval':
|
||||||
|
return 'chip chip--pending';
|
||||||
|
default:
|
||||||
|
return 'chip chip--expired';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+181
@@ -0,0 +1,181 @@
|
|||||||
|
<!--
|
||||||
|
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>
|
||||||
|
Manage the central CIBIL-based rate chart used across all loan products. Submitting a new version routes through
|
||||||
|
maker-checker — once approved, the current Active version is <strong>deactivated</strong> and the new one
|
||||||
|
<strong>activated</strong>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<button mat-stroked-button class="lirr__excel-btn">
|
||||||
|
<i class="fas fa-exchange-alt"></i>
|
||||||
|
Excel
|
||||||
|
</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 → > ₹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">+2.00% (poor) → base (above 700)</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lirr__history">
|
||||||
|
<div class="lirr__history-head">
|
||||||
|
<div>
|
||||||
|
<div class="lirr__history-title">Loan Interest Rate Register — Version History</div>
|
||||||
|
<div class="lirr__history-sub">All versions, newest first · click a version to expand its rate chart</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lirr__empty" *ngIf="registers.length === 0">
|
||||||
|
<div class="lirr__empty-icon"><i class="fas fa-folder-open"></i></div>
|
||||||
|
<div class="lirr__empty-title">No rate register versions yet</div>
|
||||||
|
<div class="lirr__empty-sub">
|
||||||
|
Create the first version to publish rates for all loan products. The template comes pre-filled from the bank's
|
||||||
|
approved Excel chart (34 products × 10 amount slabs + 5 CIBIL bands) — you can edit everything before
|
||||||
|
submitting for approval.
|
||||||
|
</div>
|
||||||
|
<button mat-flat-button color="primary" class="lirr__empty-btn" (click)="createFirstVersion()">
|
||||||
|
<i class="fas fa-plus"></i> Create first version
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-accordion class="lirr__accordion" multi *ngIf="registers.length > 0">
|
||||||
|
<mat-expansion-panel
|
||||||
|
*ngFor="let r of registers"
|
||||||
|
class="lirr__panel"
|
||||||
|
[class.lirr__panel--active]="r.status === 'Active'"
|
||||||
|
[expanded]="r.status === 'Active'"
|
||||||
|
>
|
||||||
|
<mat-expansion-panel-header class="lirr__panel-header">
|
||||||
|
<mat-panel-title class="lirr__panel-title">
|
||||||
|
<span class="lirr__panel-name">{{ r.name }}</span>
|
||||||
|
<span [class]="statusChipClass(r.status)">{{ statusLabel(r.status) }}</span>
|
||||||
|
</mat-panel-title>
|
||||||
|
<mat-panel-description class="lirr__panel-desc">
|
||||||
|
<span class="lirr__panel-range">{{ effectiveRange(r) }}</span>
|
||||||
|
<span class="lirr__panel-actions">
|
||||||
|
<ng-container [ngSwitch]="r.status">
|
||||||
|
<ng-container *ngSwitchCase="'Pending Approval'">
|
||||||
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
class="lirr__row-btn lirr__row-btn--neutral"
|
||||||
|
(click)="openCompare(r, $event)"
|
||||||
|
>
|
||||||
|
Compare
|
||||||
|
</button>
|
||||||
|
<span class="lirr__row-note">Awaiting checker · action from Approvals tab</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngSwitchCase="'Draft'">
|
||||||
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
class="lirr__row-btn lirr__row-btn--neutral"
|
||||||
|
(click)="openEditor(r, $event)"
|
||||||
|
>
|
||||||
|
Edit · Submit
|
||||||
|
</button>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngSwitchCase="'Active'">
|
||||||
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
class="lirr__row-btn lirr__row-btn--neutral"
|
||||||
|
(click)="editAsNewVersion(r, $event)"
|
||||||
|
>
|
||||||
|
Edit (new version)
|
||||||
|
</button>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngSwitchDefault>
|
||||||
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
class="lirr__row-btn lirr__row-btn--neutral"
|
||||||
|
(click)="openEditor(r, $event)"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</button>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
</span>
|
||||||
|
</mat-panel-description>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
|
||||||
|
<div class="lirr__panel-body">
|
||||||
|
<div class="lirr__panel-meta" *ngIf="r.note">{{ r.note }}</div>
|
||||||
|
<div class="lirr__panel-meta">
|
||||||
|
Created by {{ r.createdBy }} · Last modified {{ r.lastModified | date: 'dd MMM yyyy' }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="lirr__panel-section">Rate chart ({{ r.rows.length }} products × {{ r.slabs.length }} slabs)</h4>
|
||||||
|
<div class="lirr__panel-scroll">
|
||||||
|
<table class="lirr__panel-grid">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="lirr__panel-grid-first">Particulars</th>
|
||||||
|
<th *ngFor="let s of r.slabs" class="lirr__panel-grid-num">{{ s.label }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let row of r.rows">
|
||||||
|
<td class="lirr__panel-grid-first">
|
||||||
|
<span class="lirr__panel-grid-srno">{{ row.srNo }}</span
|
||||||
|
>{{ row.particulars }}
|
||||||
|
</td>
|
||||||
|
<td *ngFor="let cell of row.rates" class="lirr__panel-grid-num">{{ display(cell) }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="lirr__panel-section">CIBIL / credit-score slabs</h4>
|
||||||
|
<table class="lirr__panel-cibil">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Score from</th>
|
||||||
|
<th>Score to</th>
|
||||||
|
<th>Risk tier</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Adjustment</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let slab of r.cibilSlabs; let i = index">
|
||||||
|
<td>{{ i + 1 }}</td>
|
||||||
|
<td>{{ slab.from }}</td>
|
||||||
|
<td>{{ slab.to }}</td>
|
||||||
|
<td>{{ slab.tier }}</td>
|
||||||
|
<td>{{ slab.type }}</td>
|
||||||
|
<td>{{ formatPct(slab.adjustmentPct) }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</mat-expansion-panel>
|
||||||
|
</mat-accordion>
|
||||||
|
|
||||||
|
<div class="lirr__history-foot">Showing {{ registers.length }} versions</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
+508
@@ -0,0 +1,508 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__row-btn {
|
||||||
|
height: 28px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 0 10px;
|
||||||
|
margin-left: 6px;
|
||||||
|
border-radius: 6px;
|
||||||
|
|
||||||
|
&--neutral {
|
||||||
|
color: #334155;
|
||||||
|
border-color: #cbd5e1;
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--approve {
|
||||||
|
color: #065f46;
|
||||||
|
border-color: #a7f3d0;
|
||||||
|
background: #ecfdf5;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #d1fae5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--reject {
|
||||||
|
color: #991b1b;
|
||||||
|
border-color: #fecaca;
|
||||||
|
background: #fef2f2;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #fee2e2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__row-note {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #64748b;
|
||||||
|
font-style: italic;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__table-foot {
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-top: 1px solid #f1f5f9;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Version History accordion (CBS BIR style) ------------------------ */
|
||||||
|
|
||||||
|
&__history {
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__history-head {
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__history-title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__history-sub {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__accordion {
|
||||||
|
display: block;
|
||||||
|
padding: 8px 12px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel {
|
||||||
|
border: 1px solid #e2e8f0 !important;
|
||||||
|
border-radius: 10px !important;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
box-shadow: none !important;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.mat-expanded {
|
||||||
|
border-color: #cbd5e1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
border-left: 3px solid #10b981 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-header {
|
||||||
|
padding: 0 20px !important;
|
||||||
|
height: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-title {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
gap: 12px !important;
|
||||||
|
flex: 0 0 auto !important;
|
||||||
|
margin-right: 24px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-name {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-desc {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
justify-content: space-between !important;
|
||||||
|
gap: 12px;
|
||||||
|
flex: 1 1 auto !important;
|
||||||
|
color: #475569 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-range {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #475569;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-actions {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 6px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-body {
|
||||||
|
padding: 8px 20px 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #334155;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-meta {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-section {
|
||||||
|
margin: 10px 0 4px;
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
color: #64748b;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-scroll {
|
||||||
|
overflow: auto;
|
||||||
|
max-height: 360px;
|
||||||
|
border: 1px solid #f1f5f9;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-grid {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td {
|
||||||
|
padding: 7px 10px;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-grid-first {
|
||||||
|
text-align: left;
|
||||||
|
max-width: 240px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-grid-num {
|
||||||
|
text-align: right;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-grid-srno {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 22px;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__panel-cibil {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 12px;
|
||||||
|
border: 1px solid #f1f5f9;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 8px 12px;
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td {
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__history-foot {
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-top: 1px solid #f1f5f9;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 56px 24px 48px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty-icon {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #ede9fe;
|
||||||
|
color: #6d28d9;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 22px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty-sub {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #64748b;
|
||||||
|
max-width: 560px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty-btn {
|
||||||
|
margin-top: 8px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip {
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
background: #dcfce7;
|
||||||
|
color: #166534;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--draft {
|
||||||
|
background: #fef3c7;
|
||||||
|
color: #92400e;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--pending {
|
||||||
|
background: #ede9fe;
|
||||||
|
color: #5b21b6;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--expired {
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: #475569;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--scheduled {
|
||||||
|
background: #e0e7ff;
|
||||||
|
color: #3730a3;
|
||||||
|
}
|
||||||
|
}
|
||||||
+190
@@ -0,0 +1,190 @@
|
|||||||
|
/**
|
||||||
|
* 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 { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
|
import { MatExpansionModule } from '@angular/material/expansion';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { RateRegisterService } from './rate-register.service';
|
||||||
|
import { CibilSlab, RateCell, RateChartRow, RateRegister, SlabColumn } 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,
|
||||||
|
MatExpansionModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class LoanInterestRateRegisterComponent implements OnInit {
|
||||||
|
private readonly service = inject(RateRegisterService);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly snack = inject(MatSnackBar);
|
||||||
|
|
||||||
|
registers: RateRegister[] = [];
|
||||||
|
active?: RateRegister;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
private reload(): 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 } });
|
||||||
|
}
|
||||||
|
|
||||||
|
preview(register: RateRegister): void {
|
||||||
|
this.router.navigate(['/products/loan-interest-rate-register/preview'], { queryParams: { id: register.id } });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Route by status: Pending → Compare screen (checker view); otherwise the editor. */
|
||||||
|
openRow(register: RateRegister): void {
|
||||||
|
if (register.status === 'Pending Approval') {
|
||||||
|
this.preview(register);
|
||||||
|
} else {
|
||||||
|
this.edit(register);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Checker approves the pending register. The previously-Active one is deactivated. */
|
||||||
|
approve(register: RateRegister, event: Event): void {
|
||||||
|
event.stopPropagation();
|
||||||
|
this.service.approve(register.id).subscribe((updated) => {
|
||||||
|
if (updated) {
|
||||||
|
this.snack.open(`${updated.name} activated`, 'OK', { duration: 3000 });
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Checker rejects the pending register — it goes back to Draft. */
|
||||||
|
reject(register: RateRegister, event: Event): void {
|
||||||
|
event.stopPropagation();
|
||||||
|
this.service.reject(register.id).subscribe((updated) => {
|
||||||
|
if (updated) {
|
||||||
|
this.snack.open(`${updated.name} sent back to Draft`, 'OK', { duration: 3000 });
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
statusChipClass(status: RateRegister['status']): string {
|
||||||
|
switch (status) {
|
||||||
|
case 'Active':
|
||||||
|
return 'chip chip--active';
|
||||||
|
case 'Draft':
|
||||||
|
return 'chip chip--draft';
|
||||||
|
case 'Pending Approval':
|
||||||
|
return 'chip chip--pending';
|
||||||
|
case 'Expired':
|
||||||
|
return 'chip chip--expired';
|
||||||
|
default:
|
||||||
|
return 'chip chip--scheduled';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
statusLabel(status: RateRegister['status']): string {
|
||||||
|
switch (status) {
|
||||||
|
case 'Active':
|
||||||
|
return '● Active';
|
||||||
|
case 'Pending Approval':
|
||||||
|
return '⏳ Pending Approval';
|
||||||
|
default:
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
activeWindow(): string {
|
||||||
|
if (!this.active) {
|
||||||
|
return '—';
|
||||||
|
}
|
||||||
|
return `${this.formatShort(this.active.effectiveFrom)} → ${this.formatShort(this.active.effectiveTo)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Panel header subtitle — effective date range, with "Current" for the active one. */
|
||||||
|
effectiveRange(r: RateRegister): string {
|
||||||
|
const from = this.formatShort(r.effectiveFrom);
|
||||||
|
const to = r.status === 'Active' ? 'Current' : this.formatShort(r.effectiveTo);
|
||||||
|
return `From ${from} To ${to}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Compact display of a rate cell (for the read-only expanded view). */
|
||||||
|
display(cell: RateCell): string {
|
||||||
|
if (cell === null) {
|
||||||
|
return 'N.A.';
|
||||||
|
}
|
||||||
|
if (typeof cell === 'string') {
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
return cell.toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
formatPct(pct: number): string {
|
||||||
|
if (pct === 0) {
|
||||||
|
return '0.00%';
|
||||||
|
}
|
||||||
|
const sign = pct > 0 ? '+' : '−';
|
||||||
|
return `${sign}${Math.abs(pct).toFixed(2)}%`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Open this register's full editor (grid) — stops the row click from toggling the panel. */
|
||||||
|
openEditor(r: RateRegister, event: Event): void {
|
||||||
|
event.stopPropagation();
|
||||||
|
this.edit(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Edit (new version)" on Active: duplicate the Active register as a new Draft first, then
|
||||||
|
* open the Draft in the editor. The live Active is never mutated this way.
|
||||||
|
*/
|
||||||
|
editAsNewVersion(r: RateRegister, event: Event): void {
|
||||||
|
event.stopPropagation();
|
||||||
|
const draft = this.service.duplicateAsDraft(r.id);
|
||||||
|
if (draft) {
|
||||||
|
this.snack.open('New draft created from Active — editing the copy', 'OK', { duration: 2500 });
|
||||||
|
this.reload();
|
||||||
|
this.edit(draft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Scaffold the very first version — used only when the register has no versions at all. */
|
||||||
|
createFirstVersion(): void {
|
||||||
|
const draft = this.service.createFirstVersion();
|
||||||
|
this.snack.open('Blank draft created — fill in rates and submit for approval', 'OK', { duration: 3000 });
|
||||||
|
this.reload();
|
||||||
|
this.edit(draft);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Open the Compare screen for a pending register (checker view). */
|
||||||
|
openCompare(r: RateRegister, event: Event): void {
|
||||||
|
event.stopPropagation();
|
||||||
|
this.preview(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
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,55 @@
|
|||||||
|
/**
|
||||||
|
* 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' | 'Pending Approval' | '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 = 'V. Poor' | 'Poor' | 'Fair' | '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[];
|
||||||
|
/** Immutable snapshot of the last-approved state. Compare screen diffs against this. */
|
||||||
|
baselineRows: RateChartRow[];
|
||||||
|
baselineCibilSlabs: CibilSlab[];
|
||||||
|
fallbackNoCibilSlab: number;
|
||||||
|
fallbackBelowMin: 'use-min-slab' | 'block';
|
||||||
|
}
|
||||||
+181
@@ -0,0 +1,181 @@
|
|||||||
|
<!--
|
||||||
|
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="pr" *ngIf="draft">
|
||||||
|
<div class="pr__header">
|
||||||
|
<div class="pr__header-icon">⇄</div>
|
||||||
|
<div class="pr__header-text">
|
||||||
|
<h2>Compare changes</h2>
|
||||||
|
<p>Review the diff before submitting · each changed cell shows OLD → NEW with yellow highlight</p>
|
||||||
|
</div>
|
||||||
|
<button mat-stroked-button (click)="backToEdit()">← Back to edit</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pr__summary">
|
||||||
|
<div class="pr__summary-item">
|
||||||
|
<div class="pr__summary-label">Draft</div>
|
||||||
|
<div class="pr__summary-value">{{ draft.name }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="pr__summary-item">
|
||||||
|
<div class="pr__summary-label">Rate cells changed</div>
|
||||||
|
<div class="pr__summary-value pr__summary-value--count">{{ changedCellCount() }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="pr__summary-item">
|
||||||
|
<div class="pr__summary-label">CIBIL slabs changed</div>
|
||||||
|
<div class="pr__summary-value pr__summary-value--count">{{ changedCibilCount() }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Side-by-side baseline/draft context strip -->
|
||||||
|
<div class="pr__version-strip">
|
||||||
|
<div class="pr__version pr__version--old">
|
||||||
|
<div class="pr__version-pill pr__version-pill--old">OLD · WILL BE DEACTIVATED</div>
|
||||||
|
<div class="pr__version-name">{{ active?.name ?? 'No active register' }}</div>
|
||||||
|
<div class="pr__version-sub" *ngIf="active">
|
||||||
|
Effective {{ active.effectiveFrom }} → {{ active.effectiveTo || '—' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="pr__version-arrow">→</div>
|
||||||
|
<div class="pr__version pr__version--new">
|
||||||
|
<div class="pr__version-pill pr__version-pill--new">NEW · WILL BE ACTIVATED</div>
|
||||||
|
<div class="pr__version-name">{{ draft.name }}</div>
|
||||||
|
<div class="pr__version-sub">Effective {{ draft.effectiveFrom }} → {{ draft.effectiveTo || '—' }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Consolidated inline-diff rate chart -->
|
||||||
|
<div class="pr__card">
|
||||||
|
<div class="pr__card-head">
|
||||||
|
<div>
|
||||||
|
<div class="pr__card-title">Rate chart — inline diff</div>
|
||||||
|
<div class="pr__card-sub">Changed cells highlighted · unchanged cells show single value</div>
|
||||||
|
</div>
|
||||||
|
<mat-slide-toggle *ngIf="changedCellCount() > 0" [(ngModel)]="showOnlyChanged" class="pr__toggle">
|
||||||
|
Show only changed rows
|
||||||
|
</mat-slide-toggle>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pr__empty" *ngIf="changedCellCount() === 0 && changedCibilCount() === 0">
|
||||||
|
<i class="fas fa-equals"></i>
|
||||||
|
<div class="pr__empty-title">No changes detected</div>
|
||||||
|
<div class="pr__empty-sub">
|
||||||
|
Draft is identical to the current Active register. Edit the Draft first to see diffs here.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pr__scroll" *ngIf="changedCellCount() > 0">
|
||||||
|
<table class="pr__grid">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="pr__col-particulars">Particulars</th>
|
||||||
|
<th *ngFor="let s of slabs" class="pr__col-rate">{{ s.label }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let row of visibleRows" [class.pr__row--changed]="rowHasChanges(row.srNo)">
|
||||||
|
<td class="pr__col-particulars">
|
||||||
|
<span class="pr__srno">{{ row.srNo }}</span
|
||||||
|
>{{ row.particulars }}
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
*ngFor="let _ of slabs; let j = index"
|
||||||
|
class="pr__col-rate"
|
||||||
|
[class.pr__cell-changed]="cellChanged(row.srNo, j)"
|
||||||
|
>
|
||||||
|
<ng-container *ngIf="cellChanged(row.srNo, j); else sameCell">
|
||||||
|
<span class="pr__old">{{ display(baselineCell(row.srNo, j)) }}</span>
|
||||||
|
<span class="pr__arrow">→</span>
|
||||||
|
<span class="pr__new">{{ display(draftCell(row.srNo, j)) }}</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #sameCell>{{ display(draftCell(row.srNo, j)) }}</ng-template>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- CIBIL slabs inline-diff -->
|
||||||
|
<div class="pr__card" *ngIf="changedCibilCount() > 0">
|
||||||
|
<div class="pr__card-head">
|
||||||
|
<div>
|
||||||
|
<div class="pr__card-title">CIBIL slabs — inline diff</div>
|
||||||
|
<div class="pr__card-sub">Changed fields shown as OLD → NEW · unchanged fields render once</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="pr__cibil">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Score from</th>
|
||||||
|
<th>Score to</th>
|
||||||
|
<th>Tier</th>
|
||||||
|
<th>Adjustment</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let slab of draftCibil; let i = index" [class.pr__row--changed]="cibilChanged(i)">
|
||||||
|
<td>{{ i + 1 }}</td>
|
||||||
|
<td [class.pr__cell-changed]="cibilFieldChanged(i, 'from')">
|
||||||
|
<ng-container *ngIf="cibilFieldChanged(i, 'from'); else sameFrom">
|
||||||
|
<span class="pr__old">{{ baselineCibil[i]?.from ?? '—' }}</span>
|
||||||
|
<span class="pr__arrow">→</span>
|
||||||
|
<span class="pr__new">{{ slab.from }}</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #sameFrom>{{ slab.from }}</ng-template>
|
||||||
|
</td>
|
||||||
|
<td [class.pr__cell-changed]="cibilFieldChanged(i, 'to')">
|
||||||
|
<ng-container *ngIf="cibilFieldChanged(i, 'to'); else sameTo">
|
||||||
|
<span class="pr__old">{{ baselineCibil[i]?.to ?? '—' }}</span>
|
||||||
|
<span class="pr__arrow">→</span>
|
||||||
|
<span class="pr__new">{{ slab.to }}</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #sameTo>{{ slab.to }}</ng-template>
|
||||||
|
</td>
|
||||||
|
<td [class.pr__cell-changed]="cibilFieldChanged(i, 'tier')">
|
||||||
|
<ng-container *ngIf="cibilFieldChanged(i, 'tier'); else sameTier">
|
||||||
|
<span class="pr__old">{{ baselineCibil[i]?.tier ?? '—' }}</span>
|
||||||
|
<span class="pr__arrow">→</span>
|
||||||
|
<span class="pr__new">{{ slab.tier }}</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #sameTier>{{ slab.tier }}</ng-template>
|
||||||
|
</td>
|
||||||
|
<td [class.pr__cell-changed]="cibilFieldChanged(i, 'adjustmentPct')">
|
||||||
|
<ng-container *ngIf="cibilFieldChanged(i, 'adjustmentPct'); else sameAdj">
|
||||||
|
<span class="pr__old">{{ formatPct(baselineCibil[i]?.adjustmentPct ?? 0) }}</span>
|
||||||
|
<span class="pr__arrow">→</span>
|
||||||
|
<span class="pr__new">{{ formatPct(slab.adjustmentPct) }}</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #sameAdj>{{ formatPct(slab.adjustmentPct) }}</ng-template>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pr__footer">
|
||||||
|
<button mat-stroked-button (click)="backToEdit()">{{ canSubmit ? 'Cancel' : 'Back' }}</button>
|
||||||
|
<div class="pr__footer-note" *ngIf="canSubmit">
|
||||||
|
Submission will create a maker-checker request · the register becomes effective only after a checker approves it.
|
||||||
|
</div>
|
||||||
|
<div class="pr__footer-note" *ngIf="!canSubmit">
|
||||||
|
Review-only — this version has already been submitted ({{ draft.status }}).
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
*ngIf="canSubmit"
|
||||||
|
mat-flat-button
|
||||||
|
color="primary"
|
||||||
|
class="pr__submit"
|
||||||
|
(click)="submit()"
|
||||||
|
[disabled]="submitting || changedCellCount() + changedCibilCount() === 0"
|
||||||
|
>
|
||||||
|
<i class="fas fa-paper-plane"></i>
|
||||||
|
{{ submitting ? 'Submitting…' : 'Submit for approval' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
+362
@@ -0,0 +1,362 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.pr {
|
||||||
|
background: #f8fafc;
|
||||||
|
min-height: calc(100vh - 160px);
|
||||||
|
padding: 24px 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: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__header-icon {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #ede9fe;
|
||||||
|
color: #6d28d9;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__header-text {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 3px 0 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 2fr 1fr 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 14px 20px;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-label {
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.4px;
|
||||||
|
color: #64748b;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-value {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
|
||||||
|
&--count {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #6d28d9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- OLD → NEW version strip ------------------------------------------
|
||||||
|
|
||||||
|
&__version-strip {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr auto 1fr;
|
||||||
|
gap: 16px;
|
||||||
|
align-items: stretch;
|
||||||
|
padding: 14px 20px;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__version {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border-radius: 8px;
|
||||||
|
|
||||||
|
&--old {
|
||||||
|
background: #fef2f2;
|
||||||
|
border-left: 3px solid #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--new {
|
||||||
|
background: #f0fdf4;
|
||||||
|
border-left: 3px solid #059669;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__version-pill {
|
||||||
|
display: inline-block;
|
||||||
|
width: fit-content;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
|
||||||
|
&--old {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #991b1b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--new {
|
||||||
|
background: #d1fae5;
|
||||||
|
color: #065f46;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__version-name {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__version-sub {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__version-arrow {
|
||||||
|
align-self: center;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Card wrapper -----------------------------------------------------
|
||||||
|
|
||||||
|
&__card {
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card-title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__card-sub {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__toggle {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Empty state (no changes) -----------------------------------------
|
||||||
|
|
||||||
|
&__empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 48px 20px;
|
||||||
|
color: #64748b;
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty-title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__empty-sub {
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
max-width: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Scrollable rate chart --------------------------------------------
|
||||||
|
|
||||||
|
&__scroll {
|
||||||
|
overflow: auto;
|
||||||
|
max-height: 520px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__grid {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: right;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th.pr__col-particulars {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td {
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
text-align: right;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
color: #0f172a;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td.pr__col-particulars {
|
||||||
|
text-align: left;
|
||||||
|
font-weight: 500;
|
||||||
|
max-width: 240px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__srno {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 24px;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Row & cell highlights --------------------------------------------
|
||||||
|
|
||||||
|
&__row--changed {
|
||||||
|
background: #fffbeb;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__cell-changed {
|
||||||
|
background: #fef3c7 !important;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__old {
|
||||||
|
color: #991b1b;
|
||||||
|
font-weight: 500;
|
||||||
|
text-decoration: line-through;
|
||||||
|
text-decoration-color: #dc2626;
|
||||||
|
text-decoration-thickness: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__arrow {
|
||||||
|
color: #94a3b8;
|
||||||
|
margin: 0 4px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__new {
|
||||||
|
color: #065f46;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- CIBIL inline-diff table ------------------------------------------
|
||||||
|
|
||||||
|
&__cibil {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td {
|
||||||
|
padding: 10px 14px;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Footer -----------------------------------------------------------
|
||||||
|
|
||||||
|
&__footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 14px 20px;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__footer-note {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__submit {
|
||||||
|
i {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+210
@@ -0,0 +1,210 @@
|
|||||||
|
/**
|
||||||
|
* 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 { FormsModule } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||||
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
|
import { RateRegisterService } from '../rate-register.service';
|
||||||
|
import { CibilSlab, RateCell, RateRegister, SlabColumn } from '../models/rate-register.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inline-diff Compare screen for a Loan Interest Rate Register draft.
|
||||||
|
*
|
||||||
|
* Shows a single consolidated matrix where every cell renders either its unchanged value or an
|
||||||
|
* "OLD → NEW" diff with highlight. A "Show only changed rows" toggle filters out rows with no
|
||||||
|
* changes so the reviewer can focus on what moved.
|
||||||
|
*
|
||||||
|
* Submit calls the mock backend; a `rollbackTransaction:true` response means the row has landed
|
||||||
|
* in the checker inbox and effective activation waits for approval.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-preview-register',
|
||||||
|
templateUrl: './preview-register.component.html',
|
||||||
|
styleUrls: ['./preview-register.component.scss'],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatSlideToggleModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class PreviewRegisterComponent implements OnInit {
|
||||||
|
private readonly service = inject(RateRegisterService);
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly snack = inject(MatSnackBar);
|
||||||
|
|
||||||
|
draft!: RateRegister;
|
||||||
|
active?: RateRegister;
|
||||||
|
|
||||||
|
slabs: SlabColumn[] = [];
|
||||||
|
draftRows: { srNo: number; particulars: string; rates: RateCell[] }[] = [];
|
||||||
|
baselineRows: { srNo: number; particulars: string; rates: RateCell[] }[] = [];
|
||||||
|
draftCibil: CibilSlab[] = [];
|
||||||
|
baselineCibil: CibilSlab[] = [];
|
||||||
|
|
||||||
|
submitting = false;
|
||||||
|
/** User toggle to collapse the chart to only the rows that changed. */
|
||||||
|
showOnlyChanged = true;
|
||||||
|
|
||||||
|
/** Submit button is live only for a Draft. A Pending Approval or Active register is review-only here. */
|
||||||
|
get canSubmit(): boolean {
|
||||||
|
return this.draft?.status === 'Draft';
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
const idParam = this.route.snapshot.queryParamMap.get('id');
|
||||||
|
const id = idParam ? Number(idParam) : null;
|
||||||
|
this.service.list().subscribe((all) => {
|
||||||
|
this.draft = (id ? all.find((r) => r.id === id) : undefined) ?? this.service.getActiveOrFirstDraft();
|
||||||
|
this.active = this.service.getActive();
|
||||||
|
this.slabs = this.draft.slabs;
|
||||||
|
this.draftRows = this.draft.rows;
|
||||||
|
this.draftCibil = this.draft.cibilSlabs;
|
||||||
|
// Compare always diffs against a frozen baseline — the currently-Active register's
|
||||||
|
// last-approved snapshot, OR the draft's own baseline when editing Active in place.
|
||||||
|
const base = this.draft.id === this.active?.id ? this.draft : (this.active ?? this.draft);
|
||||||
|
this.baselineRows = base.baselineRows;
|
||||||
|
this.baselineCibil = base.baselineCibilSlabs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
display(cell: RateCell): string {
|
||||||
|
if (cell === null) {
|
||||||
|
return 'N.A.';
|
||||||
|
}
|
||||||
|
if (typeof cell === 'string') {
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
return cell.toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The baseline (OLD) value of a cell — null if the row did not exist in the baseline. */
|
||||||
|
baselineCell(srNo: number, colIdx: number): RateCell {
|
||||||
|
return this.baselineRows.find((r) => r.srNo === srNo)?.rates[colIdx] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The draft (NEW) value of a cell. */
|
||||||
|
draftCell(srNo: number, colIdx: number): RateCell {
|
||||||
|
return this.draftRows.find((r) => r.srNo === srNo)?.rates[colIdx] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True when the same {product, amount-slab} cell differs between baseline and draft. */
|
||||||
|
cellChanged(srNo: number, colIdx: number): boolean {
|
||||||
|
return !this.sameCell(this.baselineCell(srNo, colIdx), this.draftCell(srNo, colIdx));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True when a product row has at least one changed cell — used by the "show only changed" filter. */
|
||||||
|
rowHasChanges(srNo: number): boolean {
|
||||||
|
for (let j = 0; j < this.slabs.length; j++) {
|
||||||
|
if (this.cellChanged(srNo, j)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Rows the chart should actually render — all rows, or only the ones with any diff. */
|
||||||
|
get visibleRows(): { srNo: number; particulars: string; rates: RateCell[] }[] {
|
||||||
|
if (!this.showOnlyChanged || this.changedCellCount() === 0) {
|
||||||
|
return this.draftRows;
|
||||||
|
}
|
||||||
|
return this.draftRows.filter((r) => this.rowHasChanges(r.srNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
cibilChanged(index: number): boolean {
|
||||||
|
const a = this.baselineCibil[index];
|
||||||
|
const d = this.draftCibil[index];
|
||||||
|
if (!a || !d) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return a.from !== d.from || a.to !== d.to || a.tier !== d.tier || a.adjustmentPct !== d.adjustmentPct;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Which CIBIL field(s) differ between baseline and draft — drives per-field highlight. */
|
||||||
|
cibilFieldChanged(index: number, field: 'from' | 'to' | 'tier' | 'adjustmentPct'): boolean {
|
||||||
|
const a = this.baselineCibil[index];
|
||||||
|
const d = this.draftCibil[index];
|
||||||
|
if (!a || !d) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return a[field] !== d[field];
|
||||||
|
}
|
||||||
|
|
||||||
|
changedCellCount(): number {
|
||||||
|
let n = 0;
|
||||||
|
for (const row of this.draftRows) {
|
||||||
|
for (let j = 0; j < this.slabs.length; j++) {
|
||||||
|
if (this.cellChanged(row.srNo, j)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
changedCibilCount(): number {
|
||||||
|
let n = 0;
|
||||||
|
const max = Math.max(this.draftCibil.length, this.baselineCibil.length);
|
||||||
|
for (let i = 0; i < max; i++) {
|
||||||
|
if (this.cibilChanged(i)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
formatPct(pct: number): string {
|
||||||
|
if (pct === 0) {
|
||||||
|
return '0.00%';
|
||||||
|
}
|
||||||
|
const sign = pct > 0 ? '+' : '−';
|
||||||
|
return `${sign}${Math.abs(pct).toFixed(2)}%`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Opens the mock backend call. `rollbackTransaction:true` → row sits in checker inbox. */
|
||||||
|
submit(): void {
|
||||||
|
if (this.submitting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.submitting = true;
|
||||||
|
this.service.submitForApproval(this.draft.id).subscribe({
|
||||||
|
next: (res) => {
|
||||||
|
this.submitting = false;
|
||||||
|
const msg = res.rollbackTransaction ? 'Submitted — awaiting checker approval' : 'Changes activated';
|
||||||
|
this.snack.open(msg, 'OK', { duration: 3500 });
|
||||||
|
this.router.navigate(['/products/loan-interest-rate-register']);
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
// Belt-and-braces guard — the service already catches, but if anything slips through
|
||||||
|
// we still unlock the UI so the user can retry instead of staring at a spinner forever.
|
||||||
|
this.submitting = false;
|
||||||
|
console.error('[PreviewRegister] submit failed', err);
|
||||||
|
this.snack.open('Submit failed — check backend status and try again', 'Dismiss', { duration: 4500 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
backToEdit(): void {
|
||||||
|
this.router.navigate(['/products/loan-interest-rate-register/edit'], { queryParams: { id: this.draft.id } });
|
||||||
|
}
|
||||||
|
|
||||||
|
private sameCell(a: RateCell, b: RateCell): boolean {
|
||||||
|
if (a === null && b === null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (typeof a === 'number' && typeof b === 'number') {
|
||||||
|
return Math.abs(a - b) < 1e-9;
|
||||||
|
}
|
||||||
|
return a === b;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,858 @@
|
|||||||
|
/**
|
||||||
|
* 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 { Observable, catchError, map, of, tap } from 'rxjs';
|
||||||
|
import { ProductsService } from '../products.service';
|
||||||
|
import {
|
||||||
|
CibilSlab,
|
||||||
|
RateCell,
|
||||||
|
RateChartRow,
|
||||||
|
RateRegister,
|
||||||
|
RegisterStatus,
|
||||||
|
SlabColumn
|
||||||
|
} from './models/rate-register.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Central Loan Interest Rate Register service.
|
||||||
|
*
|
||||||
|
* Primary data path is HTTP (/loanproducts/baseinterestrates). On HTTP failure (backend not yet
|
||||||
|
* deployed, network error) the service transparently falls back to in-memory seeded data so the UI
|
||||||
|
* never breaks during development. Local Drafts (not-yet-submitted new versions) live only in
|
||||||
|
* memory and are merged in front of server data on every list().
|
||||||
|
*/
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class RateRegisterService {
|
||||||
|
private readonly productsService = inject(ProductsService);
|
||||||
|
|
||||||
|
/** True while the HTTP backend is reachable. Flipped to false on first HTTP failure (dev mode fallback). */
|
||||||
|
private useHttp = true;
|
||||||
|
|
||||||
|
/** Snapshot of the last list() result — getActive() / getActiveOrFirstDraft() read from this. */
|
||||||
|
private cache: RateRegister[] = [];
|
||||||
|
|
||||||
|
/** In-memory drafts the maker has created but not yet submitted. Preserved across list() refreshes. */
|
||||||
|
private localDrafts: RateRegister[] = [];
|
||||||
|
|
||||||
|
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 business',
|
||||||
|
[
|
||||||
|
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 & Expansion Loan', [
|
||||||
|
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 (Farmers)', this.flat(13)),
|
||||||
|
this.row(
|
||||||
|
12,
|
||||||
|
'Loan against Warehouse Receipt (Traders)',
|
||||||
|
[
|
||||||
|
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) & Refinance', [
|
||||||
|
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 & Three-wheeler)', [
|
||||||
|
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 & Gullak Scheme', 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))
|
||||||
|
];
|
||||||
|
|
||||||
|
// Credit-score bands per the bank's approved register:
|
||||||
|
// above 700 = base rate (no change), below that stepped up by 0.5% per band.
|
||||||
|
// No discount band — the register never gives a negative adjustment.
|
||||||
|
private readonly cibilSlabs: CibilSlab[] = [
|
||||||
|
{ from: 0, to: 500, tier: 'V. Poor', type: 'Flat', adjustmentPct: 2.0 },
|
||||||
|
{ from: 501, to: 600, tier: 'Poor', type: 'Flat', adjustmentPct: 1.5 },
|
||||||
|
{ from: 601, to: 650, tier: 'Fair', type: 'Flat', adjustmentPct: 1.0 },
|
||||||
|
{ from: 651, to: 700, tier: 'Good', type: 'Flat', adjustmentPct: 0.5 },
|
||||||
|
{ from: 701, to: 900, tier: 'Excellent', type: 'Flat', adjustmentPct: 0 }
|
||||||
|
];
|
||||||
|
|
||||||
|
// Seed data used ONLY when the HTTP backend is unreachable (dev fallback). Each entry has its own
|
||||||
|
// deep-cloned rows & CIBIL slabs so edits to one register do not mutate another.
|
||||||
|
private readonly seedRegisters: RateRegister[] = [
|
||||||
|
this.seedRegister({
|
||||||
|
id: 1001,
|
||||||
|
name: 'Interest Rate of Loans — Effective 01 April 2027',
|
||||||
|
effectiveFrom: '2027-04-01',
|
||||||
|
effectiveTo: '2028-03-31',
|
||||||
|
status: 'Draft',
|
||||||
|
createdBy: 'Sonali',
|
||||||
|
lastModified: '2026-10-01',
|
||||||
|
note: 'Scheduled · future effective'
|
||||||
|
// No pre-seeded deltas — Draft starts identical to the Active register.
|
||||||
|
// Only edits made in the UI will show as diffs on the Compare screen.
|
||||||
|
}),
|
||||||
|
this.seedRegister({
|
||||||
|
id: 1002,
|
||||||
|
name: 'Interest Rate of Loans — Effective 01 April 2026',
|
||||||
|
effectiveFrom: '2026-04-01',
|
||||||
|
effectiveTo: '2027-03-31',
|
||||||
|
status: 'Active',
|
||||||
|
createdBy: 'Admin',
|
||||||
|
lastModified: '2026-03-25',
|
||||||
|
note: 'Approved by Board · Nagrik Sahakari Bank Maryadit Vidisha'
|
||||||
|
}),
|
||||||
|
this.seedRegister({
|
||||||
|
id: 1003,
|
||||||
|
name: 'Interest Rate of Loans — Effective 01 April 2025',
|
||||||
|
effectiveFrom: '2025-04-01',
|
||||||
|
effectiveTo: '2026-03-31',
|
||||||
|
status: 'Expired',
|
||||||
|
createdBy: 'Admin',
|
||||||
|
lastModified: '2025-03-20'
|
||||||
|
}),
|
||||||
|
this.seedRegister({
|
||||||
|
id: 1004,
|
||||||
|
name: 'Interest Rate of Loans — Effective 01 April 2024',
|
||||||
|
effectiveFrom: '2024-04-01',
|
||||||
|
effectiveTo: '2025-03-31',
|
||||||
|
status: 'Expired',
|
||||||
|
createdBy: 'Admin',
|
||||||
|
lastModified: '2024-03-18'
|
||||||
|
}),
|
||||||
|
this.seedRegister({
|
||||||
|
id: 1005,
|
||||||
|
name: 'Interest Rate of Loans — Effective 01 April 2023',
|
||||||
|
effectiveFrom: '2023-04-01',
|
||||||
|
effectiveTo: '2024-03-31',
|
||||||
|
status: 'Expired',
|
||||||
|
createdBy: 'Admin',
|
||||||
|
lastModified: '2023-03-22'
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List all registers (local drafts + server versions). Tries HTTP first; on failure OR when
|
||||||
|
* the server returns an empty collection (fresh DB, nothing seeded yet) falls back to the
|
||||||
|
* built-in seed registers so the UI always has something to show in development.
|
||||||
|
*/
|
||||||
|
list(): Observable<RateRegister[]> {
|
||||||
|
if (!this.useHttp) {
|
||||||
|
this.cache = [
|
||||||
|
...this.localDrafts,
|
||||||
|
...this.seedRegisters
|
||||||
|
];
|
||||||
|
return of(this.cache);
|
||||||
|
}
|
||||||
|
return this.productsService.getLoanBaseInterestRates().pipe(
|
||||||
|
map((dtos: any[]) => (dtos ?? []).map((d) => this.fromBackend(d))),
|
||||||
|
catchError((err) => {
|
||||||
|
console.warn('[RateRegisterService] HTTP unavailable, using seeded data —', err?.message ?? err);
|
||||||
|
this.useHttp = false;
|
||||||
|
return of([...this.seedRegisters]);
|
||||||
|
}),
|
||||||
|
map((serverVersions) => {
|
||||||
|
if (serverVersions.length === 0) {
|
||||||
|
console.info('[RateRegisterService] Backend returned no versions — using seeded demo data.');
|
||||||
|
return [...this.seedRegisters];
|
||||||
|
}
|
||||||
|
return serverVersions;
|
||||||
|
}),
|
||||||
|
tap((effectiveVersions) => {
|
||||||
|
this.cache = [
|
||||||
|
...this.localDrafts,
|
||||||
|
...effectiveVersions
|
||||||
|
];
|
||||||
|
}),
|
||||||
|
map(() => this.cache)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get(id: number): Observable<RateRegister | undefined> {
|
||||||
|
const cached = this.cache.find((r) => r.id === id);
|
||||||
|
if (cached) {
|
||||||
|
return of(cached);
|
||||||
|
}
|
||||||
|
// Local draft lookup (negative ids never hit the server).
|
||||||
|
if (id < 0) {
|
||||||
|
return of(this.localDrafts.find((r) => r.id === id));
|
||||||
|
}
|
||||||
|
if (!this.useHttp) {
|
||||||
|
return of(this.seedRegisters.find((r) => r.id === id));
|
||||||
|
}
|
||||||
|
return this.productsService.getLoanBaseInterestRateById(id).pipe(
|
||||||
|
map((d: any) => (d ? this.fromBackend(d) : undefined)),
|
||||||
|
catchError(() => of(undefined))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The one currently in force. Used by the Compare screen as the "left-hand" baseline. */
|
||||||
|
getActive(): RateRegister | undefined {
|
||||||
|
return this.cache.find((r) => r.status === 'Active');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The one shown by default on list → edit navigation. */
|
||||||
|
getActiveOrFirstDraft(): RateRegister {
|
||||||
|
return (
|
||||||
|
this.cache.find((r) => r.status === 'Draft') ??
|
||||||
|
this.cache.find((r) => r.status === 'Active') ??
|
||||||
|
this.cache[0] ??
|
||||||
|
this.seedRegisters[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getSlabColumns(): SlabColumn[] {
|
||||||
|
return this.slabs;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCibilSlabs(): CibilSlab[] {
|
||||||
|
return this.cibilSlabs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- maker-checker (real HTTP when backend is up, mock when not) -----------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit a Draft for approval. HTTP path POSTs to /loanproducts/baseinterestrates — on a
|
||||||
|
* maker-checker-gated response ({@code rollbackTransaction=true}) the Draft stays visible as
|
||||||
|
* "Pending Approval" until the checker acts. On an un-gated response (direct commit) the Draft
|
||||||
|
* is removed and the register list is re-fetched so the new Active appears.
|
||||||
|
*/
|
||||||
|
submitForApproval(id: number): Observable<{ rollbackTransaction: boolean; commandId?: number }> {
|
||||||
|
const draft = this.localDrafts.find((x) => x.id === id) ?? this.cache.find((x) => x.id === id);
|
||||||
|
if (!draft) {
|
||||||
|
return of({ rollbackTransaction: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.useHttp) {
|
||||||
|
// Dev fallback — flip status locally so the UI can still demo the flow.
|
||||||
|
draft.status = 'Pending Approval';
|
||||||
|
draft.lastModified = new Date().toISOString().slice(0, 10);
|
||||||
|
return of({ rollbackTransaction: true, commandId: Math.floor(Math.random() * 100000) });
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = this.toBackend(draft);
|
||||||
|
return this.productsService.saveLoanBaseInterestRate(payload).pipe(
|
||||||
|
map((res: any) => {
|
||||||
|
const rollback = res?.rollbackTransaction === true;
|
||||||
|
const commandId = res?.commandId;
|
||||||
|
if (rollback) {
|
||||||
|
// Keep the local Draft visible as "Pending Approval" until the checker acts.
|
||||||
|
draft.status = 'Pending Approval';
|
||||||
|
draft.lastModified = new Date().toISOString().slice(0, 10);
|
||||||
|
} else {
|
||||||
|
// Direct commit — drop the local draft; the server now owns the new Active version.
|
||||||
|
this.localDrafts = this.localDrafts.filter((d) => d.id !== id);
|
||||||
|
this.cache = this.cache.filter((c) => c.id !== id);
|
||||||
|
}
|
||||||
|
return { rollbackTransaction: rollback, commandId };
|
||||||
|
}),
|
||||||
|
catchError((err) => {
|
||||||
|
// HTTP failed (backend down, 4xx/5xx). Mark the draft as locally Pending so the UI isn't
|
||||||
|
// stuck on "Submitting…", and surface the failure to the caller for toast handling.
|
||||||
|
console.warn('[RateRegisterService] POST failed, keeping draft in local Pending state —', err?.message ?? err);
|
||||||
|
draft.status = 'Pending Approval';
|
||||||
|
draft.lastModified = new Date().toISOString().slice(0, 10);
|
||||||
|
return of({ rollbackTransaction: true, commandId: undefined });
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checker approves a Pending register — it becomes Active and the previously-Active one is
|
||||||
|
* deactivated. In real use the Approvals tab calls Fineract's /makercheckers/{id}?command=approve;
|
||||||
|
* this method remains as a local-only stub for the dev-fallback path.
|
||||||
|
*/
|
||||||
|
approve(id: number): Observable<RateRegister | undefined> {
|
||||||
|
const pending = this.cache.find((x) => x.id === id);
|
||||||
|
if (!pending || pending.status !== 'Pending Approval') {
|
||||||
|
return of(undefined);
|
||||||
|
}
|
||||||
|
const today = new Date().toISOString().slice(0, 10);
|
||||||
|
const previouslyActive = this.cache.find((x) => x.status === 'Active');
|
||||||
|
if (previouslyActive) {
|
||||||
|
previouslyActive.status = 'Expired';
|
||||||
|
previouslyActive.effectiveTo = today;
|
||||||
|
previouslyActive.lastModified = today;
|
||||||
|
}
|
||||||
|
pending.status = 'Active';
|
||||||
|
pending.effectiveFrom = today;
|
||||||
|
pending.lastModified = today;
|
||||||
|
pending.baselineRows = this.cloneRows(pending.rows);
|
||||||
|
pending.baselineCibilSlabs = this.cloneCibilSlabs(pending.cibilSlabs);
|
||||||
|
// Promote the local draft to the server-shaped view by moving it out of localDrafts.
|
||||||
|
this.localDrafts = this.localDrafts.filter((d) => d.id !== id);
|
||||||
|
return of(pending);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scaffold a brand-new local Draft when the backend has no versions yet. Uses the Excel-sourced
|
||||||
|
* template (34 products × 10 slabs + 5 CIBIL bands) so the user has a sensible starting point to
|
||||||
|
* tweak and submit as the first-ever Active version. Carries a negative id like other local drafts.
|
||||||
|
*/
|
||||||
|
createFirstVersion(): RateRegister {
|
||||||
|
const template = this.seedRegisters.find((r) => r.status === 'Active') ?? this.seedRegisters[0];
|
||||||
|
const newId = this.nextLocalDraftId();
|
||||||
|
const today = new Date().toISOString().slice(0, 10);
|
||||||
|
const draft: RateRegister = {
|
||||||
|
id: newId,
|
||||||
|
name: 'Interest Rate of Loans — new version',
|
||||||
|
effectiveFrom: today,
|
||||||
|
effectiveTo: null,
|
||||||
|
currency: 'INR',
|
||||||
|
status: 'Draft',
|
||||||
|
createdBy: 'Current User',
|
||||||
|
lastModified: today,
|
||||||
|
note: 'First Loan Interest Rate Register — seeded from Excel template',
|
||||||
|
slabs: template.slabs,
|
||||||
|
rows: this.cloneRows(template.rows),
|
||||||
|
cibilSlabs: this.cloneCibilSlabs(template.cibilSlabs),
|
||||||
|
// Baseline is empty rows for the first version — compare screen will show every cell as "new".
|
||||||
|
baselineRows: template.rows.map((r) => ({
|
||||||
|
srNo: r.srNo,
|
||||||
|
particulars: r.particulars,
|
||||||
|
rates: new Array(r.rates.length).fill(null)
|
||||||
|
})),
|
||||||
|
baselineCibilSlabs: [],
|
||||||
|
fallbackNoCibilSlab: template.fallbackNoCibilSlab,
|
||||||
|
fallbackBelowMin: template.fallbackBelowMin
|
||||||
|
};
|
||||||
|
this.localDrafts.unshift(draft);
|
||||||
|
this.cache.unshift(draft);
|
||||||
|
return draft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplicate the current Active (or any register) as a new local Draft so the user can propose
|
||||||
|
* changes without touching the live Active. Local Drafts carry a negative id to never collide
|
||||||
|
* with server-assigned ids.
|
||||||
|
*/
|
||||||
|
duplicateAsDraft(sourceId: number): RateRegister | undefined {
|
||||||
|
const source = this.cache.find((r) => r.id === sourceId) ?? this.seedRegisters.find((r) => r.id === sourceId);
|
||||||
|
if (!source) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const newId = this.nextLocalDraftId();
|
||||||
|
const today = new Date().toISOString().slice(0, 10);
|
||||||
|
const copy: RateRegister = {
|
||||||
|
id: newId,
|
||||||
|
name: `${source.name} — new version`,
|
||||||
|
effectiveFrom: source.effectiveFrom,
|
||||||
|
effectiveTo: source.effectiveTo,
|
||||||
|
currency: source.currency,
|
||||||
|
status: 'Draft',
|
||||||
|
createdBy: 'Current User',
|
||||||
|
lastModified: today,
|
||||||
|
note: `Draft derived from ${source.name}`,
|
||||||
|
slabs: source.slabs,
|
||||||
|
rows: this.cloneRows(source.rows),
|
||||||
|
cibilSlabs: this.cloneCibilSlabs(source.cibilSlabs),
|
||||||
|
baselineRows: this.cloneRows(source.rows),
|
||||||
|
baselineCibilSlabs: this.cloneCibilSlabs(source.cibilSlabs),
|
||||||
|
fallbackNoCibilSlab: source.fallbackNoCibilSlab,
|
||||||
|
fallbackBelowMin: source.fallbackBelowMin
|
||||||
|
};
|
||||||
|
this.localDrafts.unshift(copy);
|
||||||
|
this.cache.unshift(copy);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Checker rejects the pending register — it goes back to Draft (local-only fallback). */
|
||||||
|
reject(id: number): Observable<RateRegister | undefined> {
|
||||||
|
const pending = this.cache.find((x) => x.id === id);
|
||||||
|
if (!pending || pending.status !== 'Pending Approval') {
|
||||||
|
return of(undefined);
|
||||||
|
}
|
||||||
|
pending.status = 'Draft';
|
||||||
|
pending.lastModified = new Date().toISOString().slice(0, 10);
|
||||||
|
return of(pending);
|
||||||
|
}
|
||||||
|
|
||||||
|
private nextLocalDraftId(): number {
|
||||||
|
const minId = this.localDrafts.length ? Math.min(...this.localDrafts.map((d) => d.id)) : 0;
|
||||||
|
return (minId <= 0 ? minId : 0) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a register with its OWN deep-cloned rows and CIBIL slabs — editing one register must
|
||||||
|
* not mutate another. Optional overrides let a Draft start with real diffs vs the Active one.
|
||||||
|
*/
|
||||||
|
private seedRegister(spec: {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
effectiveFrom: string;
|
||||||
|
effectiveTo: string | null;
|
||||||
|
status: RateRegister['status'];
|
||||||
|
createdBy: string;
|
||||||
|
lastModified: string;
|
||||||
|
note?: string;
|
||||||
|
rateOverrides?: { srNo: number; colIdx: number; value: number | string | null }[];
|
||||||
|
cibilOverrides?: { index: number; adjustmentPct: number }[];
|
||||||
|
}): RateRegister {
|
||||||
|
const rows = this.cloneRows(this.rows);
|
||||||
|
const cibilSlabs = this.cloneCibilSlabs(this.cibilSlabs);
|
||||||
|
for (const o of spec.rateOverrides ?? []) {
|
||||||
|
const r = rows.find((x) => x.srNo === o.srNo);
|
||||||
|
if (r) {
|
||||||
|
r.rates[o.colIdx] = o.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const o of spec.cibilOverrides ?? []) {
|
||||||
|
const s = cibilSlabs[o.index];
|
||||||
|
if (s) {
|
||||||
|
s.adjustmentPct = o.adjustmentPct;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: spec.id,
|
||||||
|
name: spec.name,
|
||||||
|
effectiveFrom: spec.effectiveFrom,
|
||||||
|
effectiveTo: spec.effectiveTo,
|
||||||
|
currency: 'INR',
|
||||||
|
status: spec.status,
|
||||||
|
createdBy: spec.createdBy,
|
||||||
|
lastModified: spec.lastModified,
|
||||||
|
note: spec.note,
|
||||||
|
slabs: this.slabs, // slab columns are structural; safe to share
|
||||||
|
rows,
|
||||||
|
cibilSlabs,
|
||||||
|
// Frozen baseline (last-approved state). Lives separately from `rows`/`cibilSlabs` so edits
|
||||||
|
// to the register are visible as diffs on the Compare screen, even when the register being
|
||||||
|
// edited happens to be the one that is currently Active.
|
||||||
|
baselineRows: this.cloneRows(rows),
|
||||||
|
baselineCibilSlabs: this.cloneCibilSlabs(cibilSlabs),
|
||||||
|
fallbackNoCibilSlab: 2,
|
||||||
|
fallbackBelowMin: 'block'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private cloneRows(src: RateChartRow[]): RateChartRow[] {
|
||||||
|
return src.map((r) => ({
|
||||||
|
srNo: r.srNo,
|
||||||
|
particulars: r.particulars,
|
||||||
|
isFormula: r.isFormula,
|
||||||
|
rates: [...r.rates]
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private cloneCibilSlabs(src: CibilSlab[]): CibilSlab[] {
|
||||||
|
return src.map((s) => ({ ...s }));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- backend <-> UI mapping -----------------------------------------------
|
||||||
|
// Backend sends/receives slabs as a flat list of {productSrNo, slabOrder, cell} rows; the UI
|
||||||
|
// works with a matrix: SlabColumn[] + RateChartRow[] (34 × 10). The two mappers below bridge
|
||||||
|
// that gap.
|
||||||
|
|
||||||
|
/** Map a backend {@code LoanRateRegisterData} payload into a UI RateRegister. */
|
||||||
|
private fromBackend(d: any): RateRegister {
|
||||||
|
// Rebuild the slab columns from unique slabOrders.
|
||||||
|
const slabByOrder = new Map<number, SlabColumn>();
|
||||||
|
for (const cell of d.slabs ?? []) {
|
||||||
|
if (!slabByOrder.has(cell.slabOrder)) {
|
||||||
|
slabByOrder.set(cell.slabOrder, {
|
||||||
|
key: `s${cell.slabOrder + 1}`,
|
||||||
|
label: cell.slabLabel,
|
||||||
|
amountUpto: cell.amountUpto ?? null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const slabs = [...slabByOrder.entries()]
|
||||||
|
.sort((a, b) => a[0] - b[0])
|
||||||
|
.map(
|
||||||
|
([
|
||||||
|
,
|
||||||
|
s
|
||||||
|
]) => s
|
||||||
|
);
|
||||||
|
|
||||||
|
// Group cells by product to build rows.
|
||||||
|
const rowByProduct = new Map<number, RateChartRow>();
|
||||||
|
for (const cell of d.slabs ?? []) {
|
||||||
|
let row = rowByProduct.get(cell.productSrNo);
|
||||||
|
if (!row) {
|
||||||
|
row = { srNo: cell.productSrNo, particulars: cell.productName, rates: new Array(slabs.length).fill(null) };
|
||||||
|
rowByProduct.set(cell.productSrNo, row);
|
||||||
|
}
|
||||||
|
let value: RateCell;
|
||||||
|
if (cell.isNa) {
|
||||||
|
value = null;
|
||||||
|
} else if (cell.isFormula && cell.rateFormula) {
|
||||||
|
value = cell.rateFormula;
|
||||||
|
row.isFormula = true;
|
||||||
|
} else {
|
||||||
|
value = cell.rateValue ?? null;
|
||||||
|
}
|
||||||
|
row.rates[cell.slabOrder] = value;
|
||||||
|
}
|
||||||
|
const rows = [...rowByProduct.values()].sort((a, b) => a.srNo - b.srNo);
|
||||||
|
|
||||||
|
const cibilSlabs: CibilSlab[] = (d.cibilSlabs ?? [])
|
||||||
|
.slice()
|
||||||
|
.sort((a: any, b: any) => a.displayOrder - b.displayOrder)
|
||||||
|
.map((c: any) => ({
|
||||||
|
from: c.scoreFrom,
|
||||||
|
to: c.scoreTo,
|
||||||
|
tier: c.tier,
|
||||||
|
type: c.slabType ?? 'Flat',
|
||||||
|
adjustmentPct: Number(c.adjustmentPct)
|
||||||
|
}));
|
||||||
|
|
||||||
|
const status: RegisterStatus = d.isActive ? 'Active' : 'Expired';
|
||||||
|
return {
|
||||||
|
id: d.id,
|
||||||
|
name: d.name,
|
||||||
|
effectiveFrom: d.effectiveFromDate,
|
||||||
|
effectiveTo: d.effectiveToDate ?? null,
|
||||||
|
currency: d.currencyCode ?? 'INR',
|
||||||
|
status,
|
||||||
|
createdBy: d.createdById != null ? `User #${d.createdById}` : 'System',
|
||||||
|
lastModified: (d.createdDate ?? d.effectiveFromDate ?? '').toString().slice(0, 10),
|
||||||
|
note: d.note,
|
||||||
|
slabs,
|
||||||
|
rows,
|
||||||
|
cibilSlabs,
|
||||||
|
baselineRows: this.cloneRows(rows),
|
||||||
|
baselineCibilSlabs: this.cloneCibilSlabs(cibilSlabs),
|
||||||
|
fallbackNoCibilSlab: d.fallbackNoCibilSlab ?? 2,
|
||||||
|
fallbackBelowMin: (d.fallbackBelowMin as 'use-min-slab' | 'block') ?? 'block'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Serialise a UI RateRegister into the JSON shape POST /loanproducts/baseinterestrates expects. */
|
||||||
|
private toBackend(r: RateRegister): any {
|
||||||
|
const slabs: any[] = [];
|
||||||
|
for (const row of r.rows) {
|
||||||
|
for (let j = 0; j < r.slabs.length; j++) {
|
||||||
|
const cell = row.rates[j];
|
||||||
|
const slabCol = r.slabs[j];
|
||||||
|
const isNa = cell === null;
|
||||||
|
const isFormula = typeof cell === 'string';
|
||||||
|
slabs.push({
|
||||||
|
productSrNo: row.srNo,
|
||||||
|
productName: row.particulars,
|
||||||
|
slabOrder: j,
|
||||||
|
slabLabel: slabCol.label,
|
||||||
|
amountUpto: slabCol.amountUpto,
|
||||||
|
rateValue: isNa || isFormula ? null : cell,
|
||||||
|
rateFormula: isFormula ? cell : null,
|
||||||
|
isFormula,
|
||||||
|
isNa
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const cibilSlabs = r.cibilSlabs.map((c, i) => ({
|
||||||
|
scoreFrom: c.from,
|
||||||
|
scoreTo: c.to,
|
||||||
|
tier: c.tier,
|
||||||
|
slabType: c.type,
|
||||||
|
adjustmentPct: c.adjustmentPct,
|
||||||
|
displayOrder: i
|
||||||
|
}));
|
||||||
|
return {
|
||||||
|
name: r.name,
|
||||||
|
effectiveFromDate: r.effectiveFrom,
|
||||||
|
currencyCode: r.currency,
|
||||||
|
fallbackNoCibilSlab: r.fallbackNoCibilSlab,
|
||||||
|
fallbackBelowMin: r.fallbackBelowMin,
|
||||||
|
note: r.note,
|
||||||
|
slabs,
|
||||||
|
cibilSlabs
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+102
-23
@@ -42,19 +42,94 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|
||||||
<mat-tab>
|
@if (isAdvanceProduct) {
|
||||||
<ng-template mat-tab-label>
|
<mat-tab>
|
||||||
<i class="fas fa-cog lp-tab-icon"></i>
|
<ng-template mat-tab-label>
|
||||||
{{ 'labels.inputs.SETTINGS' | translate }}
|
<i class="fas fa-shield-alt lp-tab-icon"></i>
|
||||||
</ng-template>
|
SECURITY & LIEN
|
||||||
<div class="lp-tab-content">
|
</ng-template>
|
||||||
<mifosx-loan-product-settings-step
|
<div class="lp-tab-content">
|
||||||
[loanProductsTemplate]="loanProductsTemplate"
|
<mifosx-loan-product-security-lien-step
|
||||||
[isLinkedToFloatingInterestRates]="loanProductTermsForm.get('isLinkedToFloatingInterestRates')"
|
[loanProductsTemplate]="loanProductsTemplate"
|
||||||
(advancePaymentStrategy)="advancePaymentStrategy($event)"
|
[productTypeGroup]="loanProductDetailsForm.get('productTypeGroup')"
|
||||||
></mifosx-loan-product-settings-step>
|
[productTypeSubGroup]="loanProductDetailsForm.get('productTypeSubGroup')"
|
||||||
</div>
|
></mifosx-loan-product-security-lien-step>
|
||||||
</mat-tab>
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
|
||||||
|
<mat-tab>
|
||||||
|
<ng-template mat-tab-label>
|
||||||
|
<i class="fas fa-sliders-h lp-tab-icon"></i>
|
||||||
|
LIMIT & TENURE
|
||||||
|
</ng-template>
|
||||||
|
<div class="lp-tab-content">
|
||||||
|
<mifosx-loan-product-advance-limit-tenure-step
|
||||||
|
[productSubType]="advanceSubType"
|
||||||
|
></mifosx-loan-product-advance-limit-tenure-step>
|
||||||
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
|
||||||
|
<mat-tab>
|
||||||
|
<ng-template mat-tab-label>
|
||||||
|
<i class="fas fa-percent lp-tab-icon"></i>
|
||||||
|
INTEREST
|
||||||
|
</ng-template>
|
||||||
|
<div class="lp-tab-content">
|
||||||
|
<mifosx-loan-product-advance-interest-step></mifosx-loan-product-advance-interest-step>
|
||||||
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
|
||||||
|
<mat-tab>
|
||||||
|
<ng-template mat-tab-label>
|
||||||
|
<i class="fas fa-triangle-exclamation lp-tab-icon"></i>
|
||||||
|
PENAL & NPA
|
||||||
|
</ng-template>
|
||||||
|
<div class="lp-tab-content">
|
||||||
|
<mifosx-loan-product-penal-npa-step
|
||||||
|
[loanProductsTemplate]="loanProductsTemplate"
|
||||||
|
></mifosx-loan-product-penal-npa-step>
|
||||||
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
|
||||||
|
<mat-tab>
|
||||||
|
<ng-template mat-tab-label>
|
||||||
|
<i class="fas fa-arrows-rotate lp-tab-icon"></i>
|
||||||
|
RENEWAL & CLOSURE
|
||||||
|
</ng-template>
|
||||||
|
<div class="lp-tab-content">
|
||||||
|
<mifosx-loan-product-renewal-closure-step></mifosx-loan-product-renewal-closure-step>
|
||||||
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
|
||||||
|
@if (isOverdraftFacility) {
|
||||||
|
<mat-tab>
|
||||||
|
<ng-template mat-tab-label>
|
||||||
|
<i class="fas fa-money-check lp-tab-icon"></i>
|
||||||
|
CHEQUE BOOK
|
||||||
|
</ng-template>
|
||||||
|
<div class="lp-tab-content">
|
||||||
|
<mifosx-loan-product-cheque-book-step></mifosx-loan-product-cheque-book-step>
|
||||||
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!isAdvanceProduct) {
|
||||||
|
<mat-tab>
|
||||||
|
<ng-template mat-tab-label>
|
||||||
|
<i class="fas fa-cog lp-tab-icon"></i>
|
||||||
|
{{ 'labels.inputs.SETTINGS' | translate }}
|
||||||
|
</ng-template>
|
||||||
|
<div class="lp-tab-content">
|
||||||
|
<mifosx-loan-product-settings-step
|
||||||
|
[loanProductsTemplate]="loanProductsTemplate"
|
||||||
|
[isLinkedToFloatingInterestRates]="loanProductTermsForm?.get('isLinkedToFloatingInterestRates')"
|
||||||
|
[productTypeGroup]="loanProductDetailsForm.get('productTypeGroup')"
|
||||||
|
(advancePaymentStrategy)="advancePaymentStrategy($event)"
|
||||||
|
></mifosx-loan-product-settings-step>
|
||||||
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
}
|
||||||
|
|
||||||
@if (isAdvancedPaymentStrategy) {
|
@if (isAdvancedPaymentStrategy) {
|
||||||
<mat-tab>
|
<mat-tab>
|
||||||
@@ -90,15 +165,19 @@
|
|||||||
</mat-tab>
|
</mat-tab>
|
||||||
}
|
}
|
||||||
|
|
||||||
<mat-tab>
|
@if (!isAdvanceProduct) {
|
||||||
<ng-template mat-tab-label>
|
<mat-tab>
|
||||||
<i class="fas fa-sliders-h lp-tab-icon"></i>
|
<ng-template mat-tab-label>
|
||||||
{{ 'labels.inputs.TERMS' | translate }}
|
<i class="fas fa-sliders-h lp-tab-icon"></i>
|
||||||
</ng-template>
|
{{ 'labels.inputs.TERMS' | translate }}
|
||||||
<div class="lp-tab-content">
|
</ng-template>
|
||||||
<mifosx-loan-product-terms-step [loanProductsTemplate]="loanProductsTemplate"></mifosx-loan-product-terms-step>
|
<div class="lp-tab-content">
|
||||||
</div>
|
<mifosx-loan-product-terms-step
|
||||||
</mat-tab>
|
[loanProductsTemplate]="loanProductsTemplate"
|
||||||
|
></mifosx-loan-product-terms-step>
|
||||||
|
</div>
|
||||||
|
</mat-tab>
|
||||||
|
}
|
||||||
|
|
||||||
<mat-tab>
|
<mat-tab>
|
||||||
<ng-template mat-tab-label>
|
<ng-template mat-tab-label>
|
||||||
@@ -109,7 +188,7 @@
|
|||||||
<mifosx-loan-product-charges-step
|
<mifosx-loan-product-charges-step
|
||||||
[loanProductsTemplate]="loanProductsTemplate"
|
[loanProductsTemplate]="loanProductsTemplate"
|
||||||
[currencyCode]="loanProductCurrencyForm.get('currencyCode')"
|
[currencyCode]="loanProductCurrencyForm.get('currencyCode')"
|
||||||
[multiDisburseLoan]="loanProductSettingsForm.get('multiDisburseLoan')"
|
[multiDisburseLoan]="loanProductSettingsForm?.get('multiDisburseLoan') ?? multiDisburseFallback"
|
||||||
></mifosx-loan-product-charges-step>
|
></mifosx-loan-product-charges-step>
|
||||||
</div>
|
</div>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|||||||
+243
-24
@@ -13,6 +13,12 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { LoanProductDetailsStepComponent } from '../loan-product-stepper/loan-product-details-step/loan-product-details-step.component';
|
import { LoanProductDetailsStepComponent } from '../loan-product-stepper/loan-product-details-step/loan-product-details-step.component';
|
||||||
import { LoanProductCurrencyStepComponent } from '../loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component';
|
import { LoanProductCurrencyStepComponent } from '../loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component';
|
||||||
|
import { LoanProductSecurityLienStepComponent } from '../loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component';
|
||||||
|
import { LoanProductAdvanceLimitTenureStepComponent } from '../loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component';
|
||||||
|
import { LoanProductAdvanceInterestStepComponent } from '../loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component';
|
||||||
|
import { LoanProductPenalNpaStepComponent } from '../loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component';
|
||||||
|
import { LoanProductRenewalClosureStepComponent } from '../loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component';
|
||||||
|
import { LoanProductChequeBookStepComponent } from '../loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component';
|
||||||
import { LoanProductTermsStepComponent } from '../loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component';
|
import { LoanProductTermsStepComponent } from '../loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component';
|
||||||
import { LoanProductSettingsStepComponent } from '../loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component';
|
import { LoanProductSettingsStepComponent } from '../loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component';
|
||||||
import { LoanProductChargesStepComponent } from '../loan-product-stepper/loan-product-charges-step/loan-product-charges-step.component';
|
import { LoanProductChargesStepComponent } from '../loan-product-stepper/loan-product-charges-step/loan-product-charges-step.component';
|
||||||
@@ -34,7 +40,7 @@ import {
|
|||||||
import { Accounting } from 'app/core/utils/accounting';
|
import { Accounting } from 'app/core/utils/accounting';
|
||||||
import { StringEnumOptionData } from '../../../shared/models/option-data.model';
|
import { StringEnumOptionData } from '../../../shared/models/option-data.model';
|
||||||
import { LoanProductDeferredIncomeRecognitionStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-deferred-income-recognition-step.component';
|
import { LoanProductDeferredIncomeRecognitionStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-deferred-income-recognition-step.component';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
import { LoanProductPaymentStrategyStepComponent } from '../loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component';
|
import { LoanProductPaymentStrategyStepComponent } from '../loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component';
|
||||||
import { LoanProductPreviewStepComponent } from '../loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component';
|
import { LoanProductPreviewStepComponent } from '../loan-product-stepper/loan-product-preview-step/loan-product-preview-step.component';
|
||||||
@@ -51,6 +57,12 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
FaIconComponent,
|
FaIconComponent,
|
||||||
LoanProductDetailsStepComponent,
|
LoanProductDetailsStepComponent,
|
||||||
LoanProductCurrencyStepComponent,
|
LoanProductCurrencyStepComponent,
|
||||||
|
LoanProductSecurityLienStepComponent,
|
||||||
|
LoanProductAdvanceLimitTenureStepComponent,
|
||||||
|
LoanProductAdvanceInterestStepComponent,
|
||||||
|
LoanProductPenalNpaStepComponent,
|
||||||
|
LoanProductRenewalClosureStepComponent,
|
||||||
|
LoanProductChequeBookStepComponent,
|
||||||
LoanProductSettingsStepComponent,
|
LoanProductSettingsStepComponent,
|
||||||
LoanProductInterestRefundStepComponent,
|
LoanProductInterestRefundStepComponent,
|
||||||
LoanProductPaymentStrategyStepComponent,
|
LoanProductPaymentStrategyStepComponent,
|
||||||
@@ -73,12 +85,27 @@ export class CreateLoanProductComponent implements OnInit {
|
|||||||
@ViewChild(LoanProductDetailsStepComponent, { static: true }) loanProductDetailsStep: LoanProductDetailsStepComponent;
|
@ViewChild(LoanProductDetailsStepComponent, { static: true }) loanProductDetailsStep: LoanProductDetailsStepComponent;
|
||||||
@ViewChild(LoanProductCurrencyStepComponent, { static: true })
|
@ViewChild(LoanProductCurrencyStepComponent, { static: true })
|
||||||
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
|
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
|
||||||
|
// Conditional tabs (Advances A/C only): static false — resolved after the @if renders them.
|
||||||
|
@ViewChild(LoanProductSecurityLienStepComponent)
|
||||||
|
loanProductSecurityLienStep: LoanProductSecurityLienStepComponent;
|
||||||
|
@ViewChild(LoanProductAdvanceLimitTenureStepComponent)
|
||||||
|
loanProductAdvanceLimitTenureStep: LoanProductAdvanceLimitTenureStepComponent;
|
||||||
|
@ViewChild(LoanProductAdvanceInterestStepComponent)
|
||||||
|
loanProductAdvanceInterestStep: LoanProductAdvanceInterestStepComponent;
|
||||||
|
@ViewChild(LoanProductPenalNpaStepComponent) loanProductPenalNpaStep: LoanProductPenalNpaStepComponent;
|
||||||
|
@ViewChild(LoanProductRenewalClosureStepComponent)
|
||||||
|
loanProductRenewalClosureStep: LoanProductRenewalClosureStepComponent;
|
||||||
|
@ViewChild(LoanProductChequeBookStepComponent) loanProductChequeBookStep: LoanProductChequeBookStepComponent;
|
||||||
|
|
||||||
|
/** Charges step needs a real control; Settings is absent on the Advances path, so fall back to this. */
|
||||||
|
readonly multiDisburseFallback = new UntypedFormControl(false);
|
||||||
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
|
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
|
||||||
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
|
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
|
||||||
@ViewChild(LoanProductDeferredIncomeRecognitionStepComponent, { static: true })
|
@ViewChild(LoanProductDeferredIncomeRecognitionStepComponent, { static: true })
|
||||||
loanProductDeferredIncomeRecognitionStep: LoanProductDeferredIncomeRecognitionStepComponent;
|
loanProductDeferredIncomeRecognitionStep: LoanProductDeferredIncomeRecognitionStepComponent;
|
||||||
@ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent;
|
// Terms & Settings tabs are now conditional (Loans path only), so resolve them non-statically.
|
||||||
@ViewChild(LoanProductSettingsStepComponent, { static: true })
|
@ViewChild(LoanProductTermsStepComponent) loanProductTermsStep: LoanProductTermsStepComponent;
|
||||||
|
@ViewChild(LoanProductSettingsStepComponent)
|
||||||
loanProductSettingsStep: LoanProductSettingsStepComponent;
|
loanProductSettingsStep: LoanProductSettingsStepComponent;
|
||||||
@ViewChild(LoanProductChargesStepComponent, { static: true }) loanProductChargesStep: LoanProductChargesStepComponent;
|
@ViewChild(LoanProductChargesStepComponent, { static: true }) loanProductChargesStep: LoanProductChargesStepComponent;
|
||||||
@ViewChild(LoanProductAccountingStepComponent, { static: true })
|
@ViewChild(LoanProductAccountingStepComponent, { static: true })
|
||||||
@@ -143,7 +170,18 @@ export class CreateLoanProductComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get loanProductTermsForm() {
|
get loanProductTermsForm() {
|
||||||
return this.loanProductTermsStep.loanProductTermsForm;
|
// Absent on the Advances path (tab hidden), so guard for callers.
|
||||||
|
return this.loanProductTermsStep?.loanProductTermsForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True once the Advance Limit & Tenure step reports an Overdraft (running) facility. */
|
||||||
|
get isOverdraftFacility(): boolean {
|
||||||
|
return this.isAdvanceProduct && !!this.loanProductAdvanceLimitTenureStep?.isOverdraft;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sub type chosen on the Details step; drives the FD 12–15 month tenure policy downstream. */
|
||||||
|
get advanceSubType(): string {
|
||||||
|
return this.loanProductDetailsStep?.loanProductDetailsForm?.get('productTypeSubGroup')?.value ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
advancePaymentStrategy(value: string) {
|
advancePaymentStrategy(value: string) {
|
||||||
@@ -231,47 +269,71 @@ export class CreateLoanProductComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get loanProductSettingsForm() {
|
get loanProductSettingsForm() {
|
||||||
return this.loanProductSettingsStep.loanProductSettingsForm;
|
// Absent on the Advances path (tab hidden), so guard for callers.
|
||||||
|
return this.loanProductSettingsStep?.loanProductSettingsForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
get loanProductAccountingForm() {
|
get loanProductAccountingForm() {
|
||||||
return this.loanProductAccountingStep.loanProductAccountingForm;
|
return this.loanProductAccountingStep.loanProductAccountingForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The Details step's chosen product type; drives the Advances-only tabs. */
|
||||||
|
get isAdvanceProduct(): boolean {
|
||||||
|
return this.loanProductDetailsForm?.get('productTypeGroup')?.value === 'advances';
|
||||||
|
}
|
||||||
|
|
||||||
get totalTabs(): number {
|
get totalTabs(): number {
|
||||||
let tabs = 6; // details, currency, settings, terms, charges, accounting
|
let tabs = 4; // details, currency, charges, accounting (always)
|
||||||
if (this.isAdvancedPaymentStrategy) tabs += 3; // interest refund, payment allocation, deferred income
|
if (this.isAdvanceProduct) {
|
||||||
|
// security & lien, limit & tenure, interest, penal & npa, renewal & closure
|
||||||
|
tabs += 5;
|
||||||
|
if (this.isOverdraftFacility) tabs += 1; // cheque book
|
||||||
|
} else {
|
||||||
|
tabs += 2; // settings, terms
|
||||||
|
if (this.isAdvancedPaymentStrategy) tabs += 3; // interest refund, payment allocation, deferred income
|
||||||
|
}
|
||||||
if (this.loanProductFormValid) tabs += 1; // preview
|
if (this.loanProductFormValid) tabs += 1; // preview
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
get loanProductFormValid() {
|
get loanProductFormValid() {
|
||||||
if (this.isAdvancedPaymentStrategy) {
|
const base =
|
||||||
|
this.loanProductDetailsForm.valid && this.loanProductCurrencyForm.valid && this.loanProductAccountingForm.valid;
|
||||||
|
|
||||||
|
// Advances A/C: the curated Figma steps gate the form; Settings/Terms tabs are hidden.
|
||||||
|
if (this.isAdvanceProduct) {
|
||||||
return (
|
return (
|
||||||
this.loanProductDetailsForm.valid &&
|
base &&
|
||||||
this.loanProductCurrencyForm.valid &&
|
!!this.loanProductSecurityLienStep?.loanProductSecurityLienForm?.valid &&
|
||||||
this.loanProductTermsForm.valid &&
|
!!this.loanProductAdvanceLimitTenureStep?.loanProductAdvanceLimitTenureForm?.valid &&
|
||||||
this.loanProductSettingsForm.valid &&
|
!!this.loanProductAdvanceInterestStep?.loanProductAdvanceInterestForm?.valid &&
|
||||||
this.loanIncomeCapitalizationForm.valid &&
|
!!this.loanProductPenalNpaStep?.loanProductPenalNpaForm?.valid &&
|
||||||
this.loanProductAccountingForm.valid
|
!!this.loanProductRenewalClosureStep?.loanProductRenewalClosureForm?.valid &&
|
||||||
);
|
(!this.isOverdraftFacility || !!this.loanProductChequeBookStep?.loanProductChequeBookForm?.valid)
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
this.loanProductDetailsForm.valid &&
|
|
||||||
this.loanProductCurrencyForm.valid &&
|
|
||||||
this.loanProductTermsForm.valid &&
|
|
||||||
this.loanProductSettingsForm.valid &&
|
|
||||||
this.loanProductAccountingForm.valid
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Loans A/C: original Settings + Terms path.
|
||||||
|
const loansValid = !!this.loanProductTermsForm?.valid && !!this.loanProductSettingsForm?.valid;
|
||||||
|
if (this.isAdvancedPaymentStrategy) {
|
||||||
|
return base && loansValid && !!this.loanIncomeCapitalizationForm?.valid;
|
||||||
|
}
|
||||||
|
return base && loansValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
get loanProduct() {
|
get loanProduct() {
|
||||||
|
// Advances A/C builds its own payload: the curated steps map onto Fineract's mandatory core fields
|
||||||
|
// (principal, tenure, rate, amortization defaults) plus the whitelisted satellite params.
|
||||||
|
if (this.isAdvanceProduct) {
|
||||||
|
return this.assembleAdvanceProduct();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loans A/C: original composition (Settings/Terms present).
|
||||||
const loanProduct = {
|
const loanProduct = {
|
||||||
...this.loanProductDetailsStep.loanProductDetails,
|
...this.loanProductDetailsStep.loanProductDetails,
|
||||||
...this.loanProductCurrencyStep.loanProductCurrency,
|
...this.loanProductCurrencyStep.loanProductCurrency,
|
||||||
...this.loanProductTermsStep.loanProductTerms,
|
...(this.loanProductTermsStep?.loanProductTerms ?? {}),
|
||||||
...this.loanProductSettingsStep.loanProductSettings,
|
...(this.loanProductSettingsStep?.loanProductSettings ?? {}),
|
||||||
...this.loanProductChargesStep.loanProductCharges,
|
...this.loanProductChargesStep.loanProductCharges,
|
||||||
...this.loanProductAccountingStep.loanProductAccounting
|
...this.loanProductAccountingStep.loanProductAccounting
|
||||||
};
|
};
|
||||||
@@ -304,6 +366,163 @@ export class CreateLoanProductComponent implements OnInit {
|
|||||||
return loanProduct;
|
return loanProduct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the create payload for an Advances A/C product: the curated wizard steps mapped onto Fineract's
|
||||||
|
* mandatory core fields (so the standard product saves) plus the whitelisted satellite params (persisted by
|
||||||
|
* LoanProductAdvanceExtService). Only keys the backend accepts are emitted — an unknown key would be
|
||||||
|
* rejected by checkForUnsupportedParameters.
|
||||||
|
*/
|
||||||
|
private assembleAdvanceProduct(): any {
|
||||||
|
const num = (v: any): number | undefined => (v === '' || v === null || v === undefined ? undefined : Number(v));
|
||||||
|
|
||||||
|
const d = this.loanProductDetailsStep.loanProductDetails;
|
||||||
|
const cur = this.loanProductCurrencyStep.loanProductCurrency;
|
||||||
|
const sec = this.loanProductSecurityLienStep.loanProductSecurityLien;
|
||||||
|
const lt = this.loanProductAdvanceLimitTenureStep.loanProductAdvanceLimitTenure;
|
||||||
|
const intr = this.loanProductAdvanceInterestStep.loanProductAdvanceInterest;
|
||||||
|
const pn = this.loanProductPenalNpaStep.loanProductPenalNpa;
|
||||||
|
const rc = this.loanProductRenewalClosureStep.loanProductRenewalClosure;
|
||||||
|
const cb = this.isOverdraftFacility ? this.loanProductChequeBookStep?.loanProductChequeBook : null;
|
||||||
|
|
||||||
|
const defaultStrategy = this.loanProductsTemplate?.transactionProcessingStrategyOptions?.[0]?.code;
|
||||||
|
const minTenure = num(lt.minTenure);
|
||||||
|
const minRate = num(intr.minRate);
|
||||||
|
|
||||||
|
const payload: any = {
|
||||||
|
// identity + currency
|
||||||
|
name: d.name,
|
||||||
|
shortName: d.shortName,
|
||||||
|
description: d.description,
|
||||||
|
startDate: d.startDate,
|
||||||
|
closeDate: d.closeDate,
|
||||||
|
currencyCode: cur.currencyCode,
|
||||||
|
digitsAfterDecimal: cur.digitsAfterDecimal,
|
||||||
|
inMultiplesOf: 1,
|
||||||
|
|
||||||
|
// limit -> principal
|
||||||
|
minPrincipal: num(lt.minLimit),
|
||||||
|
principal: num(lt.defaultLimit) ?? num(lt.minLimit),
|
||||||
|
maxPrincipal: num(lt.maxLimit),
|
||||||
|
|
||||||
|
// tenure -> repayments (monthly)
|
||||||
|
minNumberOfRepayments: minTenure,
|
||||||
|
numberOfRepayments: num(lt.defaultTenure) ?? minTenure,
|
||||||
|
maxNumberOfRepayments: num(lt.maxTenure),
|
||||||
|
repaymentEvery: 1,
|
||||||
|
repaymentFrequencyType: 2, // months
|
||||||
|
|
||||||
|
// rate
|
||||||
|
minInterestRatePerPeriod: minRate,
|
||||||
|
interestRatePerPeriod: minRate,
|
||||||
|
maxInterestRatePerPeriod: num(intr.maxRate),
|
||||||
|
interestRateFrequencyType: 3, // per year
|
||||||
|
|
||||||
|
// Fineract mandatory engine defaults for an Advance (no EMI schedule shown to the officer)
|
||||||
|
amortizationType: 1, // equal installments
|
||||||
|
interestType: 0, // declining balance
|
||||||
|
interestCalculationPeriodType: 1, // same as repayment period
|
||||||
|
transactionProcessingStrategyCode: defaultStrategy,
|
||||||
|
daysInYearType: 1, // actual
|
||||||
|
daysInMonthType: 1, // actual
|
||||||
|
isInterestRecalculationEnabled: false,
|
||||||
|
|
||||||
|
// NPA / delinquency map onto core product fields
|
||||||
|
overdueDaysForNPA: num(pn.npaDays),
|
||||||
|
graceOnArrearsAgeing: num(pn.graceOnArrearsAgeing),
|
||||||
|
inArrearsTolerance: num(pn.inArrearsTolerance),
|
||||||
|
delinquencyBucketId: pn.delinquencyBucketId || undefined,
|
||||||
|
|
||||||
|
// accounting rule + GL mappings + charges (all standard, whitelisted)
|
||||||
|
...this.loanProductAccountingStep.loanProductAccounting,
|
||||||
|
...this.loanProductChargesStep.loanProductCharges,
|
||||||
|
|
||||||
|
// ---- satellite params (must match LoanProductAdvanceExtService.ADVANCE_PARAMETERS) ----
|
||||||
|
productTypeGroup: d.productTypeGroup,
|
||||||
|
productTypeSubGroup: d.productTypeSubGroup,
|
||||||
|
glAccount: d.glAccount || undefined,
|
||||||
|
loanProductCategory: d.loanProductCategory,
|
||||||
|
prioritySector: d.prioritySector,
|
||||||
|
cibilAccountType: d.cibilAccountType,
|
||||||
|
kfsEnabled: d.kfsEnabled,
|
||||||
|
aprEnabled: d.aprEnabled,
|
||||||
|
facilityType: lt.facilityType,
|
||||||
|
securityType: sec.securityType,
|
||||||
|
eligibleAmountBasis: sec.eligibleAmountBasis,
|
||||||
|
margin: num(sec.margin),
|
||||||
|
ltv: sec.ltv,
|
||||||
|
dpMethod: 'security_value_x_ltv',
|
||||||
|
lienRequired: this.loanProductSecurityLienStep.isLienSubType,
|
||||||
|
lienMarkingStage: sec.lienMarkingStage,
|
||||||
|
lienCertificateRequired: sec.lienCertificateRequired,
|
||||||
|
lienCertificatePrefix: sec.lienCertificatePrefix,
|
||||||
|
printCertificateOnDisbursement: sec.printOnDisbursement,
|
||||||
|
interestBasis: intr.interestBasis,
|
||||||
|
spread: num(intr.spread),
|
||||||
|
interestChargedOn: intr.interestChargedOn,
|
||||||
|
interestPostingFrequency: intr.postingFrequency,
|
||||||
|
penalApplicable: pn.penalApplicable,
|
||||||
|
penalRate: num(pn.penalRate),
|
||||||
|
penalAppliedOn: pn.penalAppliedOn,
|
||||||
|
penalGraceDays: num(pn.penalGraceDays),
|
||||||
|
npaTrigger: pn.npaTrigger,
|
||||||
|
interestAfterNpa: pn.interestAfterNpa,
|
||||||
|
renewalAllowed: rc.renewalAllowed,
|
||||||
|
renewalPeriodMonths: num(rc.renewalPeriodMonths),
|
||||||
|
renewalGraceDays: num(rc.renewalGraceDays),
|
||||||
|
preclosureAllowed: rc.preclosureAllowed,
|
||||||
|
lockInMonths: num(rc.lockInMonths),
|
||||||
|
interestOnPreclosure: rc.interestOnPreclosure,
|
||||||
|
chequeBookEnabled: this.isOverdraftFacility,
|
||||||
|
chequeType: cb?.chequeType,
|
||||||
|
defaultChequeBookSize: num(cb?.defaultBookSize),
|
||||||
|
ppsThreshold: num(cb?.ppsThreshold),
|
||||||
|
ppsMandatoryAbove: num(cb?.ppsMandatoryAbove),
|
||||||
|
|
||||||
|
// ---- remaining wizard fields ----
|
||||||
|
// security & lien extras (deposit list joined; rule checkboxes)
|
||||||
|
eligibleDepositProducts: (sec.eligibleDepositProducts ?? []).join('|'),
|
||||||
|
lienTenureNotExceedMaturity: sec.lienRules?.tenureNotExceedMaturity,
|
||||||
|
lienAutoReleaseOnClosure: sec.lienRules?.autoReleaseOnClosure,
|
||||||
|
lienAllowMultipleDeposits: sec.lienRules?.allowMultipleDeposits,
|
||||||
|
lienAdjustFromMaturity: sec.lienRules?.adjustFromMaturity,
|
||||||
|
lienAllowThirdParty: sec.lienRules?.allowThirdPartyDeposit,
|
||||||
|
lienAllowRenewalUnderLien: sec.lienRules?.allowRenewalUnderLien,
|
||||||
|
// limit & tenure extras
|
||||||
|
repaymentType: lt.repaymentType,
|
||||||
|
appropriationOrder: lt.appropriationOrder,
|
||||||
|
debitBalanceAllow: lt.debitBalanceAllow,
|
||||||
|
allowDebitAfterDueDate: lt.allowDebitTransAfterDueDate,
|
||||||
|
branchLevelAccountType: lt.branchLevelAccountType,
|
||||||
|
// interest extras
|
||||||
|
interestCalcMethod: intr.calcMethod,
|
||||||
|
interestOnCreditBalance: intr.interestOnCreditBalance,
|
||||||
|
interestPostingDay: intr.postingDay,
|
||||||
|
// NPA upgrade rules
|
||||||
|
npaUpgradeOnlyAllArrears: pn.upgradeOnlyAllArrears,
|
||||||
|
npaKeepStandardIfDepositCovers: pn.keepStandardIfDepositCovers,
|
||||||
|
// cheque book full config
|
||||||
|
chequeBookSizes: (cb?.bookSizes ?? []).join('|'),
|
||||||
|
chequeMaxBooksOutstanding: num(cb?.maxBooksOutstanding),
|
||||||
|
chequeReissueWhenLeaves: num(cb?.reissueWhenLeaves),
|
||||||
|
chequeFirstBookFree: cb?.firstBookFree,
|
||||||
|
chequeFreeBooksPerYear: num(cb?.freeBooksPerYear),
|
||||||
|
chequeNamePrinted: cb?.namePrinted,
|
||||||
|
chequePrintDescription: cb?.chequePrintDescription,
|
||||||
|
chequeStopPaymentAllowed: cb?.stopPaymentAllowed,
|
||||||
|
chequeMaintainStockRegister: cb?.maintainStockRegister,
|
||||||
|
chequeAllowWithdrawalSlip: cb?.allowWithdrawalSlip,
|
||||||
|
chequeBlockNpa: cb?.blockNpa,
|
||||||
|
chequeBlockLimitExpired: cb?.blockLimitExpired,
|
||||||
|
chequeBlockOverDp: cb?.blockOverDp,
|
||||||
|
chequeBlockFrozen: cb?.blockFrozen,
|
||||||
|
chequeBlockLienReleased: cb?.blockLienReleased
|
||||||
|
};
|
||||||
|
|
||||||
|
// Drop undefined keys so we never send an unresolved value.
|
||||||
|
Object.keys(payload).forEach((k) => payload[k] === undefined && delete payload[k]);
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
const loanProduct = this.loanProducts.buildPayload(this.loanProduct, this.itemsByDefault);
|
const loanProduct = this.loanProducts.buildPayload(this.loanProduct, this.itemsByDefault);
|
||||||
if (this.isAdvancedPaymentStrategy) {
|
if (this.isAdvancedPaymentStrategy) {
|
||||||
|
|||||||
@@ -0,0 +1,174 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shared styling for the Advances A/C wizard steps (Security & Lien, Limit & Tenure,
|
||||||
|
* Interest, Penal & NPA, Renewal & Closure, Cheque Book).
|
||||||
|
*/
|
||||||
|
|
||||||
|
$accent: #0ea5e9;
|
||||||
|
$border: #e2e8f0;
|
||||||
|
$gray-50: #f8f9fa;
|
||||||
|
$gray-200: #e8eaed;
|
||||||
|
$gray-900: #202124;
|
||||||
|
|
||||||
|
.adv-section {
|
||||||
|
border: 1px solid $border;
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
& + & {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 12px 24px;
|
||||||
|
background: $gray-50;
|
||||||
|
border-bottom: 1px solid $gray-200;
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 14px;
|
||||||
|
color: $accent;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: $gray-900;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__hint {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #5f6368;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-subsection {
|
||||||
|
padding: 16px 24px;
|
||||||
|
|
||||||
|
& + & {
|
||||||
|
border-top: 1px solid $border;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-group {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #5f6368;
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 4px 16px;
|
||||||
|
padding: 16px 24px;
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-grid--3 {
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|
||||||
|
@media (width <= 900px) {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-subsection .adv-grid {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-field {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&--full {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-checks {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 12px 32px;
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-type-options {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px 24px 0;
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-type-option {
|
||||||
|
border: 1px solid #cbd5e1;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
|
||||||
|
&__label {
|
||||||
|
display: block;
|
||||||
|
font-weight: 600;
|
||||||
|
color: $gray-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__hint {
|
||||||
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #5f6368;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-note {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: 1px dashed $border;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #5f6368;
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: $accent;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.adv-info {
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #f0f9ff;
|
||||||
|
border: 1px solid #bae6fd;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #075985;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
+120
@@ -0,0 +1,120 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<form [formGroup]="loanProductAdvanceInterestForm">
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-percent"></i>
|
||||||
|
<h3>Rate</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Interest Basis</mat-label>
|
||||||
|
<mat-select formControlName="interestBasis">
|
||||||
|
@for (opt of interestBasisOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
@if (showSpread) {
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Spread over Deposit Rate (%)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="spread" min="0" max="20" step="0.01" />
|
||||||
|
<mat-hint>Advance rate = deposit rate + spread</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
} @else {
|
||||||
|
<div class="adv-field"></div>
|
||||||
|
}
|
||||||
|
<div class="adv-field"></div>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Minimum Rate (% p.a.)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="minRate" min="0" step="0.01" required />
|
||||||
|
<mat-error>Minimum Rate is <strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Maximum Rate (% p.a.)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="maxRate" min="0" step="0.01" required />
|
||||||
|
<mat-error>Maximum Rate is <strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-sliders-h"></i>
|
||||||
|
<h3>Calculation</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Calculation Method</mat-label>
|
||||||
|
<mat-select formControlName="calcMethod">
|
||||||
|
@for (opt of calcMethodOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Days in Year</mat-label>
|
||||||
|
<mat-select formControlName="daysInYear">
|
||||||
|
@for (opt of daysInYearOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Days in Month</mat-label>
|
||||||
|
<mat-select formControlName="daysInMonth">
|
||||||
|
@for (opt of daysInMonthOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Interest Charged On</mat-label>
|
||||||
|
<mat-select formControlName="interestChargedOn">
|
||||||
|
@for (opt of chargedOnOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Interest on Credit Balance</mat-label>
|
||||||
|
<mat-select formControlName="interestOnCreditBalance">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-clock"></i>
|
||||||
|
<h3>Posting</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Posting Frequency</mat-label>
|
||||||
|
<mat-select formControlName="postingFrequency">
|
||||||
|
@for (opt of postingFrequencyOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Posting Day</mat-label>
|
||||||
|
<mat-select formControlName="postingDay">
|
||||||
|
@for (opt of postingDayOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
+105
@@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* 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 } from '@angular/core';
|
||||||
|
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interest step for an Advances A/C product (Figma step 5). Interest basis + spread, rate bounds,
|
||||||
|
* daily calculation and monthly posting. UI-only for now — not sent in the create payload.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-loan-product-advance-interest-step',
|
||||||
|
templateUrl: './loan-product-advance-interest-step.component.html',
|
||||||
|
styleUrls: ['../advance-steps.scss'],
|
||||||
|
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||||
|
})
|
||||||
|
export class LoanProductAdvanceInterestStepComponent {
|
||||||
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
|
|
||||||
|
loanProductAdvanceInterestForm: UntypedFormGroup;
|
||||||
|
|
||||||
|
readonly interestBasisOptions = [
|
||||||
|
{ id: 'deposit_spread', label: 'Deposit Rate + Spread' },
|
||||||
|
{ id: 'fixed', label: 'Fixed rate' },
|
||||||
|
{ id: 'floating', label: 'Floating (EBLR-linked)' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly calcMethodOptions = [
|
||||||
|
{ id: 'daily', label: 'Daily product (daily outstanding)' },
|
||||||
|
{ id: 'monthly', label: 'Monthly average balance' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly daysInYearOptions = [
|
||||||
|
'Actual (365 / 366)',
|
||||||
|
'365',
|
||||||
|
'360'
|
||||||
|
];
|
||||||
|
readonly daysInMonthOptions = [
|
||||||
|
'Actual',
|
||||||
|
'30'
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly chargedOnOptions = [
|
||||||
|
{ id: 'utilised', label: 'Utilised (debit) balance' },
|
||||||
|
{ id: 'limit', label: 'Sanctioned limit' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly postingFrequencyOptions = [
|
||||||
|
'Monthly',
|
||||||
|
'Quarterly',
|
||||||
|
'Half-yearly',
|
||||||
|
'At Maturity'
|
||||||
|
];
|
||||||
|
readonly postingDayOptions = [
|
||||||
|
'Last day of month',
|
||||||
|
'1st of month',
|
||||||
|
'Anniversary day'
|
||||||
|
];
|
||||||
|
readonly yesNoOptions = [
|
||||||
|
'YES',
|
||||||
|
'NO'
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.loanProductAdvanceInterestForm = this.formBuilder.group({
|
||||||
|
interestBasis: ['deposit_spread'],
|
||||||
|
spread: [
|
||||||
|
2.0,
|
||||||
|
[
|
||||||
|
Validators.min(0),
|
||||||
|
Validators.max(20)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
minRate: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
maxRate: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
calcMethod: ['daily'],
|
||||||
|
daysInYear: ['Actual (365 / 366)'],
|
||||||
|
daysInMonth: ['Actual'],
|
||||||
|
interestChargedOn: ['utilised'],
|
||||||
|
interestOnCreditBalance: ['NO'],
|
||||||
|
postingFrequency: ['Monthly'],
|
||||||
|
postingDay: ['Last day of month']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get showSpread(): boolean {
|
||||||
|
return this.loanProductAdvanceInterestForm.get('interestBasis').value === 'deposit_spread';
|
||||||
|
}
|
||||||
|
|
||||||
|
get loanProductAdvanceInterest() {
|
||||||
|
return this.loanProductAdvanceInterestForm.getRawValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
+155
@@ -0,0 +1,155 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<form [formGroup]="loanProductAdvanceLimitTenureForm">
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-layer-group"></i>
|
||||||
|
<h3>Facility Type</h3>
|
||||||
|
</div>
|
||||||
|
<mat-radio-group formControlName="facilityType" class="adv-type-options">
|
||||||
|
<mat-radio-button value="demand" class="adv-type-option">
|
||||||
|
<span class="adv-type-option__label">Demand Loan</span>
|
||||||
|
<span class="adv-type-option__hint">Paid out once; repaid at maturity. No cheque book.</span>
|
||||||
|
</mat-radio-button>
|
||||||
|
<mat-radio-button value="overdraft" class="adv-type-option">
|
||||||
|
<span class="adv-type-option__label">Overdraft (Running)</span>
|
||||||
|
<span class="adv-type-option__hint">Draw and repay any time within the limit. Cheque book allowed.</span>
|
||||||
|
</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
<div style="padding: 16px 24px 20px">
|
||||||
|
<div class="adv-info">
|
||||||
|
This choice decides whether the <strong>Cheque Book</strong> step appears. CC / OD sub types are always running.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-coins"></i>
|
||||||
|
<h3>Limit</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Minimum Limit (₹)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="minLimit" min="0" required />
|
||||||
|
<mat-error>Minimum Limit is <strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Default Limit (₹)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="defaultLimit" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Maximum Limit (₹)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="maxLimit" min="0" required />
|
||||||
|
<mat-error>Maximum Limit is <strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-clock"></i>
|
||||||
|
<h3>Tenure & Repayment</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Minimum Tenure (months)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="minTenure" [min]="tenureMin" [max]="tenureMax" required />
|
||||||
|
@if (isFdTenureLocked) {
|
||||||
|
<mat-hint>FD policy: 12–15 months only</mat-hint>
|
||||||
|
}
|
||||||
|
<mat-error>
|
||||||
|
@if (isFdTenureLocked) {
|
||||||
|
Must be between <strong>12 and 15</strong> months
|
||||||
|
} @else {
|
||||||
|
Minimum Tenure is <strong>required</strong>
|
||||||
|
}
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Default Tenure (months)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="defaultTenure" [min]="tenureMin" [max]="tenureMax" />
|
||||||
|
@if (isFdTenureLocked) {
|
||||||
|
<mat-hint>Between 12 and 15</mat-hint>
|
||||||
|
<mat-error>Must be between <strong>12 and 15</strong> months</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Maximum Tenure (months)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="maxTenure" [min]="tenureMin" [max]="tenureMax" required />
|
||||||
|
@if (isFdTenureLocked) {
|
||||||
|
<mat-hint>FD policy: max 15 months (also capped at deposit maturity)</mat-hint>
|
||||||
|
} @else {
|
||||||
|
<mat-hint>Also capped at the deposit's maturity (Lien rule)</mat-hint>
|
||||||
|
}
|
||||||
|
<mat-error>
|
||||||
|
@if (isFdTenureLocked) {
|
||||||
|
Must be between <strong>12 and 15</strong> months
|
||||||
|
} @else {
|
||||||
|
Maximum Tenure is <strong>required</strong>
|
||||||
|
}
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Repayment Type</mat-label>
|
||||||
|
<mat-select formControlName="repaymentType">
|
||||||
|
@for (opt of repaymentTypeOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field adv-field--full">
|
||||||
|
<mat-label>Appropriation Order</mat-label>
|
||||||
|
<mat-select formControlName="appropriationOrder">
|
||||||
|
@for (opt of appropriationOrderOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-toggle-on"></i>
|
||||||
|
<h3>Account Behaviour</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Debit Balance Allow</mat-label>
|
||||||
|
<mat-select formControlName="debitBalanceAllow">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Allow Debit Trans After Due Date</mat-label>
|
||||||
|
<mat-select formControlName="allowDebitTransAfterDueDate">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Branch Level A/c Type</mat-label>
|
||||||
|
<mat-select formControlName="branchLevelAccountType">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-note">
|
||||||
|
<i class="fas fa-circle-info"></i>
|
||||||
|
<span>EMI fields (Number of Repayments, Repaid Every, Variable Installments) are hidden for an Advance.</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
+171
@@ -0,0 +1,171 @@
|
|||||||
|
/**
|
||||||
|
* 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, Input } from '@angular/core';
|
||||||
|
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { MatRadioButton, MatRadioGroup } from '@angular/material/radio';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limit & Tenure step for an Advances A/C product (Figma step 4).
|
||||||
|
*
|
||||||
|
* Facility Type here decides the rest of the flow: an Overdraft (running) facility gets a cheque book,
|
||||||
|
* a Demand Loan does not. UI-only for now — not sent in the create payload.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-loan-product-advance-limit-tenure-step',
|
||||||
|
templateUrl: './loan-product-advance-limit-tenure-step.component.html',
|
||||||
|
styleUrls: ['../advance-steps.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatRadioGroup,
|
||||||
|
MatRadioButton
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class LoanProductAdvanceLimitTenureStepComponent {
|
||||||
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
|
|
||||||
|
loanProductAdvanceLimitTenureForm: UntypedFormGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product sub type picked on the Details step. "Loan against FD" is bank-policy capped to a
|
||||||
|
* 12–15 month tenure, so the officer cannot create an FD product outside that band. Other
|
||||||
|
* advance sub types (Gold, RD, CC, …) stay open.
|
||||||
|
*/
|
||||||
|
private _productSubType = '';
|
||||||
|
@Input()
|
||||||
|
set productSubType(value: string) {
|
||||||
|
const next = value || '';
|
||||||
|
if (next === this._productSubType) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._productSubType = next;
|
||||||
|
this.applyTenurePolicy();
|
||||||
|
}
|
||||||
|
get productSubType(): string {
|
||||||
|
return this._productSubType;
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly repaymentTypeOptions = [
|
||||||
|
{ id: 'bullet', label: 'Bullet – principal + interest at maturity' },
|
||||||
|
{ id: 'running', label: 'Running – any time; clear by limit expiry' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly appropriationOrderOptions = [
|
||||||
|
{ id: 'charges_penal_interest_principal', label: 'Charges → Penal → Interest → Principal' },
|
||||||
|
{ id: 'principal_interest_penal_charges', label: 'Principal → Interest → Penal → Charges' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly yesNoOptions = [
|
||||||
|
'YES',
|
||||||
|
'NO'
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.loanProductAdvanceLimitTenureForm = this.formBuilder.group({
|
||||||
|
facilityType: ['demand'],
|
||||||
|
minLimit: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
defaultLimit: [''],
|
||||||
|
maxLimit: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
minTenure: [
|
||||||
|
12,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(1)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
defaultTenure: [12],
|
||||||
|
maxTenure: [
|
||||||
|
15,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(1)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
repaymentType: ['bullet'],
|
||||||
|
appropriationOrder: ['charges_penal_interest_principal'],
|
||||||
|
debitBalanceAllow: ['YES'],
|
||||||
|
allowDebitTransAfterDueDate: ['NO'],
|
||||||
|
branchLevelAccountType: ['NO']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Read by the wizard to decide whether the Cheque Book step applies. */
|
||||||
|
get isOverdraft(): boolean {
|
||||||
|
return this.loanProductAdvanceLimitTenureForm.get('facilityType').value === 'overdraft';
|
||||||
|
}
|
||||||
|
|
||||||
|
get loanProductAdvanceLimitTenure() {
|
||||||
|
return this.loanProductAdvanceLimitTenureForm.getRawValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True when the FD 12–15 month cap is in force (drives the hints/errors in the template). */
|
||||||
|
get isFdTenureLocked(): boolean {
|
||||||
|
return this._productSubType === 'fd';
|
||||||
|
}
|
||||||
|
|
||||||
|
get tenureMin(): number {
|
||||||
|
return this.isFdTenureLocked ? 12 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
get tenureMax(): number | null {
|
||||||
|
return this.isFdTenureLocked ? 15 : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FD advances are bank-policy capped to 12–15 months; every other sub type stays open (min 1).
|
||||||
|
* Called whenever the sub type changes so the validators — and thus the wizard's validity gate —
|
||||||
|
* match the selected product.
|
||||||
|
*/
|
||||||
|
private applyTenurePolicy(): void {
|
||||||
|
const form = this.loanProductAdvanceLimitTenureForm;
|
||||||
|
if (!form) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const min = form.get('minTenure');
|
||||||
|
const def = form.get('defaultTenure');
|
||||||
|
const max = form.get('maxTenure');
|
||||||
|
if (this._productSubType === 'fd') {
|
||||||
|
const bounds = [
|
||||||
|
Validators.min(12),
|
||||||
|
Validators.max(15)
|
||||||
|
];
|
||||||
|
min.setValidators([
|
||||||
|
Validators.required,
|
||||||
|
...bounds
|
||||||
|
]);
|
||||||
|
def.setValidators(bounds);
|
||||||
|
max.setValidators([
|
||||||
|
Validators.required,
|
||||||
|
...bounds
|
||||||
|
]);
|
||||||
|
min.setValue(12, { emitEvent: false });
|
||||||
|
def.setValue(12, { emitEvent: false });
|
||||||
|
max.setValue(15, { emitEvent: false });
|
||||||
|
} else {
|
||||||
|
min.setValidators([
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(1)
|
||||||
|
]);
|
||||||
|
def.setValidators([Validators.min(1)]);
|
||||||
|
max.setValidators([
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(1)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
min.updateValueAndValidity({ emitEvent: false });
|
||||||
|
def.updateValueAndValidity({ emitEvent: false });
|
||||||
|
max.updateValueAndValidity({ emitEvent: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
+144
@@ -0,0 +1,144 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<form [formGroup]="loanProductChequeBookForm">
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-money-check"></i>
|
||||||
|
<h3>Cheque Book Facility</h3>
|
||||||
|
<span class="adv-section__hint">Overdraft (running) only</span>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field adv-field--full" style="grid-column: span 2">
|
||||||
|
<mat-label>Cheque Type</mat-label>
|
||||||
|
<mat-select formControlName="chequeType">
|
||||||
|
@for (opt of chequeTypeOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Book Sizes Allowed (leaves)</mat-label>
|
||||||
|
<mat-select formControlName="bookSizes" multiple>
|
||||||
|
@for (opt of bookSizeOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Default Book Size (leaves)</mat-label>
|
||||||
|
<mat-select formControlName="defaultBookSize">
|
||||||
|
@for (opt of bookSizeOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Max Books Outstanding</mat-label>
|
||||||
|
<input matInput type="number" formControlName="maxBooksOutstanding" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Reissue When Unused Leaves ≤</mat-label>
|
||||||
|
<input matInput type="number" formControlName="reissueWhenLeaves" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>First Cheque Book Free</mat-label>
|
||||||
|
<mat-select formControlName="firstBookFree">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Free Cheque Books per Year</mat-label>
|
||||||
|
<input matInput type="number" formControlName="freeBooksPerYear" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Name Printed on Cheque</mat-label>
|
||||||
|
<mat-select formControlName="namePrinted">
|
||||||
|
@for (opt of namePrintedOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field adv-field--full" style="grid-column: span 2">
|
||||||
|
<mat-label>Cheque Print Description</mat-label>
|
||||||
|
<input matInput formControlName="chequePrintDescription" />
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-shield-halved"></i>
|
||||||
|
<h3>Validation & Security</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Positive Pay (PPS) Threshold (₹)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="ppsThreshold" min="0" required />
|
||||||
|
<mat-hint>Issuer confirms cheques at or above this</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>PPS Mandatory Above (₹)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="ppsMandatoryAbove" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Cheque Validity</mat-label>
|
||||||
|
<input matInput value="3 months (RBI)" disabled />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Stop Payment Allowed</mat-label>
|
||||||
|
<mat-select formControlName="stopPaymentAllowed">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Maintain Cheque Stock Register</mat-label>
|
||||||
|
<mat-select formControlName="maintainStockRegister">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Allow Withdrawal Slip</mat-label>
|
||||||
|
<mat-select formControlName="allowWithdrawalSlip">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-ban"></i>
|
||||||
|
<h3>Block Cheque Issue & Clearing When</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-subsection">
|
||||||
|
<div class="adv-checks">
|
||||||
|
<mat-checkbox formControlName="blockNpa">Account is NPA or out of order</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="blockLimitExpired">Limit has expired (renewal due)</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="blockOverDp">Debit would exceed the limit / drawing power</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="blockFrozen">Account is frozen or inoperative</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="blockLienReleased">
|
||||||
|
Pledged deposit has matured or its lien was released
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-note">
|
||||||
|
<i class="fas fa-circle-info"></i>
|
||||||
|
<span>Cheque book fees (issue, per leaf, return, stop payment) are set on the Charges step.</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
/**
|
||||||
|
* 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 } from '@angular/core';
|
||||||
|
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { MatCheckbox } from '@angular/material/checkbox';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cheque Book step (Figma step 8), shown only when the Facility Type is Overdraft (running).
|
||||||
|
* UI-only for now — not sent in the create payload.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-loan-product-cheque-book-step',
|
||||||
|
templateUrl: './loan-product-cheque-book-step.component.html',
|
||||||
|
styleUrls: ['../advance-steps.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatCheckbox
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class LoanProductChequeBookStepComponent {
|
||||||
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
|
|
||||||
|
loanProductChequeBookForm: UntypedFormGroup;
|
||||||
|
|
||||||
|
readonly chequeTypeOptions = [
|
||||||
|
'CTS-2010 · Payable at par (multi-city)',
|
||||||
|
'CTS-2010 · Local',
|
||||||
|
'Non-CTS'
|
||||||
|
];
|
||||||
|
readonly bookSizeOptions = [
|
||||||
|
'10',
|
||||||
|
'25',
|
||||||
|
'50',
|
||||||
|
'100'
|
||||||
|
];
|
||||||
|
readonly namePrintedOptions = [
|
||||||
|
'Account holder name',
|
||||||
|
'Firm / entity name',
|
||||||
|
'As per instruction'
|
||||||
|
];
|
||||||
|
readonly yesNoOptions = [
|
||||||
|
'YES',
|
||||||
|
'NO'
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.loanProductChequeBookForm = this.formBuilder.group({
|
||||||
|
chequeType: ['CTS-2010 · Payable at par (multi-city)'],
|
||||||
|
bookSizes: [
|
||||||
|
[
|
||||||
|
'10',
|
||||||
|
'25',
|
||||||
|
'50'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
defaultBookSize: ['25'],
|
||||||
|
maxBooksOutstanding: [1],
|
||||||
|
reissueWhenLeaves: [5],
|
||||||
|
firstBookFree: ['YES'],
|
||||||
|
freeBooksPerYear: [1],
|
||||||
|
namePrinted: ['Account holder name'],
|
||||||
|
chequePrintDescription: [''],
|
||||||
|
ppsThreshold: [
|
||||||
|
50000,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(0)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
ppsMandatoryAbove: [500000],
|
||||||
|
stopPaymentAllowed: ['YES'],
|
||||||
|
maintainStockRegister: ['YES'],
|
||||||
|
allowWithdrawalSlip: ['NO'],
|
||||||
|
blockNpa: [true],
|
||||||
|
blockLimitExpired: [true],
|
||||||
|
blockOverDp: [true],
|
||||||
|
blockFrozen: [true],
|
||||||
|
blockLienReleased: [true]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get loanProductChequeBook() {
|
||||||
|
return this.loanProductChequeBookForm.getRawValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
+176
-164
@@ -7,178 +7,190 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<form [formGroup]="loanProductDetailsForm">
|
<form [formGroup]="loanProductDetailsForm">
|
||||||
<div class="lpd-section">
|
<!-- Product Type — picked first; it decides which sections the rest of the wizard shows -->
|
||||||
<div class="lpd-section__header">
|
|
||||||
<i class="fas fa-info-circle"></i>
|
|
||||||
<h3>{{ 'labels.inputs.Product Name' | translate }} & {{ 'labels.inputs.Description' | translate }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="lpd-grid">
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field lpd-field--full">
|
|
||||||
<mat-label>{{ 'labels.inputs.Product Name' | translate }}</mat-label>
|
|
||||||
<input
|
|
||||||
matInput
|
|
||||||
formControlName="name"
|
|
||||||
matTooltip="{{ 'tooltips.Product name is a unique identifier' | translate }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<mat-error>
|
|
||||||
{{ 'labels.inputs.Product Name' | translate }} {{ 'labels.commons.is' | translate }}
|
|
||||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
||||||
</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
|
||||||
<mat-label>{{ 'labels.inputs.Short Name' | translate }}</mat-label>
|
|
||||||
<input
|
|
||||||
matInput
|
|
||||||
formControlName="shortName"
|
|
||||||
maxlength="4"
|
|
||||||
matTooltip="{{ 'tooltips.Short name is a unique identifier' | translate }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<mat-error>
|
|
||||||
{{ 'labels.inputs.Short Name' | translate }} {{ 'labels.commons.is' | translate }}
|
|
||||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
||||||
</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="lpd-section">
|
|
||||||
<div class="lpd-section__header">
|
|
||||||
<i class="fas fa-calendar-alt"></i>
|
|
||||||
<h3>{{ 'labels.inputs.Availability' | translate }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="lpd-grid">
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field" (click)="startDatePicker.open()">
|
|
||||||
<mat-label>{{ 'labels.inputs.Start Date' | translate }}</mat-label>
|
|
||||||
<input
|
|
||||||
matInput
|
|
||||||
[min]="minDate"
|
|
||||||
[max]="maxDate"
|
|
||||||
[matDatepicker]="startDatePicker"
|
|
||||||
matTooltip="{{ 'tooltips.loan product will be active and available to clients' | translate }}"
|
|
||||||
formControlName="startDate"
|
|
||||||
/>
|
|
||||||
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
|
|
||||||
<mat-datepicker #startDatePicker></mat-datepicker>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field" (click)="closeDatePicker.open()">
|
|
||||||
<mat-label>{{ 'labels.inputs.Close Date' | translate }}</mat-label>
|
|
||||||
<input
|
|
||||||
matInput
|
|
||||||
[min]="minDate"
|
|
||||||
[max]="maxDate"
|
|
||||||
[matDatepicker]="closeDatePicker"
|
|
||||||
matTooltip="{{ 'tooltips.loan product will become inactive and unavailable to clients' | translate }}"
|
|
||||||
formControlName="closeDate"
|
|
||||||
/>
|
|
||||||
<mat-datepicker-toggle matSuffix [for]="closeDatePicker"></mat-datepicker-toggle>
|
|
||||||
<mat-datepicker #closeDatePicker></mat-datepicker>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field lpd-field--full">
|
|
||||||
<mat-label>{{ 'labels.inputs.Description' | translate }}</mat-label>
|
|
||||||
<textarea
|
|
||||||
matInput
|
|
||||||
matTooltip="{{ 'tooltips.Provide additional information' | translate }}"
|
|
||||||
formControlName="description"
|
|
||||||
cdkTextareaAutosize
|
|
||||||
cdkAutosizeMinRows="2"
|
|
||||||
></textarea>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Interest Information -->
|
|
||||||
<div class="lpd-section">
|
|
||||||
<div class="lpd-section__header">
|
|
||||||
<i class="fas fa-percentage"></i>
|
|
||||||
<h3>Interest Information</h3>
|
|
||||||
</div>
|
|
||||||
<div class="lpd-grid">
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
|
||||||
<mat-label>Debit Int. Calculation</mat-label>
|
|
||||||
<mat-select formControlName="debitIntCalculation">
|
|
||||||
@for (opt of yesNoOptions; track opt.value) {
|
|
||||||
<mat-option [value]="opt.value">{{ opt.label }}</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
|
||||||
<mat-label>Separate Penal Int.</mat-label>
|
|
||||||
<mat-select formControlName="separatePenalInterest">
|
|
||||||
@for (opt of yesNoOptions; track opt.value) {
|
|
||||||
<mat-option [value]="opt.value">{{ opt.label }}</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
|
||||||
<mat-label>Credit Int. Calculation</mat-label>
|
|
||||||
<mat-select formControlName="creditIntCalculation">
|
|
||||||
@for (opt of yesNoOptions; track opt.value) {
|
|
||||||
<mat-option [value]="opt.value">{{ opt.label }}</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
|
||||||
<mat-label>Sub A/c Type Balance</mat-label>
|
|
||||||
<mat-select formControlName="subAccountTypeBalance">
|
|
||||||
@for (opt of yesNoOptions; track opt.value) {
|
|
||||||
<mat-option [value]="opt.value">{{ opt.label }}</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
|
||||||
<mat-label>Final Int. Rounding</mat-label>
|
|
||||||
<mat-select formControlName="finalIntRounding">
|
|
||||||
@for (opt of yesNoOptions; track opt.value) {
|
|
||||||
<mat-option [value]="opt.value">{{ opt.label }}</mat-option>
|
|
||||||
}
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
@if (loanProductDetailsForm.get('finalIntRounding')?.value) {
|
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
|
||||||
<mat-label>Rounding UpTo</mat-label>
|
|
||||||
<input matInput type="number" formControlName="roundingUpTo" min="0" />
|
|
||||||
</mat-form-field>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Product Classification + GL Account — combined section -->
|
|
||||||
<div class="lpd-section">
|
<div class="lpd-section">
|
||||||
<div class="lpd-section__header">
|
<div class="lpd-section__header">
|
||||||
<i class="fas fa-sitemap"></i>
|
<i class="fas fa-sitemap"></i>
|
||||||
<h3>Product Classification</h3>
|
<h3>Product Type</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="lpd-grid">
|
<mat-radio-group formControlName="productTypeGroup" class="lpd-type-options">
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
@for (group of productTypeGroups; track group.id) {
|
||||||
<mat-label>Product Type Group</mat-label>
|
<mat-radio-button [value]="group.id" class="lpd-type-option">
|
||||||
<mat-select formControlName="productTypeGroup">
|
<span class="lpd-type-option__label">{{ group.label }}</span>
|
||||||
@for (group of productTypeGroups; track group.id) {
|
<span class="lpd-type-option__hint">{{ group.hint }}</span>
|
||||||
<mat-option [value]="group.id">{{ group.label }}</mat-option>
|
</mat-radio-button>
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-radio-group>
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
@if (loanProductDetailsForm.get('productTypeGroup')?.value) {
|
@if (loanProductDetailsForm.get('productTypeGroup')?.value) {
|
||||||
|
<div class="lpd-grid">
|
||||||
<mat-form-field appearance="outline" class="lpd-field">
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
<mat-label>GL Account ({{ glClassificationLabel }})</mat-label>
|
<mat-label>Product Sub Type</mat-label>
|
||||||
<mat-select formControlName="glAccount">
|
<mat-select formControlName="productTypeSubGroup" [required]="!isExistingProduct">
|
||||||
@for (acc of availableGlAccounts; track acc.id) {
|
@for (subGroup of availableSubGroups; track subGroup.id) {
|
||||||
<mat-option [value]="acc.id"> ({{ acc.glCode }}) {{ acc.name }} </mat-option>
|
<mat-option [value]="subGroup.id">{{ subGroup.label }}</mat-option>
|
||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error>GL Account is required</mat-error>
|
<mat-error>Product Sub Type is <strong>required</strong></mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
}
|
|
||||||
</div>
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
|
<mat-label>GL Account (Asset)</mat-label>
|
||||||
|
<mat-select
|
||||||
|
formControlName="glAccount"
|
||||||
|
[required]="!isExistingProduct"
|
||||||
|
matTooltip="Ledger GL of this product. Account numbers of its loan accounts are generated from this GL."
|
||||||
|
>
|
||||||
|
@for (acc of assetAccountOptions; track acc.id) {
|
||||||
|
<mat-option [value]="acc.id">({{ acc.glCode }}) {{ acc.name }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
<mat-error>GL Account is <strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (!isProductTypeChosen) {
|
||||||
|
<div class="lpd-type-pending">
|
||||||
|
<i class="fas fa-circle-info"></i>
|
||||||
|
Select a Product Type and Sub Type to continue.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (isProductTypeChosen) {
|
||||||
|
<div class="lpd-section">
|
||||||
|
<div class="lpd-section__header">
|
||||||
|
<i class="fas fa-info-circle"></i>
|
||||||
|
<h3>{{ 'labels.inputs.Product Name' | translate }} & {{ 'labels.inputs.Description' | translate }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="lpd-grid">
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field lpd-field--full">
|
||||||
|
<mat-label>{{ 'labels.inputs.Product Name' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
formControlName="name"
|
||||||
|
matTooltip="{{ 'tooltips.Product name is a unique identifier' | translate }}"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<mat-error>
|
||||||
|
{{ 'labels.inputs.Product Name' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
|
<mat-label>{{ 'labels.inputs.Short Name' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
formControlName="shortName"
|
||||||
|
[maxlength]="isExistingProduct ? 4 : null"
|
||||||
|
matTooltip="{{ 'tooltips.Short name is a unique identifier' | translate }}"
|
||||||
|
required
|
||||||
|
(input)="normalizeShortName($event)"
|
||||||
|
/>
|
||||||
|
@if (loanProductDetailsForm.get('shortName').hasError('pattern')) {
|
||||||
|
<mat-error>Short Name must be exactly <strong>2 capital letters</strong> (A–Z)</mat-error>
|
||||||
|
} @else {
|
||||||
|
<mat-error>
|
||||||
|
{{ 'labels.inputs.Short Name' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field lpd-field--row-start" (click)="startDatePicker.open()">
|
||||||
|
<mat-label>{{ 'labels.inputs.Start Date' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[min]="startDateMin"
|
||||||
|
[max]="startDateMax"
|
||||||
|
[matDatepicker]="startDatePicker"
|
||||||
|
matTooltip="{{ 'tooltips.loan product will be active and available to clients' | translate }}"
|
||||||
|
formControlName="startDate"
|
||||||
|
/>
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #startDatePicker></mat-datepicker>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field" (click)="closeDatePicker.open()">
|
||||||
|
<mat-label>{{ 'labels.inputs.Close Date' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[min]="closeDateMin"
|
||||||
|
[max]="maxDate"
|
||||||
|
[matDatepicker]="closeDatePicker"
|
||||||
|
matTooltip="{{ 'tooltips.loan product will become inactive and unavailable to clients' | translate }}"
|
||||||
|
formControlName="closeDate"
|
||||||
|
/>
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="closeDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #closeDatePicker></mat-datepicker>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field lpd-field--full">
|
||||||
|
<mat-label>{{ 'labels.inputs.Description' | translate }}</mat-label>
|
||||||
|
<textarea
|
||||||
|
matInput
|
||||||
|
matTooltip="{{ 'tooltips.Provide additional information' | translate }}"
|
||||||
|
formControlName="description"
|
||||||
|
cdkTextareaAutosize
|
||||||
|
cdkAutosizeMinRows="2"
|
||||||
|
></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lpd-section">
|
||||||
|
<div class="lpd-section__header">
|
||||||
|
<i class="fas fa-flag"></i>
|
||||||
|
<h3>Regulatory Classification</h3>
|
||||||
|
</div>
|
||||||
|
<div class="lpd-grid">
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
|
<mat-label>Loan Product Category (RBI)</mat-label>
|
||||||
|
<mat-select formControlName="loanProductCategory">
|
||||||
|
@for (opt of loanProductCategoryOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
|
<mat-label>Priority Sector</mat-label>
|
||||||
|
<mat-select formControlName="prioritySector">
|
||||||
|
@for (opt of prioritySectorOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
|
<mat-label>CIBIL Account Type</mat-label>
|
||||||
|
<mat-select formControlName="cibilAccountType">
|
||||||
|
@for (opt of cibilAccountTypeOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
|
<mat-label>Key Fact Statement (KFS)</mat-label>
|
||||||
|
<mat-select formControlName="kfsEnabled">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lpd-field">
|
||||||
|
<mat-label>APR Calculation</mat-label>
|
||||||
|
<mat-select formControlName="aprEnabled">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+51
@@ -61,6 +61,57 @@ $gray-900: #202124;
|
|||||||
&--full {
|
&--full {
|
||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Starts a new row, so Start / Close Date sit together instead of one of them beside Short Name.
|
||||||
|
&--row-start {
|
||||||
|
grid-column-start: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Product Type — first section
|
||||||
|
.lpd-type-options {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px 24px 0;
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lpd-type-option {
|
||||||
|
border: 1px solid $border;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
|
||||||
|
&__label {
|
||||||
|
display: block;
|
||||||
|
font-weight: 600;
|
||||||
|
color: $gray-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__hint {
|
||||||
|
display: block;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #5f6368;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lpd-type-pending {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: 1px dashed $border;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #5f6368;
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: $accent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lpd-checkbox-row {
|
.lpd-checkbox-row {
|
||||||
|
|||||||
+153
-69
@@ -15,6 +15,7 @@ import { Dates } from 'app/core/utils/dates';
|
|||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||||
|
import { MatRadioButton, MatRadioGroup } from '@angular/material/radio';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -24,7 +25,9 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
imports: [
|
imports: [
|
||||||
...STANDALONE_SHARED_IMPORTS,
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
MatTooltip,
|
MatTooltip,
|
||||||
CdkTextareaAutosize
|
CdkTextareaAutosize,
|
||||||
|
MatRadioGroup,
|
||||||
|
MatRadioButton
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class LoanProductDetailsStepComponent implements OnInit {
|
export class LoanProductDetailsStepComponent implements OnInit {
|
||||||
@@ -39,6 +42,14 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
|||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
maxDate = new Date(new Date().setFullYear(new Date().getFullYear() + 10));
|
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 {FormBuilder} formBuilder Form Builder.
|
||||||
* @param {Dates} dateUtils Date Utils.
|
* @param {Dates} dateUtils Date Utils.
|
||||||
@@ -50,90 +61,158 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
// Product Type is not persisted by the backend yet, so an existing product comes back without one.
|
||||||
|
// Only a new product is made to pick it first; editing must not hide or block the rest of the form.
|
||||||
|
this.isExistingProduct = !!this.loanProductsTemplate?.id;
|
||||||
|
if (!this.isExistingProduct) {
|
||||||
|
this.loanProductDetailsForm.get('productTypeGroup').setValidators(Validators.required);
|
||||||
|
this.loanProductDetailsForm.get('productTypeSubGroup').setValidators(Validators.required);
|
||||||
|
this.loanProductDetailsForm.get('glAccount').setValidators(Validators.required);
|
||||||
|
// A new product's short name is exactly two capital letters. Saved products keep the old 4-character
|
||||||
|
// rule, so an existing short name such as 'PW16' does not stop the product from being edited.
|
||||||
|
this.loanProductDetailsForm.get('shortName').setValidators([
|
||||||
|
Validators.required,
|
||||||
|
Validators.pattern(/^[A-Z]{2}$/)
|
||||||
|
]);
|
||||||
|
this.loanProductDetailsForm.get('productTypeGroup').updateValueAndValidity({ emitEvent: false });
|
||||||
|
this.loanProductDetailsForm.get('productTypeSubGroup').updateValueAndValidity({ emitEvent: false });
|
||||||
|
this.loanProductDetailsForm.get('glAccount').updateValueAndValidity({ emitEvent: false });
|
||||||
|
this.loanProductDetailsForm.get('shortName').updateValueAndValidity({ emitEvent: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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({
|
this.loanProductDetailsForm.patchValue({
|
||||||
name: this.loanProductsTemplate.name,
|
name: this.loanProductsTemplate.name,
|
||||||
shortName: this.loanProductsTemplate.shortName,
|
shortName: this.loanProductsTemplate.shortName,
|
||||||
description: this.loanProductsTemplate.description,
|
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)
|
closeDate: this.loanProductsTemplate.closeDate && new Date(this.loanProductsTemplate.closeDate)
|
||||||
});
|
});
|
||||||
|
|
||||||
const mappingOptions = this.loanProductsTemplate?.accountingMappingOptions ?? {};
|
|
||||||
this.assetAccountOptions = mappingOptions.assetAccountOptions ?? [];
|
|
||||||
this.liabilityAccountOptions = mappingOptions.liabilityAccountOptions ?? [];
|
|
||||||
|
|
||||||
this.loanProductDetailsForm.patchValue({
|
|
||||||
debitIntCalculation: this.loanProductsTemplate.debitIntCalculation ?? false,
|
|
||||||
separatePenalInterest: this.loanProductsTemplate.separatePenalInterest ?? false,
|
|
||||||
creditIntCalculation: this.loanProductsTemplate.creditIntCalculation ?? false,
|
|
||||||
subAccountTypeBalance: this.loanProductsTemplate.subAccountTypeBalance ?? false,
|
|
||||||
finalIntRounding: this.loanProductsTemplate.finalIntRounding ?? false,
|
|
||||||
roundingUpTo: this.loanProductsTemplate.roundingUpTo ?? null
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Product Classification data */
|
/** True when editing a saved product; see ngOnInit. */
|
||||||
|
isExistingProduct = false;
|
||||||
|
|
||||||
|
/** Product Type -- picked first, since it decides which sections the rest of the wizard shows. */
|
||||||
readonly productTypeGroups = [
|
readonly productTypeGroups = [
|
||||||
{ id: 'loans', label: 'Loan' },
|
{ id: 'advances', label: 'Advances A/C', hint: 'No EMI. Limit / drawing power against security.' },
|
||||||
{ id: 'advanced', label: 'Advanced' }
|
{ id: 'loans', label: 'Loans A/C', hint: 'Fixed disbursement, fixed tenure, EMI repayment.' }
|
||||||
];
|
];
|
||||||
|
|
||||||
readonly productTypeSubGroups: Record<string, { id: string; label: string }[]> = {
|
/** `shortName` is the two-letter code the product's Short Name is pre-filled with when the sub type is picked. */
|
||||||
loans: [
|
readonly productTypeSubGroups: Record<string, { id: string; label: string; shortName: string }[]> = {
|
||||||
{ id: 'emi', label: 'EMI' },
|
advances: [
|
||||||
{ id: 'cc', label: 'CC (Cash Credit)' },
|
{ id: 'fd', label: 'Loan against FD', shortName: 'FD' },
|
||||||
{ id: 'overdraft', label: 'Overdraft' },
|
{ id: 'rd', label: 'Loan against RD', shortName: 'RD' },
|
||||||
{ id: 'warehouse', label: 'Warehouse' },
|
{ id: 'dds', label: 'Loan against DDS', shortName: 'DS' },
|
||||||
{ id: 'gold', label: 'Gold' }
|
{ id: 'lic', label: 'Loan against LIC Policy', shortName: 'LI' },
|
||||||
|
{ id: 'gold', label: 'Loan against Gold', shortName: 'GD' },
|
||||||
|
{ id: 'warehouse', label: 'Warehouse Receipt', shortName: 'WR' },
|
||||||
|
{ id: 'cc', label: 'Cash Credit (CC)', shortName: 'CC' },
|
||||||
|
{ id: 'overdraft', label: 'Overdraft (OD)', shortName: 'OD' },
|
||||||
|
{ id: 'kcc', label: 'Kisan Credit Card (KCC)', shortName: 'KC' },
|
||||||
|
{ id: 'bills', label: 'Bills Purchased / Discounted', shortName: 'BP' }
|
||||||
],
|
],
|
||||||
advanced: [
|
loans: [
|
||||||
{ id: 'fd', label: 'FD (Fixed Deposit)' },
|
{ id: 'term', label: 'Term Loan', shortName: 'TL' },
|
||||||
{ id: 'rd', label: 'RD (Recurring Deposit)' }
|
{ id: 'personal', label: 'Personal Loan', shortName: 'PL' },
|
||||||
|
{ id: 'housing', label: 'Housing Loan', shortName: 'HL' },
|
||||||
|
{ id: 'vehicle', label: 'Vehicle Loan', shortName: 'VL' },
|
||||||
|
{ id: 'education', label: 'Education Loan', shortName: 'EL' },
|
||||||
|
{ id: 'business', label: 'Business / MSME Loan', shortName: 'BL' },
|
||||||
|
{ id: 'gold_emi', label: 'Gold EMI Loan', shortName: 'GE' }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Default GL per product type group */
|
/** Regulatory Classification options (UI-only; RBI / bureau reporting). */
|
||||||
private readonly glDefaultMap: Record<string, string> = {
|
readonly loanProductCategoryOptions = [
|
||||||
loans: 'asset',
|
{ id: 'advances_deposits', label: 'Advances against deposits' },
|
||||||
advanced: 'asset'
|
{ id: 'gold_loan', label: 'Gold loan' },
|
||||||
};
|
{ id: 'agriculture', label: 'Agriculture' },
|
||||||
|
{ id: 'msme', label: 'MSME' },
|
||||||
|
{ id: 'personal', label: 'Personal / retail' },
|
||||||
|
{ id: 'housing', label: 'Housing' },
|
||||||
|
{ id: 'other', label: 'Other' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly prioritySectorOptions = [
|
||||||
|
{ id: 'yes', label: 'Yes' },
|
||||||
|
{ id: 'no', label: 'No' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly cibilAccountTypeOptions = [
|
||||||
|
{ id: 'loan_bank_deposits', label: 'Loan against Bank Deposits' },
|
||||||
|
{ id: 'gold_loan', label: 'Gold Loan' },
|
||||||
|
{ id: 'overdraft', label: 'Overdraft' },
|
||||||
|
{ id: 'business_loan', label: 'Business Loan' },
|
||||||
|
{ id: 'other', label: 'Other' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly yesNoOptions = [
|
||||||
|
'YES',
|
||||||
|
'NO'
|
||||||
|
];
|
||||||
|
|
||||||
|
/** The rest of the Details form stays hidden on a new product until its type and sub type are picked. */
|
||||||
|
get isProductTypeChosen(): boolean {
|
||||||
|
if (this.isExistingProduct) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const value = this.loanProductDetailsForm.value;
|
||||||
|
return !!value.productTypeGroup && !!value.productTypeSubGroup;
|
||||||
|
}
|
||||||
|
|
||||||
get availableSubGroups() {
|
get availableSubGroups() {
|
||||||
const group = this.loanProductDetailsForm.get('productTypeGroup')?.value;
|
const group = this.loanProductDetailsForm.get('productTypeGroup')?.value;
|
||||||
return group ? (this.productTypeSubGroups[group] ?? []) : [];
|
return group ? (this.productTypeSubGroups[group] ?? []) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
get glOptions(): string[] {
|
/**
|
||||||
return [
|
* Asset GLs offered for the product's ledger GL -- the GL the product's loan account numbers are
|
||||||
'asset',
|
* generated from. Separate from the Accounting tab mappings, which drive the journal entries.
|
||||||
'liability'
|
*/
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
assetAccountOptions: any[] = [];
|
assetAccountOptions: any[] = [];
|
||||||
liabilityAccountOptions: any[] = [];
|
|
||||||
|
|
||||||
get availableGlAccounts(): any[] {
|
|
||||||
const type = this.loanProductDetailsForm.get('glClassification')?.value;
|
|
||||||
if (type === 'asset') return this.assetAccountOptions;
|
|
||||||
if (type === 'liability') return this.liabilityAccountOptions;
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
get glClassificationLabel(): string {
|
|
||||||
const type = this.loanProductDetailsForm.get('glClassification')?.value;
|
|
||||||
return type === 'liability' ? 'Liability' : 'Asset';
|
|
||||||
}
|
|
||||||
|
|
||||||
get selectedGroupLabel(): string {
|
get selectedGroupLabel(): string {
|
||||||
const group = this.loanProductDetailsForm.get('productTypeGroup')?.value;
|
const group = this.loanProductDetailsForm.get('productTypeGroup')?.value;
|
||||||
return this.productTypeGroups.find((g) => g.id === group)?.label ?? '';
|
return this.productTypeGroups.find((g) => g.id === group)?.label ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly yesNoOptions = [
|
/**
|
||||||
{ value: true, label: 'YES' },
|
* A new product's short name is two capital letters, so what is typed or pasted is upper-cased, anything
|
||||||
{ value: false, label: 'NO' }
|
* that is not a letter is dropped, and only the first two letters are kept. Trimming here rather than with
|
||||||
];
|
* maxlength means a paste like 'g1old' still yields 'GO' instead of being cut to 'g1' first.
|
||||||
|
*/
|
||||||
|
normalizeShortName(event: Event) {
|
||||||
|
if (this.isExistingProduct) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Read from the input itself: this handler can run before the form control has taken the new value.
|
||||||
|
const typed = (event.target as HTMLInputElement).value ?? '';
|
||||||
|
const cleaned = typed
|
||||||
|
.toUpperCase()
|
||||||
|
.replace(/[^A-Z]/g, '')
|
||||||
|
.slice(0, 2);
|
||||||
|
if (cleaned !== typed) {
|
||||||
|
this.loanProductDetailsForm.get('shortName').setValue(cleaned);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
createLoanProductDetailsForm() {
|
createLoanProductDetailsForm() {
|
||||||
this.loanProductDetailsForm = this.formBuilder.group({
|
this.loanProductDetailsForm = this.formBuilder.group({
|
||||||
@@ -150,21 +229,26 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
|||||||
closeDate: [''],
|
closeDate: [''],
|
||||||
productTypeGroup: [''],
|
productTypeGroup: [''],
|
||||||
productTypeSubGroup: [''],
|
productTypeSubGroup: [''],
|
||||||
glClassification: ['asset'],
|
|
||||||
glAccount: [''],
|
glAccount: [''],
|
||||||
debitIntCalculation: [false],
|
// Regulatory Classification (UI-only; stripped in buildPayload)
|
||||||
separatePenalInterest: [false],
|
loanProductCategory: ['advances_deposits'],
|
||||||
creditIntCalculation: [false],
|
prioritySector: ['no'],
|
||||||
subAccountTypeBalance: [false],
|
cibilAccountType: ['loan_bank_deposits'],
|
||||||
finalIntRounding: [false],
|
kfsEnabled: ['YES'],
|
||||||
roundingUpTo: [null]
|
aprEnabled: ['YES']
|
||||||
});
|
});
|
||||||
|
|
||||||
// Auto-set GL based on product type group
|
// A sub type belongs to one group, so changing the group clears it.
|
||||||
this.loanProductDetailsForm.get('productTypeGroup')?.valueChanges.subscribe((group: string) => {
|
this.loanProductDetailsForm.get('productTypeGroup')?.valueChanges.subscribe(() => {
|
||||||
const defaultVal = this.glDefaultMap[group] ?? 'asset';
|
this.loanProductDetailsForm.get('productTypeSubGroup')?.setValue('');
|
||||||
this.loanProductDetailsForm.get('glClassification')?.setValue(defaultVal);
|
});
|
||||||
this.loanProductDetailsForm.get('glAccount')?.setValue('');
|
|
||||||
|
// Picking a sub type pre-fills the Short Name with its code; the user can still change it.
|
||||||
|
this.loanProductDetailsForm.get('productTypeSubGroup')?.valueChanges.subscribe((subGroupId: string) => {
|
||||||
|
const subGroup = this.availableSubGroups.find((s) => s.id === subGroupId);
|
||||||
|
if (subGroup) {
|
||||||
|
this.loanProductDetailsForm.get('shortName').setValue(subGroup.shortName);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<form [formGroup]="loanProductPenalNpaForm">
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-percent"></i>
|
||||||
|
<h3>Penal Charges</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Penal Charges Applicable</mat-label>
|
||||||
|
<mat-select formControlName="penalApplicable">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Penal Rate (% p.a.)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="penalRate" min="0" max="100" step="0.01" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Applied On</mat-label>
|
||||||
|
<mat-select formControlName="penalAppliedOn">
|
||||||
|
@for (opt of appliedOnOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Penal Grace Days</mat-label>
|
||||||
|
<input matInput type="number" formControlName="penalGraceDays" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
<div class="adv-field adv-field--full" style="grid-column: span 2">
|
||||||
|
<div class="adv-info">
|
||||||
|
RBI: penal charges are kept separate from interest, never capitalised, and shown in the Key Fact Statement.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-triangle-exclamation"></i>
|
||||||
|
<h3>Asset Classification (SMA / NPA)</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Delinquency Bucket (SMA)</mat-label>
|
||||||
|
<mat-select formControlName="delinquencyBucketId">
|
||||||
|
<mat-option [value]="''">— None —</mat-option>
|
||||||
|
@for (bucket of delinquencyBucketOptions; track bucket.id) {
|
||||||
|
<mat-option [value]="bucket.id">{{ bucket.name }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
<mat-hint>SMA 0–30 / 31–60 / 61–90</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>NPA After (days overdue)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="npaDays" min="0" required />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>NPA Trigger</mat-label>
|
||||||
|
<mat-select formControlName="npaTrigger">
|
||||||
|
@for (opt of npaTriggerOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Interest after NPA</mat-label>
|
||||||
|
<mat-select formControlName="interestAfterNpa">
|
||||||
|
@for (opt of interestAfterNpaOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Grace on Arrears Ageing (days)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="graceOnArrearsAgeing" min="0" />
|
||||||
|
<mat-hint>Days before an amount counts as overdue</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>In-Arrears Tolerance (₹)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="inArrearsTolerance" min="0" />
|
||||||
|
<mat-hint>Small balance ignored for arrears</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div class="adv-subsection">
|
||||||
|
<div class="adv-checks">
|
||||||
|
<mat-checkbox formControlName="upgradeOnlyAllArrears">
|
||||||
|
Upgrade from NPA only when all arrears are cleared
|
||||||
|
</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="keepStandardIfDepositCovers">
|
||||||
|
Keep standard while the pledged deposit fully covers the dues
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
+90
@@ -0,0 +1,90 @@
|
|||||||
|
/**
|
||||||
|
* 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, Input, inject } from '@angular/core';
|
||||||
|
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { MatCheckbox } from '@angular/material/checkbox';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Penal charges & asset-classification (SMA / NPA) step for an Advances A/C product (Figma step 6).
|
||||||
|
* UI-only for now — not sent in the create payload.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-loan-product-penal-npa-step',
|
||||||
|
templateUrl: './loan-product-penal-npa-step.component.html',
|
||||||
|
styleUrls: ['../advance-steps.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatCheckbox
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class LoanProductPenalNpaStepComponent {
|
||||||
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
|
|
||||||
|
@Input() loanProductsTemplate: any;
|
||||||
|
|
||||||
|
loanProductPenalNpaForm: UntypedFormGroup;
|
||||||
|
|
||||||
|
readonly yesNoOptions = [
|
||||||
|
'YES',
|
||||||
|
'NO'
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly appliedOnOptions = [
|
||||||
|
{ id: 'overdue', label: 'Overdue amount' },
|
||||||
|
{ id: 'outstanding', label: 'Full outstanding' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly npaTriggerOptions = [
|
||||||
|
{ id: 'maturity', label: 'Dues overdue after maturity' },
|
||||||
|
{ id: 'out_of_order', label: 'Out of order 90 days (CC/OD)' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly interestAfterNpaOptions = [
|
||||||
|
{ id: 'undebited', label: 'Move to Undebited Interest GL' },
|
||||||
|
{ id: 'suspense', label: 'Move to Interest Suspense GL' }
|
||||||
|
];
|
||||||
|
|
||||||
|
get delinquencyBucketOptions(): any[] {
|
||||||
|
return this.loanProductsTemplate?.delinquencyBucketOptions ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.loanProductPenalNpaForm = this.formBuilder.group({
|
||||||
|
penalApplicable: ['YES'],
|
||||||
|
penalRate: [
|
||||||
|
2.0,
|
||||||
|
[
|
||||||
|
Validators.min(0),
|
||||||
|
Validators.max(100)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
penalAppliedOn: ['overdue'],
|
||||||
|
penalGraceDays: [0],
|
||||||
|
delinquencyBucketId: [''],
|
||||||
|
npaDays: [
|
||||||
|
90,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(0)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
npaTrigger: ['maturity'],
|
||||||
|
interestAfterNpa: ['undebited'],
|
||||||
|
graceOnArrearsAgeing: [0],
|
||||||
|
inArrearsTolerance: [0],
|
||||||
|
upgradeOnlyAllArrears: [true],
|
||||||
|
keepStandardIfDepositCovers: [true]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get loanProductPenalNpa() {
|
||||||
|
return this.loanProductPenalNpaForm.getRawValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<form [formGroup]="loanProductRenewalClosureForm">
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-arrows-rotate"></i>
|
||||||
|
<h3>Limit Renewal</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Renewal Allowed</mat-label>
|
||||||
|
<mat-select formControlName="renewalAllowed">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Renewal Period (months)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="renewalPeriodMonths" min="1" required />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Renewal Grace Days</mat-label>
|
||||||
|
<input matInput type="number" formControlName="renewalGraceDays" min="0" />
|
||||||
|
<mat-hint>Days allowed after the renewal date</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-section">
|
||||||
|
<div class="adv-section__header">
|
||||||
|
<i class="fas fa-door-open"></i>
|
||||||
|
<h3>Pre-closure</h3>
|
||||||
|
</div>
|
||||||
|
<div class="adv-grid adv-grid--3">
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Pre-closure Allowed</mat-label>
|
||||||
|
<mat-select formControlName="preclosureAllowed">
|
||||||
|
@for (opt of preclosureOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Lock-in Period (months)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="lockInMonths" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field appearance="outline" class="adv-field">
|
||||||
|
<mat-label>Interest on Pre-closure</mat-label>
|
||||||
|
<mat-select formControlName="interestOnPreclosure">
|
||||||
|
@for (opt of preclosureInterestOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="adv-note">
|
||||||
|
<i class="fas fa-circle-info"></i>
|
||||||
|
<span>Renewal and pre-closure <strong>fees</strong> are set once, on the Charges step.</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
/**
|
||||||
|
* 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 } from '@angular/core';
|
||||||
|
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limit renewal & pre-closure rules for an Advances A/C product (Figma step 7). Fees live on the
|
||||||
|
* Charges step. UI-only for now — not sent in the create payload.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-loan-product-renewal-closure-step',
|
||||||
|
templateUrl: './loan-product-renewal-closure-step.component.html',
|
||||||
|
styleUrls: ['../advance-steps.scss'],
|
||||||
|
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||||
|
})
|
||||||
|
export class LoanProductRenewalClosureStepComponent {
|
||||||
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
|
|
||||||
|
loanProductRenewalClosureForm: UntypedFormGroup;
|
||||||
|
|
||||||
|
readonly yesNoOptions = [
|
||||||
|
'YES',
|
||||||
|
'NO'
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly preclosureOptions = [
|
||||||
|
{ id: 'anytime', label: 'Anytime' },
|
||||||
|
{ id: 'after_lockin', label: 'After lock-in period' },
|
||||||
|
{ id: 'not_allowed', label: 'Not allowed' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly preclosureInterestOptions = [
|
||||||
|
{ id: 'till_closing', label: 'Till closing date (broken period)' },
|
||||||
|
{ id: 'full_period', label: 'Full current period' }
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.loanProductRenewalClosureForm = this.formBuilder.group({
|
||||||
|
renewalAllowed: ['YES'],
|
||||||
|
renewalPeriodMonths: [
|
||||||
|
12,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(1)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
renewalGraceDays: [30],
|
||||||
|
preclosureAllowed: ['anytime'],
|
||||||
|
lockInMonths: [0],
|
||||||
|
interestOnPreclosure: ['till_closing']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get loanProductRenewalClosure() {
|
||||||
|
return this.loanProductRenewalClosureForm.getRawValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
+160
@@ -0,0 +1,160 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<form [formGroup]="loanProductSecurityLienForm">
|
||||||
|
@if (!isAdvance) {
|
||||||
|
<div class="lsl-note">
|
||||||
|
<i class="fas fa-circle-info"></i>
|
||||||
|
Security & Lien applies to an <strong>Advances A/C</strong> product. Choose it on the Details step.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (isAdvance) {
|
||||||
|
<div class="lsl-section">
|
||||||
|
<div class="lsl-section__header">
|
||||||
|
<i class="fas fa-shield-alt"></i>
|
||||||
|
<h3>Security & Margin</h3>
|
||||||
|
</div>
|
||||||
|
<div class="lsl-grid">
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Security Type</mat-label>
|
||||||
|
<input matInput formControlName="securityType" matTooltip="Set from the Product Sub Type" />
|
||||||
|
<mat-hint>From Sub Type — not chosen again</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Eligible Amount Basis</mat-label>
|
||||||
|
<mat-select formControlName="eligibleAmountBasis" required>
|
||||||
|
@for (opt of eligibleAmountBasisOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
<mat-error>Eligible Amount Basis is <strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Margin (%)</mat-label>
|
||||||
|
<input matInput type="number" formControlName="margin" min="0" max="100" step="0.01" required />
|
||||||
|
<mat-hint>0 – 100. Drawing Power = security value × LTV</mat-hint>
|
||||||
|
@if (loanProductSecurityLienForm.get('margin').hasError('required')) {
|
||||||
|
<mat-error>Margin is <strong>required</strong></mat-error>
|
||||||
|
} @else {
|
||||||
|
<mat-error>Margin must be between 0 and 100</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>LTV (%)</mat-label>
|
||||||
|
<input matInput [value]="ltv" disabled />
|
||||||
|
<mat-hint>= 100 − Margin</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (isLienSubType) {
|
||||||
|
<div class="lsl-section">
|
||||||
|
<div class="lsl-section__header">
|
||||||
|
<i class="fas fa-lock"></i>
|
||||||
|
<h3>Lien Settings</h3>
|
||||||
|
<span class="lsl-section__hint">FD · RD · DDS · LIC</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lsl-subsection">
|
||||||
|
<p class="lsl-group">Lien marking</p>
|
||||||
|
<div class="lsl-grid">
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Lien Required</mat-label>
|
||||||
|
<input matInput value="YES (mandatory)" disabled />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Lien Marking Stage</mat-label>
|
||||||
|
<mat-select formControlName="lienMarkingStage" required>
|
||||||
|
@for (opt of lienMarkingStageOptions; track opt.id) {
|
||||||
|
<mat-option [value]="opt.id">{{ opt.label }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field lsl-field--full">
|
||||||
|
<mat-label>Eligible Deposit Products</mat-label>
|
||||||
|
<mat-select formControlName="eligibleDepositProducts" multiple required>
|
||||||
|
@for (product of depositProductOptions; track product) {
|
||||||
|
<mat-option [value]="product">{{ product }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
<mat-hint>Only accounts of these deposit products can be pledged for this advance</mat-hint>
|
||||||
|
<mat-error>Pick at least one deposit product</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lsl-subsection">
|
||||||
|
<p class="lsl-group">Rules</p>
|
||||||
|
<div class="lsl-checks">
|
||||||
|
<mat-checkbox formControlName="tenureNotExceedMaturity">
|
||||||
|
Tenure cannot exceed deposit maturity date
|
||||||
|
</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="autoReleaseOnClosure">
|
||||||
|
Auto-release lien when the advance is closed
|
||||||
|
</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="allowMultipleDeposits">
|
||||||
|
Allow multiple deposits for one advance
|
||||||
|
</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="adjustFromMaturity">
|
||||||
|
Adjust advance from deposit proceeds at maturity
|
||||||
|
</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="allowThirdPartyDeposit">
|
||||||
|
Allow third-party deposit (consent letter required)
|
||||||
|
</mat-checkbox>
|
||||||
|
<mat-checkbox formControlName="allowRenewalUnderLien">
|
||||||
|
Allow deposit renewal under lien (lien carries forward)
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lsl-subsection">
|
||||||
|
<p class="lsl-group">Lien certificate</p>
|
||||||
|
<div class="lsl-grid">
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Lien Certificate Required</mat-label>
|
||||||
|
<mat-select formControlName="lienCertificateRequired">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
@if (loanProductSecurityLienForm.get('lienCertificateRequired').value === 'YES') {
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Certificate No. Prefix</mat-label>
|
||||||
|
<input matInput formControlName="lienCertificatePrefix" required />
|
||||||
|
<mat-error>Prefix is <strong>required</strong></mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="lsl-field">
|
||||||
|
<mat-label>Print on Disbursement</mat-label>
|
||||||
|
<mat-select formControlName="printOnDisbursement">
|
||||||
|
@for (opt of yesNoOptions; track opt) {
|
||||||
|
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lsl-note">
|
||||||
|
<i class="fas fa-circle-info"></i>
|
||||||
|
Interest basis and spread are set on the <strong>Interest</strong> step; the lien-certificate fee on the
|
||||||
|
<strong>Charges</strong> step.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</form>
|
||||||
+117
@@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$accent: #0ea5e9;
|
||||||
|
$border: #e2e8f0;
|
||||||
|
$gray-50: #f8f9fa;
|
||||||
|
$gray-200: #e8eaed;
|
||||||
|
$gray-900: #202124;
|
||||||
|
|
||||||
|
.lsl-section {
|
||||||
|
border: 1px solid $border;
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
& + & {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 12px 24px;
|
||||||
|
background: $gray-50;
|
||||||
|
border-bottom: 1px solid $gray-200;
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 14px;
|
||||||
|
color: $accent;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: $gray-900;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__hint {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #5f6368;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lsl-subsection {
|
||||||
|
padding: 16px 24px;
|
||||||
|
|
||||||
|
& + & {
|
||||||
|
border-top: 1px solid $border;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lsl-group {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #5f6368;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lsl-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 4px 16px;
|
||||||
|
padding: 16px 24px;
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lsl-subsection .lsl-grid {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lsl-field {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&--full {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lsl-checks {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 12px 32px;
|
||||||
|
|
||||||
|
@media (width <= 600px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lsl-note {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: 1px dashed $border;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #5f6368;
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: $accent;
|
||||||
|
}
|
||||||
|
}
|
||||||
+196
@@ -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, OnInit, Input, inject } from '@angular/core';
|
||||||
|
import { AbstractControl, UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
|
import { MatCheckbox } from '@angular/material/checkbox';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Security & Lien step, shown only for an "Advances A/C" product.
|
||||||
|
*
|
||||||
|
* For a deposit-backed advance (Loan against FD / RD / DDS / LIC) the bank marks a lien on the
|
||||||
|
* customer's own deposit. This step captures the product-level rules for that: the margin (from which
|
||||||
|
* the LTV and drawing power follow), which deposit products may be pledged, and the lien certificate.
|
||||||
|
*
|
||||||
|
* UI-only for now: its values are NOT sent in the create payload, because the backend has no column to
|
||||||
|
* store them yet. Once the satellite table lands, wire `loanProductSecurityLien` into the payload.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-loan-product-security-lien-step',
|
||||||
|
templateUrl: './loan-product-security-lien-step.component.html',
|
||||||
|
styleUrls: ['./loan-product-security-lien-step.component.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatTooltip,
|
||||||
|
MatCheckbox
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class LoanProductSecurityLienStepComponent implements OnInit {
|
||||||
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
|
|
||||||
|
@Input() loanProductsTemplate: any;
|
||||||
|
/** The Details step's Product Type controls, so this step reacts to the chosen group / sub type. */
|
||||||
|
@Input() productTypeGroup: AbstractControl;
|
||||||
|
@Input() productTypeSubGroup: AbstractControl;
|
||||||
|
|
||||||
|
loanProductSecurityLienForm: UntypedFormGroup;
|
||||||
|
|
||||||
|
/** Sub type -> the security it is backed by. Only deposit / policy sub types get a lien section. */
|
||||||
|
private readonly securityTypeBySubGroup: Record<string, string> = {
|
||||||
|
fd: 'Fixed Deposit',
|
||||||
|
rd: 'Recurring Deposit',
|
||||||
|
dds: 'Daily Deposit Scheme',
|
||||||
|
lic: 'LIC Policy',
|
||||||
|
gold: 'Gold Ornaments',
|
||||||
|
warehouse: 'Warehouse Receipt',
|
||||||
|
cc: 'Stock / Book Debts',
|
||||||
|
overdraft: 'Deposit / Property'
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Sub types whose security is lien-marked on a deposit (rather than pledged / hypothecated). */
|
||||||
|
private readonly lienSubGroups = [
|
||||||
|
'fd',
|
||||||
|
'rd',
|
||||||
|
'dds',
|
||||||
|
'lic'
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Default margin % per sub type (bank policy in real use); LTV is derived from it. */
|
||||||
|
private readonly defaultMarginBySubGroup: Record<string, number> = {
|
||||||
|
fd: 10,
|
||||||
|
rd: 10,
|
||||||
|
dds: 10,
|
||||||
|
lic: 40
|
||||||
|
};
|
||||||
|
|
||||||
|
readonly eligibleAmountBasisOptions = [
|
||||||
|
{ id: 'balance_accrued', label: 'Deposit balance + accrued interest' },
|
||||||
|
{ id: 'balance', label: 'Deposit balance only' },
|
||||||
|
{ id: 'surrender', label: 'Surrender value (LIC)' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly lienMarkingStageOptions = [
|
||||||
|
{ id: 'disbursement', label: 'At Disbursement' },
|
||||||
|
{ id: 'sanction', label: 'At Sanction' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly depositProductOptions = [
|
||||||
|
'Fixed Deposit – Regular',
|
||||||
|
'Fixed Deposit – Senior Citizen',
|
||||||
|
'Recurring Deposit – Regular',
|
||||||
|
'Daily Deposit Scheme'
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly yesNoOptions = [
|
||||||
|
'YES',
|
||||||
|
'NO'
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.createForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.applySubGroup(this.productTypeSubGroup?.value);
|
||||||
|
// Keep Security Type and the default margin in step with the sub type chosen on the Details step.
|
||||||
|
this.productTypeSubGroup?.valueChanges.subscribe((subGroup: string) => this.applySubGroup(subGroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
private applySubGroup(subGroup: string): void {
|
||||||
|
this.loanProductSecurityLienForm
|
||||||
|
.get('securityType')
|
||||||
|
.setValue(this.securityTypeBySubGroup[subGroup] ?? '', { emitEvent: false });
|
||||||
|
const margin = this.defaultMarginBySubGroup[subGroup];
|
||||||
|
if (margin != null && !this.loanProductSecurityLienForm.get('margin').dirty) {
|
||||||
|
this.loanProductSecurityLienForm.get('margin').setValue(margin, { emitEvent: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This whole step is only relevant to an Advances A/C product. */
|
||||||
|
get isAdvance(): boolean {
|
||||||
|
return this.productTypeGroup?.value === 'advances';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The lien block shows only for deposit / policy sub types; gold, warehouse, CC etc. are pledged. */
|
||||||
|
get isLienSubType(): boolean {
|
||||||
|
return this.lienSubGroups.includes(this.productTypeSubGroup?.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** LTV = 100 − margin, shown read-only next to the margin. */
|
||||||
|
get ltv(): number | null {
|
||||||
|
const margin = this.loanProductSecurityLienForm.get('margin').value;
|
||||||
|
if (margin === null || margin === '' || isNaN(margin)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return 100 - Number(margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
createForm() {
|
||||||
|
this.loanProductSecurityLienForm = this.formBuilder.group({
|
||||||
|
securityType: [{ value: '', disabled: true }],
|
||||||
|
eligibleAmountBasis: [
|
||||||
|
'balance_accrued',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
margin: [
|
||||||
|
10,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(0),
|
||||||
|
Validators.max(100)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
lienMarkingStage: [
|
||||||
|
'disbursement',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
eligibleDepositProducts: [
|
||||||
|
['Fixed Deposit – Regular'],
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
tenureNotExceedMaturity: [true],
|
||||||
|
autoReleaseOnClosure: [true],
|
||||||
|
allowMultipleDeposits: [false],
|
||||||
|
adjustFromMaturity: [true],
|
||||||
|
allowThirdPartyDeposit: [false],
|
||||||
|
allowRenewalUnderLien: [true],
|
||||||
|
lienCertificateRequired: ['YES'],
|
||||||
|
lienCertificatePrefix: [
|
||||||
|
'LC/FD/',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
printOnDisbursement: ['YES']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Flat values for the payload. Not wired into submit yet — see the class comment. */
|
||||||
|
get loanProductSecurityLien() {
|
||||||
|
const value = this.loanProductSecurityLienForm.getRawValue();
|
||||||
|
return {
|
||||||
|
securityType: value.securityType,
|
||||||
|
eligibleAmountBasis: value.eligibleAmountBasis,
|
||||||
|
margin: value.margin,
|
||||||
|
ltv: this.ltv,
|
||||||
|
lienMarkingStage: value.lienMarkingStage,
|
||||||
|
eligibleDepositProducts: value.eligibleDepositProducts,
|
||||||
|
lienRules: {
|
||||||
|
tenureNotExceedMaturity: value.tenureNotExceedMaturity,
|
||||||
|
autoReleaseOnClosure: value.autoReleaseOnClosure,
|
||||||
|
allowMultipleDeposits: value.allowMultipleDeposits,
|
||||||
|
adjustFromMaturity: value.adjustFromMaturity,
|
||||||
|
allowThirdPartyDeposit: value.allowThirdPartyDeposit,
|
||||||
|
allowRenewalUnderLien: value.allowRenewalUnderLien
|
||||||
|
},
|
||||||
|
lienCertificateRequired: value.lienCertificateRequired,
|
||||||
|
lienCertificatePrefix: value.lienCertificatePrefix,
|
||||||
|
printOnDisbursement: value.printOnDisbursement
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+1285
-1240
File diff suppressed because it is too large
Load Diff
+10
@@ -71,6 +71,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lps-panel {
|
||||||
|
& + & {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lps-section__body {
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.lps-full-width {
|
.lps-full-width {
|
||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
}
|
}
|
||||||
|
|||||||
+78
-8
@@ -22,6 +22,12 @@ import { MatTooltip } from '@angular/material/tooltip';
|
|||||||
import { MatCheckbox } from '@angular/material/checkbox';
|
import { MatCheckbox } from '@angular/material/checkbox';
|
||||||
import { MatIconButton } from '@angular/material/button';
|
import { MatIconButton } from '@angular/material/button';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
import {
|
||||||
|
MatAccordion,
|
||||||
|
MatExpansionPanel,
|
||||||
|
MatExpansionPanelHeader,
|
||||||
|
MatExpansionPanelTitle
|
||||||
|
} from '@angular/material/expansion';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -35,7 +41,11 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
MatCheckbox,
|
MatCheckbox,
|
||||||
MatIconButton,
|
MatIconButton,
|
||||||
FaIconComponent,
|
FaIconComponent,
|
||||||
ReactiveFormsModule
|
ReactiveFormsModule,
|
||||||
|
MatAccordion,
|
||||||
|
MatExpansionPanel,
|
||||||
|
MatExpansionPanelHeader,
|
||||||
|
MatExpansionPanelTitle
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class LoanProductSettingsStepComponent implements OnInit {
|
export class LoanProductSettingsStepComponent implements OnInit {
|
||||||
@@ -44,9 +54,35 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
|||||||
|
|
||||||
@Input() toEdit: boolean;
|
@Input() toEdit: boolean;
|
||||||
@Input() loanProductsTemplate: any;
|
@Input() loanProductsTemplate: any;
|
||||||
@Input() isLinkedToFloatingInterestRates: UntypedFormControl;
|
@Input() productTypeGroup: UntypedFormControl;
|
||||||
@Output() advancePaymentStrategy = new EventEmitter<string>();
|
@Output() advancePaymentStrategy = new EventEmitter<string>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provided from the Terms step's control. It can arrive after this component's ngOnInit (the Terms tab
|
||||||
|
* resolves later now that the tabs are conditional), so subscribe from the setter when it is present
|
||||||
|
* rather than assuming it in ngOnInit — otherwise a null control blanks the whole wizard.
|
||||||
|
*/
|
||||||
|
private _isLinkedToFloatingInterestRates: UntypedFormControl;
|
||||||
|
private isLinkedSubscribed = false;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
set isLinkedToFloatingInterestRates(control: UntypedFormControl) {
|
||||||
|
this._isLinkedToFloatingInterestRates = control;
|
||||||
|
if (control && !this.isLinkedSubscribed) {
|
||||||
|
this.isLinkedSubscribed = true;
|
||||||
|
control.valueChanges.subscribe((isLinked: any) => {
|
||||||
|
if (isLinked) {
|
||||||
|
this.loanProductSettingsForm.get('isInterestRecalculationEnabled').setValue(true);
|
||||||
|
this.loanProductSettingsForm.get('allowPartialPeriodInterestCalculation').setValue(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get isLinkedToFloatingInterestRates(): UntypedFormControl {
|
||||||
|
return this._isLinkedToFloatingInterestRates;
|
||||||
|
}
|
||||||
|
|
||||||
loanProductSettingsForm: UntypedFormGroup;
|
loanProductSettingsForm: UntypedFormGroup;
|
||||||
|
|
||||||
amortizationTypeData: any;
|
amortizationTypeData: any;
|
||||||
@@ -74,6 +110,15 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
|||||||
daysInYearCustomStrategyOptions: OptionData[] = [];
|
daysInYearCustomStrategyOptions: OptionData[] = [];
|
||||||
useDaysInYearCustomStrategy = false;
|
useDaysInYearCustomStrategy = false;
|
||||||
|
|
||||||
|
/** True when the product being created is an "Advances A/C" (no-EMI, limit-based) product. */
|
||||||
|
isAdvanceAccount = false;
|
||||||
|
|
||||||
|
/** UI-only for now; not yet wired into the submitted payload (see loan-products.ts buildPayload). */
|
||||||
|
readonly loanPeriodOptions = [
|
||||||
|
{ value: 12, label: '12 Months' },
|
||||||
|
{ value: 15, label: '15 Months' }
|
||||||
|
];
|
||||||
|
|
||||||
/** Values to Days for Repayments */
|
/** Values to Days for Repayments */
|
||||||
defaultConfigValues: GlobalConfiguration[] = [];
|
defaultConfigValues: GlobalConfiguration[] = [];
|
||||||
|
|
||||||
@@ -84,12 +129,13 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.defaultConfigValues = this.loanProductsTemplate['itemsByDefault'];
|
this.defaultConfigValues = this.loanProductsTemplate['itemsByDefault'];
|
||||||
this.isLinkedToFloatingInterestRates.valueChanges.subscribe((isLinkedToFloatingInterestRates: any) => {
|
|
||||||
if (isLinkedToFloatingInterestRates) {
|
if (this.productTypeGroup) {
|
||||||
this.loanProductSettingsForm.get('isInterestRecalculationEnabled').setValue(true);
|
this.applyAdvanceAccountRules(this.productTypeGroup.value === 'advances');
|
||||||
this.loanProductSettingsForm.get('allowPartialPeriodInterestCalculation').setValue(true);
|
this.productTypeGroup.valueChanges.subscribe((productTypeGroup: string) => {
|
||||||
}
|
this.applyAdvanceAccountRules(productTypeGroup === 'advances');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.amortizationTypeData = this.loanProductsTemplate.amortizationTypeOptions;
|
this.amortizationTypeData = this.loanProductsTemplate.amortizationTypeOptions;
|
||||||
this.interestTypeData = this.loanProductsTemplate.interestTypeOptions;
|
this.interestTypeData = this.loanProductsTemplate.interestTypeOptions;
|
||||||
@@ -334,6 +380,8 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
|||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
allowAccrualPostingInArrears: [false],
|
allowAccrualPostingInArrears: [false],
|
||||||
|
// Advances A/C only; UI-only for now, stripped from the payload in loan-products.ts buildPayload().
|
||||||
|
loanPeriod: [''],
|
||||||
|
|
||||||
// Cheque Book Settings
|
// Cheque Book Settings
|
||||||
chequeBookIssueEnabled: ['NO'],
|
chequeBookIssueEnabled: ['NO'],
|
||||||
@@ -453,6 +501,28 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Advances A/C has no EMI, so the Loan Schedule section is simplified: schedule type is locked to
|
||||||
|
* Cumulative (Progressive only makes sense with Advanced Payment Allocation, which is an EMI concept),
|
||||||
|
* installment-amount fixing doesn't apply, and Days in year/month are replaced by a placeholder
|
||||||
|
* Loan Period pick. loanScheduleType/canDefineInstallmentAmount stay enabled (not `.disable()`d) so they
|
||||||
|
* remain in `loanProductSettingsForm.value` and the submitted payload is unaffected by this UI change.
|
||||||
|
*/
|
||||||
|
private applyAdvanceAccountRules(isAdvance: boolean): void {
|
||||||
|
this.isAdvanceAccount = isAdvance;
|
||||||
|
const loanPeriodControl = this.loanProductSettingsForm.get('loanPeriod');
|
||||||
|
if (isAdvance) {
|
||||||
|
this.loanProductSettingsForm.patchValue({
|
||||||
|
loanScheduleType: LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE,
|
||||||
|
canDefineInstallmentAmount: false
|
||||||
|
});
|
||||||
|
loanPeriodControl.setValidators(Validators.required);
|
||||||
|
} else {
|
||||||
|
loanPeriodControl.clearValidators();
|
||||||
|
}
|
||||||
|
loanPeriodControl.updateValueAndValidity();
|
||||||
|
}
|
||||||
|
|
||||||
setConditionalControls() {
|
setConditionalControls() {
|
||||||
const allowAttributeOverrides = this.loanProductSettingsForm.get('allowAttributeOverrides');
|
const allowAttributeOverrides = this.loanProductSettingsForm.get('allowAttributeOverrides');
|
||||||
|
|
||||||
|
|||||||
+56
@@ -264,6 +264,62 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Interest Information (moved here from the Details tab, next to the interest rates it qualifies) -->
|
||||||
|
<div class="lpt-section">
|
||||||
|
<div class="lpt-section-header">
|
||||||
|
<i class="fas fa-percentage lpt-section-icon"></i>
|
||||||
|
<h3>Interest Information</h3>
|
||||||
|
</div>
|
||||||
|
<div class="lpt-grid">
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Debit Int. Calculation</mat-label>
|
||||||
|
<mat-select formControlName="debitIntCalculation">
|
||||||
|
<mat-option [value]="true">YES</mat-option>
|
||||||
|
<mat-option [value]="false">NO</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Separate Penal Int.</mat-label>
|
||||||
|
<mat-select formControlName="separatePenalInterest">
|
||||||
|
<mat-option [value]="true">YES</mat-option>
|
||||||
|
<mat-option [value]="false">NO</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Credit Int. Calculation</mat-label>
|
||||||
|
<mat-select formControlName="creditIntCalculation">
|
||||||
|
<mat-option [value]="true">YES</mat-option>
|
||||||
|
<mat-option [value]="false">NO</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Sub A/c Type Balance</mat-label>
|
||||||
|
<mat-select formControlName="subAccountTypeBalance">
|
||||||
|
<mat-option [value]="true">YES</mat-option>
|
||||||
|
<mat-option [value]="false">NO</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Final Int. Rounding</mat-label>
|
||||||
|
<mat-select formControlName="finalIntRounding">
|
||||||
|
<mat-option [value]="true">YES</mat-option>
|
||||||
|
<mat-option [value]="false">NO</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
@if (loanProductTermsForm.value.finalIntRounding) {
|
||||||
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Rounding UpTo</mat-label>
|
||||||
|
<input matInput type="number" formControlName="roundingUpTo" min="0" />
|
||||||
|
</mat-form-field>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Interest Rate Slabs Section -->
|
<!-- Interest Rate Slabs Section -->
|
||||||
<div class="lpt-section">
|
<div class="lpt-section">
|
||||||
<div class="lpt-section-header">
|
<div class="lpt-section-header">
|
||||||
|
|||||||
+15
-2
@@ -111,7 +111,13 @@ export class LoanProductTermsStepComponent implements OnInit, OnChanges {
|
|||||||
repaymentStartDateType: this.loanProductsTemplate.repaymentStartDateType.id || 1,
|
repaymentStartDateType: this.loanProductsTemplate.repaymentStartDateType.id || 1,
|
||||||
debitBalanceAllow: this.loanProductsTemplate.debitBalanceAllow ?? false,
|
debitBalanceAllow: this.loanProductsTemplate.debitBalanceAllow ?? false,
|
||||||
allowDebitTransAfterDueDate: this.loanProductsTemplate.allowDebitTransAfterDueDate ?? false,
|
allowDebitTransAfterDueDate: this.loanProductsTemplate.allowDebitTransAfterDueDate ?? false,
|
||||||
branchLevelAccountType: this.loanProductsTemplate.branchLevelAccountType ?? false
|
branchLevelAccountType: this.loanProductsTemplate.branchLevelAccountType ?? false,
|
||||||
|
debitIntCalculation: this.loanProductsTemplate.debitIntCalculation ?? false,
|
||||||
|
separatePenalInterest: this.loanProductsTemplate.separatePenalInterest ?? false,
|
||||||
|
creditIntCalculation: this.loanProductsTemplate.creditIntCalculation ?? false,
|
||||||
|
subAccountTypeBalance: this.loanProductsTemplate.subAccountTypeBalance ?? false,
|
||||||
|
finalIntRounding: this.loanProductsTemplate.finalIntRounding ?? false,
|
||||||
|
roundingUpTo: this.loanProductsTemplate.roundingUpTo ?? null
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.loanProductsTemplate.allowApprovedDisbursedAmountsOverApplied) {
|
if (this.loanProductsTemplate.allowApprovedDisbursedAmountsOverApplied) {
|
||||||
@@ -213,7 +219,14 @@ export class LoanProductTermsStepComponent implements OnInit, OnChanges {
|
|||||||
fixedLength: [null],
|
fixedLength: [null],
|
||||||
debitBalanceAllow: [false],
|
debitBalanceAllow: [false],
|
||||||
allowDebitTransAfterDueDate: [false],
|
allowDebitTransAfterDueDate: [false],
|
||||||
branchLevelAccountType: [false]
|
branchLevelAccountType: [false],
|
||||||
|
// Interest Information (moved here from the Details tab)
|
||||||
|
debitIntCalculation: [false],
|
||||||
|
separatePenalInterest: [false],
|
||||||
|
creditIntCalculation: [false],
|
||||||
|
subAccountTypeBalance: [false],
|
||||||
|
finalIntRounding: [false],
|
||||||
|
roundingUpTo: [null]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,9 +45,29 @@ export class LoanProducts {
|
|||||||
dateFormat,
|
dateFormat,
|
||||||
locale
|
locale
|
||||||
};
|
};
|
||||||
// Remove unnecessary properties
|
// Remove UI-only flags that are never valid loan-product parameters (both paths).
|
||||||
delete loanProduct.allowAttributeConfiguration;
|
delete loanProduct.allowAttributeConfiguration;
|
||||||
delete loanProduct.advancedAccountingRules;
|
delete loanProduct.advancedAccountingRules;
|
||||||
|
delete loanProduct.loanPeriod;
|
||||||
|
|
||||||
|
// The Advances payload is assembled explicitly in the create component and already carries only
|
||||||
|
// whitelisted params (core Fineract fields + satellite ADVANCE_PARAMETERS), so it is NOT stripped.
|
||||||
|
// For the Loans path, the Details/Security fields below are not backend params, so drop them.
|
||||||
|
if (loanProduct.productTypeGroup !== 'advances') {
|
||||||
|
delete loanProduct.productTypeGroup;
|
||||||
|
delete loanProduct.productTypeSubGroup;
|
||||||
|
delete loanProduct.glAccount;
|
||||||
|
delete loanProduct.loanProductCategory;
|
||||||
|
delete loanProduct.prioritySector;
|
||||||
|
delete loanProduct.cibilAccountType;
|
||||||
|
delete loanProduct.kfsEnabled;
|
||||||
|
delete loanProduct.aprEnabled;
|
||||||
|
delete loanProduct.securityType;
|
||||||
|
delete loanProduct.lienCertificateRequired;
|
||||||
|
delete loanProduct.securityMargin;
|
||||||
|
delete loanProduct.dpType;
|
||||||
|
delete loanProduct.dpValue;
|
||||||
|
}
|
||||||
|
|
||||||
// In Fineract, the POST and PUT endpoints for /v1/loanproducts have a typo in the field
|
// In Fineract, the POST and PUT endpoints for /v1/loanproducts have a typo in the field
|
||||||
// allowPartialPeriodInterestCalculation. Until that is fixed, we need to replace the field name in the payload.
|
// allowPartialPeriodInterestCalculation. Until that is fixed, we need to replace the field name in the payload.
|
||||||
|
|||||||
@@ -108,6 +108,10 @@ import { ChargesTemplateAndResolver } from './charges/charges-template-and-resol
|
|||||||
import { EditFixedDepositProductComponent } from './fixed-deposit-products/edit-fixed-deposit-product/edit-fixed-deposit-product.component';
|
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 { 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 { 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 { PreviewRegisterComponent } from './loan-interest-rate-register/preview-register/preview-register.component';
|
||||||
import { CollateralResolver } from './collaterals/collateral.resolver';
|
import { CollateralResolver } from './collaterals/collateral.resolver';
|
||||||
import { CollateralsResolver } from './collaterals/collaterals.resolver';
|
import { CollateralsResolver } from './collaterals/collaterals.resolver';
|
||||||
import { CollateralTemplateResolver } from './collaterals/collaterals-template.resolver';
|
import { CollateralTemplateResolver } from './collaterals/collaterals-template.resolver';
|
||||||
@@ -916,6 +920,31 @@ 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: 'preview',
|
||||||
|
component: PreviewRegisterComponent,
|
||||||
|
data: { title: 'Compare Changes', breadcrumb: 'Compare' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'charges',
|
path: 'charges',
|
||||||
data: { title: 'Charges', breadcrumb: 'Charges' },
|
data: { title: 'Charges', breadcrumb: 'Charges' },
|
||||||
|
|||||||
@@ -106,6 +106,19 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</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>
|
<div #recurringDepositProducts>
|
||||||
<a
|
<a
|
||||||
class="pd-card"
|
class="pd-card"
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable, inject } from '@angular/core';
|
||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpContext, HttpParams } from '@angular/common/http';
|
||||||
|
import { SILENT_HTTP_ERROR } from 'app/core/http/silent-error.token';
|
||||||
|
|
||||||
/** rxjs Imports */
|
/** rxjs Imports */
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
@@ -836,6 +837,35 @@ export class ProductsService {
|
|||||||
return this.http.post('/fixeddepositproducts/baseinterestrates', payload);
|
return this.http.post('/fixeddepositproducts/baseinterestrates', payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- Loan Interest Rate Register (CBS Loan Base Interest Rate) -----------
|
||||||
|
// Reads carry SILENT_HTTP_ERROR so a backend not-yet-deployed (404) doesn't surface the global
|
||||||
|
// error modal — rate-register.service.ts has its own catchError that falls back to seeded data.
|
||||||
|
|
||||||
|
private silentCtx(): { context: HttpContext } {
|
||||||
|
return { context: new HttpContext().set(SILENT_HTTP_ERROR, true) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns all Loan Rate Register versions, newest-effective first (for Version History accordion). */
|
||||||
|
getLoanBaseInterestRates(): Observable<any> {
|
||||||
|
return this.http.get('/loanproducts/baseinterestrates', this.silentCtx());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the currently in-force Loan Rate Register version (isActive=true), or null when none exists. */
|
||||||
|
getActiveLoanBaseInterestRate(): Observable<any> {
|
||||||
|
return this.http.get('/loanproducts/baseinterestrates/active', this.silentCtx());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a specific Loan Rate Register version by id. */
|
||||||
|
getLoanBaseInterestRateById(id: number): Observable<any> {
|
||||||
|
return this.http.get(`/loanproducts/baseinterestrates/${id}`, this.silentCtx());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Submits a new Loan Rate Register version. If maker-checker is enabled, the response's
|
||||||
|
* `rollbackTransaction` flag is true and the row sits in the Approvals tab until a checker approves. */
|
||||||
|
saveLoanBaseInterestRate(payload: any): Observable<any> {
|
||||||
|
return this.http.post('/loanproducts/baseinterestrates', payload, this.silentCtx());
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns loan interest rate categories. Pass activeOnly=true to get only active ones. */
|
/** Returns loan interest rate categories. Pass activeOnly=true to get only active ones. */
|
||||||
getLoanInterestRateCategories(activeOnly = false): Observable<any> {
|
getLoanInterestRateCategories(activeOnly = false): Observable<any> {
|
||||||
const url = activeOnly
|
const url = activeOnly
|
||||||
|
|||||||
Reference in New Issue
Block a user