Loan Account Creation Fix

This commit is contained in:
Ramveer
2022-05-26 14:08:12 +02:00
committed by Arnold Gálovics
parent ccdd2336fd
commit 149865da4b
2 changed files with 25 additions and 2 deletions
@@ -132,8 +132,8 @@ export class CreateLoansAccountComponent implements OnInit {
loansAccountData.recalculationRestFrequencyDate = this.datePipe.transform(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
}
if (loansAccountData.recalculationCompoundingFrequencyDate) {
loansAccountData.recalculationCompoundingFrequencyDate = this.datePipe.transform(this.loansAccount.recalculationCompoundingFrequencyDate, dateFormat);
if (!loansAccountData.recalculationCompoundingFrequencyDate) {
delete loansAccountData.recalculationCompoundingFrequencyDate;
}
if (loansAccountData.interestCalculationPeriodType === 0) {
@@ -92,6 +92,29 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
});
}
}
this.createloansAccountTermsForm();
this.setCustomValidators();
}
/** Custom Validators for the form */
setCustomValidators() {
const repaymentFrequencyNthDayType = this.loansAccountTermsForm.get('repaymentFrequencyNthDayType');
const repaymentFrequencyDayOfWeekType = this.loansAccountTermsForm.get('repaymentFrequencyDayOfWeekType');
this.loansAccountTermsForm.get('repaymentFrequencyType').valueChanges
.subscribe(repaymentFrequencyType => {
if (repaymentFrequencyType === 2) {
repaymentFrequencyNthDayType.setValidators([Validators.required]);
repaymentFrequencyDayOfWeekType.setValidators([Validators.required]);
}else{
repaymentFrequencyNthDayType.setValidators(null);
repaymentFrequencyDayOfWeekType.setValidators(null);
}
repaymentFrequencyNthDayType.updateValueAndValidity();
repaymentFrequencyDayOfWeekType.updateValueAndValidity();
});
}
/** Create Loans Account Terms Form */