Loan account fixed due required fields

This commit is contained in:
Jose Alberto Hernandez
2022-05-26 09:13:39 -05:00
parent 479fefaa3f
commit 86a48f9691
23 changed files with 96 additions and 91 deletions
@@ -1,7 +1,6 @@
/** Angular Imports */
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { DatePipe } from '@angular/common';
/** Custom Services */
import { LoansService } from '../loans.service';
@@ -11,6 +10,7 @@ import { SettingsService } from 'app/settings/settings.service';
import { LoansAccountDetailsStepComponent } from '../loans-account-stepper/loans-account-details-step/loans-account-details-step.component';
import { LoansAccountTermsStepComponent } from '../loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component';
import { LoansAccountChargesStepComponent } from '../loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component';
import { Dates } from 'app/core/utils/dates';
/**
* Create loans account
@@ -44,7 +44,7 @@ export class CreateLoansAccountComponent implements OnInit {
*/
constructor(private route: ActivatedRoute,
private router: Router,
private datePipe: DatePipe,
private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService
) {
@@ -107,17 +107,17 @@ export class CreateLoansAccountComponent implements OnInit {
charges: this.loansAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
dueDate: charge.dueDate && this.datePipe.transform(charge.dueDate, dateFormat),
dueDate: charge.dueDate && this.dateUtils.formatDate(charge.dueDate, dateFormat),
})),
collateral: this.loansAccount.collateral.map((collateralEle: any) => ({
type: collateralEle.type,
value: collateralEle.value,
description: collateralEle.description
})),
interestChargedFromDate: this.datePipe.transform(this.loansAccount.interestChargedFromDate, dateFormat),
repaymentsStartingFromDate: this.datePipe.transform(this.loansAccount.repaymentsStartingFromDate, dateFormat),
submittedOnDate: this.datePipe.transform(this.loansAccount.submittedOnDate, dateFormat),
expectedDisbursementDate: this.datePipe.transform(this.loansAccount.expectedDisbursementDate, dateFormat),
interestChargedFromDate: this.dateUtils.formatDate(this.loansAccount.interestChargedFromDate, dateFormat),
repaymentsStartingFromDate: this.dateUtils.formatDate(this.loansAccount.repaymentsStartingFromDate, dateFormat),
submittedOnDate: this.dateUtils.formatDate(this.loansAccount.submittedOnDate, dateFormat),
expectedDisbursementDate: this.dateUtils.formatDate(this.loansAccount.expectedDisbursementDate, dateFormat),
dateFormat,
locale,
loanType
@@ -129,10 +129,14 @@ export class CreateLoansAccountComponent implements OnInit {
}
if (loansAccountData.recalculationRestFrequencyDate) {
loansAccountData.recalculationRestFrequencyDate = this.datePipe.transform(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
loansAccountData.recalculationRestFrequencyDate = this.dateUtils.formatDate(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
}
if (!loansAccountData.recalculationCompoundingFrequencyDate) {
if (this.loansAccountProductTemplate.isInterestRecalculationEnabled) {
if (loansAccountData.recalculationCompoundingFrequencyDate !== null) {
loansAccountData.recalculationCompoundingFrequencyDate = this.dateUtils.formatDate(this.loansAccount.recalculationCompoundingFrequencyDate, dateFormat);
}
} else {
delete loansAccountData.recalculationCompoundingFrequencyDate;
}