From 283ab2f733c74d1dbd07a7f7d213fe9f270d2734 Mon Sep 17 00:00:00 2001 From: Sonali Likhitkar Date: Tue, 29 Sep 2026 18:06:08 +0530 Subject: [PATCH 1/3] feat(loan-products): add advance loan product stepper steps Co-Authored-By: Claude Sonnet 5.5 --- .../create-loan-product.component.html | 125 +- .../create-loan-product.component.ts | 267 +- .../loan-product-stepper/advance-steps.scss | 174 ++ ...oduct-advance-interest-step.component.html | 120 + ...product-advance-interest-step.component.ts | 105 + ...t-advance-limit-tenure-step.component.html | 155 + ...uct-advance-limit-tenure-step.component.ts | 171 ++ ...an-product-cheque-book-step.component.html | 144 + ...loan-product-cheque-book-step.component.ts | 92 + .../loan-product-details-step.component.html | 340 +-- .../loan-product-details-step.component.scss | 51 + .../loan-product-details-step.component.ts | 202 +- ...loan-product-penal-npa-step.component.html | 106 + .../loan-product-penal-npa-step.component.ts | 90 + ...roduct-renewal-closure-step.component.html | 69 + ...-product-renewal-closure-step.component.ts | 64 + ...-product-security-lien-step.component.html | 160 ++ ...-product-security-lien-step.component.scss | 117 + ...an-product-security-lien-step.component.ts | 196 ++ .../loan-product-settings-step.component.html | 2525 +++++++++-------- .../loan-product-settings-step.component.scss | 10 + .../loan-product-settings-step.component.ts | 86 +- .../loan-product-terms-step.component.html | 56 + .../loan-product-terms-step.component.ts | 17 +- .../products/loan-products/loan-products.ts | 22 +- 25 files changed, 3934 insertions(+), 1530 deletions(-) create mode 100644 src/app/products/loan-products/loan-product-stepper/advance-steps.scss create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.html create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.ts create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.html create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.html create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.ts create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.html create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.ts create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.html create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.ts create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.html create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.scss create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.ts diff --git a/src/app/products/loan-products/create-loan-product/create-loan-product.component.html b/src/app/products/loan-products/create-loan-product/create-loan-product.component.html index 260e066d8..abc3da5c8 100644 --- a/src/app/products/loan-products/create-loan-product/create-loan-product.component.html +++ b/src/app/products/loan-products/create-loan-product/create-loan-product.component.html @@ -42,19 +42,94 @@ - - - - {{ 'labels.inputs.SETTINGS' | translate }} - -
- -
-
+ @if (isAdvanceProduct) { + + + + SECURITY & LIEN + +
+ +
+
+ + + + + LIMIT & TENURE + +
+ +
+
+ + + + + INTEREST + +
+ +
+
+ + + + + PENAL & NPA + +
+ +
+
+ + + + + RENEWAL & CLOSURE + +
+ +
+
+ + @if (isOverdraftFacility) { + + + + CHEQUE BOOK + +
+ +
+
+ } + } + + @if (!isAdvanceProduct) { + + + + {{ 'labels.inputs.SETTINGS' | translate }} + +
+ +
+
+ } @if (isAdvancedPaymentStrategy) { @@ -90,15 +165,19 @@ } - - - - {{ 'labels.inputs.TERMS' | translate }} - -
- -
-
+ @if (!isAdvanceProduct) { + + + + {{ 'labels.inputs.TERMS' | translate }} + +
+ +
+
+ } @@ -109,7 +188,7 @@ diff --git a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts index 93785c36a..50c14db3b 100644 --- a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts +++ b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts @@ -13,6 +13,12 @@ import { ActivatedRoute, Router } from '@angular/router'; /** Custom Components */ 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 { 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 { 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'; @@ -34,7 +40,7 @@ import { import { Accounting } from 'app/core/utils/accounting'; 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 { UntypedFormGroup } from '@angular/forms'; +import { UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; 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'; @@ -51,6 +57,12 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; FaIconComponent, LoanProductDetailsStepComponent, LoanProductCurrencyStepComponent, + LoanProductSecurityLienStepComponent, + LoanProductAdvanceLimitTenureStepComponent, + LoanProductAdvanceInterestStepComponent, + LoanProductPenalNpaStepComponent, + LoanProductRenewalClosureStepComponent, + LoanProductChequeBookStepComponent, LoanProductSettingsStepComponent, LoanProductInterestRefundStepComponent, LoanProductPaymentStrategyStepComponent, @@ -73,12 +85,27 @@ export class CreateLoanProductComponent implements OnInit { @ViewChild(LoanProductDetailsStepComponent, { static: true }) loanProductDetailsStep: LoanProductDetailsStepComponent; @ViewChild(LoanProductCurrencyStepComponent, { static: true }) 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 }) loanProductInterestRefundStep: LoanProductInterestRefundStepComponent; @ViewChild(LoanProductDeferredIncomeRecognitionStepComponent, { static: true }) loanProductDeferredIncomeRecognitionStep: LoanProductDeferredIncomeRecognitionStepComponent; - @ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent; - @ViewChild(LoanProductSettingsStepComponent, { static: true }) + // Terms & Settings tabs are now conditional (Loans path only), so resolve them non-statically. + @ViewChild(LoanProductTermsStepComponent) loanProductTermsStep: LoanProductTermsStepComponent; + @ViewChild(LoanProductSettingsStepComponent) loanProductSettingsStep: LoanProductSettingsStepComponent; @ViewChild(LoanProductChargesStepComponent, { static: true }) loanProductChargesStep: LoanProductChargesStepComponent; @ViewChild(LoanProductAccountingStepComponent, { static: true }) @@ -143,7 +170,18 @@ export class CreateLoanProductComponent implements OnInit { } 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) { @@ -231,47 +269,71 @@ export class CreateLoanProductComponent implements OnInit { } get loanProductSettingsForm() { - return this.loanProductSettingsStep.loanProductSettingsForm; + // Absent on the Advances path (tab hidden), so guard for callers. + return this.loanProductSettingsStep?.loanProductSettingsForm; } get 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 { - let tabs = 6; // details, currency, settings, terms, charges, accounting - if (this.isAdvancedPaymentStrategy) tabs += 3; // interest refund, payment allocation, deferred income + let tabs = 4; // details, currency, charges, accounting (always) + 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 return tabs; } 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 ( - this.loanProductDetailsForm.valid && - this.loanProductCurrencyForm.valid && - this.loanProductTermsForm.valid && - this.loanProductSettingsForm.valid && - this.loanIncomeCapitalizationForm.valid && - this.loanProductAccountingForm.valid - ); - } else { - return ( - this.loanProductDetailsForm.valid && - this.loanProductCurrencyForm.valid && - this.loanProductTermsForm.valid && - this.loanProductSettingsForm.valid && - this.loanProductAccountingForm.valid + base && + !!this.loanProductSecurityLienStep?.loanProductSecurityLienForm?.valid && + !!this.loanProductAdvanceLimitTenureStep?.loanProductAdvanceLimitTenureForm?.valid && + !!this.loanProductAdvanceInterestStep?.loanProductAdvanceInterestForm?.valid && + !!this.loanProductPenalNpaStep?.loanProductPenalNpaForm?.valid && + !!this.loanProductRenewalClosureStep?.loanProductRenewalClosureForm?.valid && + (!this.isOverdraftFacility || !!this.loanProductChequeBookStep?.loanProductChequeBookForm?.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() { + // 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 = { ...this.loanProductDetailsStep.loanProductDetails, ...this.loanProductCurrencyStep.loanProductCurrency, - ...this.loanProductTermsStep.loanProductTerms, - ...this.loanProductSettingsStep.loanProductSettings, + ...(this.loanProductTermsStep?.loanProductTerms ?? {}), + ...(this.loanProductSettingsStep?.loanProductSettings ?? {}), ...this.loanProductChargesStep.loanProductCharges, ...this.loanProductAccountingStep.loanProductAccounting }; @@ -304,6 +366,163 @@ export class CreateLoanProductComponent implements OnInit { 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() { const loanProduct = this.loanProducts.buildPayload(this.loanProduct, this.itemsByDefault); if (this.isAdvancedPaymentStrategy) { diff --git a/src/app/products/loan-products/loan-product-stepper/advance-steps.scss b/src/app/products/loan-products/loan-product-stepper/advance-steps.scss new file mode 100644 index 000000000..29d9a6b7e --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/advance-steps.scss @@ -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; +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.html new file mode 100644 index 000000000..d81f96fbf --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.html @@ -0,0 +1,120 @@ + + +
+
+
+ +

Rate

+
+
+ + Interest Basis + + @for (opt of interestBasisOptions; track opt.id) { + {{ opt.label }} + } + + + @if (showSpread) { + + Spread over Deposit Rate (%) + + Advance rate = deposit rate + spread + + } @else { +
+ } +
+ + Minimum Rate (% p.a.) + + Minimum Rate is required + + + Maximum Rate (% p.a.) + + Maximum Rate is required + +
+
+ +
+
+ +

Calculation

+
+
+ + Calculation Method + + @for (opt of calcMethodOptions; track opt.id) { + {{ opt.label }} + } + + + + Days in Year + + @for (opt of daysInYearOptions; track opt) { + {{ opt }} + } + + + + Days in Month + + @for (opt of daysInMonthOptions; track opt) { + {{ opt }} + } + + + + Interest Charged On + + @for (opt of chargedOnOptions; track opt.id) { + {{ opt.label }} + } + + + + Interest on Credit Balance + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + +
+
+ +
+
+ +

Posting

+
+
+ + Posting Frequency + + @for (opt of postingFrequencyOptions; track opt) { + {{ opt }} + } + + + + Posting Day + + @for (opt of postingDayOptions; track opt) { + {{ opt }} + } + + +
+
+
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.ts new file mode 100644 index 000000000..89dbb9956 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-interest-step/loan-product-advance-interest-step.component.ts @@ -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(); + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.html new file mode 100644 index 000000000..ed9f6e540 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.html @@ -0,0 +1,155 @@ + + +
+
+
+ +

Facility Type

+
+ + + Demand Loan + Paid out once; repaid at maturity. No cheque book. + + + Overdraft (Running) + Draw and repay any time within the limit. Cheque book allowed. + + +
+
+ This choice decides whether the Cheque Book step appears. CC / OD sub types are always running. +
+
+
+ +
+
+ +

Limit

+
+
+ + Minimum Limit (₹) + + Minimum Limit is required + + + Default Limit (₹) + + + + Maximum Limit (₹) + + Maximum Limit is required + +
+
+ +
+
+ +

Tenure & Repayment

+
+
+ + Minimum Tenure (months) + + @if (isFdTenureLocked) { + FD policy: 12–15 months only + } + + @if (isFdTenureLocked) { + Must be between 12 and 15 months + } @else { + Minimum Tenure is required + } + + + + Default Tenure (months) + + @if (isFdTenureLocked) { + Between 12 and 15 + Must be between 12 and 15 months + } + + + Maximum Tenure (months) + + @if (isFdTenureLocked) { + FD policy: max 15 months (also capped at deposit maturity) + } @else { + Also capped at the deposit's maturity (Lien rule) + } + + @if (isFdTenureLocked) { + Must be between 12 and 15 months + } @else { + Maximum Tenure is required + } + + + + Repayment Type + + @for (opt of repaymentTypeOptions; track opt.id) { + {{ opt.label }} + } + + + + Appropriation Order + + @for (opt of appropriationOrderOptions; track opt.id) { + {{ opt.label }} + } + + +
+
+ +
+
+ +

Account Behaviour

+
+
+ + Debit Balance Allow + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + Allow Debit Trans After Due Date + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + Branch Level A/c Type + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + +
+
+ +
+ + EMI fields (Number of Repayments, Repaid Every, Variable Installments) are hidden for an Advance. +
+
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts new file mode 100644 index 000000000..b35557303 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts @@ -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: 'penal_interest_principal_charges', label: 'Penal → Interest → Principal → 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 }); + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.html new file mode 100644 index 000000000..cbac09492 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.html @@ -0,0 +1,144 @@ + + +
+
+
+ +

Cheque Book Facility

+ Overdraft (running) only +
+
+ + Cheque Type + + @for (opt of chequeTypeOptions; track opt) { + {{ opt }} + } + + + + Book Sizes Allowed (leaves) + + @for (opt of bookSizeOptions; track opt) { + {{ opt }} + } + + + + Default Book Size (leaves) + + @for (opt of bookSizeOptions; track opt) { + {{ opt }} + } + + + + Max Books Outstanding + + + + Reissue When Unused Leaves ≤ + + + + First Cheque Book Free + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + Free Cheque Books per Year + + + + Name Printed on Cheque + + @for (opt of namePrintedOptions; track opt) { + {{ opt }} + } + + + + Cheque Print Description + + +
+
+ +
+
+ +

Validation & Security

+
+
+ + Positive Pay (PPS) Threshold (₹) + + Issuer confirms cheques at or above this + + + PPS Mandatory Above (₹) + + + + Cheque Validity + + + + Stop Payment Allowed + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + Maintain Cheque Stock Register + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + Allow Withdrawal Slip + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + +
+
+ +
+
+ +

Block Cheque Issue & Clearing When

+
+
+
+ Account is NPA or out of order + Limit has expired (renewal due) + Debit would exceed the limit / drawing power + Account is frozen or inoperative + + Pledged deposit has matured or its lien was released + +
+
+
+ +
+ + Cheque book fees (issue, per leaf, return, stop payment) are set on the Charges step. +
+
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.ts new file mode 100644 index 000000000..3eade52c6 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-cheque-book-step/loan-product-cheque-book-step.component.ts @@ -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(); + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html index 49df9f6d2..62b792538 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html @@ -7,178 +7,190 @@ -->
-
-
- -

{{ 'labels.inputs.Product Name' | translate }} & {{ 'labels.inputs.Description' | translate }}

-
-
- - {{ 'labels.inputs.Product Name' | translate }} - - - {{ 'labels.inputs.Product Name' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - - {{ 'labels.inputs.Short Name' | translate }} - - - {{ 'labels.inputs.Short Name' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - -
-
- -
-
- -

{{ 'labels.inputs.Availability' | translate }}

-
-
- - {{ 'labels.inputs.Start Date' | translate }} - - - - - - - {{ 'labels.inputs.Close Date' | translate }} - - - - - - - {{ 'labels.inputs.Description' | translate }} - - -
-
- - -
-
- -

Interest Information

-
-
- - Debit Int. Calculation - - @for (opt of yesNoOptions; track opt.value) { - {{ opt.label }} - } - - - - - Separate Penal Int. - - @for (opt of yesNoOptions; track opt.value) { - {{ opt.label }} - } - - - - - Credit Int. Calculation - - @for (opt of yesNoOptions; track opt.value) { - {{ opt.label }} - } - - - - - Sub A/c Type Balance - - @for (opt of yesNoOptions; track opt.value) { - {{ opt.label }} - } - - - - - Final Int. Rounding - - @for (opt of yesNoOptions; track opt.value) { - {{ opt.label }} - } - - - - @if (loanProductDetailsForm.get('finalIntRounding')?.value) { - - Rounding UpTo - - - } -
-
- - +
-

Product Classification

+

Product Type

-
- - Product Type Group - - @for (group of productTypeGroups; track group.id) { - {{ group.label }} - } - - + + @for (group of productTypeGroups; track group.id) { + + {{ group.label }} + {{ group.hint }} + + } + - @if (loanProductDetailsForm.get('productTypeGroup')?.value) { + @if (loanProductDetailsForm.get('productTypeGroup')?.value) { +
- GL Account ({{ glClassificationLabel }}) - - @for (acc of availableGlAccounts; track acc.id) { - ({{ acc.glCode }}) {{ acc.name }} + Product Sub Type + + @for (subGroup of availableSubGroups; track subGroup.id) { + {{ subGroup.label }} } - GL Account is required + Product Sub Type is required - } -
+ + + GL Account (Asset) + + @for (acc of assetAccountOptions; track acc.id) { + ({{ acc.glCode }}) {{ acc.name }} + } + + GL Account is required + +
+ }
+ + @if (!isProductTypeChosen) { +
+ + Select a Product Type and Sub Type to continue. +
+ } + + @if (isProductTypeChosen) { +
+
+ +

{{ 'labels.inputs.Product Name' | translate }} & {{ 'labels.inputs.Description' | translate }}

+
+
+ + {{ 'labels.inputs.Product Name' | translate }} + + + {{ 'labels.inputs.Product Name' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + + + {{ 'labels.inputs.Short Name' | translate }} + + @if (loanProductDetailsForm.get('shortName').hasError('pattern')) { + Short Name must be exactly 2 capital letters (A–Z) + } @else { + + {{ 'labels.inputs.Short Name' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + } + + + + {{ 'labels.inputs.Start Date' | translate }} + + + + + + + {{ 'labels.inputs.Close Date' | translate }} + + + + + + + {{ 'labels.inputs.Description' | translate }} + + +
+
+ +
+
+ +

Regulatory Classification

+
+
+ + Loan Product Category (RBI) + + @for (opt of loanProductCategoryOptions; track opt.id) { + {{ opt.label }} + } + + + + + Priority Sector + + @for (opt of prioritySectorOptions; track opt.id) { + {{ opt.label }} + } + + + + + CIBIL Account Type + + @for (opt of cibilAccountTypeOptions; track opt.id) { + {{ opt.label }} + } + + + + + Key Fact Statement (KFS) + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + + APR Calculation + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + +
+
+ }
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.scss b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.scss index f6a3f62d5..a5eecb505 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.scss +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.scss @@ -61,6 +61,57 @@ $gray-900: #202124; &--full { 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 { diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.ts index ded56834c..6b32897fd 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.ts @@ -15,6 +15,7 @@ import { Dates } from 'app/core/utils/dates'; import { SettingsService } from 'app/settings/settings.service'; import { MatTooltip } from '@angular/material/tooltip'; import { CdkTextareaAutosize } from '@angular/cdk/text-field'; +import { MatRadioButton, MatRadioGroup } from '@angular/material/radio'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @Component({ @@ -24,7 +25,9 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; imports: [ ...STANDALONE_SHARED_IMPORTS, MatTooltip, - CdkTextareaAutosize + CdkTextareaAutosize, + MatRadioGroup, + MatRadioButton ] }) export class LoanProductDetailsStepComponent implements OnInit { @@ -50,6 +53,28 @@ export class LoanProductDetailsStepComponent implements OnInit { } 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 ?? []; + this.loanProductDetailsForm.patchValue({ name: this.loanProductsTemplate.name, shortName: this.loanProductsTemplate.shortName, @@ -57,83 +82,119 @@ export class LoanProductDetailsStepComponent implements OnInit { startDate: this.loanProductsTemplate.startDate && new Date(this.loanProductsTemplate.startDate), 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 = [ - { id: 'loans', label: 'Loan' }, - { id: 'advanced', label: 'Advanced' } + { id: 'advances', label: 'Advances A/C', hint: 'No EMI. Limit / drawing power against security.' }, + { id: 'loans', label: 'Loans A/C', hint: 'Fixed disbursement, fixed tenure, EMI repayment.' } ]; - readonly productTypeSubGroups: Record = { - loans: [ - { id: 'emi', label: 'EMI' }, - { id: 'cc', label: 'CC (Cash Credit)' }, - { id: 'overdraft', label: 'Overdraft' }, - { id: 'warehouse', label: 'Warehouse' }, - { id: 'gold', label: 'Gold' } + /** `shortName` is the two-letter code the product's Short Name is pre-filled with when the sub type is picked. */ + readonly productTypeSubGroups: Record = { + advances: [ + { id: 'fd', label: 'Loan against FD', shortName: 'FD' }, + { id: 'rd', label: 'Loan against RD', shortName: 'RD' }, + { id: 'dds', label: 'Loan against DDS', shortName: 'DS' }, + { 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: [ - { id: 'fd', label: 'FD (Fixed Deposit)' }, - { id: 'rd', label: 'RD (Recurring Deposit)' } + loans: [ + { id: 'term', label: 'Term Loan', shortName: 'TL' }, + { 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 */ - private readonly glDefaultMap: Record = { - loans: 'asset', - advanced: 'asset' - }; + /** Regulatory Classification options (UI-only; RBI / bureau reporting). */ + readonly loanProductCategoryOptions = [ + { id: 'advances_deposits', label: 'Advances against deposits' }, + { 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: 'no', label: 'No' }, + { id: 'agriculture', label: 'Agriculture' }, + { id: 'msme', label: 'MSME' }, + { id: 'weaker_sections', label: 'Weaker Sections' }, + { id: 'education', label: 'Education' }, + { id: 'housing', label: 'Housing' } + ]; + + 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() { const group = this.loanProductDetailsForm.get('productTypeGroup')?.value; return group ? (this.productTypeSubGroups[group] ?? []) : []; } - get glOptions(): string[] { - return [ - 'asset', - 'liability' - ]; - } - + /** + * Asset GLs offered for the product's ledger GL -- the GL the product's loan account numbers are + * generated from. Separate from the Accounting tab mappings, which drive the journal entries. + */ 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 { const group = this.loanProductDetailsForm.get('productTypeGroup')?.value; return this.productTypeGroups.find((g) => g.id === group)?.label ?? ''; } - readonly yesNoOptions = [ - { value: true, label: 'YES' }, - { value: false, label: 'NO' } - ]; + /** + * A new product's short name is two capital letters, so what is typed or pasted is upper-cased, anything + * 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() { this.loanProductDetailsForm = this.formBuilder.group({ @@ -150,21 +211,26 @@ export class LoanProductDetailsStepComponent implements OnInit { closeDate: [''], productTypeGroup: [''], productTypeSubGroup: [''], - glClassification: ['asset'], glAccount: [''], - debitIntCalculation: [false], - separatePenalInterest: [false], - creditIntCalculation: [false], - subAccountTypeBalance: [false], - finalIntRounding: [false], - roundingUpTo: [null] + // Regulatory Classification (UI-only; stripped in buildPayload) + loanProductCategory: ['advances_deposits'], + prioritySector: ['no'], + cibilAccountType: ['loan_bank_deposits'], + kfsEnabled: ['YES'], + aprEnabled: ['YES'] }); - // Auto-set GL based on product type group - this.loanProductDetailsForm.get('productTypeGroup')?.valueChanges.subscribe((group: string) => { - const defaultVal = this.glDefaultMap[group] ?? 'asset'; - this.loanProductDetailsForm.get('glClassification')?.setValue(defaultVal); - this.loanProductDetailsForm.get('glAccount')?.setValue(''); + // A sub type belongs to one group, so changing the group clears it. + this.loanProductDetailsForm.get('productTypeGroup')?.valueChanges.subscribe(() => { + this.loanProductDetailsForm.get('productTypeSubGroup')?.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); + } }); } diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.html new file mode 100644 index 000000000..30c8eda8e --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.html @@ -0,0 +1,106 @@ + + +
+
+
+ +

Penal Charges

+
+
+ + Penal Charges Applicable + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + Penal Rate (% p.a.) + + + + Applied On + + @for (opt of appliedOnOptions; track opt.id) { + {{ opt.label }} + } + + + + Penal Grace Days + + +
+
+ RBI: penal charges are kept separate from interest, never capitalised, and shown in the Key Fact Statement. +
+
+
+
+ +
+
+ +

Asset Classification (SMA / NPA)

+
+
+ + Delinquency Bucket (SMA) + + — None — + @for (bucket of delinquencyBucketOptions; track bucket.id) { + {{ bucket.name }} + } + + SMA 0–30 / 31–60 / 61–90 + + + NPA After (days overdue) + + + + NPA Trigger + + @for (opt of npaTriggerOptions; track opt.id) { + {{ opt.label }} + } + + + + Interest after NPA + + @for (opt of interestAfterNpaOptions; track opt.id) { + {{ opt.label }} + } + + + + Grace on Arrears Ageing (days) + + Days before an amount counts as overdue + + + In-Arrears Tolerance (₹) + + Small balance ignored for arrears + +
+
+
+ + Upgrade from NPA only when all arrears are cleared + + + Keep standard while the pledged deposit fully covers the dues + +
+
+
+
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.ts new file mode 100644 index 000000000..0df4451de --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-penal-npa-step/loan-product-penal-npa-step.component.ts @@ -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(); + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.html new file mode 100644 index 000000000..3a062eb6a --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.html @@ -0,0 +1,69 @@ + + +
+
+
+ +

Limit Renewal

+
+
+ + Renewal Allowed + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + Renewal Period (months) + + + + Renewal Grace Days + + Days allowed after the renewal date + +
+
+ +
+
+ +

Pre-closure

+
+
+ + Pre-closure Allowed + + @for (opt of preclosureOptions; track opt.id) { + {{ opt.label }} + } + + + + Lock-in Period (months) + + + + Interest on Pre-closure + + @for (opt of preclosureInterestOptions; track opt.id) { + {{ opt.label }} + } + + +
+
+ +
+ + Renewal and pre-closure fees are set once, on the Charges step. +
+
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.ts new file mode 100644 index 000000000..984ade3bc --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-renewal-closure-step/loan-product-renewal-closure-step.component.ts @@ -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(); + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.html new file mode 100644 index 000000000..c2410aea5 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.html @@ -0,0 +1,160 @@ + + +
+ @if (!isAdvance) { +
+ + Security & Lien applies to an Advances A/C product. Choose it on the Details step. +
+ } + + @if (isAdvance) { +
+
+ +

Security & Margin

+
+
+ + Security Type + + From Sub Type — not chosen again + + + + Eligible Amount Basis + + @for (opt of eligibleAmountBasisOptions; track opt.id) { + {{ opt.label }} + } + + Eligible Amount Basis is required + + + + Margin (%) + + 0 – 100. Drawing Power = security value × LTV + @if (loanProductSecurityLienForm.get('margin').hasError('required')) { + Margin is required + } @else { + Margin must be between 0 and 100 + } + + + + LTV (%) + + = 100 − Margin + +
+
+ + @if (isLienSubType) { +
+
+ +

Lien Settings

+ FD · RD · DDS · LIC +
+ +
+

Lien marking

+
+ + Lien Required + + + + + Lien Marking Stage + + @for (opt of lienMarkingStageOptions; track opt.id) { + {{ opt.label }} + } + + + + + Eligible Deposit Products + + @for (product of depositProductOptions; track product) { + {{ product }} + } + + Only accounts of these deposit products can be pledged for this advance + Pick at least one deposit product + +
+
+ +
+

Rules

+
+ + Tenure cannot exceed deposit maturity date + + + Auto-release lien when the advance is closed + + + Allow multiple deposits for one advance + + + Adjust advance from deposit proceeds at maturity + + + Allow third-party deposit (consent letter required) + + + Allow deposit renewal under lien (lien carries forward) + +
+
+ +
+

Lien certificate

+
+ + Lien Certificate Required + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + + @if (loanProductSecurityLienForm.get('lienCertificateRequired').value === 'YES') { + + Certificate No. Prefix + + Prefix is required + + + + Print on Disbursement + + @for (opt of yesNoOptions; track opt) { + {{ opt }} + } + + + } +
+
+
+ +
+ + Interest basis and spread are set on the Interest step; the lien-certificate fee on the + Charges step. +
+ } + } +
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.scss b/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.scss new file mode 100644 index 000000000..7d57dfc5e --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.scss @@ -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; + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.ts new file mode 100644 index 000000000..d0327c94a --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-security-lien-step/loan-product-security-lien-step.component.ts @@ -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 = { + 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 = { + 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 + }; + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html index 5853a8895..c255df105 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html @@ -7,1100 +7,1212 @@ -->
- -
-
- -

- {{ 'labels.inputs.products.loan.Amortization' | translate }} & - {{ 'labels.inputs.Interest Method' | translate }} -

-
-
- - {{ 'labels.inputs.products.loan.Amortization' | translate }} - - @for (amortizationType of amortizationTypeData; track amortizationType) { - - {{ 'labels.inputs.products.loan.amortizationType.' + amortizationType.value | translate }} - - } - - - {{ 'labels.inputs.products.loan.Amortization' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - - {{ 'labels.inputs.Interest Method' | translate }} - - @for (interestType of interestTypeData; track interestType) { - - {{ interestType.value | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Interest Method' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - - {{ 'labels.inputs.Interest calculation period' | translate }} - - @for ( - interestCalculationPeriodType of interestCalculationPeriodTypeData; - track interestCalculationPeriodType - ) { - - {{ interestCalculationPeriodType.value | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Interest calculation period' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - -
- - {{ 'labels.inputs.products.loan.Is Equal Amortization?' | translate }} - -
- - @if (loanProductSettingsForm.value.interestCalculationPeriodType === 1) { -
- - {{ 'labels.inputs.Calculate interest for exact days in partial period' | translate }} - -
- } -
-
- - -
-
- -

{{ 'labels.inputs.Loan Schedule' | translate }}

-
-
- - {{ 'labels.inputs.Loan Schedule Type' | translate }} - - @for (loanScheduleType of loanScheduleTypeData; track loanScheduleType) { - - {{ loanScheduleType.value | translateKey: 'catalogs' }} - - } - - - - - {{ 'labels.inputs.Repayment strategy' | translate }} - - @for ( - transactionProcessingStrategy of transactionProcessingStrategyData; - track transactionProcessingStrategy - ) { - - {{ transactionProcessingStrategy.name | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Repayment strategy' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - @if (isAdvancedTransactionProcessingStrategy) { + + + + + + + {{ 'labels.inputs.products.loan.Amortization' | translate }} & + {{ 'labels.inputs.Interest Method' | translate }} + + +
- {{ 'labels.inputs.Loan Schedule Processing Type' | translate }} - - @for (loanScheduleProcessingType of loanScheduleProcessingTypeData; track loanScheduleProcessingType) { - - {{ loanScheduleProcessingType.value | translateKey: 'catalogs' }} - - } - - - } - - - {{ 'labels.inputs.Interest free period' | translate }} - - - - - Allowed pending EMI amount - - - - - {{ 'labels.inputs.Days in year' | translate }} - - @for (daysInYearType of daysInYearTypeData; track daysInYearType) { - - {{ daysInYearType.value | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Days in year' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - @if (useDaysInYearCustomStrategy) { - - {{ 'labels.inputs.Days in year custom strategy' | translate }} + {{ 'labels.inputs.products.loan.Amortization' | translate }} - @for (daysInYearCustomStrategy of daysInYearCustomStrategyOptions; track daysInYearCustomStrategy) { - - {{ daysInYearCustomStrategy.value | translateKey: 'catalogs' }} + @for (amortizationType of amortizationTypeData; track amortizationType) { + + {{ 'labels.inputs.products.loan.amortizationType.' + amortizationType.value | translate }} } + + {{ 'labels.inputs.products.loan.Amortization' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + - } - - {{ 'labels.inputs.Days in month' | translate }} - - @for (daysInMonthType of daysInMonthTypeData; track daysInMonthType) { - - {{ daysInMonthType.value | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Days in month' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - -
- - {{ 'labels.inputs.Allow fixing of the installment amount' | translate }} - -
-
-
- - -
-
- -

Cheque Book Settings

-
-
- - Cheque Book Issue Enabled - - YES - NO - - - - - Cheque Validation Required - - YES - NO - - - - - Is First Cheque Book Free - - YES - NO - - - - - Cheque Printing Account Type - - Savings Bank - Current Account - Cash Credit - Overdraft - - - - - Allow Withdrawal Slip Usage - - YES - NO - - - - - Maintain Cheque Book Stock Registry - - YES - NO - - - - - Free Cheque Books Per Year - - - - - Allow Credit By Cheque Number - - YES - NO - - - - - Credit Cheque Validation Required - - YES - NO - - - - - Grace Days For Stock Statement - - -
-
- - -
-
- -

Additional Product Settings

-
-
- - Account Type Active For Transactions - - YES - NO - - - - - Sub Type Activity Enabled - - YES - NO - - - - - Account Opening Charges - - - - - Maximum Gold Loan Limit - - - - - Last Account Number Opened - - - - - Customer Termination Allowed - - YES - NO - - - - - Charges For Cash Credit Above Limit - - - - - Death Interest GL Account - - - - - Starting Ledger Number - - - - - Ending Ledger Number - - - - - Current Ledger Number - - - - - Remittance Account Number - - - - - Is Non Resident Indian Account - - YES - NO - - - - - Debit Clearing GL Account - - - - - Missed Call Alert Service Active - - YES - NO - - - - - Standing Instruction Charge GL Account - - - - - Standing Instruction Debit Charge Skip Option - - Skip Always - Skip on First Failure - Never Skip - Retry after 24 Hours - - - - - Opening Balance Multiplier For Remittance Charges - - -
-
- - -
-
- -

Interest Related Parameters

-
-
- - Drawing Power And Limit Generation Procedure - - Normal D.P. Entry Is Considered - Against F.D. Interest with Certificate Wise Interest Rate + {{ 'labels.inputs.Interest Method' | translate }} + - Based on Asset Value - Monthly Stock Statement Basis - - + @for (interestType of interestTypeData; track interestType) { + + {{ interestType.value | translateKey: 'catalogs' }} + + } + + + {{ 'labels.inputs.Interest Method' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + - - Advances Interest Calculation Method - - Debit Closing Balance Considered as Product + {{ 'labels.inputs.Interest calculation period' | translate }} + - - + @for ( + interestCalculationPeriodType of interestCalculationPeriodTypeData; + track interestCalculationPeriodType + ) { + + {{ interestCalculationPeriodType.value | translateKey: 'catalogs' }} + + } + + + {{ 'labels.inputs.Interest calculation period' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + - - Against Interest Calculation Enabled - - YES - NO - - - - - Day Wise Against Clearing Interest Rounding - - YES - NO - - - - - Interest Calculation One Fourth Method - - 0 (Standard) - 1 (Custom A) - 2 (Custom B) - - - - - Against Clearing Interest Procedure Type - - Normal Against Clearing Interest - - - - - Consider Debit Closing Amount For Against Clearing - - YES - NO - - - - - Interest Rounding Method - - All Int. Round - Nearest Rupee - Round Up - Round Down - - - - - Penalty Interest Calculation Enabled - - YES - NO - - - - - Penalty Interest Calculation Method - - Daywise ( 36500 ) - - - - - Penalty Interest Procedure Number - - On Debit, Penalty Product is Closing Balance - Limit is Considered for Penalty Product - - - - - Overdrawn Interest Calculation Method - - Overdrawn = Balance - Limit - Overdrawn = Balance - D.P. - Don't Calculate - - - - - Calculate Overdrawn Interest After Renewal - - YES - NO - - - - - Interest On Credit Balance - - YES - NO - - - - - Penalty Interest Date Different Than Regular Interest - - YES - NO - - - - - Fixed Deposit Overdraft Certificate Sort Order - - Order on Interest Rate - Order on Drawing Power - - - - - Use Document Submission Date For Interest - - YES - NO - - - - - Loan Management System Renewal Penalty Active - - YES - NO - - - - - Minimum Normal Interest Amount - - - - - Minimum Interest Calculation Method - - Flat Amount - Percentage of Balance - Tier Based - - - - - Minimum Against Clearing Interest Amount - - - - - Limit Increase Upto Interest Amount In Interest Calculation - - YES - NO - - - - - Minimum Penalty Interest Amount - - - - - Days For Limit Increase Upto Interest Amount - - - - - Additional Interest Rate For Fixed Deposit Overdraft - - - - - Consider DD/Payorder In Against Clearing Interest Calculation - - YES - NO - - - - - Grace Days After Renewal Date - - - - - Apply Undebited Interest Concept Enabled - - YES - NO - - - - - Interest Register Print Format Type - - Interest Amount with Opening Balance - Interest Only - Full Ledger Format - - - - - Normal Grace Days After Overdue - - - - - Allow Against Clearing Entry - - YES - NO - - - - - Allow No Balance Entry - - YES - NO - - - - - Fixed Deposit Overdraft Penalty Interest Combined With Normal Interest - - YES - NO - - - - - Allow No Balance Entry With Password - - YES - NO - - - - - Undebited Simple Interest Account Wise - - YES - NO - - - - - Daily Interest Calculation Enabled - - YES - NO - - - - - Daily Interest Calculation Start Date - - - - - Non Performing Asset Penal Interest Rate Update - - YES - NO - - - - - Non Performing Asset Penal Interest Rate - - - - - Fixed Deposit Overdraft Penal Interest Rate Update In Branch Process - - YES - NO - - - - - Add Penal Interest Rate - - -
-
- - -
-
- -

RBI Compliance & KFS Settings

-
-
- - Penal Charge Method - - RBI Compliant Penal Charges (Non-Compounding) - Legacy Penal Interest (Compounding) - - - -
- - Is Floating Rate Loan? (Individual) - -
- - - Foreclosure Charges Applicable - - YES - NO - - RBI: No charges for Floating Rate Loans to Individuals - - -
- - Enable Key Fact Statement (KFS) - -
- -
- - Calculate APR - -
-
-
- - -
-
- -

Credit Bureau Settings (CIBIL/Highmark)

-
-
- - Loan Product Category (RBI Reporting) - - Personal/Consumer Loan (Code 02) - Housing/Mortgage Loan (Code 15) - Business/Commercial Loan (Code 50) - Vehicle/Auto Loan (Code 04) - - Selecting a category will auto-fill the credit bureau account types below. - - - CIBIL Account Type - - - - - CIBIL Commercial Account Type - - - - - Highmark Account Type - - - - - Highmark Commercial Account Type - - - - - Experian Account Type - - - - - Experian Commercial Account Type - - - - - Equifax Account Type - - - - - Equifax Commercial Account Type - - -
-
- - -
-
- -

- {{ 'labels.inputs.Moratorium' | translate }} - -

-
-
- - {{ 'labels.inputs.Grace on principal payment' | translate }} - - - - - {{ 'labels.inputs.Grace on interest payment' | translate }} - - - - - {{ 'labels.inputs.Delinquency Bucket' | translate }} - - @for (delinquencyBucket of delinquencyBucketData; track delinquencyBucket) { - - {{ delinquencyBucket.name }} - - } - - @if (loanProductSettingsForm.controls.delinquencyBucketId) { - - } - - - @if (loanProductSettingsForm.value.delinquencyBucketId) { -
- - {{ 'labels.inputs.Enable installment level Delinquency' | translate }} +
+ + {{ 'labels.inputs.products.loan.Is Equal Amortization?' | translate }}
- } -
-
- -
-
- -

- {{ 'labels.inputs.Number of days a loan may be overdue before moving into arrears' | translate }} -

-
-
- - {{ 'labels.inputs.On arrears ageing' | translate }} - - - - - {{ 'labels.inputs.Overdue days for NPA' | translate }} - - - -
- - {{ 'labels.inputs.Account moves out of NPA only after all arrears have been cleared' | translate }} - + @if (loanProductSettingsForm.value.interestCalculationPeriodType === 1) { +
+ + {{ 'labels.inputs.Calculate interest for exact days in partial period' | translate }} + +
+ }
+ - - {{ 'labels.inputs.Principal Threshold (%) for Last Instalment' | translate }} - - -
-
- - -
-
- -

{{ 'labels.inputs.Variable Installments' | translate }}

-
-
-
- - {{ 'labels.inputs.Are Variable Installments allowed?' | translate }} - -
- - @if (loanProductSettingsForm.value.allowVariableInstallments) { + + + + + + {{ 'labels.inputs.Loan Schedule' | translate }} + + +
- {{ 'labels.inputs.Minimum gap between Installments' | translate }} - - - {{ 'labels.inputs.Minimum gap between Installments' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - + {{ 'labels.inputs.Loan Schedule Type' | translate }} + + @for (loanScheduleType of loanScheduleTypeData; track loanScheduleType) { + + {{ loanScheduleType.value | translateKey: 'catalogs' }} + + } + + - {{ 'labels.inputs.Maximum gap between Installments' | translate }} - - - {{ 'labels.inputs.Maximum gap between Installments' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - } - -
- - {{ 'labels.inputs.Allowed to be used for providing Topup Loans' | translate }} - -
-
-
- - -
-
- -

{{ 'labels.heading.Interest Recalculation' | translate }}

-
-
-
- - {{ 'labels.inputs.Recalculate Interest' | translate }} - -
- - @if (loanProductSettingsForm.value.isInterestRecalculationEnabled) { - - {{ 'labels.inputs.Pre-closure interest calculation rule' | translate }} - + {{ 'labels.inputs.Repayment strategy' | translate }} + @for ( - preClosureInterestCalculationStrategy of preClosureInterestCalculationStrategyData; - track preClosureInterestCalculationStrategy + transactionProcessingStrategy of transactionProcessingStrategyData; + track transactionProcessingStrategy ) { - - {{ preClosureInterestCalculationStrategy.value | translateKey: 'catalogs' }} + + {{ transactionProcessingStrategy.name | translateKey: 'catalogs' }} } - {{ 'labels.inputs.Pre-closure interest calculation rule' | translate }} - {{ 'labels.commons.is' | translate }} + {{ 'labels.inputs.Repayment strategy' | translate }} {{ 'labels.commons.is' | translate }} {{ 'labels.commons.required' | translate }} - - {{ 'labels.inputs.Advance payments adjustment type' | translate }} - - @for (rescheduleStrategyType of rescheduleStrategyTypeData; track rescheduleStrategyType) { - - {{ rescheduleStrategyType.value | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Advance payments adjustment type' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - - {{ 'labels.inputs.Interest recalculation compounding on' | translate }} - - @for ( - interestRecalculationCompoundingType of interestRecalculationCompoundingTypeData; - track interestRecalculationCompoundingType - ) { - - {{ interestRecalculationCompoundingType.value | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Interest recalculation compounding on' | translate }} - {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - - @if ( - loanProductSettingsForm.value.interestRecalculationCompoundingMethod !== 0 && - loanProductSettingsForm.value.recalculationCompoundingFrequencyType !== 1 - ) { + @if (isAdvancedTransactionProcessingStrategy) { - {{ 'labels.inputs.Frequency Interval for compounding' | translate }} - + {{ 'labels.inputs.Loan Schedule Processing Type' | translate }} + + @for (loanScheduleProcessingType of loanScheduleProcessingTypeData; track loanScheduleProcessingType) { + + {{ loanScheduleProcessingType.value | translateKey: 'catalogs' }} + + } + + + } + + + {{ 'labels.inputs.Interest free period' | translate }} + + + + + Allowed pending EMI amount + + + + @if (!isAdvanceAccount) { + + {{ 'labels.inputs.Days in year' | translate }} + + @for (daysInYearType of daysInYearTypeData; track daysInYearType) { + + {{ daysInYearType.value | translateKey: 'catalogs' }} + + } + - {{ 'labels.inputs.Frequency Interval for compounding' | translate }} - {{ 'labels.commons.is' | translate }} + {{ 'labels.inputs.Days in year' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + + @if (useDaysInYearCustomStrategy) { + + {{ 'labels.inputs.Days in year custom strategy' | translate }} + + @for (daysInYearCustomStrategy of daysInYearCustomStrategyOptions; track daysInYearCustomStrategy) { + + {{ daysInYearCustomStrategy.value | translateKey: 'catalogs' }} + + } + + + } + + + {{ 'labels.inputs.Days in month' | translate }} + + @for (daysInMonthType of daysInMonthTypeData; track daysInMonthType) { + + {{ daysInMonthType.value | translateKey: 'catalogs' }} + + } + + + {{ 'labels.inputs.Days in month' | translate }} {{ 'labels.commons.is' | translate }} {{ 'labels.commons.required' | translate }} } - @if (loanProductSettingsForm.value.recalculationRestFrequencyType !== 1) { + + @if (isAdvanceAccount) { - {{ 'labels.inputs.Frequency Interval for recalculation' | translate }} - + {{ 'labels.inputs.Loan Period' | translate }} + + @for (loanPeriod of loanPeriodOptions; track loanPeriod.value) { + + {{ loanPeriod.label }} + + } + - {{ 'labels.inputs.Frequency Interval for recalculation' | translate }} - {{ 'labels.commons.is' | translate }} {{ 'labels.commons.required' | translate }} + {{ 'labels.inputs.Loan Period' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} } - - @if (loanProductSettingsForm.value.interestRecalculationCompoundingMethod !== 0) { + @if (!isAdvanceAccount) { +
+ + {{ 'labels.inputs.Allow fixing of the installment amount' | translate }} + +
+ } +
+ + + + + + + + Cheque Book Settings + + +
+ + Cheque Book Issue Enabled + + YES + NO + + + + + Cheque Validation Required + + YES + NO + + + + + Is First Cheque Book Free + + YES + NO + + + + + Cheque Printing Account Type + + Savings Bank + Current Account + Cash Credit + Overdraft + + + + + Allow Withdrawal Slip Usage + + YES + NO + + + + + Maintain Cheque Book Stock Registry + + YES + NO + + + + + Free Cheque Books Per Year + + + + + Allow Credit By Cheque Number + + YES + NO + + + + + Credit Cheque Validation Required + + YES + NO + + + + + Grace Days For Stock Statement + + +
+
+ + + + + + + Additional Product Settings + + +
+ + Account Type Active For Transactions + + YES + NO + + + + + Sub Type Activity Enabled + + YES + NO + + + + + Account Opening Charges + + + + + Maximum Gold Loan Limit + + + + + Last Account Number Opened + + + + + Customer Termination Allowed + + YES + NO + + + + + Charges For Cash Credit Above Limit + + + + + Death Interest GL Account + + + + + Starting Ledger Number + + + + + Ending Ledger Number + + + + + Current Ledger Number + + + + + Remittance Account Number + + + + + Is Non Resident Indian Account + + YES + NO + + + + + Debit Clearing GL Account + + + + + Missed Call Alert Service Active + + YES + NO + + + + + Standing Instruction Charge GL Account + + + + + Standing Instruction Debit Charge Skip Option + + Skip Always + Skip on First Failure + Never Skip + Retry after 24 Hours + + + + + Opening Balance Multiplier For Remittance Charges + + +
+
+ + + + + + + Interest Related Parameters + + +
+ + Drawing Power And Limit Generation Procedure + + Normal D.P. Entry Is Considered + Against F.D. Interest with Certificate Wise Interest Rate + Based on Asset Value + Monthly Stock Statement Basis + + + + + Advances Interest Calculation Method + + Debit Closing Balance Considered as Product + + + + + Against Interest Calculation Enabled + + YES + NO + + + + + Day Wise Against Clearing Interest Rounding + + YES + NO + + + + + Interest Calculation One Fourth Method + + 0 (Standard) + 1 (Custom A) + 2 (Custom B) + + + + + Against Clearing Interest Procedure Type + + Normal Against Clearing Interest + + + + + Consider Debit Closing Amount For Against Clearing + + YES + NO + + + + + Interest Rounding Method + + All Int. Round + Nearest Rupee + Round Up + Round Down + + + + + Penalty Interest Calculation Enabled + + YES + NO + + + + + Penalty Interest Calculation Method + + Daywise ( 36500 ) + + + + + Penalty Interest Procedure Number + + On Debit, Penalty Product is Closing Balance + Limit is Considered for Penalty Product + + + + + Overdrawn Interest Calculation Method + + Overdrawn = Balance - Limit + Overdrawn = Balance - D.P. + Don't Calculate + + + + + Calculate Overdrawn Interest After Renewal + + YES + NO + + + + + Interest On Credit Balance + + YES + NO + + + + + Penalty Interest Date Different Than Regular Interest + + YES + NO + + + + + Fixed Deposit Overdraft Certificate Sort Order + + Order on Interest Rate + Order on Drawing Power + + + + + Use Document Submission Date For Interest + + YES + NO + + + + + Loan Management System Renewal Penalty Active + + YES + NO + + + + + Minimum Normal Interest Amount + + + + + Minimum Interest Calculation Method + + Flat Amount + Percentage of Balance + Tier Based + + + + + Minimum Against Clearing Interest Amount + + + + + Limit Increase Upto Interest Amount In Interest Calculation + + YES + NO + + + + + Minimum Penalty Interest Amount + + + + + Days For Limit Increase Upto Interest Amount + + + + + Additional Interest Rate For Fixed Deposit Overdraft + + + + + Consider DD/Payorder In Against Clearing Interest Calculation + + YES + NO + + + + + Grace Days After Renewal Date + + + + + Apply Undebited Interest Concept Enabled + + YES + NO + + + + + Interest Register Print Format Type + + Interest Amount with Opening Balance + Interest Only + Full Ledger Format + + + + + Normal Grace Days After Overdue + + + + + Allow Against Clearing Entry + + YES + NO + + + + + Allow No Balance Entry + + YES + NO + + + + + Fixed Deposit Overdraft Penalty Interest Combined With Normal Interest + + YES + NO + + + + + Allow No Balance Entry With Password + + YES + NO + + + + + Undebited Simple Interest Account Wise + + YES + NO + + + + + Daily Interest Calculation Enabled + + YES + NO + + + + + Daily Interest Calculation Start Date + + + + + Non Performing Asset Penal Interest Rate Update + + YES + NO + + + + + Non Performing Asset Penal Interest Rate + + + + + Fixed Deposit Overdraft Penal Interest Rate Update In Branch Process + + YES + NO + + + + + Add Penal Interest Rate + + +
+
+ + + + + + + RBI Compliance & KFS Settings + + +
+ + Penal Charge Method + + RBI Compliant Penal Charges (Non-Compounding) + Legacy Penal Interest (Compounding) + + + +
+ + Is Floating Rate Loan? (Individual) + +
+ + + Foreclosure Charges Applicable + + YES + NO + + RBI: No charges for Floating Rate Loans to Individuals + + +
+ + Enable Key Fact Statement (KFS) + +
+ +
+ + Calculate APR + +
+
+
+ + + + + + + Credit Bureau Settings (CIBIL/Highmark) + + +
+ + Loan Product Category (RBI Reporting) + + Personal/Consumer Loan (Code 02) + Housing/Mortgage Loan (Code 15) + Business/Commercial Loan (Code 50) + Vehicle/Auto Loan (Code 04) + + Selecting a category will auto-fill the credit bureau account types below. + + + CIBIL Account Type + + + + + CIBIL Commercial Account Type + + + + + Highmark Account Type + + + + + Highmark Commercial Account Type + + + + + Experian Account Type + + + + + Experian Commercial Account Type + + + + + Equifax Account Type + + + + + Equifax Commercial Account Type + + +
+
+ + + + + + + {{ 'labels.inputs.Moratorium' | translate }} + + + +
+ + {{ 'labels.inputs.Grace on principal payment' | translate }} + + + + + {{ 'labels.inputs.Grace on interest payment' | translate }} + + + + + {{ 'labels.inputs.Delinquency Bucket' | translate }} + + @for (delinquencyBucket of delinquencyBucketData; track delinquencyBucket) { + + {{ delinquencyBucket.name }} + + } + + @if (loanProductSettingsForm.controls.delinquencyBucketId) { + + } + + + @if (loanProductSettingsForm.value.delinquencyBucketId) { +
+ + {{ 'labels.inputs.Enable installment level Delinquency' | translate }} + +
+ } +
+
+ + + + + + + {{ 'labels.inputs.Number of days a loan may be overdue before moving into arrears' | translate }} + + +
+ + {{ 'labels.inputs.On arrears ageing' | translate }} + + + + + {{ 'labels.inputs.Overdue days for NPA' | translate }} + + + +
+ + {{ 'labels.inputs.Account moves out of NPA only after all arrears have been cleared' | translate }} + +
+ + + {{ 'labels.inputs.Principal Threshold (%) for Last Instalment' | translate }} + + +
+
+ + + + + + + {{ 'labels.inputs.Variable Installments' | translate }} + + +
+
+ + {{ 'labels.inputs.Are Variable Installments allowed?' | translate }} + +
+ + @if (loanProductSettingsForm.value.allowVariableInstallments) { - {{ 'labels.inputs.Frequency for compounding' | translate }} - + {{ 'labels.inputs.Minimum gap between Installments' | translate }} + + + {{ 'labels.inputs.Minimum gap between Installments' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + + {{ 'labels.inputs.Maximum gap between Installments' | translate }} + + + {{ 'labels.inputs.Maximum gap between Installments' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + } + +
+ + {{ 'labels.inputs.Allowed to be used for providing Topup Loans' | translate }} + +
+
+
+ + + + + + + {{ 'labels.heading.Interest Recalculation' | translate }} + + +
+
+ + {{ 'labels.inputs.Recalculate Interest' | translate }} + +
+ + @if (loanProductSettingsForm.value.isInterestRecalculationEnabled) { + + {{ 'labels.inputs.Pre-closure interest calculation rule' | translate }} + + @for ( + preClosureInterestCalculationStrategy of preClosureInterestCalculationStrategyData; + track preClosureInterestCalculationStrategy + ) { + + {{ preClosureInterestCalculationStrategy.value | translateKey: 'catalogs' }} + + } + + + {{ 'labels.inputs.Pre-closure interest calculation rule' | translate }} + {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + + + {{ 'labels.inputs.Advance payments adjustment type' | translate }} + + @for (rescheduleStrategyType of rescheduleStrategyTypeData; track rescheduleStrategyType) { + + {{ rescheduleStrategyType.value | translateKey: 'catalogs' }} + + } + + + {{ 'labels.inputs.Advance payments adjustment type' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + + + {{ 'labels.inputs.Interest recalculation compounding on' | translate }} + + @for ( + interestRecalculationCompoundingType of interestRecalculationCompoundingTypeData; + track interestRecalculationCompoundingType + ) { + + {{ interestRecalculationCompoundingType.value | translateKey: 'catalogs' }} + + } + + + {{ 'labels.inputs.Interest recalculation compounding on' | translate }} + {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + + + @if ( + loanProductSettingsForm.value.interestRecalculationCompoundingMethod !== 0 && + loanProductSettingsForm.value.recalculationCompoundingFrequencyType !== 1 + ) { + + {{ 'labels.inputs.Frequency Interval for compounding' | translate }} + + + {{ 'labels.inputs.Frequency Interval for compounding' | translate }} + {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + } + @if (loanProductSettingsForm.value.recalculationRestFrequencyType !== 1) { + + {{ 'labels.inputs.Frequency Interval for recalculation' | translate }} + + + {{ 'labels.inputs.Frequency Interval for recalculation' | translate }} + {{ 'labels.commons.is' | translate }} {{ 'labels.commons.required' | translate }} + + + } + + + @if (loanProductSettingsForm.value.interestRecalculationCompoundingMethod !== 0) { + + {{ 'labels.inputs.Frequency for compounding' | translate }} + + @for ( + interestRecalculationFrequencyType of interestRecalculationFrequencyTypeData; + track interestRecalculationFrequencyType + ) { + + {{ interestRecalculationFrequencyType.value }} + + } + + + + @if (loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 4) { + + + @for ( + interestRecalculationNthDayType of interestRecalculationNthDayTypeData; + track interestRecalculationNthDayType + ) { + + {{ interestRecalculationNthDayType.value | translateKey: 'catalogs' }} + + } + + + } + + @if ( + (loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 4 && + loanProductSettingsForm.value.recalculationCompoundingFrequencyNthDayType !== -2) || + loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 3 + ) { + + + @for ( + interestRecalculationDayOfWeekType of interestRecalculationDayOfWeekTypeData; + track interestRecalculationDayOfWeekType + ) { + + {{ interestRecalculationDayOfWeekType.value | translateKey: 'catalogs' }} + + } + + + } + + @if ( + loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 4 && + loanProductSettingsForm.value.recalculationCompoundingFrequencyNthDayType === -2 + ) { + + + @for ( + interestRecalculationOnDayType of interestRecalculationOnDayTypeData; + track interestRecalculationOnDayType + ) { + + {{ interestRecalculationOnDayType }} + + } + + + } + } + + + + {{ 'labels.inputs.Frequency for recalculate Outstanding Principal' | translate }} + @for ( interestRecalculationFrequencyType of interestRecalculationFrequencyTypeData; track interestRecalculationFrequencyType ) { - {{ interestRecalculationFrequencyType.value }} + {{ interestRecalculationFrequencyType.value | translateKey: 'catalogs' }} } + + {{ 'labels.inputs.Frequency for recalculate Outstanding Principal' | translate }} + {{ 'labels.commons.is' | translate }} {{ 'labels.commons.required' | translate }} + - @if (loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 4) { + @if (loanProductSettingsForm.value.recalculationRestFrequencyType === 4) { - + @for ( interestRecalculationNthDayType of interestRecalculationNthDayTypeData; track interestRecalculationNthDayType @@ -1114,12 +1226,12 @@ } @if ( - (loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 4 && - loanProductSettingsForm.value.recalculationCompoundingFrequencyNthDayType !== -2) || - loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 3 + (loanProductSettingsForm.value.recalculationRestFrequencyType === 4 && + loanProductSettingsForm.value.recalculationRestFrequencyNthDayType !== -2) || + loanProductSettingsForm.value.recalculationRestFrequencyType === 3 ) { - + @for ( interestRecalculationDayOfWeekType of interestRecalculationDayOfWeekTypeData; track interestRecalculationDayOfWeekType @@ -1133,11 +1245,11 @@ } @if ( - loanProductSettingsForm.value.recalculationCompoundingFrequencyType === 4 && - loanProductSettingsForm.value.recalculationCompoundingFrequencyNthDayType === -2 + loanProductSettingsForm.value.recalculationRestFrequencyType === 4 && + loanProductSettingsForm.value.recalculationRestFrequencyNthDayType === -2 ) { - + @for ( interestRecalculationOnDayType of interestRecalculationOnDayTypeData; track interestRecalculationOnDayType @@ -1149,205 +1261,138 @@ } - } - - - {{ 'labels.inputs.Frequency for recalculate Outstanding Principal' | translate }} - - @for ( - interestRecalculationFrequencyType of interestRecalculationFrequencyTypeData; - track interestRecalculationFrequencyType - ) { - - {{ interestRecalculationFrequencyType.value | translateKey: 'catalogs' }} - - } - - - {{ 'labels.inputs.Frequency for recalculate Outstanding Principal' | translate }} - {{ 'labels.commons.is' | translate }} {{ 'labels.commons.required' | translate }} - - - - @if (loanProductSettingsForm.value.recalculationRestFrequencyType === 4) { - - - @for ( - interestRecalculationNthDayType of interestRecalculationNthDayTypeData; - track interestRecalculationNthDayType - ) { - - {{ interestRecalculationNthDayType.value | translateKey: 'catalogs' }} - - } - - - } - - @if ( - (loanProductSettingsForm.value.recalculationRestFrequencyType === 4 && - loanProductSettingsForm.value.recalculationRestFrequencyNthDayType !== -2) || - loanProductSettingsForm.value.recalculationRestFrequencyType === 3 - ) { - - - @for ( - interestRecalculationDayOfWeekType of interestRecalculationDayOfWeekTypeData; - track interestRecalculationDayOfWeekType - ) { - - {{ interestRecalculationDayOfWeekType.value | translateKey: 'catalogs' }} - - } - - - } - - @if ( - loanProductSettingsForm.value.recalculationRestFrequencyType === 4 && - loanProductSettingsForm.value.recalculationRestFrequencyNthDayType === -2 - ) { - - - @for ( - interestRecalculationOnDayType of interestRecalculationOnDayTypeData; - track interestRecalculationOnDayType - ) { - - {{ interestRecalculationOnDayType }} - - } - - - } - -
- - {{ 'labels.inputs.Is Arrears recognization based on original schedule' | translate }}? - -
- - @if (loanProductSettingsForm.value.loanScheduleType === 'PROGRESSIVE') {
- - {{ 'labels.inputs.Do not calculate interest on past due principal balances' | translate }} + + {{ 'labels.inputs.Is Arrears recognization based on original schedule' | translate }}? + +
+ + @if (loanProductSettingsForm.value.loanScheduleType === 'PROGRESSIVE') { +
+ + {{ 'labels.inputs.Do not calculate interest on past due principal balances' | translate }} + +
+ } + +
+ + {{ 'labels.inputs.Allow accrual posting in arrears' | translate }} + +
+ +
+ + {{ 'labels.inputs.Allow compounding on EOD' | translate }} + +
+ +
+ + {{ 'labels.inputs.Post compounding as transaction' | translate }}
} - -
- - {{ 'labels.inputs.Allow accrual posting in arrears' | translate }} - -
- -
- - {{ 'labels.inputs.Allow compounding on EOD' | translate }} - -
- -
- - {{ 'labels.inputs.Post compounding as transaction' | translate }} - -
- } -
-
- - -
-
- -

{{ 'labels.heading.Guarantee Requirements' | translate }}

-
-
-
- - {{ 'labels.inputs.Place Guarantee Funds On-Hold' | translate }} -
+ - @if (loanProductSettingsForm.value.holdGuaranteeFunds) { - - {{ 'labels.inputs.Mandatory Guarantee(%)' | translate }} - - - {{ 'labels.inputs.Mandatory Guarantee(%)' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - - {{ 'labels.inputs.Minimum Guarantee from Own Funds(%)' | translate }} - - - - {{ 'labels.inputs.Minimum Guarantee from Guarantor Funds(%)' | translate }} - - - } -
-
- - -
-
- -

{{ 'labels.inputs.Configurable Terms and Settings' | translate }}

-
-
-
- - {{ 'labels.inputs.Allow overriding select terms and settings in loan accounts' | translate }} - -
- - @if (loanProductSettingsForm.value.allowAttributeConfiguration) { -
-
- - {{ 'labels.inputs.Amortization' | translate }} - -
-
- - {{ 'labels.inputs.Interest method' | translate }} - -
-
- - {{ 'labels.inputs.Repayment strategy' | translate }} - -
-
- - {{ 'labels.inputs.Interest calculation period' | translate }} - -
-
- - Allowed pending EMI amount - -
-
- - {{ 'labels.inputs.Repaid every' | translate }} - -
-
- - {{ 'labels.inputs.Moratorium' | translate }} - -
-
- - {{ 'labels.inputs.Number of days a loan may be overdue before moving into arrears' | translate }} - -
+ + + + + + {{ 'labels.heading.Guarantee Requirements' | translate }} + + +
+
+ + {{ 'labels.inputs.Place Guarantee Funds On-Hold' | translate }} +
- } -
-
+ + @if (loanProductSettingsForm.value.holdGuaranteeFunds) { + + {{ 'labels.inputs.Mandatory Guarantee(%)' | translate }} + + + {{ 'labels.inputs.Mandatory Guarantee(%)' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + + {{ 'labels.inputs.Minimum Guarantee from Own Funds(%)' | translate }} + + + + {{ 'labels.inputs.Minimum Guarantee from Guarantor Funds(%)' | translate }} + + + } +
+ + + + + + + + {{ 'labels.inputs.Configurable Terms and Settings' | translate }} + + +
+
+ + {{ 'labels.inputs.Allow overriding select terms and settings in loan accounts' | translate }} + +
+ + @if (loanProductSettingsForm.value.allowAttributeConfiguration) { +
+
+ + {{ 'labels.inputs.Amortization' | translate }} + +
+
+ + {{ 'labels.inputs.Interest method' | translate }} + +
+
+ + {{ 'labels.inputs.Repayment strategy' | translate }} + +
+
+ + {{ 'labels.inputs.Interest calculation period' | translate }} + +
+
+ + Allowed pending EMI amount + +
+
+ + {{ 'labels.inputs.Repaid every' | translate }} + +
+
+ + {{ 'labels.inputs.Moratorium' | translate }} + +
+
+ + {{ 'labels.inputs.Number of days a loan may be overdue before moving into arrears' | translate }} + +
+
+ } +
+
+ diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.scss b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.scss index 50934aecc..c14c4b170 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.scss +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.scss @@ -71,6 +71,16 @@ } } +.lps-panel { + & + & { + margin-top: 12px; + } + + .lps-section__body { + padding-top: 8px; + } +} + .lps-full-width { grid-column: 1 / -1; } diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts index d230afc79..5153727bf 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts @@ -22,6 +22,12 @@ import { MatTooltip } from '@angular/material/tooltip'; import { MatCheckbox } from '@angular/material/checkbox'; import { MatIconButton } from '@angular/material/button'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; +import { + MatAccordion, + MatExpansionPanel, + MatExpansionPanelHeader, + MatExpansionPanelTitle +} from '@angular/material/expansion'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @Component({ @@ -35,7 +41,11 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; MatCheckbox, MatIconButton, FaIconComponent, - ReactiveFormsModule + ReactiveFormsModule, + MatAccordion, + MatExpansionPanel, + MatExpansionPanelHeader, + MatExpansionPanelTitle ] }) export class LoanProductSettingsStepComponent implements OnInit { @@ -44,9 +54,35 @@ export class LoanProductSettingsStepComponent implements OnInit { @Input() toEdit: boolean; @Input() loanProductsTemplate: any; - @Input() isLinkedToFloatingInterestRates: UntypedFormControl; + @Input() productTypeGroup: UntypedFormControl; @Output() advancePaymentStrategy = new EventEmitter(); + /** + * 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; amortizationTypeData: any; @@ -74,6 +110,15 @@ export class LoanProductSettingsStepComponent implements OnInit { daysInYearCustomStrategyOptions: OptionData[] = []; 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 */ defaultConfigValues: GlobalConfiguration[] = []; @@ -84,12 +129,13 @@ export class LoanProductSettingsStepComponent implements OnInit { ngOnInit() { this.defaultConfigValues = this.loanProductsTemplate['itemsByDefault']; - this.isLinkedToFloatingInterestRates.valueChanges.subscribe((isLinkedToFloatingInterestRates: any) => { - if (isLinkedToFloatingInterestRates) { - this.loanProductSettingsForm.get('isInterestRecalculationEnabled').setValue(true); - this.loanProductSettingsForm.get('allowPartialPeriodInterestCalculation').setValue(true); - } - }); + + if (this.productTypeGroup) { + this.applyAdvanceAccountRules(this.productTypeGroup.value === 'advances'); + this.productTypeGroup.valueChanges.subscribe((productTypeGroup: string) => { + this.applyAdvanceAccountRules(productTypeGroup === 'advances'); + }); + } this.amortizationTypeData = this.loanProductsTemplate.amortizationTypeOptions; this.interestTypeData = this.loanProductsTemplate.interestTypeOptions; @@ -334,6 +380,8 @@ export class LoanProductSettingsStepComponent implements OnInit { Validators.required ], allowAccrualPostingInArrears: [false], + // Advances A/C only; UI-only for now, stripped from the payload in loan-products.ts buildPayload(). + loanPeriod: [''], // Cheque Book Settings 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() { const allowAttributeOverrides = this.loanProductSettingsForm.get('allowAttributeOverrides'); diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html index 6e765fbe3..7b68bec2d 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html @@ -264,6 +264,62 @@ }
+ +
+
+ +

Interest Information

+
+
+ + Debit Int. Calculation + + YES + NO + + + + + Separate Penal Int. + + YES + NO + + + + + Credit Int. Calculation + + YES + NO + + + + + Sub A/c Type Balance + + YES + NO + + + + + Final Int. Rounding + + YES + NO + + + + @if (loanProductTermsForm.value.finalIntRounding) { + + Rounding UpTo + + + } +
+
+
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts index 9e457b6d8..92f7e797b 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts @@ -111,7 +111,13 @@ export class LoanProductTermsStepComponent implements OnInit, OnChanges { repaymentStartDateType: this.loanProductsTemplate.repaymentStartDateType.id || 1, debitBalanceAllow: this.loanProductsTemplate.debitBalanceAllow ?? 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) { @@ -213,7 +219,14 @@ export class LoanProductTermsStepComponent implements OnInit, OnChanges { fixedLength: [null], debitBalanceAllow: [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] }); } diff --git a/src/app/products/loan-products/loan-products.ts b/src/app/products/loan-products/loan-products.ts index 884b0a087..52e913db3 100644 --- a/src/app/products/loan-products/loan-products.ts +++ b/src/app/products/loan-products/loan-products.ts @@ -45,9 +45,29 @@ export class LoanProducts { dateFormat, locale }; - // Remove unnecessary properties + // Remove UI-only flags that are never valid loan-product parameters (both paths). delete loanProduct.allowAttributeConfiguration; 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 // allowPartialPeriodInterestCalculation. Until that is fixed, we need to replace the field name in the payload. From 7c868ae07314e345cbe9b56000d56a0b40454660 Mon Sep 17 00:00:00 2001 From: Sonali Likhitkar Date: Mon, 5 Oct 2026 16:20:36 +0530 Subject: [PATCH 2/3] feat(loan-products): add loan interest rate register UI - Add Loan Interest Rate Register screen with CIBIL adjustment and edit-register views, backed by rate-register service and model - Wire the new screen into products routing and the products menu - Update loan product details and advance limit/tenure steps Co-Authored-By: Claude Sonnet 5.5 --- .../cibil-adjustment.component.html | 166 +++++++ .../cibil-adjustment.component.scss | 344 +++++++++++++ .../cibil-adjustment.component.ts | 162 +++++++ .../edit-register.component.html | 114 +++++ .../edit-register.component.scss | 323 +++++++++++++ .../edit-register/edit-register.component.ts | 196 ++++++++ ...loan-interest-rate-register.component.html | 83 ++++ ...loan-interest-rate-register.component.scss | 212 ++++++++ .../loan-interest-rate-register.component.ts | 78 +++ .../models/rate-register.model.ts | 52 ++ .../rate-register.service.ts | 457 ++++++++++++++++++ ...uct-advance-limit-tenure-step.component.ts | 2 +- .../loan-product-details-step.component.html | 6 +- .../loan-product-details-step.component.ts | 32 +- src/app/products/products-routing.module.ts | 23 + src/app/products/products.component.html | 13 + 16 files changed, 2252 insertions(+), 11 deletions(-) create mode 100644 src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html create mode 100644 src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss create mode 100644 src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts create mode 100644 src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html create mode 100644 src/app/products/loan-interest-rate-register/edit-register/edit-register.component.scss create mode 100644 src/app/products/loan-interest-rate-register/edit-register/edit-register.component.ts create mode 100644 src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.html create mode 100644 src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.scss create mode 100644 src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.ts create mode 100644 src/app/products/loan-interest-rate-register/models/rate-register.model.ts create mode 100644 src/app/products/loan-interest-rate-register/rate-register.service.ts diff --git a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html new file mode 100644 index 000000000..92b80c9de --- /dev/null +++ b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html @@ -0,0 +1,166 @@ + + +
+
+
CS
+
+

CIBIL / credit score adjustment

+

Applied on top of the chart rate at loan sanction · reused across all loan products linked to this register

+
+ +
+ +
+
+
+
+
Credit score slabs
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
#Score fromScore toRisk tierTypeAdjustment
{{ i + 1 }}{{ slab.from }}{{ slab.to }} + {{ slab.tier }} + {{ slab.type }} + {{ formatPct(slab.adjustmentPct) }} + ⋯
+
+ +
+
+
Fallback behaviour
+
+
+ + +
+
+ + +
+
+
+
+
+ +
+
+
+
Live preview
+
pick a scenario
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
RATE DERIVATION
+
+ Chart cell — {{ productLabel(previewProductSrNo) }} + {{ + chartCell() !== null ? (chartCell() | number: '1.2-2') + '%' : 'N.A.' + }} +
+
+ CIBIL {{ previewCibil }} ({{ cibilSlab()?.tier ?? '—' }}) + + {{ formatPct(cibilSlab()?.adjustmentPct ?? 0) }} + +
+
+ Product floor / ceiling + no clamp +
+
+
+ Final rate + {{ finalRate() }} +
+
+
+
+ +
+
+
What changes if…
+
+
+ CIBIL = 700 + {{ rateFor(700) }} +
+
+ CIBIL = 870 + {{ rateFor(870) }} +
+
+ No CIBIL fetched + {{ rateForFallback() }} +
+
+
+
+
+
+ + +
diff --git a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss new file mode 100644 index 000000000..243151aa0 --- /dev/null +++ b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss @@ -0,0 +1,344 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +.ca { + background: #f8fafc; + min-height: calc(100vh - 160px); + padding: 20px 32px; + display: flex; + flex-direction: column; + gap: 16px; + + &__header { + display: flex; + align-items: center; + gap: 14px; + padding: 20px 24px; + background: white; + border: 1px solid #e2e8f0; + border-radius: 10px; + } + + &__header-icon { + width: 40px; + height: 40px; + border-radius: 9px; + background: #dbeafe; + color: #1d4ed8; + display: flex; + align-items: center; + justify-content: center; + font-size: 15px; + font-weight: 700; + } + + &__header-text { + flex: 1; + + h2 { + margin: 0; + font-size: 20px; + font-weight: 600; + } + + p { + margin: 3px 0 0; + font-size: 12px; + color: #64748b; + } + } + + &__body { + display: grid; + grid-template-columns: 1.3fr 1fr; + gap: 16px; + } + + &__left, + &__right { + display: flex; + flex-direction: column; + gap: 14px; + } + + &__card { + background: white; + border: 1px solid #e2e8f0; + border-radius: 10px; + overflow: hidden; + } + + &__card-head { + padding: 12px 16px; + border-bottom: 1px solid #f1f5f9; + display: flex; + align-items: center; + gap: 10px; + } + + &__card-title { + font-size: 14px; + font-weight: 600; + } + + &__card-hint { + margin-left: auto; + font-size: 11px; + color: #64748b; + } + + &__card-body { + padding: 14px 18px; + display: flex; + flex-direction: column; + gap: 12px; + } + + &__dash-btn { + margin-left: auto; + height: 28px; + font-size: 11px; + font-weight: 600; + color: #1d4ed8; + border: 1px dashed #1d4ed8; + + i { + margin-right: 3px; + } + } + + &__table { + width: 100%; + border-collapse: collapse; + font-size: 13px; + + thead tr { + background: #f8fafc; + color: #64748b; + font-size: 10px; + text-transform: uppercase; + letter-spacing: 0.3px; + + th { + text-align: left; + padding: 9px 14px; + font-weight: 600; + } + } + + tbody tr { + border-top: 1px solid #f1f5f9; + + td { + padding: 11px 14px; + } + } + } + + &__row-alt { + background: #fafbfc; + } + + &__num { + text-align: right; + } + + &__dots { + text-align: center; + color: #94a3b8; + cursor: pointer; + } + + &__fallback-grid, + &__preview-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 14px; + } + + &__field { + display: flex; + flex-direction: column; + + label { + font-size: 11px; + color: #64748b; + font-weight: 600; + letter-spacing: 0.3px; + margin-bottom: 4px; + } + + input, + select { + height: 36px; + border: 1px solid #cbd5e1; + background: white; + border-radius: 6px; + padding: 0 12px; + font-size: 13px; + color: #0f172a; + font-family: inherit; + + &:focus { + outline: 2px solid #1d4ed8; + outline-offset: -1px; + } + } + } + + &__derivation { + padding: 12px 14px; + background: #f8fafc; + border-radius: 8px; + } + + &__derivation-label { + font-size: 11px; + color: #64748b; + font-weight: 600; + letter-spacing: 0.3px; + margin-bottom: 8px; + } + + &__derivation-row { + display: flex; + justify-content: space-between; + font-size: 12px; + padding: 3px 0; + + &--muted { + color: #64748b; + } + } + + &__derivation-val { + font-weight: 600; + + &--pos { + color: #059669; + } + + &--neg { + color: #dc2626; + } + } + + &__divider { + height: 1px; + background: #e2e8f0; + margin: 8px 0; + } + + &__final { + display: flex; + justify-content: space-between; + align-items: center; + + span:first-child { + font-size: 12px; + font-weight: 600; + } + } + + &__final-val { + font-size: 20px; + font-weight: 700; + color: #1d4ed8; + } + + &__scenarios { + display: flex; + flex-direction: column; + gap: 8px; + font-size: 12px; + color: #334155; + } + + &__scenario { + padding: 8px 10px; + background: #f8fafc; + border-radius: 6px; + display: flex; + justify-content: space-between; + + span:last-child { + font-weight: 600; + } + } + + &__scenario-val--pos { + color: #059669; + } + + &__scenario-val--warn { + color: #d97706; + } + + &__footer { + background: white; + border: 1px solid #e2e8f0; + border-radius: 10px; + padding: 10px 16px; + display: flex; + align-items: center; + justify-content: space-between; + } + + &__footer-note { + font-size: 11px; + color: #64748b; + } +} + +.tier { + padding: 3px 8px; + border-radius: 4px; + font-size: 11px; + font-weight: 600; + + &--poor { + background: #fee2e2; + color: #991b1b; + } + + &--fair { + background: #fef3c7; + color: #92400e; + } + + &--good { + background: #dbeafe; + color: #1e40af; + } + + &--vgood { + background: #dcfce7; + color: #166534; + } + + &--excellent { + background: #d1fae5; + color: #065f46; + } +} + +.adj { + font-weight: 600; + + &--negative { + color: #059669; + } + + &--positive { + color: #d97706; + } + + &--high { + color: #dc2626; + } +} diff --git a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts new file mode 100644 index 000000000..4a183cabf --- /dev/null +++ b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts @@ -0,0 +1,162 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import { Component, OnInit, inject } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ActivatedRoute, Router } from '@angular/router'; +import { FormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; +import { RateRegisterService } from '../rate-register.service'; +import { CibilSlab, RateRegister } from '../models/rate-register.model'; + +/** + * CIBIL/credit-score adjustment editor for a Rate Register — slab table, fallback behaviour + * and a live preview that resolves {product, loan amount, CIBIL} down to the final rate. + */ +@Component({ + selector: 'mifosx-cibil-adjustment', + templateUrl: './cibil-adjustment.component.html', + styleUrls: ['./cibil-adjustment.component.scss'], + imports: [ + CommonModule, + FormsModule, + MatButtonModule, + MatFormFieldModule, + MatInputModule, + MatSelectModule + ] +}) +export class CibilAdjustmentComponent implements OnInit { + private readonly service = inject(RateRegisterService); + private readonly route = inject(ActivatedRoute); + private readonly router = inject(Router); + + register!: RateRegister; + + // Live preview inputs. + previewProductSrNo = 7; // House Purchase / Construction + previewAmount = 2500000; + previewCibil = 820; + previewTenureMonths = 120; + + ngOnInit(): void { + const idParam = this.route.snapshot.queryParamMap.get('id'); + const id = idParam ? Number(idParam) : null; + this.service.list().subscribe((all) => { + this.register = (id ? all.find((r) => r.id === id) : undefined) ?? this.service.getActiveOrFirstDraft(); + }); + } + + tierClass(tier: CibilSlab['tier']): string { + const map: Record = { + Poor: 'tier tier--poor', + Fair: 'tier tier--fair', + Good: 'tier tier--good', + 'V. Good': 'tier tier--vgood', + Excellent: 'tier tier--excellent' + }; + return map[tier] ?? 'tier'; + } + + adjustmentClass(pct: number): string { + if (pct < 0) { + return 'adj adj--negative'; + } + if (pct > 0) { + return pct >= 1 ? 'adj adj--high' : 'adj adj--positive'; + } + return 'adj'; + } + + formatPct(pct: number): string { + if (pct === 0) { + return '0.00%'; + } + const sign = pct > 0 ? '+' : '−'; + return `${sign}${Math.abs(pct).toFixed(2)}%`; + } + + /** Looks up the chart cell for the currently previewed scenario. */ + private chartRateFor(productSrNo: number, amount: number): number | null { + const row = this.register.rows.find((r) => r.srNo === productSrNo); + if (!row) { + return null; + } + for (let i = 0; i < this.register.slabs.length; i++) { + const slab = this.register.slabs[i]; + const upto = slab.amountUpto; + if (upto === null || amount <= upto) { + const cell = row.rates[i]; + if (cell === null) { + return null; + } + if (typeof cell === 'string') { + // Formula cell — in a real derive we'd resolve against the pledged deposit's rate. + return null; + } + return cell; + } + } + return null; + } + + private cibilAdjustmentFor(score: number): CibilSlab | null { + return this.register.cibilSlabs.find((s) => score >= s.from && score <= s.to) ?? null; + } + + chartCell(): number | null { + return this.chartRateFor(this.previewProductSrNo, this.previewAmount); + } + + cibilSlab(): CibilSlab | null { + return this.cibilAdjustmentFor(this.previewCibil); + } + + finalRate(): string { + const base = this.chartCell(); + const slab = this.cibilSlab(); + if (base === null) { + return 'N.A.'; + } + const adjustment = slab?.adjustmentPct ?? 0; + return `${(base + adjustment).toFixed(2)}% p.a.`; + } + + productLabel(srNo: number): string { + return this.register.rows.find((r) => r.srNo === srNo)?.particulars ?? '—'; + } + + rateFor(cibil: number): string { + const base = this.chartRateFor(this.previewProductSrNo, this.previewAmount); + if (base === null) { + return 'N.A.'; + } + const slab = this.cibilAdjustmentFor(cibil); + return `${(base + (slab?.adjustmentPct ?? 0)).toFixed(2)}%`; + } + + rateForFallback(): string { + const base = this.chartRateFor(this.previewProductSrNo, this.previewAmount); + if (base === null) { + return 'N.A.'; + } + const fallback = this.register.cibilSlabs[this.register.fallbackNoCibilSlab - 1]; + return `${(base + (fallback?.adjustmentPct ?? 0)).toFixed(2)}%`; + } + + backToRegister(): void { + this.router.navigate(['/products/loan-interest-rate-register/edit'], { queryParams: { id: this.register.id } }); + } + + save(): void { + this.backToRegister(); + } +} diff --git a/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html new file mode 100644 index 000000000..02d72204d --- /dev/null +++ b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html @@ -0,0 +1,114 @@ + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ +
+
+
Rate chart grid
+
+ {{ rows.length }} products × {{ slabs.length }} amount slabs · click any cell to edit +
+
+ + +
+
+
+ + + + + + + + + + + + + +
Particulars{{ slab.label }}
+ {{ row.srNo }}{{ row.particulars }} + + + {{ display(cell) }} +
+
+
+ +
+
CS
+
+
CIBIL / credit score adjustment
+
+ {{ register.cibilSlabs.length }} slabs · +1.00% (poor) to −0.20% (excellent) · applied on top of chart rate +
+
+ Edit → +
+ + +
diff --git a/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.scss b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.scss new file mode 100644 index 000000000..e784c658d --- /dev/null +++ b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.scss @@ -0,0 +1,323 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +.er { + background: #f8fafc; + min-height: calc(100vh - 160px); + padding: 20px 24px; + display: flex; + flex-direction: column; + gap: 12px; + + &__meta-bar { + background: white; + border: 1px solid #e2e8f0; + border-radius: 9px; + padding: 12px 14px; + display: flex; + gap: 10px; + align-items: flex-end; + } + + &__field { + display: flex; + flex-direction: column; + flex: 1.5; + + label { + font-size: 10px; + color: #64748b; + font-weight: 600; + letter-spacing: 0.3px; + margin-bottom: 3px; + } + + input, + select { + height: 32px; + border: 1px solid #cbd5e1; + background: white; + border-radius: 6px; + padding: 0 10px; + font-size: 13px; + font-family: inherit; + color: #0f172a; + + &:focus { + outline: 2px solid #1d4ed8; + outline-offset: -1px; + } + } + + &--date { + flex: 0.9; + } + + &--curr { + flex: 0.5; + } + } + + &__meta-btn { + height: 32px; + font-size: 11px; + + i { + margin-right: 4px; + } + } + + &__grid-card { + background: white; + border: 1px solid #e2e8f0; + border-radius: 9px; + overflow: hidden; + display: flex; + flex-direction: column; + flex: 1; + min-height: 500px; + } + + &__grid-head { + padding: 8px 14px; + background: #f8fafc; + border-bottom: 1px solid #e2e8f0; + display: flex; + align-items: center; + gap: 10px; + } + + &__grid-title { + font-size: 12px; + font-weight: 600; + } + + &__grid-sub { + font-size: 10px; + color: #64748b; + } + + &__grid-actions { + margin-left: auto; + display: flex; + gap: 6px; + } + + &__dash-btn { + height: 26px; + font-size: 10px; + font-weight: 600; + color: #1d4ed8; + border: 1px dashed #1d4ed8; + + i { + margin-right: 3px; + } + } + + &__grid-scroll { + overflow: auto; + flex: 1; + } + + &__grid { + width: 100%; + border-collapse: separate; + border-spacing: 0; + font-size: 11px; + + thead tr { + background: #f8fafc; + color: #475569; + font-size: 9px; + text-transform: uppercase; + letter-spacing: 0.3px; + + th { + padding: 8px 7px; + font-weight: 600; + position: sticky; + top: 0; + background: #f8fafc; + border-bottom: 1px solid #e2e8f0; + z-index: 2; + white-space: nowrap; + } + } + + tbody tr { + border-top: 1px solid #f1f5f9; + } + + td { + padding: 7px; + text-align: right; + cursor: text; + + &:first-child { + text-align: left; + } + } + } + + &__col-particulars { + position: sticky; + left: 0; + background: white; + border-right: 1px solid #e2e8f0; + font-weight: 500; + min-width: 240px; + text-align: left !important; + padding-left: 12px !important; + } + + &__row-alt &__col-particulars { + background: #fafbfc; + } + + &__row-alt { + background: #fafbfc; + } + + &__row--formula { + .er__col-particulars { + background: #eff6ff; + color: #1d4ed8; + font-weight: 600; + } + } + + &__srno { + color: #94a3b8; + margin-right: 6px; + } + + &__cell { + cursor: cell; + transition: background-color 0.1s; + + &:hover { + background: #f1f5f9; + outline: 1px solid #cbd5e1; + outline-offset: -1px; + } + + &--na { + color: #cbd5e1; + } + + &--formula { + background: #eff6ff; + color: #1d4ed8; + font-weight: 600; + } + + &--editing { + padding: 0 !important; + background: #fef9c3 !important; + outline: 2px solid #1d4ed8 !important; + outline-offset: -2px; + } + } + + &__cell-input { + width: 100%; + height: 100%; + min-height: 28px; + border: none; + outline: none; + background: transparent; + padding: 7px; + font-size: 11px; + text-align: right; + font-family: inherit; + color: #0f172a; + box-sizing: border-box; + } + + &__cibil-strip { + background: white; + border: 1px solid #e2e8f0; + border-radius: 9px; + padding: 9px 14px; + display: flex; + align-items: center; + gap: 10px; + cursor: pointer; + transition: background-color 0.1s; + + &:hover { + background: #f8fafc; + } + } + + &__cibil-badge { + width: 24px; + height: 24px; + border-radius: 12px; + background: #dbeafe; + color: #1d4ed8; + display: flex; + align-items: center; + justify-content: center; + font-size: 11px; + font-weight: 700; + } + + &__cibil-text { + flex: 1; + } + + &__cibil-title { + font-size: 12px; + font-weight: 600; + } + + &__cibil-sub { + font-size: 10px; + color: #64748b; + margin-top: 1px; + } + + &__cibil-edit { + font-size: 11px; + font-weight: 600; + color: #1d4ed8; + cursor: pointer; + } + + &__footer { + background: white; + border: 1px solid #e2e8f0; + border-radius: 9px; + padding: 10px 14px; + display: flex; + align-items: center; + justify-content: space-between; + } + + &__footer-note { + font-size: 11px; + color: #64748b; + } + + &__footer-actions { + display: flex; + gap: 6px; + } + + &__submit { + background: #059669 !important; + color: white !important; + font-weight: 600; + + i { + margin-right: 4px; + } + } +} diff --git a/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.ts b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.ts new file mode 100644 index 000000000..3d57a6eb4 --- /dev/null +++ b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.ts @@ -0,0 +1,196 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import { Component, ElementRef, OnInit, ViewChild, inject } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ActivatedRoute, Router, RouterLink } from '@angular/router'; +import { FormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; +import { MatIconModule } from '@angular/material/icon'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatNativeDateModule } from '@angular/material/core'; +import { RateRegisterService } from '../rate-register.service'; +import { RateCell, RateChartRow, RateRegister, SlabColumn } from '../models/rate-register.model'; + +/** + * Grid editor for one Loan Interest Rate Register — Excel-shaped: 34 products as rows and 10 + * amount slabs as columns. Cells can hold a plain rate, N.A., or a formula ("1% + FD"). All + * data today comes from {@link RateRegisterService}; wire-up to the real API comes later. + */ +@Component({ + selector: 'mifosx-edit-register', + templateUrl: './edit-register.component.html', + styleUrls: ['./edit-register.component.scss'], + imports: [ + CommonModule, + FormsModule, + RouterLink, + MatButtonModule, + MatFormFieldModule, + MatInputModule, + MatSelectModule, + MatIconModule, + MatDatepickerModule, + MatNativeDateModule + ] +}) +export class EditRegisterComponent implements OnInit { + private readonly service = inject(RateRegisterService); + private readonly route = inject(ActivatedRoute); + private readonly router = inject(Router); + + register!: RateRegister; + slabs: SlabColumn[] = []; + rows: RateChartRow[] = []; + + /** The cell currently being edited (row/column indices into the grid), or null when nothing is open. */ + editing: { row: number; col: number } | null = null; + editValue = ''; + + @ViewChild('cellInput') cellInput?: ElementRef; + + ngOnInit(): void { + const idParam = this.route.snapshot.queryParamMap.get('id'); + const id = idParam ? Number(idParam) : null; + this.service.list().subscribe((all) => { + this.register = (id ? all.find((r) => r.id === id) : undefined) ?? this.service.getActiveOrFirstDraft(); + this.slabs = this.register.slabs; + this.rows = this.register.rows; + }); + } + + /** Formatted display for a cell. */ + display(cell: RateCell): string { + if (cell === null) { + return 'N.A.'; + } + if (typeof cell === 'string') { + return cell; + } + return cell.toFixed(2); + } + + isFormulaRow(row: RateChartRow): boolean { + return !!row.isFormula; + } + + isNa(cell: RateCell): boolean { + return cell === null; + } + + /** Click on a cell → open it as an editable input, pre-filled with the current value. */ + startEdit(rowIdx: number, colIdx: number, current: RateCell): void { + this.editing = { row: rowIdx, col: colIdx }; + if (current === null) { + this.editValue = ''; + } else if (typeof current === 'string') { + this.editValue = current; + } else { + this.editValue = current.toString(); + } + // Let the view render the input, then focus and select its contents. + setTimeout(() => { + const el = this.cellInput?.nativeElement; + if (el) { + el.focus(); + el.select(); + } + }, 0); + } + + isEditing(rowIdx: number, colIdx: number): boolean { + return !!this.editing && this.editing.row === rowIdx && this.editing.col === colIdx; + } + + /** + * Save the cell: + * - empty / "N.A." / "NA" → the slab is marked unavailable + * - value with letters, "%" or "+" → persisted as a formula string ("1% + FD") + * - plain number → stored as a number so it formats as a % + */ + saveEdit(rowIdx: number, colIdx: number): void { + if (!this.editing) { + return; + } + const raw = this.editValue.trim(); + let next: RateCell; + if (!raw || raw.toLowerCase() === 'n.a.' || raw.toLowerCase() === 'na') { + next = null; + } else if (/[a-zA-Z+%]/.test(raw)) { + next = raw; + } else { + const num = Number(raw); + next = Number.isFinite(num) ? num : this.rows[rowIdx].rates[colIdx]; + } + this.rows[rowIdx].rates[colIdx] = next; + this.rows[rowIdx].isFormula = this.rows[rowIdx].rates.some((c) => typeof c === 'string'); + this.editing = null; + } + + cancelEdit(): void { + this.editing = null; + } + + /** Append a new empty product row at the bottom of the grid. */ + addProduct(): void { + const name = window.prompt('New product name', 'New product'); + if (!name) { + return; + } + const next = this.rows.length > 0 ? Math.max(...this.rows.map((r) => r.srNo)) + 1 : 1; + this.rows.push({ + srNo: next, + particulars: name.trim(), + rates: Array(this.slabs.length).fill(null), + isFormula: false + }); + } + + /** Append a new amount slab column; every existing row grows by one blank cell. */ + addSlab(): void { + const label = window.prompt('Slab label (e.g. "Upto 50,00,000" or "> 50,00,000")', 'New slab'); + if (!label) { + return; + } + const amountText = window.prompt('Amount upper bound in ₹ (leave blank for no cap)', ''); + const amountUpto = amountText && amountText.trim() ? Number(amountText) : null; + this.slabs.push({ + key: `s_${Date.now()}`, + label: label.trim(), + amountUpto: amountUpto !== null && !Number.isFinite(amountUpto) ? null : amountUpto + }); + this.rows.forEach((r) => r.rates.push(null)); + } + + editCibil(): void { + this.router.navigate(['/products/loan-interest-rate-register/cibil'], { queryParams: { id: this.register.id } }); + } + + backToList(): void { + this.router.navigate(['/products/loan-interest-rate-register']); + } + + submitForApproval(): void { + this.register.status = 'Active'; + this.router.navigate(['/products/loan-interest-rate-register']); + } + + statusChipClass(): string { + switch (this.register?.status) { + case 'Active': + return 'chip chip--active'; + case 'Draft': + return 'chip chip--draft'; + default: + return 'chip chip--expired'; + } + } +} diff --git a/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.html b/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.html new file mode 100644 index 000000000..76909d598 --- /dev/null +++ b/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.html @@ -0,0 +1,83 @@ + + +
+
+
+
+

Loan Interest Rate Register

+

Central CIBIL-based rate chart used across all loan products

+
+ + +
+ +
+
+
+
ACTIVE REGISTER
+
{{ active?.name ?? 'None' }}
+
Effective {{ activeWindow() }}
+
+
+
SLABS
+
10 amount slabs
+
₹10k → > ₹25L
+
+
+
CIBIL ADJUSTMENTS
+
{{ active?.cibilSlabs?.length ?? 0 }} slabs
+
+1.00% → −0.20%
+
+
+ +
+
+
All registers
+
+ + + + + + + + + + + + + + + + + + + + + + + +
NameEffective fromEffective toStatusCreated byLast modified
+
{{ r.name }}
+
{{ r.note }}
+
{{ r.effectiveFrom | date: 'dd MMM yyyy' }}{{ r.effectiveTo ? (r.effectiveTo | date: 'dd MMM yyyy') : '—' }} + {{ r.status === 'Active' ? '● Active' : r.status }} + {{ r.createdBy }}{{ r.lastModified | date: 'dd MMM yyyy' }}{{ r.status === 'Draft' ? 'Edit · Submit' : 'View' }}
+
+
Showing 1–{{ registers.length }} of {{ registers.length }}
+
+
+
+
diff --git a/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.scss b/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.scss new file mode 100644 index 000000000..1b930acd0 --- /dev/null +++ b/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.scss @@ -0,0 +1,212 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +.lirr { + background: #f8fafc; + min-height: calc(100vh - 160px); + + &__header { + display: flex; + align-items: center; + gap: 14px; + padding: 22px 32px 14px; + background: white; + border-bottom: 1px solid #e2e8f0; + } + + &__header-icon { + width: 40px; + height: 40px; + border-radius: 9px; + background: #eff6ff; + color: #1d4ed8; + display: flex; + align-items: center; + justify-content: center; + font-size: 18px; + } + + &__header-text { + flex: 1; + + h2 { + margin: 0; + font-size: 20px; + font-weight: 600; + } + + p { + margin: 3px 0 0; + font-size: 12px; + color: #64748b; + } + } + + &__excel-btn, + &__create-btn { + i { + margin-right: 6px; + } + } + + &__body { + padding: 20px 32px; + } + + &__kpi-grid { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: 12px; + margin-bottom: 18px; + } + + &__kpi { + background: white; + border: 1px solid #e2e8f0; + border-radius: 10px; + padding: 14px 16px; + } + + &__kpi-label { + font-size: 11px; + color: #64748b; + font-weight: 600; + letter-spacing: 0.3px; + } + + &__kpi-value { + font-size: 18px; + font-weight: 600; + margin-top: 4px; + } + + &__kpi-sub { + font-size: 11px; + color: #64748b; + margin-top: 4px; + + &--ok { + color: #059669; + } + } + + &__table-card { + background: white; + border: 1px solid #e2e8f0; + border-radius: 10px; + overflow: hidden; + } + + &__table-head { + padding: 12px 20px; + border-bottom: 1px solid #f1f5f9; + display: flex; + align-items: center; + } + + &__table-title { + font-size: 14px; + font-weight: 600; + } + + &__table { + width: 100%; + border-collapse: collapse; + font-size: 13px; + + thead { + background: #f8fafc; + color: #64748b; + font-size: 11px; + text-transform: uppercase; + letter-spacing: 0.3px; + + th { + text-align: left; + padding: 10px 12px; + font-weight: 600; + + &:first-child { + padding-left: 20px; + } + } + } + + tbody tr { + border-top: 1px solid #f1f5f9; + cursor: pointer; + transition: background-color 0.1s; + + &:hover { + background: #f8fafc; + } + + td { + padding: 12px; + + &:first-child { + padding-left: 20px; + } + } + } + } + + &__row--active { + background: #f0fdf4; + } + + &__name { + font-weight: 600; + } + + &__name-sub { + font-size: 11px; + color: #64748b; + margin-top: 2px; + } + + &__row-actions { + text-align: right; + color: #64748b; + padding-right: 20px !important; + } + + &__table-foot { + padding: 10px 20px; + border-top: 1px solid #f1f5f9; + font-size: 12px; + color: #64748b; + } +} + +.chip { + padding: 3px 10px; + border-radius: 10px; + font-size: 11px; + font-weight: 600; + + &--active { + background: #dcfce7; + color: #166534; + } + + &--draft { + background: #fef3c7; + color: #92400e; + } + + &--expired { + background: #f1f5f9; + color: #475569; + } + + &--scheduled { + background: #e0e7ff; + color: #3730a3; + } +} diff --git a/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.ts b/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.ts new file mode 100644 index 000000000..409735ebf --- /dev/null +++ b/src/app/products/loan-interest-rate-register/loan-interest-rate-register.component.ts @@ -0,0 +1,78 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import { Component, OnInit, inject } from '@angular/core'; +import { DatePipe } from '@angular/common'; +import { Router } from '@angular/router'; +import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; +import { RateRegisterService } from './rate-register.service'; +import { RateRegister } from './models/rate-register.model'; + +/** + * List screen for the central Loan Interest Rate Register — three KPI cards followed by the + * registers table (name, effective window, status, author, last modified). + */ +@Component({ + selector: 'mifosx-loan-interest-rate-register', + templateUrl: './loan-interest-rate-register.component.html', + styleUrls: ['./loan-interest-rate-register.component.scss'], + imports: [ + ...STANDALONE_SHARED_IMPORTS, + DatePipe + ] +}) +export class LoanInterestRateRegisterComponent implements OnInit { + private readonly service = inject(RateRegisterService); + private readonly router = inject(Router); + + registers: RateRegister[] = []; + active?: RateRegister; + + ngOnInit(): void { + this.service.list().subscribe((rows) => { + this.registers = rows; + this.active = rows.find((r) => r.status === 'Active'); + }); + } + + edit(register: RateRegister): void { + this.router.navigate(['/products/loan-interest-rate-register/edit'], { queryParams: { id: register.id } }); + } + + create(): void { + this.router.navigate(['/products/loan-interest-rate-register/edit']); + } + + statusChipClass(status: RateRegister['status']): string { + switch (status) { + case 'Active': + return 'chip chip--active'; + case 'Draft': + return 'chip chip--draft'; + case 'Expired': + return 'chip chip--expired'; + default: + return 'chip chip--scheduled'; + } + } + + activeWindow(): string { + if (!this.active) { + return '—'; + } + return `${this.formatShort(this.active.effectiveFrom)} → ${this.formatShort(this.active.effectiveTo)}`; + } + + private formatShort(iso: string | null): string { + if (!iso) { + return '—'; + } + const d = new Date(iso); + return d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: '2-digit' }); + } +} diff --git a/src/app/products/loan-interest-rate-register/models/rate-register.model.ts b/src/app/products/loan-interest-rate-register/models/rate-register.model.ts new file mode 100644 index 000000000..d1ffe6e02 --- /dev/null +++ b/src/app/products/loan-interest-rate-register/models/rate-register.model.ts @@ -0,0 +1,52 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +export type RegisterStatus = 'Active' | 'Draft' | 'Expired' | 'Scheduled'; + +export interface SlabColumn { + key: string; + label: string; + amountUpto: number | null; +} + +/** A single rate cell: number for a %, string for a formula ("1% + FD"), null for N.A. */ +export type RateCell = number | string | null; + +export interface RateChartRow { + srNo: number; + particulars: string; + isFormula?: boolean; + rates: RateCell[]; +} + +export type RiskTier = 'Poor' | 'Fair' | 'Good' | 'V. Good' | 'Excellent'; + +export interface CibilSlab { + from: number; + to: number; + tier: RiskTier; + type: 'Flat'; + adjustmentPct: number; +} + +export interface RateRegister { + id: number; + name: string; + effectiveFrom: string; + effectiveTo: string | null; + currency: string; + status: RegisterStatus; + createdBy: string; + lastModified: string; + note?: string; + slabs: SlabColumn[]; + rows: RateChartRow[]; + cibilSlabs: CibilSlab[]; + fallbackNoCibilSlab: number; + fallbackBelowMin: 'use-min-slab' | 'block'; +} diff --git a/src/app/products/loan-interest-rate-register/rate-register.service.ts b/src/app/products/loan-interest-rate-register/rate-register.service.ts new file mode 100644 index 000000000..69453daec --- /dev/null +++ b/src/app/products/loan-interest-rate-register/rate-register.service.ts @@ -0,0 +1,457 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import { Injectable } from '@angular/core'; +import { Observable, of } from 'rxjs'; +import { CibilSlab, RateChartRow, RateRegister, SlabColumn } from './models/rate-register.model'; + +/** + * In-memory stand-in for the central Loan Interest Rate Register. + * + * Mirrors the Excel chart the bank's Board approves each quarter (34 products × 10 amount slabs). + * Backing API will land later; today the service only serves the demo data in memory so the + * screens can be driven end-to-end without a server. + */ +@Injectable({ providedIn: 'root' }) +export class RateRegisterService { + private readonly slabs: SlabColumn[] = [ + { key: 's1', label: 'Upto 10,000', amountUpto: 10000 }, + { key: 's2', label: 'Upto 25,000', amountUpto: 25000 }, + { key: 's3', label: 'Upto 1,00,000', amountUpto: 100000 }, + { key: 's4', label: 'Upto 2,00,000', amountUpto: 200000 }, + { key: 's5', label: 'Upto 5,00,000', amountUpto: 500000 }, + { key: 's6', label: 'Upto 10,00,000', amountUpto: 1000000 }, + { key: 's7', label: 'Upto 15,00,000', amountUpto: 1500000 }, + { key: 's8', label: 'Upto 20,00,000', amountUpto: 2000000 }, + { key: 's9', label: 'Upto 25,00,000', amountUpto: 2500000 }, + { key: 's10', label: '> 25,00,000', amountUpto: null } + ]; + + // Values taken from the bank's approved Interest Rate of Loans register. + private readonly rows: RateChartRow[] = [ + this.row(1, 'Consumer Loan', [ + 18, + 18, + 15, + 13, + null, + null, + null, + null, + null, + null + ]), + this.row( + 2, + 'Self Employment Loan', + [ + 18, + 18, + 15, + 13, + 12.5, + 12, + 11.5, + 11, + 10.5, + 10.5 + ] + ), + this.row( + 3, + 'Business Term Loan for running', + [ + 18, + 18, + 15, + 13, + 12.5, + 11, + 10.5, + 10, + 9.5, + 9.5 + ] + ), + this.row( + 4, + 'Cash Credit', + [ + 18, + 18, + 15, + 13, + 13, + 11, + 10.5, + 10, + 9.5, + 9.5 + ] + ), + this.row( + 5, + 'Limit (OD) on property — MSME', + [ + 18, + 18, + 15, + 13, + 13, + 11, + 10.5, + 10, + 9.5, + 9.5 + ] + ), + this.row( + 6, + 'Limit (OD) on property — Personal', + [ + 18, + 18, + 15, + 14, + 13.5, + 12, + 11.5, + 11, + 10.5, + 10.5 + ] + ), + this.row(7, 'House Purchase / Construction', [ + null, + null, + 15, + 12, + 12, + 9.25, + 8.75, + 8.25, + 8, + 8 + ]), + this.row(8, 'House Repairing / Renovation', [ + null, + null, + 15, + 14, + 14, + 13, + 12, + 11, + 10.5, + 10 + ]), + this.row( + 9, + 'Commercial Real Estate Loan', + [ + 18, + 18, + 15, + 13, + 12.5, + 12, + 11, + 10.5, + 10.5, + 10 + ] + ), + this.row(10, 'Loan against Jewellery', this.flat(10.8)), + this.row(11, 'Loan against Warehouse Receipt (A)', this.flat(13)), + this.row( + 12, + 'Loan against Warehouse Receipt (B)', + [ + 10.5, + 10.5, + 10.5, + 10.5, + 10.5, + 10.5, + 10, + 10, + 10, + 9 + ] + ), + this.row(13, 'Agriculture Loan', [ + null, + null, + 15, + 12, + 12, + 12, + 11.75, + 11.5, + 11.25, + 11 + ]), + this.row(14, 'Personal Loan (Unsecured)', [ + 18, + 18, + 16, + 15, + null, + null, + null, + null, + null, + null + ]), + this.row( + 15, + 'Personal Loan (Secured / Property)', + [ + 18, + 18, + 16, + 15, + 15, + 13, + 12, + 11.5, + 11, + 11 + ] + ), + this.row(16, 'Two Wheeler Loan', this.flat(13)), + this.row(17, 'Car Loan (4-Wheel Domestic)', [ + null, + null, + 10, + 9.5, + 9.5, + 8.75, + 8.5, + 8.35, + 8.25, + 8.25 + ]), + this.row(18, 'Old Car Loan (4-Wheel Domestic)', [ + null, + null, + 13, + 12.5, + 12.5, + 12, + 11.5, + 11, + 10.5, + 10.5 + ]), + this.row(19, 'Vehicle Loan (Commercial & Three-wheeler)', [ + null, + null, + 13, + 12, + 12, + 10.5, + 10, + 10, + 10, + 10 + ]), + this.row(20, 'Old Vehicle Loan (Commercial)', [ + null, + null, + 15, + 14, + 14, + 13.5, + 13.5, + 13, + 12.5, + 12.5 + ]), + this.row( + 21, + 'Machinery & Plant Loan', + [ + 18, + 18, + 15, + 13, + 12.5, + 12, + 11, + 10.5, + 10.5, + 10 + ] + ), + this.row( + 22, + 'Office Chamber / Equipment Loan', + [ + 18, + 18, + 15, + 13, + 12.5, + 12, + 11, + 10.5, + 10.5, + 10 + ] + ), + this.formulaRow(23, 'Loan against F.D.R.', [ + '1% + FD', + '1% + FD', + '1% + FD', + '1% + FD', + '1% + FD', + '1% + FD', + '0.75% + FD', + '0.50% + FD', + '0.50% + FD', + '0.50% + FD' + ]), + this.row(24, 'Loan against Daily Deposit & Gold', this.flat(10)), + this.formulaRow(25, 'Loan against Recurring Deposit', Array(10).fill('1% + RD')), + this.row(26, 'Loan against Staff Service Fund', this.flat(7)), + this.row(27, 'Over Draft A/c', this.flat(null)), + this.row(28, 'Loan on LIC Policy', this.flat(null)), + this.row(29, 'Loan on KVP / NSC', this.flat(null)), + this.row(30, 'Bill Discount', this.flat(null)), + this.row(31, 'Temporary Limit', this.flat(15)), + this.row(32, 'Bank Guarantee (commission)', this.flat(0.25)), + this.row(33, 'Sugam Vyapar Loan', this.flat(null)), + this.row(34, 'OD to Staff (upto 2 lakh)', this.flat(null)) + ]; + + private readonly cibilSlabs: CibilSlab[] = [ + { from: 0, to: 649, tier: 'Poor', type: 'Flat', adjustmentPct: 1.0 }, + { from: 650, to: 749, tier: 'Fair', type: 'Flat', adjustmentPct: 0.5 }, + { from: 750, to: 799, tier: 'Good', type: 'Flat', adjustmentPct: 0 }, + { from: 800, to: 850, tier: 'V. Good', type: 'Flat', adjustmentPct: -0.1 }, + { from: 851, to: 900, tier: 'Excellent', type: 'Flat', adjustmentPct: -0.2 } + ]; + + private readonly registers: RateRegister[] = [ + { + id: 1001, + name: 'Q1 2027 Rates', + effectiveFrom: '2027-01-01', + effectiveTo: '2027-03-31', + currency: 'INR', + status: 'Draft', + createdBy: 'Sonali', + lastModified: '2026-10-01', + note: 'Scheduled · future effective', + slabs: this.slabs, + rows: this.rows, + cibilSlabs: this.cibilSlabs, + fallbackNoCibilSlab: 2, + fallbackBelowMin: 'block' + }, + { + id: 1002, + name: 'Interest Rate of Loans — Oct 2026', + effectiveFrom: '2026-10-01', + effectiveTo: '2026-12-31', + currency: 'INR', + status: 'Active', + createdBy: 'Admin', + lastModified: '2026-09-25', + note: 'Approved by Board on 25 Sep', + slabs: this.slabs, + rows: this.rows, + cibilSlabs: this.cibilSlabs, + fallbackNoCibilSlab: 2, + fallbackBelowMin: 'block' + }, + { + id: 1003, + name: 'Q3 2026 Rates', + effectiveFrom: '2026-07-01', + effectiveTo: '2026-09-30', + currency: 'INR', + status: 'Expired', + createdBy: 'Admin', + lastModified: '2026-06-15', + slabs: this.slabs, + rows: this.rows, + cibilSlabs: this.cibilSlabs, + fallbackNoCibilSlab: 2, + fallbackBelowMin: 'block' + }, + { + id: 1004, + name: 'Q2 2026 Rates', + effectiveFrom: '2026-04-01', + effectiveTo: '2026-06-30', + currency: 'INR', + status: 'Expired', + createdBy: 'Admin', + lastModified: '2026-03-10', + slabs: this.slabs, + rows: this.rows, + cibilSlabs: this.cibilSlabs, + fallbackNoCibilSlab: 2, + fallbackBelowMin: 'block' + }, + { + id: 1005, + name: 'Q1 2026 Rates', + effectiveFrom: '2026-01-01', + effectiveTo: '2026-03-31', + currency: 'INR', + status: 'Expired', + createdBy: 'Admin', + lastModified: '2025-12-20', + slabs: this.slabs, + rows: this.rows, + cibilSlabs: this.cibilSlabs, + fallbackNoCibilSlab: 2, + fallbackBelowMin: 'block' + } + ]; + + list(): Observable { + return of(this.registers); + } + + get(id: number): Observable { + return of(this.registers.find((r) => r.id === id)); + } + + /** The one shown by default on list → edit navigation. */ + getActiveOrFirstDraft(): RateRegister { + return ( + this.registers.find((r) => r.status === 'Draft') ?? + this.registers.find((r) => r.status === 'Active') ?? + this.registers[0] + ); + } + + getSlabColumns(): SlabColumn[] { + return this.slabs; + } + + getCibilSlabs(): CibilSlab[] { + return this.cibilSlabs; + } + + private row(srNo: number, particulars: string, rates: (number | null)[]): RateChartRow { + return { srNo, particulars, rates }; + } + + private formulaRow(srNo: number, particulars: string, rates: string[]): RateChartRow { + return { srNo, particulars, isFormula: true, rates }; + } + + private flat(value: number | null): (number | null)[] { + return Array(10).fill(value); + } +} diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts index b35557303..ddb60f62b 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-advance-limit-tenure-step/loan-product-advance-limit-tenure-step.component.ts @@ -58,7 +58,7 @@ export class LoanProductAdvanceLimitTenureStepComponent { readonly appropriationOrderOptions = [ { id: 'charges_penal_interest_principal', label: 'Charges → Penal → Interest → Principal' }, - { id: 'penal_interest_principal_charges', label: 'Penal → Interest → Principal → Charges' } + { id: 'principal_interest_penal_charges', label: 'Principal → Interest → Penal → Charges' } ]; readonly yesNoOptions = [ diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html index 62b792538..e35ab7664 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-details-step/loan-product-details-step.component.html @@ -103,8 +103,8 @@ {{ 'labels.inputs.Start Date' | translate }} {{ 'labels.inputs.Close Date' | translate }}
+ +
Date: Wed, 7 Oct 2026 15:30:15 +0530 Subject: [PATCH 3/3] Add interest loan related UI --- .../cibil-adjustment.component.html | 206 ++----- .../cibil-adjustment.component.scss | 522 +++++++++------- .../cibil-adjustment.component.ts | 158 ++--- .../edit-register.component.html | 42 +- .../edit-register.component.scss | 94 +++ .../edit-register/edit-register.component.ts | 46 +- ...loan-interest-rate-register.component.html | 178 ++++-- ...loan-interest-rate-register.component.scss | 296 +++++++++ .../loan-interest-rate-register.component.ts | 120 +++- .../models/rate-register.model.ts | 7 +- .../preview-register.component.html | 181 ++++++ .../preview-register.component.scss | 362 +++++++++++ .../preview-register.component.ts | 210 +++++++ .../rate-register.service.ts | 583 +++++++++++++++--- src/app/products/products-routing.module.ts | 6 + src/app/products/products.service.ts | 32 +- src/assets/env.js | 10 +- src/environments/.env.ts | 4 +- 18 files changed, 2445 insertions(+), 612 deletions(-) create mode 100644 src/app/products/loan-interest-rate-register/preview-register/preview-register.component.html create mode 100644 src/app/products/loan-interest-rate-register/preview-register/preview-register.component.scss create mode 100644 src/app/products/loan-interest-rate-register/preview-register/preview-register.component.ts diff --git a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html index 92b80c9de..25a387ffa 100644 --- a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html +++ b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.html @@ -7,6 +7,23 @@ -->
+
+ +
+
Read-only — {{ register.status }}
+
{{ readOnlyReason() }}
+
+
+ +
+
CS
@@ -16,151 +33,64 @@
-
-
-
-
-
Credit score slabs
- -
- - - - - - - - - - - - - - - - - - - - - - - -
#Score fromScore toRisk tierTypeAdjustment
{{ i + 1 }}{{ slab.from }}{{ slab.to }} - {{ slab.tier }} - {{ slab.type }} - {{ formatPct(slab.adjustmentPct) }} - ⋯
-
- -
-
-
Fallback behaviour
-
-
- - -
-
- - -
-
+
+
+
+
Credit score slabs
+
+ Only the Adjustment % is editable · changes apply to new sanctions after the register is approved
+
-
-
-
-
Live preview
-
pick a scenario
-
-
-
-
- - + + + + + + + + + + + + + + + + + + + + + + + +
#Score fromScore toRisk tierTypeAdjustment
{{ i + 1 }}{{ slab.from }}{{ slab.to }} + {{ slab.tier }} + {{ slab.type }} +
+ + %
-
- - -
-
- - -
-
- - -
- - -
-
RATE DERIVATION
-
- Chart cell — {{ productLabel(previewProductSrNo) }} - {{ - chartCell() !== null ? (chartCell() | number: '1.2-2') + '%' : 'N.A.' - }} -
-
- CIBIL {{ previewCibil }} ({{ cibilSlab()?.tier ?? '—' }}) - - {{ formatPct(cibilSlab()?.adjustmentPct ?? 0) }} - -
-
- Product floor / ceiling - no clamp -
-
-
- Final rate - {{ finalRate() }} -
-
- - - -
-
-
What changes if…
-
-
- CIBIL = 700 - {{ rateFor(700) }} -
-
- CIBIL = 870 - {{ rateFor(870) }} -
-
- No CIBIL fetched - {{ rateForFallback() }} -
-
-
-
- +
+ +
diff --git a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss index 243151aa0..19f0c1489 100644 --- a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss +++ b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.scss @@ -9,11 +9,96 @@ .ca { background: #f8fafc; min-height: calc(100vh - 160px); - padding: 20px 32px; + 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; @@ -21,20 +106,21 @@ padding: 20px 24px; background: white; border: 1px solid #e2e8f0; - border-radius: 10px; + border-radius: 12px; } &__header-icon { - width: 40px; - height: 40px; - border-radius: 9px; + width: 42px; + height: 42px; + border-radius: 10px; background: #dbeafe; color: #1d4ed8; display: flex; align-items: center; justify-content: center; - font-size: 15px; + font-size: 14px; font-weight: 700; + letter-spacing: 0.3px; } &__header-text { @@ -44,6 +130,7 @@ margin: 0; font-size: 20px; font-weight: 600; + color: #0f172a; } p { @@ -53,282 +140,184 @@ } } - &__body { - display: grid; - grid-template-columns: 1.3fr 1fr; - gap: 16px; - } - - &__left, - &__right { - display: flex; - flex-direction: column; - gap: 14px; - } - &__card { background: white; border: 1px solid #e2e8f0; - border-radius: 10px; + border-radius: 12px; overflow: hidden; } &__card-head { - padding: 12px 16px; + padding: 16px 20px; border-bottom: 1px solid #f1f5f9; display: flex; - align-items: center; - gap: 10px; - } - - &__card-title { - font-size: 14px; - font-weight: 600; - } - - &__card-hint { - margin-left: auto; - font-size: 11px; - color: #64748b; - } - - &__card-body { - padding: 14px 18px; - display: flex; - flex-direction: column; + 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 { - margin-left: auto; - height: 28px; - font-size: 11px; + height: 32px; + font-size: 12px; font-weight: 600; color: #1d4ed8; border: 1px dashed #1d4ed8; + padding: 0 14px; i { - margin-right: 3px; + margin-right: 6px; } } - &__table { - width: 100%; - border-collapse: collapse; - font-size: 13px; - - thead tr { - background: #f8fafc; - color: #64748b; - font-size: 10px; - text-transform: uppercase; - letter-spacing: 0.3px; - - th { - text-align: left; - padding: 9px 14px; - font-weight: 600; - } - } - - tbody tr { - border-top: 1px solid #f1f5f9; - - td { - padding: 11px 14px; - } - } - } - - &__row-alt { - background: #fafbfc; - } - &__num { text-align: right; } - &__dots { + &__col-ix { + width: 44px; text-align: center; color: #94a3b8; - cursor: pointer; + font-weight: 600; } - &__fallback-grid, - &__preview-grid { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 14px; + &__col-del { + width: 48px; + text-align: center; } - &__field { + &__cell-muted { + color: #64748b; + } + + &__cell-readonly { + color: #0f172a; + font-variant-numeric: tabular-nums; + padding: 0 22px; + } + + &__footer { display: flex; - flex-direction: column; + justify-content: flex-end; + gap: 10px; + padding: 4px 2px; + } +} - label { - font-size: 11px; +/* ---- 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; - letter-spacing: 0.3px; - margin-bottom: 4px; - } + border-bottom: 1px solid #e2e8f0; - input, - select { - height: 36px; - border: 1px solid #cbd5e1; - background: white; - border-radius: 6px; - padding: 0 12px; - font-size: 13px; - color: #0f172a; - font-family: inherit; - - &:focus { - outline: 2px solid #1d4ed8; - outline-offset: -1px; + &.ca__num { + text-align: right; } } } - &__derivation { - padding: 12px 14px; - background: #f8fafc; - border-radius: 8px; - } + tbody tr { + border-bottom: 1px solid #f1f5f9; + transition: background 0.12s ease; - &__derivation-label { - font-size: 11px; - color: #64748b; - font-weight: 600; - letter-spacing: 0.3px; - margin-bottom: 8px; - } + &:hover { + background: #f8fafc; - &__derivation-row { - display: flex; - justify-content: space-between; - font-size: 12px; - padding: 3px 0; - - &--muted { - color: #64748b; - } - } - - &__derivation-val { - font-weight: 600; - - &--pos { - color: #059669; + .ca__delete-btn { + opacity: 1; + } } - &--neg { - color: #dc2626; + &:last-child { + border-bottom: 0; + } + + td { + padding: 8px 12px; + vertical-align: middle; } } +} - &__divider { - height: 1px; - background: #e2e8f0; - margin: 8px 0; - } +/* 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; - &__final { - display: flex; - justify-content: space-between; - align-items: center; - - span:first-child { - font-size: 12px; - font-weight: 600; - } - } - - &__final-val { - font-size: 20px; - font-weight: 700; - color: #1d4ed8; - } - - &__scenarios { - display: flex; - flex-direction: column; - gap: 8px; - font-size: 12px; - color: #334155; - } - - &__scenario { - padding: 8px 10px; - background: #f8fafc; - border-radius: 6px; - display: flex; - justify-content: space-between; - - span:last-child { - font-weight: 600; - } - } - - &__scenario-val--pos { - color: #059669; - } - - &__scenario-val--warn { - color: #d97706; - } - - &__footer { + &:hover { + border-color: #e2e8f0; background: white; - border: 1px solid #e2e8f0; - border-radius: 10px; - padding: 10px 16px; - display: flex; - align-items: center; - justify-content: space-between; } - &__footer-note { - font-size: 11px; - color: #64748b; + &: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; } } -.tier { - padding: 3px 8px; - border-radius: 4px; - font-size: 11px; - font-weight: 600; - - &--poor { - background: #fee2e2; - color: #991b1b; - } - - &--fair { - background: #fef3c7; - color: #92400e; - } - - &--good { - background: #dbeafe; - color: #1e40af; - } - - &--vgood { - background: #dcfce7; - color: #166534; - } - - &--excellent { - background: #d1fae5; - color: #065f46; - } +/* 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%; } -.adj { - font-weight: 600; +.ca__adj-input { + width: 72px; + font-weight: 700; &--negative { color: #059669; @@ -342,3 +331,84 @@ 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,"); + 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; + } +} diff --git a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts index 4a183cabf..244bca647 100644 --- a/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts +++ b/src/app/products/loan-interest-rate-register/cibil-adjustment/cibil-adjustment.component.ts @@ -11,15 +11,13 @@ import { CommonModule } from '@angular/common'; import { ActivatedRoute, Router } from '@angular/router'; import { FormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; import { RateRegisterService } from '../rate-register.service'; import { CibilSlab, RateRegister } from '../models/rate-register.model'; /** - * CIBIL/credit-score adjustment editor for a Rate Register — slab table, fallback behaviour - * and a live preview that resolves {product, loan amount, CIBIL} down to the final rate. + * 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', @@ -28,10 +26,7 @@ import { CibilSlab, RateRegister } from '../models/rate-register.model'; imports: [ CommonModule, FormsModule, - MatButtonModule, - MatFormFieldModule, - MatInputModule, - MatSelectModule + MatButtonModule ] }) export class CibilAdjustmentComponent implements OnInit { @@ -40,123 +35,100 @@ export class CibilAdjustmentComponent implements OnInit { private readonly router = inject(Router); register!: RateRegister; - - // Live preview inputs. - previewProductSrNo = 7; // House Purchase / Construction - previewAmount = 2500000; - previewCibil = 820; - previewTenureMonths = 120; + 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 = { + 'V. Poor': 'tier tier--vpoor', Poor: 'tier tier--poor', Fair: 'tier tier--fair', Good: 'tier tier--good', - 'V. Good': 'tier tier--vgood', Excellent: 'tier tier--excellent' }; return map[tier] ?? 'tier'; } - adjustmentClass(pct: number): string { + /** 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 'adj adj--negative'; + return `${base} ca__adj-input--negative`; + } + if (pct >= 1) { + return `${base} ca__adj-input--high`; } if (pct > 0) { - return pct >= 1 ? 'adj adj--high' : 'adj adj--positive'; + return `${base} ca__adj-input--positive`; } - return 'adj'; + return base; } - formatPct(pct: number): string { - if (pct === 0) { - return '0.00%'; + /** Append a new slab continuing from the current highest "score to". */ + addSlab(): void { + if (!this.canEdit) { + return; } - const sign = pct > 0 ? '+' : '−'; - return `${sign}${Math.abs(pct).toFixed(2)}%`; + 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 + }); } - /** Looks up the chart cell for the currently previewed scenario. */ - private chartRateFor(productSrNo: number, amount: number): number | null { - const row = this.register.rows.find((r) => r.srNo === productSrNo); - if (!row) { - return null; + deleteSlab(index: number): void { + if (!this.canEdit) { + return; } - for (let i = 0; i < this.register.slabs.length; i++) { - const slab = this.register.slabs[i]; - const upto = slab.amountUpto; - if (upto === null || amount <= upto) { - const cell = row.rates[i]; - if (cell === null) { - return null; - } - if (typeof cell === 'string') { - // Formula cell — in a real derive we'd resolve against the pledged deposit's rate. - return null; - } - return cell; - } - } - return null; + this.register.cibilSlabs.splice(index, 1); } - private cibilAdjustmentFor(score: number): CibilSlab | null { - return this.register.cibilSlabs.find((s) => score >= s.from && score <= s.to) ?? null; - } - - chartCell(): number | null { - return this.chartRateFor(this.previewProductSrNo, this.previewAmount); - } - - cibilSlab(): CibilSlab | null { - return this.cibilAdjustmentFor(this.previewCibil); - } - - finalRate(): string { - const base = this.chartCell(); - const slab = this.cibilSlab(); - if (base === null) { - return 'N.A.'; - } - const adjustment = slab?.adjustmentPct ?? 0; - return `${(base + adjustment).toFixed(2)}% p.a.`; - } - - productLabel(srNo: number): string { - return this.register.rows.find((r) => r.srNo === srNo)?.particulars ?? '—'; - } - - rateFor(cibil: number): string { - const base = this.chartRateFor(this.previewProductSrNo, this.previewAmount); - if (base === null) { - return 'N.A.'; - } - const slab = this.cibilAdjustmentFor(cibil); - return `${(base + (slab?.adjustmentPct ?? 0)).toFixed(2)}%`; - } - - rateForFallback(): string { - const base = this.chartRateFor(this.previewProductSrNo, this.previewAmount); - if (base === null) { - return 'N.A.'; - } - const fallback = this.register.cibilSlabs[this.register.fallbackNoCibilSlab - 1]; - return `${(base + (fallback?.adjustmentPct ?? 0)).toFixed(2)}%`; - } - - backToRegister(): void { + /** 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 } }); } - save(): void { - this.backToRegister(); + backToRegister(): void { + this.save(); } } diff --git a/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html index 02d72204d..8db7e5e86 100644 --- a/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html +++ b/src/app/products/loan-interest-rate-register/edit-register/edit-register.component.html @@ -7,27 +7,44 @@ -->
+
+ ● + CURRENT ACTIVE + {{ active.name }} + · effective {{ active.effectiveFrom }} → {{ active.effectiveTo || '—' }} + You are viewing the Active register + View active → +
+ +
+ +
+
Read-only — {{ register.status }}
+
{{ readOnlyReason() }}
+
+
+
- +
- +
- +
-
- +
@@ -35,9 +52,11 @@
Rate chart grid
- {{ rows.length }} products × {{ slabs.length }} amount slabs · click any cell to edit + {{ rows.length }} products × {{ slabs.length }} amount slabs + · click any cell to edit + · read-only view
-
+
@@ -70,7 +89,8 @@ [class.er__cell--na]="isNa(cell)" [class.er__cell--formula]="isFormulaRow(row)" [class.er__cell--editing]="isEditing(i, j)" - (click)="!isEditing(i, j) && startEdit(i, j, cell)" + [class.er__cell--readonly]="!canEdit" + (click)="canEdit && !isEditing(i, j) && startEdit(i, j, cell)" >
CIBIL / credit score adjustment
- {{ register.cibilSlabs.length }} slabs · +1.00% (poor) to −0.20% (excellent) · applied on top of chart rate + {{ register.cibilSlabs.length }} slabs · +2.00% (very poor) to base (above 700) · applied on top of chart rate
Edit →