fix: Loan Product settings day in year custom strategy

This commit is contained in:
Jose Alberto Hernandez
2025-03-24 20:41:22 -05:00
parent 684a937af0
commit de9fc5848c
@@ -639,6 +639,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
'chargeOffBehaviour',
new UntypedFormControl(this.loanProductsTemplate.chargeOffBehaviour.id)
);
this.validateAdvancedPaymentStrategyControls();
}
if (this.loanProductSettingsForm.value.isInterestRecalculationEnabled) {
this.setRescheduleStrategies();
@@ -720,6 +721,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
private validateAdvancedPaymentStrategyControls(): void {
if (this.isAdvancedTransactionProcessingStrategy) {
const daysInYearType: any = this.loanProductSettingsForm.get('daysInYearType').value;
this.loanProductSettingsForm.addControl(
'loanScheduleProcessingType',
new UntypedFormControl(
@@ -728,8 +730,20 @@ export class LoanProductSettingsStepComponent implements OnInit {
[Validators.required]
)
);
this.useDaysInYearCustomStrategy = daysInYearType === 1;
if (this.useDaysInYearCustomStrategy) {
const daysInYearCustomStrategy: string = this.loanProductsTemplate.daysInYearCustomStrategy?.id
? this.loanProductsTemplate.daysInYearCustomStrategy.id
: '';
this.loanProductSettingsForm.addControl(
'daysInYearCustomStrategy',
new UntypedFormControl(daysInYearCustomStrategy, Validators.required)
);
}
} else {
this.useDaysInYearCustomStrategy = false;
this.loanProductSettingsForm.removeControl('loanScheduleProcessingType');
this.loanProductSettingsForm.removeControl('daysInYearCustomStrategy');
}
}
}