Fix Loan Product Delinquency bucket

This commit is contained in:
Jose Alberto Hernandez
2023-12-20 19:45:58 +01:00
committed by Adam Saghy
parent 479d6af8b3
commit 9600e8ed56
11 changed files with 59 additions and 14 deletions
@@ -98,7 +98,6 @@ export class CentersViewComponent implements OnInit {
* Unassign's the centers's staff. * Unassign's the centers's staff.
*/ */
private centersUnassignStaff() { private centersUnassignStaff() {
const dialogcontext: string = ""
const unAssignStaffDialogRef = this.dialog.open(ConfirmationDialogComponent, { const unAssignStaffDialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Unassign Staff'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want Unassign Staff') } data: { heading: this.translateService.instant('labels.heading.Unassign Staff'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want Unassign Staff') }
}); });
@@ -66,7 +66,7 @@ export class ChargesTabComponent implements OnInit {
private router: Router, private router: Router,
public dialog: MatDialog, public dialog: MatDialog,
private translateService: TranslateService, private translateService: TranslateService,
private settingsService: SettingsService,) { private settingsService: SettingsService) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => { this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.recurringDepositsAccountData = data.recurringDepositsAccountData; this.recurringDepositsAccountData = data.recurringDepositsAccountData;
this.chargesData = this.recurringDepositsAccountData.charges; this.chargesData = this.recurringDepositsAccountData.charges;
@@ -128,7 +128,9 @@ export class ChargesTabComponent implements OnInit {
* @param {any} chargeId Charge Id * @param {any} chargeId Charge Id
*/ */
waiveCharge(chargeId: any) { waiveCharge(chargeId: any) {
const waiveChargeDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, { data: { heading: this.translateService.instant('labels.heading.Waive Charge'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to waive charge with id: ')+ `${chargeId} ?` } }); const waiveChargeDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent,
{ data: { heading: this.translateService.instant('labels.heading.Waive Charge'),
dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to waive charge with id: ') + `${chargeId} ?` } });
waiveChargeDialogRef.afterClosed().subscribe((response: any) => { waiveChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) { if (response.confirm) {
this.savingsService.executeSavingsAccountChargesCommand(this.recurringDepositsAccountData.id, 'waive', {}, chargeId) this.savingsService.executeSavingsAccountChargesCommand(this.recurringDepositsAccountData.id, 'waive', {}, chargeId)
@@ -50,7 +50,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
private recurringDepositsService: RecurringDepositsService, private recurringDepositsService: RecurringDepositsService,
private savingsService: SavingsService, private savingsService: SavingsService,
public dialog: MatDialog, public dialog: MatDialog,
private translateService:TranslateService) { private translateService: TranslateService) {
this.route.data.subscribe((data: { recurringDepositsAccountData: any, savingsDatatables: any }) => { this.route.data.subscribe((data: { recurringDepositsAccountData: any, savingsDatatables: any }) => {
this.recurringDepositsAccountData = data.recurringDepositsAccountData; this.recurringDepositsAccountData = data.recurringDepositsAccountData;
this.charges = this.recurringDepositsAccountData.charges; this.charges = this.recurringDepositsAccountData.charges;
@@ -225,7 +225,9 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
*/ */
private postInterest() { private postInterest() {
const postInterestAccountDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, { const postInterestAccountDialogRef = this.dialog.open(RecurringDepositConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Post Interest'), dialogContext:this.translateService.instant('lables.dialogContext.Are you sure you want to post interest ?') } data: { heading: this.translateService.instant('labels.heading.Post Interest'),
dialogContext: this.translateService.instant('lables.dialogContext.Are you sure you want to post interest ?')
}
}); });
postInterestAccountDialogRef.afterClosed().subscribe((response: any) => { postInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) { if (response.confirm) {
@@ -26,7 +26,6 @@ export class ViewTransactionComponent {
/** Transaction data. */ /** Transaction data. */
transactionData: any; transactionData: any;
/** /**
* Retrieves the Transaction data from `resolve`. * Retrieves the Transaction data from `resolve`.
* @param {RecurringDepositsService} recurringDepositsService Savings Service * @param {RecurringDepositsService} recurringDepositsService Savings Service
@@ -41,7 +40,7 @@ export class ViewTransactionComponent {
private dateUtils: Dates, private dateUtils: Dates,
private router: Router, private router: Router,
public dialog: MatDialog, public dialog: MatDialog,
private translateService:TranslateService, private translateService: TranslateService,
private settingsService: SettingsService, ) { private settingsService: SettingsService, ) {
this.route.data.subscribe((data: { recurringDepositsAccountTransaction: any }) => { this.route.data.subscribe((data: { recurringDepositsAccountTransaction: any }) => {
this.transactionData = data.recurringDepositsAccountTransaction; this.transactionData = data.recurringDepositsAccountTransaction;
@@ -54,7 +54,7 @@
</div> </div>
<div fxFlexFill> <div fxFlexFill>
<span fxFlex="40%">{{"labels.inputs.Loan term" | translate}}:</span> <span fxFlex="40%">{{"labels.inputs.Loan Term" | translate}}:</span>
<span fxFlex="60%">{{ loansAccount.loanTermFrequency }} <span fxFlex="60%">{{ loansAccount.loanTermFrequency }}
{{loansAccount.loanTermFrequencyType | find: loansAccountProductTemplate.termFrequencyTypeOptions:'id':'name'}}</span> {{loansAccount.loanTermFrequencyType | find: loansAccountProductTemplate.termFrequencyTypeOptions:'id':'name'}}</span>
</div> </div>
@@ -179,7 +179,9 @@ export class TransactionsTabComponent implements OnInit {
} }
const undoTransactionAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, { const undoTransactionAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Undo Transaction'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want undo the transaction type') + `${transaction.type.value}` + this.translateService.instant('labels.dialogContext.with id') + `${transaction.id}` } data: { heading: this.translateService.instant('labels.heading.Undo Transaction'),
dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want undo the transaction type') + `${transaction.type.value}` + this.translateService.instant('labels.dialogContext.with id') + `${transaction.id}`
}
}); });
undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => { undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
if (response.confirm) { if (response.confirm) {
@@ -384,7 +384,13 @@
<div fxFlexFill *ngIf="loanProduct.delinquencyBucket"> <div fxFlexFill *ngIf="loanProduct.delinquencyBucket">
<span fxFlex="47%">Delinquency Bucket:</span> <span fxFlex="47%">Delinquency Bucket:</span>
<span fxFlex="53%">{{ loanProduct.delinquencyBucket.name }}</span> <span fxFlex="53%" *ngIf="loanProduct.delinquencyBucket.name">{{ loanProduct.delinquencyBucket.name }}</span>
<span fxFlex="53%" *ngIf="!loanProduct.delinquencyBucket.name">{{ 'labels.inputs.Unassigned' | translate }}</span>
</div>
<div fxFlexFill *ngIf="!loanProduct.delinquencyBucket">
<span fxFlex="47%">Delinquency Bucket:</span>
<span fxFlex="53%">{{ 'labels.inputs.Unassigned' | translate }}</span>
</div> </div>
<div fxFlexFill> <div fxFlexFill>
@@ -1,5 +1,5 @@
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { LoanProduct } from '../../models/loan-product.model'; import { DelinquencyBucket, LoanProduct } from '../../models/loan-product.model';
import { AccountingMapping, Charge, ChargeToIncomeAccountMapping, GLAccount, PaymentChannelToFundSourceMapping, PaymentType, PaymentTypeOption } from '../../../../shared/models/general.model'; import { AccountingMapping, Charge, ChargeToIncomeAccountMapping, GLAccount, PaymentChannelToFundSourceMapping, PaymentType, PaymentTypeOption } from '../../../../shared/models/general.model';
import { AdvancePaymentAllocationData, PaymentAllocation } from '../../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model'; import { AdvancePaymentAllocationData, PaymentAllocation } from '../../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
import { LoanProducts } from '../../loan-products'; import { LoanProducts } from '../../loan-products';
@@ -62,6 +62,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
} else { } else {
this.accountingMappings = {}; this.accountingMappings = {};
if ((this.loanProduct.accountingRule && this.loanProduct.accountingRule > 1) || this.loanProductsTemplate.accountingRule.value !== 'NONE') { if ((this.loanProduct.accountingRule && this.loanProduct.accountingRule > 1) || this.loanProductsTemplate.accountingRule.value !== 'NONE') {
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || []; const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
const incomeAccountData = this.loanProductsTemplate.accountingMappingOptions.incomeAccountOptions || []; const incomeAccountData = this.loanProductsTemplate.accountingMappingOptions.incomeAccountOptions || [];
@@ -162,6 +163,10 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
optionValue = this.optionDataLookUp(this.loanProduct.repaymentStartDateType, this.loanProductsTemplate.repaymentStartDateTypeOptions); optionValue = this.optionDataLookUp(this.loanProduct.repaymentStartDateType, this.loanProductsTemplate.repaymentStartDateTypeOptions);
this.loanProduct.repaymentStartDateType = optionValue; this.loanProduct.repaymentStartDateType = optionValue;
if (this.loanProduct.delinquencyBucketId) {
this.loanProduct.delinquencyBucket = this.delinquencyBucketLookUp(this.loanProduct.delinquencyBucketId, this.loanProductsTemplate.delinquencyBucketOptions);
}
const codeValue: CodeName = this.codeNameLookUpByCode(this.loanProduct.transactionProcessingStrategyCode, const codeValue: CodeName = this.codeNameLookUpByCode(this.loanProduct.transactionProcessingStrategyCode,
this.loanProductsTemplate.transactionProcessingStrategyOptions); this.loanProductsTemplate.transactionProcessingStrategyOptions);
this.loanProduct.transactionProcessingStrategyName = codeValue.name; this.loanProduct.transactionProcessingStrategyName = codeValue.name;
@@ -275,6 +280,18 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
return paymentType; return paymentType;
} }
delinquencyBucketLookUp(delinquencyBucketId: any, delinquencyBuckets: DelinquencyBucket[]): DelinquencyBucket {
let delinquencyBucketData: DelinquencyBucket | null = null;
if (delinquencyBucketId) {
delinquencyBuckets.some((delinquencyBucket: DelinquencyBucket) => {
if (delinquencyBucket.id === delinquencyBucketId) {
delinquencyBucketData = { id: delinquencyBucket.id, name: delinquencyBucket.name };
}
});
}
return delinquencyBucketData;
}
accountingRule(): number { accountingRule(): number {
return this.loanProduct.accountingRule.id ? return this.loanProduct.accountingRule.id ?
this.loanProduct.accountingRule.id : this.loanProduct.accountingRule; this.loanProduct.accountingRule.id : this.loanProduct.accountingRule;
@@ -168,6 +168,10 @@
{{ delinquencyBucket.name }} {{ delinquencyBucket.name }}
</mat-option> </mat-option>
</mat-select> </mat-select>
<button mat-button *ngIf="loanProductSettingsForm.controls.delinquencyBucketId" matSuffix mat-icon-button
aria-label="Clear" (click)="clearProperty($event, 'delinquencyBucketId')">
<mat-icon>close</mat-icon>
</button>
</mat-form-field> </mat-form-field>
<mat-checkbox fxFlex="48%" labelPosition="before" formControlName="enableInstallmentLevelDelinquency" class="margin-v"> <mat-checkbox fxFlex="48%" labelPosition="before" formControlName="enableInstallmentLevelDelinquency" class="margin-v">
@@ -496,6 +496,16 @@ export class LoanProductSettingsStepComponent implements OnInit {
return value; return value;
} }
clearProperty($event: Event, propertyName: string): void {
if (propertyName === 'delinquencyBucketId') {
this.loanProductSettingsForm.patchValue({
'delinquencyBucketId': ''
});
}
this.loanProductSettingsForm.markAsDirty();
$event.stopPropagation();
}
get loanProductSettings() { get loanProductSettings() {
const productSettings = this.loanProductSettingsForm.value; const productSettings = this.loanProductSettingsForm.value;
if (!this.loanProductSettingsForm.value.multiDisburseLoan) { if (!this.loanProductSettingsForm.value.multiDisburseLoan) {
@@ -505,6 +515,9 @@ export class LoanProductSettingsStepComponent implements OnInit {
productSettings['dueDaysForRepaymentEvent'] = null; productSettings['dueDaysForRepaymentEvent'] = null;
productSettings['overDueDaysForRepaymentEvent'] = null; productSettings['overDueDaysForRepaymentEvent'] = null;
} }
if (productSettings['delinquencyBucketId'] === '') {
delete productSettings['delinquencyBucketId'];
}
return productSettings; return productSettings;
} }
@@ -82,6 +82,7 @@ export interface LoanProduct {
isEqualAmortization: boolean; isEqualAmortization: boolean;
delinquencyBucketOptions: DelinquencyBucket[]; delinquencyBucketOptions: DelinquencyBucket[];
delinquencyBucket: DelinquencyBucket; delinquencyBucket: DelinquencyBucket;
delinquencyBucketId?: number;
graceOnPrincipalPayment?: number; graceOnPrincipalPayment?: number;
graceOnInterestPayment?: number; graceOnInterestPayment?: number;
graceOnInterestCharged?: number; graceOnInterestCharged?: number;
@@ -137,9 +138,9 @@ export interface AllowAttributeOverrides {
} }
export interface DelinquencyBucket { export interface DelinquencyBucket {
id: number; id: number;
name: string; name: string;
ranges: Range[]; ranges?: Range[];
} }
export interface Range { export interface Range {