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.
*/
private centersUnassignStaff() {
const dialogcontext: string = ""
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') }
});
@@ -66,7 +66,7 @@ export class ChargesTabComponent implements OnInit {
private router: Router,
public dialog: MatDialog,
private translateService: TranslateService,
private settingsService: SettingsService,) {
private settingsService: SettingsService) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.recurringDepositsAccountData = data.recurringDepositsAccountData;
this.chargesData = this.recurringDepositsAccountData.charges;
@@ -128,7 +128,9 @@ export class ChargesTabComponent implements OnInit {
* @param {any} chargeId Charge Id
*/
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) => {
if (response.confirm) {
this.savingsService.executeSavingsAccountChargesCommand(this.recurringDepositsAccountData.id, 'waive', {}, chargeId)
@@ -50,7 +50,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
private recurringDepositsService: RecurringDepositsService,
private savingsService: SavingsService,
public dialog: MatDialog,
private translateService:TranslateService) {
private translateService: TranslateService) {
this.route.data.subscribe((data: { recurringDepositsAccountData: any, savingsDatatables: any }) => {
this.recurringDepositsAccountData = data.recurringDepositsAccountData;
this.charges = this.recurringDepositsAccountData.charges;
@@ -225,7 +225,9 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
*/
private postInterest() {
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) => {
if (response.confirm) {
@@ -25,7 +25,6 @@ export class ViewTransactionComponent {
/** Transaction data. */
transactionData: any;
/**
* Retrieves the Transaction data from `resolve`.
@@ -41,7 +40,7 @@ export class ViewTransactionComponent {
private dateUtils: Dates,
private router: Router,
public dialog: MatDialog,
private translateService:TranslateService,
private translateService: TranslateService,
private settingsService: SettingsService, ) {
this.route.data.subscribe((data: { recurringDepositsAccountTransaction: any }) => {
this.transactionData = data.recurringDepositsAccountTransaction;
@@ -54,7 +54,7 @@
</div>
<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 }}
{{loansAccount.loanTermFrequencyType | find: loansAccountProductTemplate.termFrequencyTypeOptions:'id':'name'}}</span>
</div>
@@ -179,7 +179,9 @@ export class TransactionsTabComponent implements OnInit {
}
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 }) => {
if (response.confirm) {
@@ -384,7 +384,13 @@
<div fxFlexFill *ngIf="loanProduct.delinquencyBucket">
<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 fxFlexFill>
@@ -1,5 +1,5 @@
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 { AdvancePaymentAllocationData, PaymentAllocation } from '../../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
import { LoanProducts } from '../../loan-products';
@@ -62,6 +62,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
} else {
this.accountingMappings = {};
if ((this.loanProduct.accountingRule && this.loanProduct.accountingRule > 1) || this.loanProductsTemplate.accountingRule.value !== 'NONE') {
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
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);
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,
this.loanProductsTemplate.transactionProcessingStrategyOptions);
this.loanProduct.transactionProcessingStrategyName = codeValue.name;
@@ -275,6 +280,18 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
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 {
return this.loanProduct.accountingRule.id ?
this.loanProduct.accountingRule.id : this.loanProduct.accountingRule;
@@ -168,6 +168,10 @@
{{ delinquencyBucket.name }}
</mat-option>
</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-checkbox fxFlex="48%" labelPosition="before" formControlName="enableInstallmentLevelDelinquency" class="margin-v">
@@ -496,6 +496,16 @@ export class LoanProductSettingsStepComponent implements OnInit {
return value;
}
clearProperty($event: Event, propertyName: string): void {
if (propertyName === 'delinquencyBucketId') {
this.loanProductSettingsForm.patchValue({
'delinquencyBucketId': ''
});
}
this.loanProductSettingsForm.markAsDirty();
$event.stopPropagation();
}
get loanProductSettings() {
const productSettings = this.loanProductSettingsForm.value;
if (!this.loanProductSettingsForm.value.multiDisburseLoan) {
@@ -505,6 +515,9 @@ export class LoanProductSettingsStepComponent implements OnInit {
productSettings['dueDaysForRepaymentEvent'] = null;
productSettings['overDueDaysForRepaymentEvent'] = null;
}
if (productSettings['delinquencyBucketId'] === '') {
delete productSettings['delinquencyBucketId'];
}
return productSettings;
}
@@ -82,6 +82,7 @@ export interface LoanProduct {
isEqualAmortization: boolean;
delinquencyBucketOptions: DelinquencyBucket[];
delinquencyBucket: DelinquencyBucket;
delinquencyBucketId?: number;
graceOnPrincipalPayment?: number;
graceOnInterestPayment?: number;
graceOnInterestCharged?: number;
@@ -137,9 +138,9 @@ export interface AllowAttributeOverrides {
}
export interface DelinquencyBucket {
id: number;
name: string;
ranges: Range[];
id: number;
name: string;
ranges?: Range[];
}
export interface Range {