Backdated delinquency pause with end date in the past validation

This commit is contained in:
Jose Alberto Hernandez
2024-01-19 10:28:17 +01:00
committed by Adam Saghy
parent 3e589894ce
commit 780c469ee4
2 changed files with 19 additions and 4 deletions
@@ -221,13 +221,13 @@
<input type="number" matInput formControlName="fixedEmiAmount">
</mat-form-field>
<ng-container *ngIf="loansAccountTermsData?.canUseForTopup">
<ng-container *ngIf="loansAccountTermsData?.isTopup">
<mat-checkbox fxFlex="48%" formControlName="isTopup">
<mat-checkbox fxFlex="20%" formControlName="isTopup">
<p>{{"labels.inputs.Is Topup Loan" | translate}}?</p>
</mat-checkbox>
<mat-form-field fxFlex="48%" *ngIf="loansAccountTermsForm.controls.isTopup.value">
<mat-form-field fxFlex="24%" *ngIf="loansAccountTermsForm.controls.isTopup.value">
<mat-label>{{"labels.inputs.Loan closed with Topup" | translate}}</mat-label>
<mat-select formControlName="loanIdToClose">
<mat-option *ngFor="let clientActiveLoan of clientActiveLoanData" [value]="clientActiveLoan.id">
@@ -129,7 +129,22 @@ export class LoanDelinquencyTagsTabComponent implements OnInit {
isCurrentAndPauseAction(item: LoanDelinquencyAction): boolean {
if (this.currentLoanDelinquencyAction != null) {
return (this.currentLoanDelinquencyAction.id === item.id && item.action === 'PAUSE');
if (this.currentLoanDelinquencyAction.id === item.id) {
if (item.action === 'PAUSE') {
const businessDate: Date = this.settingsService.businessDate;
const startDate: Date = this.dateUtils.parseDate(item.startDate);
if (businessDate < startDate) {
return false;
}
if (item.endDate) {
const endDate: Date = this.dateUtils.parseDate(item.endDate);
if (businessDate > endDate) {
return false;
}
}
return true;
}
}
}
return false;
}