build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -7,19 +7,17 @@ import { ExternalAssetOwnerService } from '../services/external-asset-owner.serv
providedIn: 'root'
})
export class ExternalAssetOwnerActiveTransferResolver implements Resolve<boolean> {
/**
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service.
*/
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) {}
/**
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service.
*/
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.externalAssetOwnerService.retrieveExternalAssetOwnerActiveTransfer(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.externalAssetOwnerService.retrieveExternalAssetOwnerActiveTransfer(loanId);
}
}
@@ -7,19 +7,17 @@ import { ExternalAssetOwnerService } from '../services/external-asset-owner.serv
providedIn: 'root'
})
export class ExternalAssetOwnerJournalEntryResolver implements Resolve<boolean> {
/**
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service.
*/
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) {}
/**
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service.
*/
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const transferId = route.paramMap.get('transferId') || route.parent.paramMap.get('transferId');
return this.externalAssetOwnerService.retrieveExternalAssetOwnerTransferJournalEntries(transferId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const transferId = route.paramMap.get('transferId') || route.parent.paramMap.get('transferId');
return this.externalAssetOwnerService.retrieveExternalAssetOwnerTransferJournalEntries(transferId);
}
}
@@ -7,19 +7,17 @@ import { ExternalAssetOwnerService } from '../services/external-asset-owner.serv
providedIn: 'root'
})
export class ExternalAssetOwnerResolver implements Resolve<boolean> {
/**
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service.
*/
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) {}
/**
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service.
*/
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.externalAssetOwnerService.retrieveExternalAssetOwnerTransfers(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.externalAssetOwnerService.retrieveExternalAssetOwnerTransfers(loanId);
}
}
@@ -13,17 +13,17 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class GLIMLoanTemplateResolver implements Resolve<Object> {
/**
* @param {ProductsService} loansService Loan service.
*/
constructor(private loansService: LoansService) { }
/**
* @param {ProductsService} loansService Loan service.
*/
constructor(private loansService: LoansService) {}
/**
* Returns the loan account template data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.paramMap.get('groupId');
return this.loansService.getGLIMLoanAccountTemplate(groupId);
}
/**
* Returns the loan account template data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.paramMap.get('groupId');
return this.loansService.getGLIMLoanAccountTemplate(groupId);
}
}
@@ -13,11 +13,10 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanActionButtonResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
constructor(private loansService: LoansService) {}
/**
* Returns the Loans Notes Data.
@@ -32,7 +31,8 @@ export class LoanActionButtonResolver implements Resolve<Object> {
return this.loansService.getLoanActionTemplate(loanId, 'repayment');
} else if (loanActionButton === 'Goodwill Credit') {
return this.loansService.getLoanActionTemplate(loanId, 'goodwillCredit');
} if (loanActionButton === 'Interest Payment Waiver') {
}
if (loanActionButton === 'Interest Payment Waiver') {
return this.loansService.getLoanActionTemplate(loanId, 'interestPaymentWaiver');
} else if (loanActionButton === 'Payout Refund') {
return this.loansService.getLoanActionTemplate(loanId, 'payoutRefund');
@@ -78,5 +78,4 @@ export class LoanActionButtonResolver implements Resolve<Object> {
return undefined;
}
}
}
@@ -7,17 +7,16 @@ import { Observable } from 'rxjs';
providedIn: 'root'
})
export class LoanArrearDelinquencyResolver implements Resolve<boolean> {
/**
* @param {SystemService} systemService System service.
*/
constructor(private systemService: SystemService) {}
/**
* @param {SystemService} systemService System service.
*/
constructor(private systemService: SystemService) { }
/**
* Returns the loan-arrears-delinquency-display-data configuration data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
return this.systemService.getConfigurationByName('loan-arrears-delinquency-display-data');
}
/**
* Returns the loan-arrears-delinquency-display-data configuration data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
return this.systemService.getConfigurationByName('loan-arrears-delinquency-display-data');
}
}
@@ -1,8 +1,5 @@
import { Injectable } from '@angular/core';
import {
Resolve,
ActivatedRouteSnapshot
} from '@angular/router';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { LoansService } from '../loans.service';
@@ -10,11 +7,10 @@ import { LoansService } from '../loans.service';
providedIn: 'root'
})
export class LoanCollateralsResolver implements Resolve<boolean> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
constructor(private loansService: LoansService) {}
/**
* Returns the Loans data.
@@ -13,20 +13,18 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanDatatableResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans Notes Data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.parent.paramMap.get('loanId');
const datatableName = route.paramMap.get('datatableName');
return this.loansService.getLoanDatatable(loanId, datatableName);
}
/**
* Returns the Loans Notes Data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.parent.paramMap.get('loanId');
const datatableName = route.paramMap.get('datatableName');
return this.loansService.getLoanDatatable(loanId, datatableName);
}
}
@@ -13,18 +13,16 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanDatatablesResolver implements Resolve<Object> {
/**
* @param {loansService} loansService loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {loansService} loansService loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the loan datatables.
* @returns {Observable<any>}
*/
resolve(): Observable<any> {
return this.loansService.getLoanDataTables();
}
/**
* Returns the loan datatables.
* @returns {Observable<any>}
*/
resolve(): Observable<any> {
return this.loansService.getLoanDataTables();
}
}
@@ -7,19 +7,17 @@ import { LoansService } from '../loans.service';
providedIn: 'root'
})
export class LoanDelinquencyActionsResolver implements Resolve<boolean> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getDelinquencyActions(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getDelinquencyActions(loanId);
}
}
@@ -13,19 +13,17 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanDelinquencyDataResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getDelinquencyData(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getDelinquencyData(loanId);
}
}
@@ -13,19 +13,17 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanDelinquencyTagsResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getDelinquencyTags(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getDelinquencyTags(loanId);
}
}
@@ -13,19 +13,17 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanDetailsChargesResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId');
return this.loansService.getLoanAccountAssociationDetails(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId');
return this.loansService.getLoanAccountAssociationDetails(loanId);
}
}
@@ -13,21 +13,19 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanDetailsResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
if (!isNaN(+loanId)) {
return this.loansService.getLoanAccountAssociationDetails(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
if (!isNaN(+loanId)) {
return this.loansService.getLoanAccountAssociationDetails(loanId);
}
}
}
@@ -13,19 +13,17 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanDocumentsResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getLoanDocuments(loanId);
}
/**
* Returns the Loans data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getLoanDocuments(loanId);
}
}
@@ -13,19 +13,17 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanNotesResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getLoanNotes(loanId);
}
/**
* Returns the Loans data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getLoanNotes(loanId);
}
}
@@ -1,9 +1,5 @@
import { Injectable } from '@angular/core';
import {
Router, Resolve,
RouterStateSnapshot,
ActivatedRouteSnapshot
} from '@angular/router';
import { Router, Resolve, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
import { Observable, of } from 'rxjs';
import { LoansService } from '../loans.service';
@@ -11,19 +7,17 @@ import { LoansService } from '../loans.service';
providedIn: 'root'
})
export class LoanReschedulesResolver implements Resolve<boolean> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.loanRescheduleRequests(loanId);
}
/**
* Returns the Loans data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.loanRescheduleRequests(loanId);
}
}
@@ -13,21 +13,19 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoanTermVariationsResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
if (!isNaN(+loanId)) {
return this.loansService.getInterestPausesOfLoan(loanId);
}
/**
* Returns the Loans with Association data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
if (!isNaN(+loanId)) {
return this.loansService.getInterestPausesOfLoan(loanId);
}
}
}
@@ -13,17 +13,17 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoansAccountAndTemplateResolver implements Resolve<Object> {
/**
* @param {ProductsService} productsService Products service.
*/
constructor(private loansService: LoansService) { }
/**
* @param {ProductsService} productsService Products service.
*/
constructor(private loansService: LoansService) {}
/**
* Returns the loan account template data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getLoansAccountAndTemplateResource(loanId);
}
/**
* Returns the loan account template data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
return this.loansService.getLoansAccountAndTemplateResource(loanId);
}
}
@@ -13,21 +13,19 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoansAccountChargeResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) {}
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
/**
* Returns the Loans Account Charge data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId');
const chargeId = route.paramMap.get('id');
return this.loansService.getLoansAccountCharge(loanId, chargeId);
}
/**
* Returns the Loans Account Charge data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const loanId = route.paramMap.get('loanId');
const chargeId = route.paramMap.get('id');
return this.loansService.getLoansAccountCharge(loanId, chargeId);
}
}
@@ -13,18 +13,18 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoansAccountTemplateResolver implements Resolve<Object> {
/**
* @param {ProductsService} productsService Products service.
*/
constructor(private loansService: LoansService) { }
/**
* @param {ProductsService} productsService Products service.
*/
constructor(private loansService: LoansService) {}
/**
* Returns the loan account template data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const entityId = route.parent.parent.paramMap.get('clientId') || route.parent.parent.paramMap.get('groupId');
const isGroup = (route.parent.parent.paramMap.get('groupId')) ? true : false;
return this.loansService.getLoansAccountTemplateResource(entityId, isGroup);
}
/**
* Returns the loan account template data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const entityId = route.parent.parent.paramMap.get('clientId') || route.parent.parent.paramMap.get('groupId');
const isGroup = route.parent.parent.paramMap.get('groupId') ? true : false;
return this.loansService.getLoansAccountTemplateResource(entityId, isGroup);
}
}
@@ -13,11 +13,10 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoansAccountTransactionTemplateResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
constructor(private loansService: LoansService) {}
/**
* Returns the Loans Account Transaction Template data.
@@ -29,5 +28,4 @@ export class LoansAccountTransactionTemplateResolver implements Resolve<Object>
const transactionId = route.paramMap.get('id');
return this.loansService.getLoansAccountTransactionTemplate(loanId, transactionId);
}
}
@@ -13,11 +13,10 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class LoansAccountTransactionResolver implements Resolve<Object> {
/**
* @param {LoansService} LoansService Loans service.
*/
constructor(private loansService: LoansService) { }
constructor(private loansService: LoansService) {}
/**
* Returns the Loans Account Transaction data.
@@ -29,5 +28,4 @@ export class LoansAccountTransactionResolver implements Resolve<Object> {
const transactionId = route.paramMap.get('id');
return this.loansService.getLoansAccountTransaction(loanId, transactionId);
}
}
@@ -13,11 +13,10 @@ import { ReportsService } from 'app/reports/reports.service';
*/
@Injectable()
export class LoansTransactionRecieptResolver implements Resolve<Object> {
/**
* @param {ReportsService} reportsService Reports service.
*/
constructor(private reportsService: ReportsService) { }
constructor(private reportsService: ReportsService) {}
/**
* Returns the Loans Transaction Reciept
@@ -27,10 +26,15 @@ export class LoansTransactionRecieptResolver implements Resolve<Object> {
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const transactionId = route.paramMap.get('id');
const data = {
'output-type': 'PDF',
R_transactionId: transactionId
'output-type': 'PDF',
R_transactionId: transactionId
};
return this.reportsService.getPentahoRunReportData('Loan Transaction Receipt', data, 'default', 'en', 'dd MMMM yyyy');
return this.reportsService.getPentahoRunReportData(
'Loan Transaction Receipt',
data,
'default',
'en',
'dd MMMM yyyy'
);
}
}
@@ -8,9 +8,8 @@ describe('CreateLoansAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateLoansAccountComponent ]
})
.compileComponents();
declarations: [CreateLoansAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -22,11 +22,12 @@ import { LoansAccountDatatableStepComponent } from '../loans-account-stepper/loa
styleUrls: ['./create-loans-account.component.scss']
})
export class CreateLoansAccountComponent {
/** Imports all the step component */
@ViewChild(LoansAccountDetailsStepComponent, { static: true }) loansAccountDetailsStep: LoansAccountDetailsStepComponent;
@ViewChild(LoansAccountDetailsStepComponent, { static: true })
loansAccountDetailsStep: LoansAccountDetailsStepComponent;
@ViewChild(LoansAccountTermsStepComponent, { static: true }) loansAccountTermsStep: LoansAccountTermsStepComponent;
@ViewChild(LoansAccountChargesStepComponent, { static: true }) loansAccountChargesStep: LoansAccountChargesStepComponent;
@ViewChild(LoansAccountChargesStepComponent, { static: true })
loansAccountChargesStep: LoansAccountChargesStepComponent;
/** Get handle on dtloan tags in the template */
@ViewChildren('dtloan') loanDatatables: QueryList<LoansAccountDatatableStepComponent>;
@@ -52,7 +53,8 @@ export class CreateLoansAccountComponent {
* @param {SettingsService} settingsService Settings Service
* @param {ClientsService} clientService Client Service
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private loansService: LoansService,
private settingsService: SettingsService,
@@ -74,8 +76,10 @@ export class CreateLoansAccountComponent {
this.clientService.getCollateralTemplate(clientId).subscribe((response: any) => {
this.collateralOptions = response;
});
const entityId = (this.loansAccountTemplate.clientId) ? this.loansAccountTemplate.clientId : this.loansAccountTemplate.group.id;
const isGroup = (this.loansAccountTemplate.clientId) ? false : true;
const entityId = this.loansAccountTemplate.clientId
? this.loansAccountTemplate.clientId
: this.loansAccountTemplate.group.id;
const isGroup = this.loansAccountTemplate.clientId ? false : true;
const productId = this.loansAccountProductTemplate.loanProductId;
this.loansService.getLoansAccountTemplateResource(entityId, isGroup, productId).subscribe((response: any) => {
this.multiDisburseLoan = response.multiDisburseLoan;
@@ -105,10 +109,7 @@ export class CreateLoansAccountComponent {
/** Checks wheter all the forms in different steps are valid or not */
get loansAccountFormValid() {
return (
this.loansAccountDetailsForm.valid &&
this.loansAccountTermsForm.valid
);
return this.loansAccountDetailsForm.valid && this.loansAccountTermsForm.valid;
}
/** Gets principal Amount */
@@ -133,8 +134,13 @@ export class CreateLoansAccountComponent {
submit() {
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const payload = this.loansService.buildLoanRequestPayload(this.loansAccount, this.loansAccountTemplate,
this.loansAccountProductTemplate.calendarOptions, locale, dateFormat);
const payload = this.loansService.buildLoanRequestPayload(
this.loansAccount,
this.loansAccountTemplate,
this.loansAccountProductTemplate.calendarOptions,
locale,
dateFormat
);
if (this.loansAccountProductTemplate.datatables && this.loansAccountProductTemplate.datatables.length > 0) {
const datatables: any[] = [];
@@ -145,8 +151,14 @@ export class CreateLoansAccountComponent {
}
this.loansService.createLoansAccount(payload).subscribe((response: any) => {
this.router.navigate(['../', response.resourceId, 'general'], { relativeTo: this.route });
this.router.navigate(
[
'../',
response.resourceId,
'general'
],
{ relativeTo: this.route }
);
});
}
}
@@ -8,9 +8,8 @@ describe('LoanDelinquencyActionDialogComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoanDelinquencyActionDialogComponent ]
})
.compileComponents();
declarations: [LoanDelinquencyActionDialogComponent]
}).compileComponents();
fixture = TestBed.createComponent(LoanDelinquencyActionDialogComponent);
component = fixture.componentInstance;
@@ -8,24 +8,30 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./loan-delinquency-action-dialog.component.scss']
})
export class LoanDelinquencyActionDialogComponent {
delinquencyActionForm: UntypedFormGroup;
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
maxDate = new Date(2100, 0, 1);
constructor(public dialogRef: MatDialogRef<LoanDelinquencyActionDialogComponent>,
constructor(
public dialogRef: MatDialogRef<LoanDelinquencyActionDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private formBuilder: UntypedFormBuilder) {
this.createDelinquencyActionForm();
private formBuilder: UntypedFormBuilder
) {
this.createDelinquencyActionForm();
}
createDelinquencyActionForm() {
this.delinquencyActionForm = this.formBuilder.group({
'startDate': [new Date(), Validators.required],
'endDate': ['', Validators.required],
startDate: [
new Date(),
Validators.required
],
endDate: [
'',
Validators.required
]
});
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountAddCollateralDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoansAccountAddCollateralDialogComponent ]
})
.compileComponents();
declarations: [LoansAccountAddCollateralDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,12 +8,11 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms
styleUrls: ['./loans-account-add-collateral-dialog.component.scss']
})
export class LoansAccountAddCollateralDialogComponent implements OnInit {
layout: {
addButtonText?: string
addButtonText?: string;
} = {
addButtonText: 'Add'
};
addButtonText: 'Add'
};
addCollateralForm: UntypedFormGroup;
/** All Collateral Options */
@@ -23,9 +22,11 @@ export class LoansAccountAddCollateralDialogComponent implements OnInit {
/** Maximum ALlowed Quantity of selected collateral */
maxQuantity: any = 0;
constructor(public dialogRef: MatDialogRef<LoansAccountAddCollateralDialogComponent>,
constructor(
public dialogRef: MatDialogRef<LoansAccountAddCollateralDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private formBuilder: UntypedFormBuilder) {
private formBuilder: UntypedFormBuilder
) {
this.createAddCollateralForm();
}
@@ -37,17 +38,23 @@ export class LoansAccountAddCollateralDialogComponent implements OnInit {
createAddCollateralForm() {
this.addCollateralForm = this.formBuilder.group({
'collateral': ['', Validators.required],
'quantity': ['', Validators.required],
'totalValue': [{value: '', disabled: true}],
'totalCollateralValue': [{value: '', disabled: true}],
collateral: [
'',
Validators.required
],
quantity: [
'',
Validators.required
],
totalValue: [{ value: '', disabled: true }],
totalCollateralValue: [{ value: '', disabled: true }]
});
}
/**
* Subscribe to Form controls value changes
*/
buildDependencies() {
buildDependencies() {
this.addCollateralForm.controls.collateral.valueChanges.subscribe((collateral: any) => {
this.collateralData = collateral;
this.maxQuantity = collateral.quantity;
@@ -55,10 +62,9 @@ export class LoansAccountAddCollateralDialogComponent implements OnInit {
this.addCollateralForm.controls.quantity.valueChanges.subscribe((quantity: any) => {
this.addCollateralForm.patchValue({
'totalValue': this.collateralData.basePrice * quantity,
'totalCollateralValue': this.collateralData.basePrice * this.collateralData.pctToBase * quantity / 100
totalValue: this.collateralData.basePrice * quantity,
totalCollateralValue: (this.collateralData.basePrice * this.collateralData.pctToBase * quantity) / 100
});
});
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountViewGuarantorDetailsDialogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoansAccountViewGuarantorDetailsDialogComponent ]
})
.compileComponents();
declarations: [LoansAccountViewGuarantorDetailsDialogComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -7,13 +7,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
styleUrls: ['./loans-account-view-guarantor-details-dialog.component.scss']
})
export class LoansAccountViewGuarantorDetailsDialogComponent implements OnInit {
constructor(public dialogRef: MatDialogRef<LoansAccountViewGuarantorDetailsDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
constructor(
public dialogRef: MatDialogRef<LoansAccountViewGuarantorDetailsDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
ngOnInit() {
this.dialogRef.updateSize('400px');
}
}
@@ -8,9 +8,8 @@ describe('EditLoansAccountComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditLoansAccountComponent ]
})
.compileComponents();
declarations: [EditLoansAccountComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,10 +18,11 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./edit-loans-account.component.scss']
})
export class EditLoansAccountComponent {
@ViewChild(LoansAccountDetailsStepComponent, { static: true }) loansAccountDetailsStep: LoansAccountDetailsStepComponent;
@ViewChild(LoansAccountDetailsStepComponent, { static: true })
loansAccountDetailsStep: LoansAccountDetailsStepComponent;
@ViewChild(LoansAccountTermsStepComponent, { static: true }) loansAccountTermsStep: LoansAccountTermsStepComponent;
@ViewChild(LoansAccountChargesStepComponent, { static: true }) loansAccountChargesStep: LoansAccountChargesStepComponent;
@ViewChild(LoansAccountChargesStepComponent, { static: true })
loansAccountChargesStep: LoansAccountChargesStepComponent;
loansAccountAndTemplate: any;
/** Loans Account Product Template */
@@ -41,7 +42,8 @@ export class EditLoansAccountComponent {
* @param {loansService} LoansService Loans Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loansService: LoansService,
@@ -61,9 +63,11 @@ export class EditLoansAccountComponent {
this.loansAccountProductTemplate = $event;
this.currencyCode = this.loansAccountProductTemplate.currency.code;
if (this.loansAccountProductTemplate.loanProductId) {
this.loansService.getLoansCollateralTemplateResource(this.loansAccountProductTemplate.loanProductId).subscribe((response: any) => {
this.collateralOptions = response.loanCollateralOptions;
});
this.loansService
.getLoansCollateralTemplateResource(this.loansAccountProductTemplate.loanProductId)
.subscribe((response: any) => {
this.collateralOptions = response.loanCollateralOptions;
});
}
}
@@ -80,14 +84,12 @@ export class EditLoansAccountComponent {
/** Checks wheter all the forms in different steps are valid and not pristine */
get loansAccountFormValidAndNotPristine() {
return (
(this.loansAccountDetailsForm.valid &&
this.loansAccountTermsForm.valid) &&
(
!this.loansAccountDetailsForm.pristine ||
this.loansAccountDetailsForm.valid &&
this.loansAccountTermsForm.valid &&
(!this.loansAccountDetailsForm.pristine ||
!this.loansAccountTermsForm.pristine ||
!this.loansAccountTermsStep.pristine ||
!this.loansAccountChargesStep.pristine
)
!this.loansAccountChargesStep.pristine)
);
}
@@ -115,7 +117,7 @@ export class EditLoansAccountComponent {
charges: this.loansAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
dueDate: charge.dueDate && this.dateUtils.formatDate(charge.dueDate, dateFormat),
dueDate: charge.dueDate && this.dateUtils.formatDate(charge.dueDate, dateFormat)
})),
collateral: this.loansAccount.collateral.map((collateralEle: any) => ({
type: collateralEle.type,
@@ -141,13 +143,19 @@ export class EditLoansAccountComponent {
}
if (loansAccountData.recalculationRestFrequencyDate) {
loansAccountData.recalculationRestFrequencyDate = this.dateUtils.formatDate(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
loansAccountData.recalculationRestFrequencyDate = this.dateUtils.formatDate(
this.loansAccount.recalculationRestFrequencyDate,
dateFormat
);
}
if (loansAccountData.interestCalculationPeriodType === 0) {
loansAccountData.allowPartialPeriodInterestCalcualtion = false;
}
if (!loansAccountData.isLoanProductLinkedToFloatingRate || loansAccountData.isLoanProductLinkedToFloatingRate === false) {
if (
!loansAccountData.isLoanProductLinkedToFloatingRate ||
loansAccountData.isLoanProductLinkedToFloatingRate === false
) {
delete loansAccountData.isFloatingInterestRate;
}
loansAccountData.principal = loansAccountData.principalAmount;
@@ -157,5 +165,4 @@ export class EditLoansAccountComponent {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CreateGlimAccountComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CreateGlimAccountComponent ]
})
.compileComponents();
declarations: [CreateGlimAccountComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -14,7 +14,6 @@ import { GlimTermsStepComponent } from './glim-account-stepper/glim-terms-step/g
styleUrls: ['./create-glim-account.component.scss']
})
export class CreateGlimAccountComponent {
/** Imports all the step component */
@ViewChild(GlimDetailsStepComponent, { static: true }) loansAccountDetailsStep: GlimDetailsStepComponent;
@ViewChild(GlimTermsStepComponent, { static: true }) loansAccountTermsStep: GlimTermsStepComponent;
@@ -48,24 +47,26 @@ export class CreateGlimAccountComponent {
* @param {LoansService} loansService Loans Service.
* @param {SettingsService} settingsService SettingsService
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private loansService: LoansService,
private settingsService: SettingsService,
public dialog: MatDialog,
private dateUtils: Dates) {
this.route.data.subscribe((data: {loansAccountTemplate: any, gsimData: any, groupsData: any}) => {
private dateUtils: Dates
) {
this.route.data.subscribe((data: { loansAccountTemplate: any; gsimData: any; groupsData: any }) => {
this.loansAccountTemplate = data.loansAccountTemplate;
this.activeClientMembers = data.groupsData.activeClientMembers;
this.gsimData = data.gsimData;
});
}
}
/**
* Sets loans account product template and collateral template
* @param {any} $event API response
*/
setTemplate($event: any) {
setTemplate($event: any) {
this.loansAccountProductTemplate = $event;
}
@@ -81,10 +82,7 @@ export class CreateGlimAccountComponent {
/** Checks wheter all the forms in different steps are valid or not */
get loansAccountFormValid() {
return (
this.loansAccountDetailsForm.valid &&
this.loansAccountTermsForm.valid
);
return this.loansAccountDetailsForm.valid && this.loansAccountTermsForm.valid;
}
/** Gets principal Amount */
@@ -98,7 +96,7 @@ export class CreateGlimAccountComponent {
return {
...this.loansAccountDetailsStep.loansAccountDetails,
...this.loansAccountTermsStep.loansAccountTerms,
...this.loansAccountChargesStep.loansAccountCharges,
...this.loansAccountChargesStep.loansAccountCharges
};
}
@@ -110,12 +108,12 @@ export class CreateGlimAccountComponent {
...this.loansAccount,
charges: this.loansAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
amount: charge.amount
})),
clientId: client.id,
totalLoan: this.totalLoan,
loanType: 'glim',
amortizationType: 1,
amortizationType: 1,
isParentAccount: true,
principal: client.principal,
syncDisbursementWithMeeting: false,
@@ -138,11 +136,10 @@ export class CreateGlimAccountComponent {
for (let index = 0; index < memberSelected.length; index++) {
requestData.push({
requestId: index.toString(),
method : 'POST',
method: 'POST',
relativeUrl: 'loans',
body : this.setData( memberSelected[ index ] )
}
);
body: this.setData(memberSelected[index])
});
}
return requestData;
}
@@ -165,5 +162,4 @@ export class CreateGlimAccountComponent {
this.router.navigate(['../../../'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('GlimChargesStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlimChargesStepComponent ]
})
.compileComponents();
declarations: [GlimChargesStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -14,7 +14,6 @@ import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
styleUrls: ['./glim-charges-step.component.scss']
})
export class GlimChargesStepComponent implements OnInit, OnChanges {
/** Savings Account Product Template */
@Input() loansAccountProductTemplate: any;
/** Savings Account Template */
@@ -33,7 +32,15 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
/** For Edit Savings Account Form */
isChargesPatched = false;
/** Display columns for charges table */
displayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery', 'action'];
displayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'repaymentsEvery',
'action'
];
/** Table Data Source */
dataSource: any;
/** Check for select all the Clients List */
@@ -41,23 +48,31 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
/** Loan Purpose Options */
loanPurposeOptions: string[] = [];
/** Table Displayed Columns */
displayedColumn: string[] = ['check', 'id', 'name', 'purpose', 'amount'];
displayedColumn: string[] = [
'check',
'id',
'name',
'purpose',
'amount'
];
/**
* @param {MatDialog} dialog Mat Dialog
*/
constructor(public dialog: MatDialog,
private dateUtils: Dates) {}
constructor(
public dialog: MatDialog,
private dateUtils: Dates
) {}
ngOnInit() {
ngOnInit() {
this.dataSource = new MatTableDataSource<any>(this.activeClientMembers);
}
}
ngOnChanges() {
ngOnChanges() {
if (this.loansAccountProductTemplate) {
this.chargeData = this.loansAccountProductTemplate.chargeOptions;
}
}
}
/**
* Adds the charge to charges table
@@ -81,7 +96,8 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
value: charge.amount,
type: 'number',
required: false
}),
})
];
const data = {
title: 'Edit Charge Amount',
@@ -111,7 +127,8 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
value: charge.dueDate || charge.feeOnMonthDay || '',
type: 'datetime-local',
required: false
}),
})
];
const data = {
title: 'Edit Charge Date',
@@ -127,11 +144,11 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
switch (charge.chargeTimeType.value) {
case 'Specified due date':
case 'Weekly Fee':
newCharge = { ...charge, dueDate: date };
break;
newCharge = { ...charge, dueDate: date };
break;
case 'Annual Fee':
newCharge = { ...charge, feeOnMonthDay: date };
break;
newCharge = { ...charge, feeOnMonthDay: date };
break;
}
this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1, newCharge);
this.chargesDataSource = this.chargesDataSource.concat([]);
@@ -152,7 +169,8 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
value: charge.feeInterval,
type: 'text',
required: false
}),
})
];
const data = {
title: 'Edit Charge Fee Interval',
@@ -188,7 +206,7 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
}
get selectedClientMembers() {
return { selectedMembers: this.activeClientMembers.filter( (item: any) => item.selected ) };
return { selectedMembers: this.activeClientMembers.filter((item: any) => item.selected) };
}
/** Toggle all checks */
@@ -201,7 +219,7 @@ export class GlimChargesStepComponent implements OnInit, OnChanges {
/** Check if all the checks are selected */
toggleSelect() {
const len = this.activeClientMembers.length;
this.selectAllItems = len === 0 ? false : this.activeClientMembers.filter( (item: any) => item.selected ).length === len;
this.selectAllItems =
len === 0 ? false : this.activeClientMembers.filter((item: any) => item.selected).length === len;
}
}
@@ -8,9 +8,8 @@ describe('GlimDetailsStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlimDetailsStepComponent ]
})
.compileComponents();
declarations: [GlimDetailsStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -39,9 +39,11 @@ export class GlimDetailsStepComponent implements OnInit {
* @param {LoansService} loansService Loans Service.
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loansService: LoansService,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.createLoansAccountDetailsForm();
}
@@ -52,13 +54,17 @@ export class GlimDetailsStepComponent implements OnInit {
this.productData = this.loansAccountTemplate.productOptions;
if (this.loansAccountTemplate.loanProductId) {
this.loansAccountDetailsForm.patchValue({
'productId': this.loansAccountTemplate.loanProductId,
'submittedOnDate': this.loansAccountTemplate.timeline.submittedOnDate && new Date(this.loansAccountTemplate.timeline.submittedOnDate),
'loanOfficerId': this.loansAccountTemplate.loanOfficerId,
'loanPurposeId': this.loansAccountTemplate.loanPurposeId,
'fundId': this.loansAccountTemplate.fundId,
'expectedDisbursementDate': this.loansAccountTemplate.timeline.expectedDisbursementDate && new Date(this.loansAccountTemplate.timeline.expectedDisbursementDate),
'externalId': this.loansAccountTemplate.externalId
productId: this.loansAccountTemplate.loanProductId,
submittedOnDate:
this.loansAccountTemplate.timeline.submittedOnDate &&
new Date(this.loansAccountTemplate.timeline.submittedOnDate),
loanOfficerId: this.loansAccountTemplate.loanOfficerId,
loanPurposeId: this.loansAccountTemplate.loanPurposeId,
fundId: this.loansAccountTemplate.fundId,
expectedDisbursementDate:
this.loansAccountTemplate.timeline.expectedDisbursementDate &&
new Date(this.loansAccountTemplate.timeline.expectedDisbursementDate),
externalId: this.loansAccountTemplate.externalId
});
}
}
@@ -67,21 +73,30 @@ export class GlimDetailsStepComponent implements OnInit {
/**
* Creates glim account details form.
*/
createLoansAccountDetailsForm() {
createLoansAccountDetailsForm() {
this.loansAccountDetailsForm = this.formBuilder.group({
'productId': ['', Validators.required],
'loanOfficerId': [''],
'fundId': [''],
'submittedOnDate': [new Date(), Validators.required],
'expectedDisbursementDate': ['', Validators.required],
'linkAccountId': [''],
productId: [
'',
Validators.required
],
loanOfficerId: [''],
fundId: [''],
submittedOnDate: [
new Date(),
Validators.required
],
expectedDisbursementDate: [
'',
Validators.required
],
linkAccountId: ['']
});
}
/**
* Fetches loans account product template on productId value changes
*/
buildDependencies() {
buildDependencies() {
const groupId = this.loansAccountTemplate.group.id;
this.loansAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
this.loansService.getLoansAccountTemplateResource(groupId, true, productId).subscribe((response: any) => {
@@ -100,5 +115,4 @@ export class GlimDetailsStepComponent implements OnInit {
get loansAccountDetails() {
return this.loansAccountDetailsForm.value;
}
}
@@ -8,9 +8,8 @@ describe('GlimPreviewStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlimPreviewStepComponent ]
})
.compileComponents();
declarations: [GlimPreviewStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -6,8 +6,6 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
styleUrls: ['./glim-preview-step.component.scss']
})
export class GlimPreviewStepComponent {
/** Loans Account Template */
@Input() loansAccountTemplate: any;
/** Loans Account Product Template */
@@ -18,10 +16,20 @@ export class GlimPreviewStepComponent {
@Output() submitEvent = new EventEmitter();
/** Charges Displayed Columns */
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date'];
chargesDisplayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date'
];
/** Overdue Charges Displayed Columns */
overdueChargesDisplayedColumns: string[] = ['name', 'type', 'amount', 'collectedon'];
constructor() { }
overdueChargesDisplayedColumns: string[] = [
'name',
'type',
'amount',
'collectedon'
];
constructor() {}
}
@@ -8,9 +8,8 @@ describe('GlimTermsStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlimTermsStepComponent ]
})
.compileComponents();
declarations: [GlimTermsStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -8,7 +8,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./glim-terms-step.component.scss']
})
export class GlimTermsStepComponent implements OnInit, OnChanges {
/** Loans Account Product Template */
@Input() loansAccountProductTemplate: any;
/** Loans Account Template */
@@ -42,8 +41,10 @@ export class GlimTermsStepComponent implements OnInit, OnChanges {
* @param formBuilder FormBuilder
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService
) {
this.createloansAccountTermsForm();
}
/**
@@ -52,16 +53,16 @@ export class GlimTermsStepComponent implements OnInit, OnChanges {
ngOnChanges() {
if (this.loansAccountProductTemplate) {
this.loansAccountTermsForm.patchValue({
'principal': this.loansAccountProductTemplate.principal,
'loanTermFrequency': this.loansAccountProductTemplate.termFrequency,
'loanTermFrequencyType': this.loansAccountProductTemplate.termPeriodFrequencyType.id,
'numberOfRepayments': this.loansAccountProductTemplate.numberOfRepayments,
'repaymentEvery': this.loansAccountProductTemplate.repaymentEvery,
'repaymentFrequencyType': this.loansAccountProductTemplate.repaymentFrequencyType.id,
'interestRatePerPeriod': this.loansAccountProductTemplate.interestRatePerPeriod,
'interestType': this.loansAccountProductTemplate.interestType.id,
'interestCalculationPeriodType': this.loansAccountProductTemplate.interestCalculationPeriodType.id,
'transactionProcessingStrategyCode': this.loansAccountProductTemplate.transactionProcessingStrategyCode,
principal: this.loansAccountProductTemplate.principal,
loanTermFrequency: this.loansAccountProductTemplate.termFrequency,
loanTermFrequencyType: this.loansAccountProductTemplate.termPeriodFrequencyType.id,
numberOfRepayments: this.loansAccountProductTemplate.numberOfRepayments,
repaymentEvery: this.loansAccountProductTemplate.repaymentEvery,
repaymentFrequencyType: this.loansAccountProductTemplate.repaymentFrequencyType.id,
interestRatePerPeriod: this.loansAccountProductTemplate.interestRatePerPeriod,
interestType: this.loansAccountProductTemplate.interestType.id,
interestCalculationPeriodType: this.loansAccountProductTemplate.interestCalculationPeriodType.id,
transactionProcessingStrategyCode: this.loansAccountProductTemplate.transactionProcessingStrategyCode
});
this.setOptions();
}
@@ -72,7 +73,9 @@ export class GlimTermsStepComponent implements OnInit, OnChanges {
if (this.loansAccountTemplate) {
if (this.loansAccountTemplate.loanProductId) {
this.loansAccountTermsForm.patchValue({
'repaymentsStartingFromDate': this.loansAccountTemplate.expectedFirstRepaymentOnDate && new Date(this.loansAccountTemplate.expectedFirstRepaymentOnDate)
repaymentsStartingFromDate:
this.loansAccountTemplate.expectedFirstRepaymentOnDate &&
new Date(this.loansAccountTemplate.expectedFirstRepaymentOnDate)
});
}
}
@@ -85,39 +88,55 @@ export class GlimTermsStepComponent implements OnInit, OnChanges {
const repaymentFrequencyNthDayType = this.loansAccountTermsForm.get('repaymentFrequencyNthDayType');
const repaymentFrequencyDayOfWeekType = this.loansAccountTermsForm.get('repaymentFrequencyDayOfWeekType');
this.loansAccountTermsForm.get('repaymentFrequencyType').valueChanges
.subscribe(repaymentFrequencyType => {
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);
}
if (repaymentFrequencyType === 2) {
repaymentFrequencyNthDayType.setValidators([Validators.required]);
repaymentFrequencyDayOfWeekType.setValidators([Validators.required]);
} else {
repaymentFrequencyNthDayType.setValidators(null);
repaymentFrequencyDayOfWeekType.setValidators(null);
}
repaymentFrequencyNthDayType.updateValueAndValidity();
repaymentFrequencyDayOfWeekType.updateValueAndValidity();
});
repaymentFrequencyNthDayType.updateValueAndValidity();
repaymentFrequencyDayOfWeekType.updateValueAndValidity();
});
}
/** Create Loans Account Terms Form */
createloansAccountTermsForm() {
this.loansAccountTermsForm = this.formBuilder.group({
'principal': ['', Validators.required],
'loanTermFrequency': ['', Validators.required],
'loanTermFrequencyType': ['', Validators.required],
'numberOfRepayments': ['', Validators.required],
'repaymentEvery': ['', Validators.required],
'repaymentFrequencyType': ['', Validators.required],
'repaymentFrequencyNthDayType': [''],
'repaymentFrequencyDayOfWeekType': [''],
'repaymentsStartingFromDate': [''],
'interestChargedFromDate': [''],
'interestRatePerPeriod': [''],
'interestType': [''],
'interestCalculationPeriodType': [''],
'transactionProcessingStrategyCode': ['']
principal: [
'',
Validators.required
],
loanTermFrequency: [
'',
Validators.required
],
loanTermFrequencyType: [
'',
Validators.required
],
numberOfRepayments: [
'',
Validators.required
],
repaymentEvery: [
'',
Validators.required
],
repaymentFrequencyType: [
'',
Validators.required
],
repaymentFrequencyNthDayType: [''],
repaymentFrequencyDayOfWeekType: [''],
repaymentsStartingFromDate: [''],
interestChargedFromDate: [''],
interestRatePerPeriod: [''],
interestType: [''],
interestCalculationPeriodType: [''],
transactionProcessingStrategyCode: ['']
});
}
@@ -127,7 +146,8 @@ export class GlimTermsStepComponent implements OnInit, OnChanges {
setOptions() {
this.termFrequencyTypeData = this.loansAccountProductTemplate.termFrequencyTypeOptions;
this.repaymentFrequencyNthDayTypeData = this.loansAccountProductTemplate.repaymentFrequencyNthDayTypeOptions;
this.repaymentFrequencyDaysOfWeekTypeData = this.loansAccountProductTemplate.repaymentFrequencyDaysOfWeekTypeOptions;
this.repaymentFrequencyDaysOfWeekTypeData =
this.loansAccountProductTemplate.repaymentFrequencyDaysOfWeekTypeOptions;
this.interestTypeData = this.loansAccountProductTemplate.interestTypeOptions;
this.amortizationTypeData = this.loansAccountProductTemplate.amortizationTypeOptions;
this.interestCalculationPeriodTypeData = this.loansAccountProductTemplate.interestCalculationPeriodTypeOptions;
@@ -141,5 +161,4 @@ export class GlimTermsStepComponent implements OnInit, OnChanges {
get loansAccountTerms() {
return this.loansAccountTermsForm.value;
}
}
@@ -13,11 +13,10 @@ import { LoansService } from '../loans.service';
*/
@Injectable()
export class GLIMViewResolver implements Resolve<Object> {
/**
* @param {LoansService} loansService Loans service.
*/
constructor(private loansService: LoansService) { }
constructor(private loansService: LoansService) {}
/**
* Returns the Savings Account data.
@@ -29,5 +28,4 @@ export class GLIMViewResolver implements Resolve<Object> {
const glimId = route.paramMap.get('glimId');
return this.loansService.getGLIMAccountData(glimId, groupId);
}
}
@@ -8,9 +8,8 @@ describe('GlimAccountComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GlimAccountComponent ]
})
.compileComponents();
declarations: [GlimAccountComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -13,9 +13,15 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./glim-account.component.scss']
})
export class GlimAccountComponent implements OnInit {
/** Columns to be displayed in GLIM overview table. */
displayedColumns: string[] = ['loanId', 'clientId', 'clientName', 'loanAccountNumber', 'clientPrincipalLoan', 'groupPrincipalLoan'];
displayedColumns: string[] = [
'loanId',
'clientId',
'clientName',
'loanAccountNumber',
'clientPrincipalLoan',
'groupPrincipalLoan'
];
/** Data source for charge overview table. */
dataSource: MatTableDataSource<any>;
/** Charge Overview data */
@@ -29,9 +35,11 @@ export class GlimAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {MatDialog} dialog Dialog reference.
*/
constructor(private route: ActivatedRoute,
public dialog: MatDialog) {
this.route.data.subscribe((data: { glimData: any }) => {
constructor(
private route: ActivatedRoute,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { glimData: any }) => {
this.glimOverviewData = data.glimData;
});
}
@@ -43,7 +51,7 @@ export class GlimAccountComponent implements OnInit {
/**
* Set GLIM Overview.
*/
setLoanClientChargeOverview() {
setLoanClientChargeOverview() {
this.dataSource = new MatTableDataSource(this.glimOverviewData);
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountChargesStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoansAccountChargesStepComponent ]
})
.compileComponents();
declarations: [LoansAccountChargesStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -25,7 +25,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./loans-account-charges-step.component.scss']
})
export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
// @Input loansAccountProductTemplate: LoansAccountProductTemplate
@Input() loansAccountProductTemplate: any;
// @Imput loansAccountTemplate: LoansAccountTemplate
@@ -42,9 +41,21 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
/** Collateral Data Source */
collateralDataSource: {}[] = [];
/** Charges table columns */
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'action'];
chargesDisplayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date',
'action'
];
/** Columns to be displayed in overdue charges table. */
overdueChargesDisplayedColumns: string[] = ['name', 'type', 'amount', 'collectedon'];
overdueChargesDisplayedColumns: string[] = [
'name',
'type',
'amount',
'collectedon'
];
/** Component is pristine if there has been no changes by user interaction */
pristine = true;
/** Check if value of collateral added is more than principal amount */
@@ -59,16 +70,19 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
* @param {Dates} dateUtils Date Utils
* @param {SettingsService} settingsService Settings Service
*/
constructor(public dialog: MatDialog,
constructor(
public dialog: MatDialog,
private dateUtils: Dates,
private route: ActivatedRoute,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
ngOnInit() {
if (this.loansAccountTemplate && this.loansAccountTemplate.charges) {
this.chargesDataSource = this.loansAccountTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
this.chargesDataSource =
this.loansAccountTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
}
}
@@ -81,8 +95,13 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
if (this.loansAccountProductTemplate.overdueCharges) {
this.overDueChargesDataSource = this.loansAccountProductTemplate.overdueCharges;
}
if (this.loansAccountProductTemplate.charges && this.loansAccountProductTemplate.charges.length > 0 && this.chargesDataSource.length === 0) {
this.chargesDataSource = this.loansAccountProductTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
if (
this.loansAccountProductTemplate.charges &&
this.loansAccountProductTemplate.charges.length > 0 &&
this.chargesDataSource.length === 0
) {
this.chargesDataSource =
this.loansAccountProductTemplate.charges.map((charge: any) => ({ ...charge, id: charge.chargeId })) || [];
}
}
}
@@ -108,7 +127,8 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.amount,
type: 'number',
required: false
}),
})
];
const data = {
title: 'Edit Charge Amount',
@@ -138,7 +158,8 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.dueDate || charge.feeOnMonthDay || '',
type: 'datetime-local',
required: false
}),
})
];
const data = {
title: 'Edit Charge Date',
@@ -179,7 +200,8 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
value: charge.feeInterval,
type: 'text',
required: false
}),
})
];
const data = {
title: 'Edit Charge Fee Interval',
@@ -214,14 +236,12 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
});
}
/**
* Returns Loans Account Charges and Collateral Form
*/
get loansAccountCharges() {
return {
charges: this.chargesDataSource,
charges: this.chargesDataSource
};
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountDatatableStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoansAccountDatatableStepComponent ]
})
.compileComponents();
declarations: [LoansAccountDatatableStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -16,13 +16,20 @@ export class LoansAccountDatatableStepComponent implements OnInit {
datatableInputs: any = [];
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService,
private dateUtils: Dates) { }
private dateUtils: Dates
) {}
ngOnInit(): void {
this.datatableInputs = this.datatableData.columnHeaderData.filter((column: any) => {
return ((column.columnName !== 'id') && (column.columnName !== 'loan_id') && (column.columnName !== 'created_at') && (column.columnName !== 'updated_at'));
return (
column.columnName !== 'id' &&
column.columnName !== 'loan_id' &&
column.columnName !== 'created_at' &&
column.columnName !== 'updated_at'
);
});
const inputItems: any = {};
this.datatableInputs.forEach((input: any) => {
@@ -72,7 +79,7 @@ export class LoansAccountDatatableStepComponent implements OnInit {
}
isColumnType(columnType: string, expectedType: string) {
return (columnType === expectedType);
return columnType === expectedType;
}
get payload(): any {
@@ -104,5 +111,4 @@ export class LoansAccountDatatableStepComponent implements OnInit {
};
return payload;
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountDetailsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoansAccountDetailsStepComponent ]
})
.compileComponents();
declarations: [LoansAccountDetailsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -19,7 +19,6 @@ import { ReplaySubject, Subject } from 'rxjs';
styleUrls: ['./loans-account-details-step.component.scss']
})
export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
/** Loans Account Template */
@Input() loansAccountTemplate: any;
@@ -60,11 +59,13 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
* @param {LoansService} loansService Loans Service.
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loansService: LoansService,
private route: ActivatedRoute,
private settingsService: SettingsService,
private commons: Commons) {
private commons: Commons
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -76,19 +77,21 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
this.productList = this.loansAccountTemplate.productOptions.sort(this.commons.dynamicSort('name'));
if (this.loansAccountTemplate.loanProductId) {
this.loansAccountDetailsForm.patchValue({
'productId': this.loansAccountTemplate.loanProductId,
'submittedOnDate': this.loansAccountTemplate.timeline.submittedOnDate && new Date(this.loansAccountTemplate.timeline.submittedOnDate),
'loanOfficerId': this.loansAccountTemplate.loanOfficerId,
'loanPurposeId': this.loansAccountTemplate.loanPurposeId,
'fundId': this.loansAccountTemplate.fundId,
'expectedDisbursementDate': this.loansAccountTemplate.timeline.expectedDisbursementDate && new Date(this.loansAccountTemplate.timeline.expectedDisbursementDate),
'externalId': this.loansAccountTemplate.externalId
productId: this.loansAccountTemplate.loanProductId,
submittedOnDate:
this.loansAccountTemplate.timeline.submittedOnDate &&
new Date(this.loansAccountTemplate.timeline.submittedOnDate),
loanOfficerId: this.loansAccountTemplate.loanOfficerId,
loanPurposeId: this.loansAccountTemplate.loanPurposeId,
fundId: this.loansAccountTemplate.fundId,
expectedDisbursementDate:
this.loansAccountTemplate.timeline.expectedDisbursementDate &&
new Date(this.loansAccountTemplate.timeline.expectedDisbursementDate),
externalId: this.loansAccountTemplate.externalId
});
}
}
this.filterFormCtrl.valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
this.filterFormCtrl.valueChanges.pipe(takeUntil(this._onDestroy)).subscribe(() => {
this.searchItem();
});
this.productData.next(this.productList.slice());
@@ -104,11 +107,13 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
const search: string = this.filterFormCtrl.value.toLowerCase();
if (!search) {
this.productData.next(this.productList.slice());
this.productData.next(this.productList.slice());
} else {
this.productData.next(this.productList.filter((option: any) => {
return option['name'].toLowerCase().indexOf(search) >= 0;
}));
this.productData.next(
this.productList.filter((option: any) => {
return option['name'].toLowerCase().indexOf(search) >= 0;
})
);
}
}
}
@@ -118,15 +123,24 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
*/
createLoansAccountDetailsForm() {
this.loansAccountDetailsForm = this.formBuilder.group({
'productId': ['', Validators.required],
'loanOfficerId': [''],
'loanPurposeId': [''],
'fundId': [''],
'submittedOnDate': [this.settingsService.businessDate, Validators.required],
'expectedDisbursementDate': ['', Validators.required],
'externalId': [''],
'linkAccountId': [''],
'createStandingInstructionAtDisbursement': ['']
productId: [
'',
Validators.required
],
loanOfficerId: [''],
loanPurposeId: [''],
fundId: [''],
submittedOnDate: [
this.settingsService.businessDate,
Validators.required
],
expectedDisbursementDate: [
'',
Validators.required
],
externalId: [''],
linkAccountId: [''],
createStandingInstructionAtDisbursement: ['']
});
}
@@ -134,8 +148,10 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
* Fetches loans account product template on productId value changes
*/
buildDependencies() {
const entityId = (this.loansAccountTemplate.clientId) ? this.loansAccountTemplate.clientId : this.loansAccountTemplate.group.id;
const isGroup = (this.loansAccountTemplate.clientId) ? false : true;
const entityId = this.loansAccountTemplate.clientId
? this.loansAccountTemplate.clientId
: this.loansAccountTemplate.group.id;
const isGroup = this.loansAccountTemplate.clientId ? false : true;
this.loansAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
this.loansService.getLoansAccountTemplateResource(entityId, isGroup, productId).subscribe((response: any) => {
this.loansAccountProductTemplate.emit(response);
@@ -145,7 +161,9 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
this.accountLinkingOptions = response.accountLinkingOptions;
this.loanProductSelected = true;
if (response.createStandingInstructionAtDisbursement) {
this.loansAccountDetailsForm.get('createStandingInstructionAtDisbursement').patchValue(response.createStandingInstructionAtDisbursement);
this.loansAccountDetailsForm
.get('createStandingInstructionAtDisbursement')
.patchValue(response.createStandingInstructionAtDisbursement);
}
});
});
@@ -157,5 +175,4 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
get loansAccountDetails() {
return this.loansAccountDetailsForm.getRawValue();
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountPreviewStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoansAccountPreviewStepComponent ]
})
.compileComponents();
declarations: [LoansAccountPreviewStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -10,7 +10,6 @@ import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from
styleUrls: ['./loans-account-preview-step.component.scss']
})
export class LoansAccountPreviewStepComponent implements OnChanges {
/** Loans Account Template */
@Input() loansAccountTemplate: any = [];
/** Loans Account Product Template */
@@ -21,16 +20,26 @@ export class LoansAccountPreviewStepComponent implements OnChanges {
@Output() submitEvent = new EventEmitter();
/** Charges Displayed Columns */
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date'];
chargesDisplayedColumns: string[] = [
'name',
'chargeCalculationType',
'amount',
'chargeTimeType',
'date'
];
/** Overdue Charges Displayed Columns */
overdueChargesDisplayedColumns: string[] = ['name', 'type', 'amount', 'collectedon'];
overdueChargesDisplayedColumns: string[] = [
'name',
'type',
'amount',
'collectedon'
];
productEnableDownPayment = false;
constructor() { }
constructor() {}
ngOnChanges(changes: SimpleChanges): void {
this.productEnableDownPayment = this.loansAccountProductTemplate.product.enableDownPayment;
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountScheduleStepComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoansAccountScheduleStepComponent ]
})
.compileComponents();
declarations: [LoansAccountScheduleStepComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -9,7 +9,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./loans-account-schedule-step.component.scss']
})
export class LoansAccountScheduleStepComponent {
/** Currency Code */
@Input() currencyCode: string;
/** Loans Account Template */
@@ -19,22 +18,29 @@ export class LoansAccountScheduleStepComponent {
/** Loans Account Data */
@Input() loansAccount: any;
repaymentScheduleDetails: any = {periods: []};
repaymentScheduleDetails: any = { periods: [] };
loanId: any = null;
constructor(private loansService: LoansService,
constructor(
private loansService: LoansService,
private settingsService: SettingsService,
private route: ActivatedRoute) {
this.loanId = this.route.snapshot.params['loanId'];
private route: ActivatedRoute
) {
this.loanId = this.route.snapshot.params['loanId'];
}
showRepaymentInfo(): void {
this.repaymentScheduleDetails = {periods: []};
this.repaymentScheduleDetails = { periods: [] };
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const payload = this.loansService.buildLoanRequestPayload(this.loansAccount, this.loansAccountTemplate,
this.loansAccountProductTemplate.calendarOptions, locale, dateFormat);
const payload = this.loansService.buildLoanRequestPayload(
this.loansAccount,
this.loansAccountTemplate,
this.loansAccountProductTemplate.calendarOptions,
locale,
dateFormat
);
delete payload['enableInstallmentLevelDelinquency'];
this.loansService.calculateLoanSchedule(payload).subscribe((response: any) => {
@@ -8,9 +8,8 @@ describe('LoansAccountTermsStepComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoansAccountTermsStepComponent ]
})
.compileComponents();
declarations: [LoansAccountTermsStepComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -24,7 +24,6 @@ import { CodeName, OptionData } from 'app/shared/models/option-data.model';
styleUrls: ['./loans-account-terms-step.component.scss']
})
export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
/** Loans Product Options */
@Input() loansProductOptions: any;
/** Loans Account Product Template */
@@ -74,9 +73,19 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
/** Collateral Data Source */
collateralDataSource: {}[] = [];
/** Columns to be displayed in collateral table. */
loanCollateralDisplayedColumns: string[] = ['type', 'value', 'totalValue', 'totalCollateralValue', 'action'];
loanCollateralDisplayedColumns: string[] = [
'type',
'value',
'totalValue',
'totalCollateralValue',
'action'
];
/** Disbursement Data Displayed Columns */
disbursementDisplayedColumns: string[] = ['expectedDisbursementDate', 'principal', 'actions'];
disbursementDisplayedColumns: string[] = [
'expectedDisbursementDate',
'principal',
'actions'
];
/** Multi Disbursement Control */
totalMultiDisbursed: any = 0;
isMultiDisbursedCompleted = false;
@@ -97,12 +106,14 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
* @param formBuilder FormBuilder
* @param {SettingsService} settingsService SettingsService
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService,
private route: ActivatedRoute,
public dialog: MatDialog) {
this.loanId = this.route.snapshot.params['loanId'];
this.createloansAccountTermsForm();
public dialog: MatDialog
) {
this.loanId = this.route.snapshot.params['loanId'];
this.createloansAccountTermsForm();
}
/**
* Executes on change of input values
@@ -124,30 +135,30 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
this.interestRateFrequencyTypeData = this.loansAccountTermsData.interestRateFrequencyTypeOptions;
this.loansAccountTermsForm.patchValue({
'principalAmount': this.loansAccountTermsData.principal,
'loanTermFrequency': this.loansAccountTermsData.termFrequency,
'loanTermFrequencyType': this.loansAccountTermsData.termPeriodFrequencyType.id,
'numberOfRepayments': this.loansAccountTermsData.numberOfRepayments,
'repaymentEvery': this.loansAccountTermsData.repaymentEvery,
'repaymentFrequencyType': this.loansAccountTermsData.repaymentFrequencyType.id,
'amortizationType': this.loansAccountTermsData.amortizationType.id,
'isEqualAmortization': this.loansAccountTermsData.isEqualAmortization,
'interestType': this.loansAccountTermsData.interestType.id,
'isFloatingInterestRate': this.loansAccountTermsData.isLoanProductLinkedToFloatingRate ? false : '',
'interestCalculationPeriodType': this.loansAccountTermsData.interestCalculationPeriodType.id,
'allowPartialPeriodInterestCalcualtion': this.loansAccountTermsData.allowPartialPeriodInterestCalcualtion,
'inArrearsTolerance': this.loansAccountTermsData.inArrearsTolerance,
'graceOnPrincipalPayment': this.loansAccountTermsData.graceOnPrincipalPayment,
'graceOnInterestPayment': this.loansAccountTermsData.graceOnInterestPayment,
'graceOnArrearsAgeing': this.loansAccountTermsData.graceOnArrearsAgeing,
'graceOnInterestCharged': this.loansAccountTermsData.graceOnInterestCharged,
'fixedEmiAmount': this.loansAccountTermsData.fixedEmiAmount,
'maxOutstandingLoanBalance': this.loansAccountTermsData.maxOutstandingLoanBalance,
'transactionProcessingStrategyCode': this.loansAccountTermsData.transactionProcessingStrategyCode,
'interestRateDifferential': this.loansAccountTermsData.interestRateDifferential,
'multiDisburseLoan': this.loansAccountTermsData.multiDisburseLoan,
'interestRateFrequencyType': this.loansAccountTermsData.interestRateFrequencyType.id,
'balloonRepaymentAmount': this.loansAccountTermsData.balloonRepaymentAmount,
principalAmount: this.loansAccountTermsData.principal,
loanTermFrequency: this.loansAccountTermsData.termFrequency,
loanTermFrequencyType: this.loansAccountTermsData.termPeriodFrequencyType.id,
numberOfRepayments: this.loansAccountTermsData.numberOfRepayments,
repaymentEvery: this.loansAccountTermsData.repaymentEvery,
repaymentFrequencyType: this.loansAccountTermsData.repaymentFrequencyType.id,
amortizationType: this.loansAccountTermsData.amortizationType.id,
isEqualAmortization: this.loansAccountTermsData.isEqualAmortization,
interestType: this.loansAccountTermsData.interestType.id,
isFloatingInterestRate: this.loansAccountTermsData.isLoanProductLinkedToFloatingRate ? false : '',
interestCalculationPeriodType: this.loansAccountTermsData.interestCalculationPeriodType.id,
allowPartialPeriodInterestCalcualtion: this.loansAccountTermsData.allowPartialPeriodInterestCalcualtion,
inArrearsTolerance: this.loansAccountTermsData.inArrearsTolerance,
graceOnPrincipalPayment: this.loansAccountTermsData.graceOnPrincipalPayment,
graceOnInterestPayment: this.loansAccountTermsData.graceOnInterestPayment,
graceOnArrearsAgeing: this.loansAccountTermsData.graceOnArrearsAgeing,
graceOnInterestCharged: this.loansAccountTermsData.graceOnInterestCharged,
fixedEmiAmount: this.loansAccountTermsData.fixedEmiAmount,
maxOutstandingLoanBalance: this.loansAccountTermsData.maxOutstandingLoanBalance,
transactionProcessingStrategyCode: this.loansAccountTermsData.transactionProcessingStrategyCode,
interestRateDifferential: this.loansAccountTermsData.interestRateDifferential,
multiDisburseLoan: this.loansAccountTermsData.multiDisburseLoan,
interestRateFrequencyType: this.loansAccountTermsData.interestRateFrequencyType.id,
balloonRepaymentAmount: this.loansAccountTermsData.balloonRepaymentAmount
});
this.setAdvancedPaymentStrategyControls();
@@ -165,11 +176,17 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
});
}
if (this.isDelinquencyEnabled()) {
this.loansAccountTermsForm.addControl('enableInstallmentLevelDelinquency', new UntypedFormControl(this.loansAccountTermsData.enableInstallmentLevelDelinquency || this.loanProduct.enableInstallmentLevelDelinquency));
this.loansAccountTermsForm.addControl(
'enableInstallmentLevelDelinquency',
new UntypedFormControl(
this.loansAccountTermsData.enableInstallmentLevelDelinquency ||
this.loanProduct.enableInstallmentLevelDelinquency
)
);
}
this.collateralDataSource = this.loansAccountTermsData.collateral || [];
if (this.productEnableDownPayment) {
const enableDownPayment = (this.loansAccountTermsData['enableDownPayment'] === false) ? false : true;
const enableDownPayment = this.loansAccountTermsData['enableDownPayment'] === false ? false : true;
this.loansAccountTermsForm.addControl('enableDownPayment', new UntypedFormControl(enableDownPayment));
}
@@ -217,34 +234,36 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
if (this.loansAccountTermsData) {
if (this.loansAccountTermsData.loanProductId) {
this.loansAccountTermsForm.patchValue({
'repaymentsStartingFromDate': this.loansAccountTermsData.expectedFirstRepaymentOnDate && new Date(this.loansAccountTermsData.expectedFirstRepaymentOnDate)
repaymentsStartingFromDate:
this.loansAccountTermsData.expectedFirstRepaymentOnDate &&
new Date(this.loansAccountTermsData.expectedFirstRepaymentOnDate)
});
}
this.loansAccountTermsForm.patchValue({
'principalAmount': this.loansAccountTermsData.principal,
'loanTermFrequency': this.loansAccountTermsData.termFrequency,
'loanTermFrequencyType': this.loansAccountTermsData.termPeriodFrequencyType.id,
'numberOfRepayments': this.loansAccountTermsData.numberOfRepayments,
'repaymentEvery': this.loansAccountTermsData.repaymentEvery,
'repaymentFrequencyType': this.loansAccountTermsData.repaymentFrequencyType.id,
'amortizationType': this.loansAccountTermsData.amortizationType.id,
'isEqualAmortization': this.loansAccountTermsData.isEqualAmortization,
'interestType': this.loansAccountTermsData.interestType.id,
'isFloatingInterestRate': this.loansAccountTermsData.isLoanProductLinkedToFloatingRate ? false : '',
'interestCalculationPeriodType': this.loansAccountTermsData.interestCalculationPeriodType.id,
'allowPartialPeriodInterestCalcualtion': this.loansAccountTermsData.allowPartialPeriodInterestCalcualtion,
'inArrearsTolerance': this.loansAccountTermsData.inArrearsTolerance,
'graceOnPrincipalPayment': this.loansAccountTermsData.graceOnPrincipalPayment,
'graceOnInterestPayment': this.loansAccountTermsData.graceOnInterestPayment,
'graceOnArrearsAgeing': this.loansAccountTermsData.graceOnArrearsAgeing,
'graceOnInterestCharged': this.loansAccountTermsData.graceOnInterestCharged,
'fixedEmiAmount': this.loansAccountTermsData.fixedEmiAmount,
'maxOutstandingLoanBalance': this.loansAccountTermsData.maxOutstandingLoanBalance,
'transactionProcessingStrategyCode': this.loansAccountTermsData.transactionProcessingStrategyCode,
'interestRateDifferential': this.loansAccountTermsData.interestRateDifferential,
'multiDisburseLoan': this.loansAccountTermsData.multiDisburseLoan,
'interestRateFrequencyType': this.loansAccountTermsData.interestRateFrequencyType.id,
'balloonRepaymentAmount': this.loansAccountTermsData.balloonRepaymentAmount
principalAmount: this.loansAccountTermsData.principal,
loanTermFrequency: this.loansAccountTermsData.termFrequency,
loanTermFrequencyType: this.loansAccountTermsData.termPeriodFrequencyType.id,
numberOfRepayments: this.loansAccountTermsData.numberOfRepayments,
repaymentEvery: this.loansAccountTermsData.repaymentEvery,
repaymentFrequencyType: this.loansAccountTermsData.repaymentFrequencyType.id,
amortizationType: this.loansAccountTermsData.amortizationType.id,
isEqualAmortization: this.loansAccountTermsData.isEqualAmortization,
interestType: this.loansAccountTermsData.interestType.id,
isFloatingInterestRate: this.loansAccountTermsData.isLoanProductLinkedToFloatingRate ? false : '',
interestCalculationPeriodType: this.loansAccountTermsData.interestCalculationPeriodType.id,
allowPartialPeriodInterestCalcualtion: this.loansAccountTermsData.allowPartialPeriodInterestCalcualtion,
inArrearsTolerance: this.loansAccountTermsData.inArrearsTolerance,
graceOnPrincipalPayment: this.loansAccountTermsData.graceOnPrincipalPayment,
graceOnInterestPayment: this.loansAccountTermsData.graceOnInterestPayment,
graceOnArrearsAgeing: this.loansAccountTermsData.graceOnArrearsAgeing,
graceOnInterestCharged: this.loansAccountTermsData.graceOnInterestCharged,
fixedEmiAmount: this.loansAccountTermsData.fixedEmiAmount,
maxOutstandingLoanBalance: this.loansAccountTermsData.maxOutstandingLoanBalance,
transactionProcessingStrategyCode: this.loansAccountTermsData.transactionProcessingStrategyCode,
interestRateDifferential: this.loansAccountTermsData.interestRateDifferential,
multiDisburseLoan: this.loansAccountTermsData.multiDisburseLoan,
interestRateFrequencyType: this.loansAccountTermsData.interestRateFrequencyType.id,
balloonRepaymentAmount: this.loansAccountTermsData.balloonRepaymentAmount
});
}
this.createloansAccountTermsForm();
@@ -254,7 +273,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
}
allowAddDisbursementDetails() {
return (this.multiDisburseLoan && !this.loansAccountTermsData.disallowExpectedDisbursements);
return this.multiDisburseLoan && !this.loansAccountTermsData.disallowExpectedDisbursements;
}
/** Custom Validators for the form */
@@ -262,63 +281,68 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
const repaymentFrequencyNthDayType = this.loansAccountTermsForm.get('repaymentFrequencyNthDayType');
const repaymentFrequencyDayOfWeekType = this.loansAccountTermsForm.get('repaymentFrequencyDayOfWeekType');
this.loansAccountTermsForm.get('repaymentFrequencyType').valueChanges
.subscribe(repaymentFrequencyType => {
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);
}
if (repaymentFrequencyType === 2) {
repaymentFrequencyNthDayType.setValidators([Validators.required]);
repaymentFrequencyDayOfWeekType.setValidators([Validators.required]);
} else {
repaymentFrequencyNthDayType.setValidators(null);
repaymentFrequencyDayOfWeekType.setValidators(null);
}
repaymentFrequencyNthDayType.updateValueAndValidity();
repaymentFrequencyDayOfWeekType.updateValueAndValidity();
});
repaymentFrequencyNthDayType.updateValueAndValidity();
repaymentFrequencyDayOfWeekType.updateValueAndValidity();
});
}
/** Custom Listeners for the form to calculate Loan Term */
setLoanTermListener() {
this.loansAccountTermsForm.get('numberOfRepayments').valueChanges
.subscribe(numberOfRepayments => {
const repaymentEvery: number = this.loansAccountTermsForm.value.repaymentEvery;
this.calculateLoanTerm(numberOfRepayments, repaymentEvery);
});
this.loansAccountTermsForm.get('numberOfRepayments').valueChanges.subscribe((numberOfRepayments) => {
const repaymentEvery: number = this.loansAccountTermsForm.value.repaymentEvery;
this.calculateLoanTerm(numberOfRepayments, repaymentEvery);
});
this.loansAccountTermsForm.get('repaymentEvery').valueChanges
.subscribe(repaymentEvery => {
const numberOfRepayments: number = this.loansAccountTermsForm.value.numberOfRepayments;
this.calculateLoanTerm(numberOfRepayments, repaymentEvery);
});
this.loansAccountTermsForm.get('repaymentEvery').valueChanges.subscribe((repaymentEvery) => {
const numberOfRepayments: number = this.loansAccountTermsForm.value.numberOfRepayments;
this.calculateLoanTerm(numberOfRepayments, repaymentEvery);
});
this.loansAccountTermsForm.get('loanTermFrequencyType').valueChanges
.subscribe(loanTermFrequencyType => {
this.loansAccountTermsForm.patchValue({'repaymentFrequencyType': loanTermFrequencyType});
});
this.loansAccountTermsForm.get('loanTermFrequencyType').valueChanges.subscribe((loanTermFrequencyType) => {
this.loansAccountTermsForm.patchValue({ repaymentFrequencyType: loanTermFrequencyType });
});
this.loansAccountTermsForm.get('amortizationType').valueChanges
.subscribe(amortizationType => {
if (amortizationType === 0) { // Equal Principal Payments
this.loansAccountTermsForm.addControl('fixedPrincipalPercentagePerInstallment', new UntypedFormControl(''));
} else { // Equal Installments
this.loansAccountTermsForm.removeControl('fixedPrincipalPercentagePerInstallment');
}
this.loansAccountTermsForm.get('amortizationType').valueChanges.subscribe((amortizationType) => {
if (amortizationType === 0) {
// Equal Principal Payments
this.loansAccountTermsForm.addControl('fixedPrincipalPercentagePerInstallment', new UntypedFormControl(''));
} else {
// Equal Installments
this.loansAccountTermsForm.removeControl('fixedPrincipalPercentagePerInstallment');
}
});
}
setAdvancedPaymentStrategyControls(): void {
// Fixed Length validation
if (this.loansAccountTermsData) {
this.loansAccountTermsForm.removeControl('interestRatePerPeriod');
this.loansAccountTermsForm.removeControl('fixedLength');
if (this.loansAccountTermsData.product.fixedLength) {
this.loansAccountTermsForm.addControl('interestRatePerPeriod', new UntypedFormControl({value: 0, disabled: true}, Validators.required));
this.loansAccountTermsForm.addControl('fixedLength', new UntypedFormControl(this.loansAccountTermsData.product.fixedLength));
} else {
this.loansAccountTermsForm.addControl('interestRatePerPeriod', new UntypedFormControl(this.loansAccountTermsData.interestRatePerPeriod, Validators.required));
}
// Fixed Length validation
if (this.loansAccountTermsData) {
this.loansAccountTermsForm.removeControl('interestRatePerPeriod');
this.loansAccountTermsForm.removeControl('fixedLength');
if (this.loansAccountTermsData.product.fixedLength) {
this.loansAccountTermsForm.addControl(
'interestRatePerPeriod',
new UntypedFormControl({ value: 0, disabled: true }, Validators.required)
);
this.loansAccountTermsForm.addControl(
'fixedLength',
new UntypedFormControl(this.loansAccountTermsData.product.fixedLength)
);
} else {
this.loansAccountTermsForm.addControl(
'interestRatePerPeriod',
new UntypedFormControl(this.loansAccountTermsData.interestRatePerPeriod, Validators.required)
);
}
}
}
hasFixedLength(): boolean {
@@ -329,49 +353,73 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
}
isEqualPrincipalPayments(): boolean {
return (this.loansAccountTermsForm.value.amortizationType === 0);
return this.loansAccountTermsForm.value.amortizationType === 0;
}
/** Create Loans Account Terms Form */
createloansAccountTermsForm() {
this.loansAccountTermsForm = this.formBuilder.group({
'principalAmount': ['', Validators.required],
'loanTermFrequency': [{ value: '', disabled: true }, Validators.required],
'loanTermFrequencyType': ['', Validators.required],
'numberOfRepayments': ['', Validators.required],
'repaymentEvery': ['', Validators.required],
'repaymentFrequencyType': [{ value: '', disabled: true }, Validators.required],
'repaymentFrequencyNthDayType': [''],
'repaymentFrequencyDayOfWeekType': [''],
'repaymentsStartingFromDate': [''],
'interestChargedFromDate': [''],
'interestRatePerPeriod': [''],
'interestType': [''],
'isFloatingInterestRate': [''],
'isEqualAmortization': [''],
'amortizationType': ['', Validators.required],
'interestCalculationPeriodType': [''],
'allowPartialPeriodInterestCalcualtion': [''],
'inArrearsTolerance': [''],
'graceOnInterestCharged': [''],
'graceOnPrincipalPayment': [''],
'graceOnInterestPayment': [''],
'graceOnArrearsAgeing': [''],
'loanIdToClose': [''],
'fixedEmiAmount': [''],
'isTopup': [''],
'maxOutstandingLoanBalance': [''],
'interestRateDifferential': [''],
'transactionProcessingStrategyCode': ['', Validators.required],
'multiDisburseLoan': [false],
'interestRateFrequencyType': [''],
'balloonRepaymentAmount': ['']
principalAmount: [
'',
Validators.required
],
loanTermFrequency: [
{ value: '', disabled: true },
Validators.required
],
loanTermFrequencyType: [
'',
Validators.required
],
numberOfRepayments: [
'',
Validators.required
],
repaymentEvery: [
'',
Validators.required
],
repaymentFrequencyType: [
{ value: '', disabled: true },
Validators.required
],
repaymentFrequencyNthDayType: [''],
repaymentFrequencyDayOfWeekType: [''],
repaymentsStartingFromDate: [''],
interestChargedFromDate: [''],
interestRatePerPeriod: [''],
interestType: [''],
isFloatingInterestRate: [''],
isEqualAmortization: [''],
amortizationType: [
'',
Validators.required
],
interestCalculationPeriodType: [''],
allowPartialPeriodInterestCalcualtion: [''],
inArrearsTolerance: [''],
graceOnInterestCharged: [''],
graceOnPrincipalPayment: [''],
graceOnInterestPayment: [''],
graceOnArrearsAgeing: [''],
loanIdToClose: [''],
fixedEmiAmount: [''],
isTopup: [''],
maxOutstandingLoanBalance: [''],
interestRateDifferential: [''],
transactionProcessingStrategyCode: [
'',
Validators.required
],
multiDisburseLoan: [false],
interestRateFrequencyType: [''],
balloonRepaymentAmount: ['']
});
}
calculateLoanTerm(numberOfRepayments: number, repaymentEvery: number): void {
const loanTerm = numberOfRepayments * repaymentEvery;
this.loansAccountTermsForm.patchValue({'loanTermFrequency': loanTerm});
this.loansAccountTermsForm.patchValue({ loanTermFrequency: loanTerm });
}
/**
@@ -408,6 +456,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
required: true,
order: 2
})
];
const data = {
title: 'Add Disbursement Details',
@@ -418,10 +467,10 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
disbursementDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) {
const principal = response.data.value.principal * 1;
if ((this.totalMultiDisbursed + principal) <= currentPrincipalAmount) {
if (this.totalMultiDisbursed + principal <= currentPrincipalAmount) {
this.disbursementDataSource = this.disbursementDataSource.concat(response.data.value);
this.totalMultiDisbursed += principal;
this.isMultiDisbursedCompleted = (this.totalMultiDisbursed === currentPrincipalAmount);
this.isMultiDisbursedCompleted = this.totalMultiDisbursed === currentPrincipalAmount;
this.pristine = false;
}
}
@@ -443,7 +492,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
this.disbursementDataSource.splice(index, 1);
this.disbursementDataSource = this.disbursementDataSource.concat([]);
this.totalMultiDisbursed -= principal;
this.isMultiDisbursedCompleted = (this.totalMultiDisbursed === currentPrincipalAmount);
this.isMultiDisbursedCompleted = this.totalMultiDisbursed === currentPrincipalAmount;
}
});
}
@@ -459,11 +508,14 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
if (response.data) {
const collateralData = {
type: response.data.value.collateral,
value: response.data.value.quantity,
value: response.data.value.quantity
};
this.totalCollateralValue += collateralData.type.pctToBase * collateralData.type.basePrice * collateralData.value / 100;
this.totalCollateralValue +=
(collateralData.type.pctToBase * collateralData.type.basePrice * collateralData.value) / 100;
this.collateralDataSource = this.collateralDataSource.concat(collateralData);
this.collateralOptions = this.collateralOptions.filter((user: any) => user.collateralId !== response.data.value.collateral.collateralId);
this.collateralOptions = this.collateralOptions.filter(
(user: any) => user.collateralId !== response.data.value.collateral.collateralId
);
if (this.loanPrincipal < this.totalCollateralValue) {
this.isCollateralSufficient = true;
} else {
@@ -484,7 +536,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
if (response.delete) {
const removed: any = this.collateralDataSource.splice(id, 1);
this.collateralOptions = this.collateralOptions.concat(removed[0].type);
this.totalCollateralValue -= removed[0].type.pctToBase * removed[0].type.basePrice * removed[0].value / 100;
this.totalCollateralValue -= (removed[0].type.pctToBase * removed[0].type.basePrice * removed[0].value) / 100;
this.collateralDataSource = this.collateralDataSource.concat([]);
this.pristine = false;
if (this.loanPrincipal < this.totalCollateralValue) {
@@ -502,7 +554,8 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
setOptions() {
this.termFrequencyTypeData = this.loansAccountProductTemplate.termFrequencyTypeOptions;
this.repaymentFrequencyNthDayTypeData = this.loansAccountProductTemplate.repaymentFrequencyNthDayTypeOptions;
this.repaymentFrequencyDaysOfWeekTypeData = this.loansAccountProductTemplate.repaymentFrequencyDaysOfWeekTypeOptions;
this.repaymentFrequencyDaysOfWeekTypeData =
this.loansAccountProductTemplate.repaymentFrequencyDaysOfWeekTypeOptions;
this.interestTypeData = this.loansAccountProductTemplate.interestTypeOptions;
this.amortizationTypeData = this.loansAccountProductTemplate.amortizationTypeOptions;
this.interestCalculationPeriodTypeData = this.loansAccountProductTemplate.interestCalculationPeriodTypeOptions;
@@ -511,14 +564,14 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
this.transactionProcessingStrategyOptions = [];
if (this.loanScheduleType.code === LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE) {
// Filter Advanced Payment Allocation Strategy
this.transactionProcessingStrategyOptions = this.loansAccountProductTemplate.transactionProcessingStrategyOptions.filter(
(cn: CodeName) => !LoanProducts.isAdvancedPaymentAllocationStrategy(cn.code)
);
this.transactionProcessingStrategyOptions =
this.loansAccountProductTemplate.transactionProcessingStrategyOptions.filter(
(cn: CodeName) => !LoanProducts.isAdvancedPaymentAllocationStrategy(cn.code)
);
this.repaymentStrategyDisabled = false;
} else {
// Only Advanced Payment Allocation Strategy
this.loansAccountProductTemplate.transactionProcessingStrategyOptions.some(
(cn: CodeName) => {
this.loansAccountProductTemplate.transactionProcessingStrategyOptions.some((cn: CodeName) => {
if (LoanProducts.isAdvancedPaymentAllocationStrategy(cn.code)) {
this.transactionProcessingStrategyOptions.push(cn);
}
@@ -554,5 +607,4 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
collateral: this.collateralDataSource
};
}
}
+39 -29
View File
@@ -99,7 +99,7 @@ const routes: Routes = [
resolve: {
loanDetailsData: LoanDetailsResolver,
loanDatatables: LoanDatatablesResolver
},
}
},
{
path: 'accountdetail',
@@ -109,12 +109,12 @@ const routes: Routes = [
{
path: 'original-schedule',
component: OriginalScheduleTabComponent,
data: { title: 'Original Schedule', breadcrumb: 'Original Schedule', routeParamBreadcrumb: false },
data: { title: 'Original Schedule', breadcrumb: 'Original Schedule', routeParamBreadcrumb: false }
},
{
path: 'repayment-schedule',
component: RepaymentScheduleTabComponent,
data: { title: 'Repayment Schedule', breadcrumb: 'Repayment Schedule', routeParamBreadcrumb: false },
data: { title: 'Repayment Schedule', breadcrumb: 'Repayment Schedule', routeParamBreadcrumb: false }
},
{
path: 'transactions',
@@ -123,7 +123,6 @@ const routes: Routes = [
{
path: '',
component: TransactionsTabComponent
},
{
path: 'export',
@@ -143,7 +142,7 @@ const routes: Routes = [
{
path: '',
component: LoanDelinquencyTagsTabComponent
},
}
]
},
{
@@ -162,7 +161,11 @@ const routes: Routes = [
{
path: 'loan-collateral',
component: LoanCollateralTabComponent,
data: { title: 'Loan Collateral Details', breadcrumb: 'Loan Collateral Details', routeParamBreadcrumb: false },
data: {
title: 'Loan Collateral Details',
breadcrumb: 'Loan Collateral Details',
routeParamBreadcrumb: false
},
resolve: {
loanCollaterals: LoanCollateralsResolver
}
@@ -174,12 +177,12 @@ const routes: Routes = [
resolve: {
loanDetailsData: LoanDetailsResolver,
interestPausesData: LoanTermVariationsResolver
},
}
},
{
path: 'loan-tranche-details',
component: LoanTrancheDetailsComponent,
data: { title: 'Loan Tranche Details', breadcrumb: 'Loan Tranche Details', routeParamBreadcrumb: false },
data: { title: 'Loan Tranche Details', breadcrumb: 'Loan Tranche Details', routeParamBreadcrumb: false }
},
{
path: 'overdue-charges',
@@ -189,12 +192,16 @@ const routes: Routes = [
{
path: 'floating-interest-rates',
component: FloatingInterestRatesComponent,
data: { title: 'Floating Interest Rates', breadcrumb: 'Floating Interest Rates', routeParamBreadcrumb: false },
data: {
title: 'Floating Interest Rates',
breadcrumb: 'Floating Interest Rates',
routeParamBreadcrumb: false
}
},
{
path: 'charges',
data: { title: 'Loans Account Charges', breadcrumb: 'Charges', routeParamBreadcrumb: false },
component: ChargesTabComponent,
component: ChargesTabComponent
},
{
path: 'loan-documents',
@@ -202,7 +209,7 @@ const routes: Routes = [
data: { title: 'Loan Documents', breadcrumb: 'Loan Documents', routeParamBreadcrumb: false },
resolve: {
loanDocuments: LoanDocumentsResolver
},
}
},
{
path: 'notes',
@@ -210,7 +217,7 @@ const routes: Routes = [
data: { title: 'Notes', breadcrumb: 'Notes', routeParamBreadcrumb: false },
resolve: {
loanNotes: LoanNotesResolver
},
}
},
{
path: 'standing-instruction',
@@ -228,16 +235,18 @@ const routes: Routes = [
},
{
path: 'datatables',
children: [{
path: ':datatableName',
component: DatatableTabComponent,
data: { title: 'Data Table View', routeParamBreadcrumb: 'datatableName' },
resolve: {
loanDatatable: LoanDatatableResolver
children: [
{
path: ':datatableName',
component: DatatableTabComponent,
data: { title: 'Data Table View', routeParamBreadcrumb: 'datatableName' },
resolve: {
loanDatatable: LoanDatatableResolver
}
}
}]
},
],
]
}
]
},
{
path: ':loanId/transactions/:id',
@@ -286,7 +295,8 @@ const routes: Routes = [
children: [
{
path: '',
redirectTo: '../charges', pathMatch: 'prefix'
redirectTo: '../charges',
pathMatch: 'prefix'
},
{
path: ':id',
@@ -318,7 +328,8 @@ const routes: Routes = [
},
{
path: ':loanId/transfer-funds',
loadChildren: () => import('../account-transfers/account-transfers.module').then(m => m.AccountTransfersModule)
loadChildren: () =>
import('../account-transfers/account-transfers.module').then((m) => m.AccountTransfersModule)
},
{
path: 'edit-loans-account',
@@ -327,7 +338,7 @@ const routes: Routes = [
resolve: {
loansAccountAndTemplate: LoansAccountAndTemplateResolver
}
},
}
]
},
{
@@ -340,8 +351,8 @@ const routes: Routes = [
resolve: {
loansAccountTemplate: GLIMLoanTemplateResolver,
gsimData: GSIMAccountsResolver,
groupsData: GroupViewResolver,
},
groupsData: GroupViewResolver
}
},
{
path: ':glimId',
@@ -350,7 +361,7 @@ const routes: Routes = [
resolve: {
glimData: GLIMViewResolver,
groupsData: GroupAccountsResolver
},
}
}
]
}
@@ -383,5 +394,4 @@ const routes: Routes = [
LoanTermVariationsResolver
]
})
export class LoansRoutingModule { }
export class LoansRoutingModule {}
@@ -8,9 +8,8 @@ describe('AccountDetailsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AccountDetailsComponent ]
})
.compileComponents();
declarations: [AccountDetailsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -7,17 +7,15 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./account-details.component.scss']
})
export class AccountDetailsComponent {
loanDetails: any;
dataObject: {
property: string,
value: string
property: string;
value: string;
}[];
constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe((data: { loanDetailsData: any, }) => {
this.route.parent.data.subscribe((data: { loanDetailsData: any }) => {
this.loanDetails = data.loanDetailsData;
});
}
}
@@ -8,9 +8,8 @@ describe('ChargesTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChargesTabComponent ]
})
.compileComponents();
declarations: [ChargesTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -30,7 +30,6 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ['./charges-tab.component.scss']
})
export class ChargesTabComponent implements OnInit {
/** Loan Details Data */
loanDetails: any;
/** Charges Data */
@@ -38,7 +37,18 @@ export class ChargesTabComponent implements OnInit {
/** Status */
status: any;
/** Columns to be displayed in charges table. */
displayedColumns: string[] = ['name', 'feepenalty', 'paymentdueat', 'dueDate', 'calculationtype', 'due', 'paid', 'waived', 'outstanding', 'actions'];
displayedColumns: string[] = [
'name',
'feepenalty',
'paymentdueat',
'dueDate',
'calculationtype',
'due',
'paid',
'waived',
'outstanding',
'actions'
];
/** Data source for charges table. */
dataSource: MatTableDataSource<any>;
@@ -54,14 +64,16 @@ export class ChargesTabComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private loansService: LoansService,
constructor(
private loansService: LoansService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
private translateService: TranslateService,
public dialog: MatDialog,
private settingsService: SettingsService,
private systemService: SystemService) {
private systemService: SystemService
) {
this.route.parent.data.subscribe((data: { loanDetailsData: any }) => {
this.loanDetails = data.loanDetailsData;
});
@@ -69,21 +81,28 @@ export class ChargesTabComponent implements OnInit {
ngOnInit() {
this.systemService.getConfigurationByName('charge-accrual-date').subscribe((config: GlobalConfiguration) => {
this.useDueDate = (config.stringValue === 'due-date');
this.useDueDate = config.stringValue === 'due-date';
});
this.chargesData = this.loanDetails.charges;
this.status = this.loanDetails.status.value;
let actionFlag;
this.chargesData.forEach((element: any) => {
element.dueDate = this.dateUtils.parseDate(element.dueDate);
if (element.paid || element.waived || element.chargeTimeType.value === 'Disbursement' || this.loanDetails.status.value !== 'Active') {
if (
element.paid ||
element.waived ||
element.chargeTimeType.value === 'Disbursement' ||
this.loanDetails.status.value !== 'Active'
) {
actionFlag = true;
} else {
actionFlag = false;
}
element.actionFlag = actionFlag;
});
this.chargesData = this.chargesData.sort(function (a: any, b: any) { return b.dueDate - a.dueDate; });
this.chargesData = this.chargesData.sort(function (a: any, b: any) {
return b.dueDate - a.dueDate;
});
this.dataSource = new MatTableDataSource(this.chargesData);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
@@ -110,6 +129,7 @@ export class ChargesTabComponent implements OnInit {
type: 'date',
required: true
})
];
const data = {
title: `Pay Charge ${chargeId}`,
@@ -127,7 +147,8 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.loansService.executeLoansAccountChargesCommand(this.loanDetails.id, 'pay', dataObject, chargeId)
this.loansService
.executeLoansAccountChargesCommand(this.loanDetails.id, 'pay', dataObject, chargeId)
.subscribe(() => {
this.reload();
});
@@ -140,10 +161,19 @@ export class ChargesTabComponent implements OnInit {
* @param {any} chargeId Charge Id
*/
waiveCharge(chargeId: any) {
const waiveChargeDialogRef = this.dialog.open(ConfirmationDialogComponent, { 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} ?`, type: 'Basic' } });
const waiveChargeDialogRef = this.dialog.open(ConfirmationDialogComponent, {
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} ?`,
type: 'Basic'
}
});
waiveChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.loansService.executeLoansAccountChargesCommand(this.loanDetails.id, 'waive', {}, chargeId)
this.loansService
.executeLoansAccountChargesCommand(this.loanDetails.id, 'waive', {}, chargeId)
.subscribe(() => {
this.reload();
});
@@ -164,6 +194,7 @@ export class ChargesTabComponent implements OnInit {
type: 'number',
required: true
})
];
const data = {
title: `Edit Charge ${charge.id}`,
@@ -180,10 +211,9 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.loansService.editLoansAccountCharge(this.loanDetails.id, dataObject, charge.id)
.subscribe(() => {
this.reload();
});
this.loansService.editLoansAccountCharge(this.loanDetails.id, dataObject, charge.id).subscribe(() => {
this.reload();
});
}
});
}
@@ -198,10 +228,9 @@ export class ChargesTabComponent implements OnInit {
});
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.loansService.deleteLoansAccountCharge(this.loanDetails.id, chargeId)
.subscribe(() => {
this.reload();
});
this.loansService.deleteLoansAccountCharge(this.loanDetails.id, chargeId).subscribe(() => {
this.reload();
});
}
});
}
@@ -221,8 +250,8 @@ export class ChargesTabComponent implements OnInit {
private reload() {
const clientId = this.loanDetails.clientId;
const url: string = this.router.url;
this.router.navigateByUrl(`/clients/${clientId}/loans-accounts`, { skipLocationChange: true })
this.router
.navigateByUrl(`/clients/${clientId}/loans-accounts`, { skipLocationChange: true })
.then(() => this.router.navigate([url]));
}
}
@@ -8,9 +8,8 @@ describe('DatatableTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatatableTabComponent ]
})
.compileComponents();
declarations: [DatatableTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -7,7 +7,6 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./datatable-tab.component.scss']
})
export class DatatableTabComponent {
entityId: string;
/** Loan Datatable */
entityDatatable: any = null;
@@ -26,5 +25,4 @@ export class DatatableTabComponent {
this.multiRowDatatableFlag = this.entityDatatable.columnHeaders[0].columnName === 'id' ? true : false;
});
}
}
@@ -8,9 +8,8 @@ describe('ExternalAssetOwnerTabComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ExternalAssetOwnerTabComponent ]
})
.compileComponents();
declarations: [ExternalAssetOwnerTabComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -11,32 +11,40 @@ import { CancelDialogComponent } from 'app/shared/cancel-dialog/cancel-dialog.co
styleUrls: ['./external-asset-owner-tab.component.scss']
})
export class ExternalAssetOwnerTabComponent implements OnInit {
defaultDate = '9999-12-31';
loanTransfersData: any[] = [];
activeTransferData: any;
loanTransferColumns: string[] = ['status', 'effectiveFrom', 'ownerExternalId', 'transferExternalId', 'settlementDate', 'purchasePriceRatio', 'actions'];
loanTransferColumns: string[] = [
'status',
'effectiveFrom',
'ownerExternalId',
'transferExternalId',
'settlementDate',
'purchasePriceRatio',
'actions'
];
currentItem: any;
existActiveTransfer = false;
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router,
private dialog: MatDialog,
private externalAssetOwner: ExternalAssetOwner,
private externalAssetOwnerService: ExternalAssetOwnerService
) {
this.route.data.subscribe((data: { loanTransfersData: any, activeTransferData: any }) => {
this.loanTransfersData = data.loanTransfersData.empty ? [] : data.loanTransfersData.content;
) {
this.route.data.subscribe((data: { loanTransfersData: any; activeTransferData: any }) => {
this.loanTransfersData = data.loanTransfersData.empty ? [] : data.loanTransfersData.content;
this.activeTransferData = data.activeTransferData || null;
this.existActiveTransfer = (data.activeTransferData && data.activeTransferData.transferId != null);
this.existActiveTransfer = data.activeTransferData && data.activeTransferData.transferId != null;
});
}
ngOnInit(): void {
this.currentItem = null;
if (this.loanTransfersData.length > 0) {
this.currentItem = this.loanTransfersData[(this.loanTransfersData.length - 1)];
this.currentItem = this.loanTransfersData[this.loanTransfersData.length - 1];
}
}
@@ -85,10 +93,11 @@ export class ExternalAssetOwnerTabComponent implements OnInit {
const payload: any = {
transferExternalId: this.currentItem.transferExternalId
};
this.externalAssetOwnerService.executeExternalAssetOwnerTransferCommand(this.currentItem.transferId, payload, 'cancel')
this.externalAssetOwnerService
.executeExternalAssetOwnerTransferCommand(this.currentItem.transferId, payload, 'cancel')
.subscribe((result: any) => {
this.reload();
});
});
}
});
}
@@ -103,7 +112,6 @@ export class ExternalAssetOwnerTabComponent implements OnInit {
reload() {
const url: string = this.router.url;
this.router.navigateByUrl(`/`, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
this.router.navigateByUrl(`/`, { skipLocationChange: true }).then(() => this.router.navigate([url]));
}
}
@@ -8,9 +8,8 @@ describe('ExternalAssetTransferComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ExternalAssetTransferComponent ]
})
.compileComponents();
declarations: [ExternalAssetTransferComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -10,10 +10,9 @@ export class ExternalAssetTransferComponent {
/** Input Fields Data */
@Input() transferData: any;
constructor(private externalAssetOwner: ExternalAssetOwner) { }
constructor(private externalAssetOwner: ExternalAssetOwner) {}
itemStatus(status: string): string {
return this.externalAssetOwner.itemStatus(status);
}
}
@@ -8,9 +8,8 @@ describe('FloatingInterestRatesComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FloatingInterestRatesComponent ]
})
.compileComponents();
declarations: [FloatingInterestRatesComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -7,20 +7,22 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./floating-interest-rates.component.scss']
})
export class FloatingInterestRatesComponent implements OnInit {
/** Loan Details */
loanDetails: any;
/** Interest Rate Data */
interestRateData: any;
/** Columns to be displayed in charges table. */
displayedColumns: string[] = ['fromDate', 'interestRate'];
displayedColumns: string[] = [
'fromDate',
'interestRate'
];
/**
* Retrieves the loans data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe(( data: { loanDetailsData: any }) => {
this.route.parent.data.subscribe((data: { loanDetailsData: any }) => {
this.loanDetails = data.loanDetailsData;
});
}
@@ -28,5 +30,4 @@ export class FloatingInterestRatesComponent implements OnInit {
ngOnInit() {
this.interestRateData = this.loanDetails.interestRatesPeriods;
}
}
@@ -8,9 +8,8 @@ describe('GeneralTabComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GeneralTabComponent ]
})
.compileComponents();
declarations: [GeneralTabComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -8,26 +8,36 @@ import { MatTableDataSource } from '@angular/material/table';
styleUrls: ['./general-tab.component.scss']
})
export class GeneralTabComponent implements OnInit {
/** Currency Code */
currencyCode: string;
loanDetails: any;
status: any;
loanSummaryColumns: string[] = ['Empty', 'Original', 'Paid', 'Waived', 'Written Off', 'Outstanding', 'Over Due'];
loanDetailsColumns: string[] = ['Key', 'Value'];
loanSummaryColumns: string[] = [
'Empty',
'Original',
'Paid',
'Waived',
'Written Off',
'Outstanding',
'Over Due'
];
loanDetailsColumns: string[] = [
'Key',
'Value'
];
loanSummaryTableData: {
'property': string,
'original': string,
'adjustment': string,
'paid': string,
'waived': string,
'writtenOff': string,
'outstanding': string,
'overdue': string
property: string;
original: string;
adjustment: string;
paid: string;
waived: string;
writtenOff: string;
outstanding: string;
overdue: string;
}[];
loanDetailsTableData: {
'key': string,
'value'?: string
key: string;
value?: string;
}[];
/** Data source for loans summary table. */
@@ -35,13 +45,22 @@ export class GeneralTabComponent implements OnInit {
detailsDataSource: MatTableDataSource<any>;
constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe((data: { loanDetailsData: any, }) => {
this.route.parent.data.subscribe((data: { loanDetailsData: any }) => {
this.loanDetails = data.loanDetailsData;
this.currencyCode = this.loanDetails.currency.code;
if (this.loanDetails.transactions) {
this.loanDetails.transactions.some((transaction: any) => {
if (transaction.type.code === 'loanTransactionType.chargeback') {
this.loanSummaryColumns = ['Empty', 'Original', 'Adjustments', 'Paid', 'Waived', 'Written Off', 'Outstanding', 'Over Due'];
this.loanSummaryColumns = [
'Empty',
'Original',
'Adjustments',
'Paid',
'Waived',
'Written Off',
'Outstanding',
'Over Due'
];
return;
}
});
@@ -62,123 +81,129 @@ export class GeneralTabComponent implements OnInit {
setloanSummaryTableData() {
this.loanSummaryTableData = [
{
'property': 'Principal',
'original': this.loanDetails.summary.principalDisbursed,
'adjustment': this.loanDetails.summary.principalAdjustments || 0,
'paid': this.loanDetails.summary.principalPaid,
'waived': this.loanDetails.summary.principalWaived || 0,
'writtenOff': this.loanDetails.summary.principalWrittenOff,
'outstanding': this.loanDetails.summary.principalOutstanding,
'overdue': this.loanDetails.summary.principalOverdue,
},
{
'property': 'Interest',
'original': this.loanDetails.summary.interestCharged,
'adjustment': '0',
'paid': this.loanDetails.summary.interestPaid,
'waived': this.loanDetails.summary.interestWaived,
'writtenOff': this.loanDetails.summary.interestWrittenOff,
'outstanding': this.loanDetails.summary.interestOutstanding,
'overdue': this.loanDetails.summary.interestOverdue,
},
{
'property': 'Fees',
'original': this.loanDetails.summary.feeChargesCharged,
'adjustment': '0',
'paid': this.loanDetails.summary.feeChargesPaid,
'waived': this.loanDetails.summary.feeChargesWaived,
'writtenOff': this.loanDetails.summary.feeChargesWrittenOff,
'outstanding': this.loanDetails.summary.feeChargesOutstanding,
'overdue': this.loanDetails.summary.feeChargesOverdue,
},
{
'property': 'Penalties',
'original': this.loanDetails.summary.penaltyChargesCharged,
'adjustment': '0',
'paid': this.loanDetails.summary.penaltyChargesPaid,
'waived': this.loanDetails.summary.penaltyChargesWaived,
'writtenOff': this.loanDetails.summary.penaltyChargesWrittenOff,
'outstanding': this.loanDetails.summary.penaltyChargesOutstanding,
'overdue': this.loanDetails.summary.penaltyChargesOverdue,
},
{
'property': 'Total',
'original': this.loanDetails.summary.totalExpectedRepayment,
'adjustment': this.loanDetails.summary.principalAdjustments || 0,
'paid': this.loanDetails.summary.totalRepayment,
'waived': this.loanDetails.summary.totalWaived,
'writtenOff': this.loanDetails.summary.totalWrittenOff,
'outstanding': this.loanDetails.summary.totalOutstanding,
'overdue': this.loanDetails.summary.totalOverdue,
}
property: 'Principal',
original: this.loanDetails.summary.principalDisbursed,
adjustment: this.loanDetails.summary.principalAdjustments || 0,
paid: this.loanDetails.summary.principalPaid,
waived: this.loanDetails.summary.principalWaived || 0,
writtenOff: this.loanDetails.summary.principalWrittenOff,
outstanding: this.loanDetails.summary.principalOutstanding,
overdue: this.loanDetails.summary.principalOverdue
},
{
property: 'Interest',
original: this.loanDetails.summary.interestCharged,
adjustment: '0',
paid: this.loanDetails.summary.interestPaid,
waived: this.loanDetails.summary.interestWaived,
writtenOff: this.loanDetails.summary.interestWrittenOff,
outstanding: this.loanDetails.summary.interestOutstanding,
overdue: this.loanDetails.summary.interestOverdue
},
{
property: 'Fees',
original: this.loanDetails.summary.feeChargesCharged,
adjustment: '0',
paid: this.loanDetails.summary.feeChargesPaid,
waived: this.loanDetails.summary.feeChargesWaived,
writtenOff: this.loanDetails.summary.feeChargesWrittenOff,
outstanding: this.loanDetails.summary.feeChargesOutstanding,
overdue: this.loanDetails.summary.feeChargesOverdue
},
{
property: 'Penalties',
original: this.loanDetails.summary.penaltyChargesCharged,
adjustment: '0',
paid: this.loanDetails.summary.penaltyChargesPaid,
waived: this.loanDetails.summary.penaltyChargesWaived,
writtenOff: this.loanDetails.summary.penaltyChargesWrittenOff,
outstanding: this.loanDetails.summary.penaltyChargesOutstanding,
overdue: this.loanDetails.summary.penaltyChargesOverdue
},
{
property: 'Total',
original: this.loanDetails.summary.totalExpectedRepayment,
adjustment: this.loanDetails.summary.principalAdjustments || 0,
paid: this.loanDetails.summary.totalRepayment,
waived: this.loanDetails.summary.totalWaived,
writtenOff: this.loanDetails.summary.totalWrittenOff,
outstanding: this.loanDetails.summary.totalOutstanding,
overdue: this.loanDetails.summary.totalOverdue
}
];
this.dataSource = new MatTableDataSource(this.loanSummaryTableData);
}
setloanDetailsTableData() {
this.loanDetailsTableData = [
{
'key': 'Disbursement Date'
key: 'Disbursement Date'
},
{
'key': 'Loan Purpose'
key: 'Loan Purpose'
},
{
'key': 'Loan Officer'
key: 'Loan Officer'
},
{
'key': 'Currency'
key: 'Currency'
},
{
'key': 'External Id'
key: 'External Id'
},
{
'key': 'Proposed Amount',
'value': this.loanDetails.proposedPrincipal,
key: 'Proposed Amount',
value: this.loanDetails.proposedPrincipal
},
{
'key': 'Approved Amount',
'value': this.loanDetails.approvedPrincipal,
key: 'Approved Amount',
value: this.loanDetails.approvedPrincipal
},
{
'key': 'Disburse Amount',
'value': this.loanDetails.principal,
},
key: 'Disburse Amount',
value: this.loanDetails.principal
}
];
this.detailsDataSource = new MatTableDataSource(this.loanDetailsTableData);
}
setloanNonDetailsTableData() {
this.loanDetailsTableData = [
{
'key': 'Disbursement Date'
key: 'Disbursement Date'
},
{
'key': 'Currency'
key: 'Currency'
},
{
'key': 'Loan Officer'
key: 'Loan Officer'
},
{
'key': 'External Id'
key: 'External Id'
}
];
this.detailsDataSource = new MatTableDataSource(this.loanDetailsTableData);
}
showApprovedAmountBasedOnStatus() {
if (this.status === 'Submitted and pending approval' || this.status === 'Withdrawn by applicant' || this.status === 'Rejected') {
return false;
if (
this.status === 'Submitted and pending approval' ||
this.status === 'Withdrawn by applicant' ||
this.status === 'Rejected'
) {
return false;
}
return true;
}
showDisbursedAmountBasedOnStatus = function() {
if (this.status === 'Submitted and pending approval' || this.status === 'Withdrawn by applicant' || this.status === 'Rejected' ||
this.status === 'Approved') {
return false;
showDisbursedAmountBasedOnStatus = function () {
if (
this.status === 'Submitted and pending approval' ||
this.status === 'Withdrawn by applicant' ||
this.status === 'Rejected' ||
this.status === 'Approved'
) {
return false;
}
return true;
};
@@ -8,9 +8,8 @@ describe('AddCollateralComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddCollateralComponent ]
})
.compileComponents();
declarations: [AddCollateralComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { LoansService } from 'app/loans/loans.service';
styleUrls: ['./add-collateral.component.scss']
})
export class AddCollateralComponent implements OnInit {
@Input() dataObject: any;
/** Collateral form. */
@@ -30,10 +29,12 @@ export class AddCollateralComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {LoansService} LoansService loans service.
*/
constructor(private formBuilder: UntypedFormBuilder,
private router: Router,
private route: ActivatedRoute,
private loanService: LoansService ) { }
constructor(
private formBuilder: UntypedFormBuilder,
private router: Router,
private route: ActivatedRoute,
private loanService: LoansService
) {}
ngOnInit() {
this.createAddCollateralForm();
@@ -44,9 +45,15 @@ export class AddCollateralComponent implements OnInit {
*/
createAddCollateralForm() {
this.collateralForm = this.formBuilder.group({
'collateralTypeId': ['', Validators.required],
'value': ['', Validators.required],
'description': ['']
collateralTypeId: [
'',
Validators.required
],
value: [
'',
Validators.required
],
description: ['']
});
}
@@ -56,7 +63,7 @@ export class AddCollateralComponent implements OnInit {
submit() {
const collateralTypeId = this.collateralForm.value.collateralTypeId;
this.collateralForm.patchValue({
'collateralTypeId': collateralTypeId
collateralTypeId: collateralTypeId
});
const loanId = this.route.snapshot.params['loanId'];
const collateralForm = this.collateralForm.value;
@@ -65,5 +72,4 @@ export class AddCollateralComponent implements OnInit {
this.router.navigate(['../../loan-collateral'], { relativeTo: this.route });
});
}
}
@@ -1,47 +1,60 @@
<div class="container mat-elevation-z8">
<mat-card>
<div class="m-b-20" fxLayout="column" *ngIf="maturityDate">
<span class="m-r-10">{{'Maturity Date' | translateKey:'inputs'}} : {{ maturityDate | dateFormat}}</span>
<mat-card>
<div class="m-b-20" fxLayout="column" *ngIf="maturityDate">
<span class="m-r-10">{{ 'Maturity Date' | translateKey: 'inputs' }} : {{ maturityDate | dateFormat }}</span>
</div>
<form [formGroup]="interestPauseLoanForm" (ngSubmit)="submit()">
<mat-card-content>
<div fxLayout="column">
<mat-form-field (click)="startDatePicker.open()">
<mat-label>{{ 'labels.inputs.Start Date' | translate }}</mat-label>
<input
matInput
[min]="minDate"
[max]="maxDate"
[matDatepicker]="startDatePicker"
required
formControlName="startDate"
/>
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
<mat-datepicker #startDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.startDate.hasError('required')">
{{ 'labels.inputs.Start Date' | translate }}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
<mat-form-field (click)="endDatePicker.open()">
<mat-label>{{ 'labels.inputs.End Date' | translate }}</mat-label>
<input
matInput
[min]="interestPauseLoanForm.value.startDate"
[max]="maxDate"
[matDatepicker]="endDatePicker"
required
formControlName="endDate"
/>
<mat-datepicker-toggle matSuffix [for]="endDatePicker"></mat-datepicker-toggle>
<mat-datepicker #endDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.endDate.hasError('required')">
{{ 'labels.inputs.End Date' | translate }}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
</div>
<form [formGroup]="interestPauseLoanForm" (ngSubmit)="submit()">
<mat-card-content>
<div fxLayout="column">
<mat-form-field (click)="startDatePicker.open()">
<mat-label>{{ 'labels.inputs.Start Date' | translate }}</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="startDatePicker"
required formControlName="startDate" />
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
<mat-datepicker #startDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.startDate.hasError('required')">
{{ 'labels.inputs.Start Date' | translate
}}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
<mat-form-field (click)="endDatePicker.open()">
<mat-label>{{ 'labels.inputs.End Date' | translate }}</mat-label>
<input matInput [min]="interestPauseLoanForm.value.startDate" [max]="maxDate" [matDatepicker]="endDatePicker"
required formControlName="endDate" />
<mat-datepicker-toggle matSuffix [for]="endDatePicker"></mat-datepicker-toggle>
<mat-datepicker #endDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.endDate.hasError('required')">
{{ 'labels.inputs.End Date' | translate
}}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
</div>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button mat-raised-button color="primary" [disabled]="!interestPauseLoanForm.valid"
*mifosxHasPermission="'DISBURSE_LOAN'">
{{ 'labels.buttons.Submit' | translate }}
</button>
</mat-card-actions>
</mat-card-content>
</form>
</mat-card>
</div>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button
mat-raised-button
color="primary"
[disabled]="!interestPauseLoanForm.valid"
*mifosxHasPermission="'DISBURSE_LOAN'"
>
{{ 'labels.buttons.Submit' | translate }}
</button>
</mat-card-actions>
</mat-card-content>
</form>
</mat-card>
</div>
@@ -1,8 +1,7 @@
.expandcollapsebutton {
margin-top: -7px;
}
.container {
max-width: 37rem;
}
margin-top: -7px;
}
.container {
max-width: 37rem;
}
@@ -8,9 +8,8 @@ describe('AddInterestPauseComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AddInterestPauseComponent ]
})
.compileComponents();
declarations: [AddInterestPauseComponent]
}).compileComponents();
fixture = TestBed.createComponent(AddInterestPauseComponent);
component = fixture.componentInstance;
@@ -11,7 +11,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./add-interest-pause.component.scss']
})
export class AddInterestPauseComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -35,13 +34,14 @@ export class AddInterestPauseComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -64,8 +64,14 @@ export class AddInterestPauseComponent implements OnInit {
*/
createInterestPauseLoanForm() {
this.interestPauseLoanForm = this.formBuilder.group({
'startDate': [this.startDate, Validators.required],
'endDate': [this.startDate, Validators.required]
startDate: [
this.startDate,
Validators.required
],
endDate: [
this.startDate,
Validators.required
]
});
}
@@ -87,10 +93,8 @@ export class AddInterestPauseComponent implements OnInit {
dateFormat,
locale
};
this.loanService.addInterestPauseToLoan(this.loanId, data )
.subscribe((response: any) => {
this.router.navigate(['../../term-variations'], { relativeTo: this.route });
});
this.loanService.addInterestPauseToLoan(this.loanId, data).subscribe((response: any) => {
this.router.navigate(['../../term-variations'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AddloanchargeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddLoanChargeComponent ]
})
.compileComponents();
declarations: [AddLoanChargeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./add-loan-charge.component.scss']
})
export class AddLoanChargeComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -51,12 +50,14 @@ export class AddLoanChargeComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { actionButtonData: any }) => {
this.loanChargeOptions = data.actionButtonData.chargeOptions;
});
@@ -69,8 +70,8 @@ export class AddLoanChargeComponent implements OnInit {
ngOnInit() {
this.maxDate = this.settingsService.maxFutureDate;
this.createLoanChargeForm();
this.loanChargeForm.controls.chargeId.valueChanges.subscribe(chargeId => {
const chargeDetails = this.loanChargeOptions.find(option => {
this.loanChargeForm.controls.chargeId.valueChanges.subscribe((chargeId) => {
const chargeDetails = this.loanChargeOptions.find((option) => {
return option.id === chargeId;
});
if (chargeDetails.chargeTimeType.id === 2) {
@@ -79,9 +80,9 @@ export class AddLoanChargeComponent implements OnInit {
this.loanChargeForm.removeControl('dueDate');
}
this.loanChargeForm.patchValue({
'amount': chargeDetails.amount,
'chargeCalculation': chargeDetails.chargeCalculationType.value,
'chargeTime': chargeDetails.chargeTimeType.value
amount: chargeDetails.amount,
chargeCalculation: chargeDetails.chargeCalculationType.value,
chargeTime: chargeDetails.chargeTimeType.value
});
});
}
@@ -91,10 +92,16 @@ export class AddLoanChargeComponent implements OnInit {
*/
createLoanChargeForm() {
this.loanChargeForm = this.formBuilder.group({
'chargeId': ['', Validators.required],
'amount': ['', Validators.required],
'chargeCalculation': [{ value: '', disabled: true }],
'chargeTime': [{ value: '', disabled: true }]
chargeId: [
'',
Validators.required
],
amount: [
'',
Validators.required
],
chargeCalculation: [{ value: '', disabled: true }],
chargeTime: [{ value: '', disabled: true }]
});
}
@@ -111,7 +118,7 @@ export class AddLoanChargeComponent implements OnInit {
dateFormat,
locale
};
this.loansService.createLoanCharge(this.loanId, 'charges', data).subscribe(res => {
this.loansService.createLoanCharge(this.loanId, 'charges', data).subscribe((res) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
@@ -8,9 +8,8 @@ describe('AdjustLoanChargeComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AdjustLoanChargeComponent ]
})
.compileComponents();
declarations: [AdjustLoanChargeComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -36,19 +36,21 @@ export class AdjustLoanChargeComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService,
private organizationService: OrganizationService) {
this.loanId = this.route.snapshot.params['loanId'];
this.chargeId = this.route.snapshot.params['id'];
this.route.data.subscribe((data: { loansAccountCharge: any, loanDetailsData: any }) => {
this.chargeData = data.loansAccountCharge;
this.loanDetailsData = data.loanDetailsData;
});
}
private organizationService: OrganizationService
) {
this.loanId = this.route.snapshot.params['loanId'];
this.chargeId = this.route.snapshot.params['id'];
this.route.data.subscribe((data: { loansAccountCharge: any; loanDetailsData: any }) => {
this.chargeData = data.loansAccountCharge;
this.loanDetailsData = data.loanDetailsData;
});
}
/**
* Creates the repayment loan form
@@ -65,10 +67,13 @@ export class AdjustLoanChargeComponent implements OnInit {
*/
createAdjustLoanChargeForm() {
this.adjustLoanChargeForm = this.formBuilder.group({
'amount': [this.chargeData.amount, Validators.required],
'externalId': '',
'paymentTypeId': '',
'note': ''
amount: [
this.chargeData.amount,
Validators.required
],
externalId: '',
paymentTypeId: '',
note: ''
});
}
@@ -107,10 +112,10 @@ export class AdjustLoanChargeComponent implements OnInit {
locale
};
const command = 'adjustment';
this.loanService.executeLoansAccountChargesCommand(this.loanId, command, data, this.chargeId)
this.loanService
.executeLoansAccountChargesCommand(this.loanId, command, data, this.chargeId)
.subscribe((response: any) => {
this.router.navigate(['../..'], { relativeTo: this.route });
});
});
}
}
@@ -8,9 +8,8 @@ describe('ApproveLoanComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ApproveLoanComponent ]
})
.compileComponents();
declarations: [ApproveLoanComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./approve-loan.component.scss']
})
export class ApproveLoanComponent implements OnInit {
/** Approve Loan form. */
approveLoanForm: UntypedFormGroup;
/** Loan data. */
@@ -40,12 +39,14 @@ export class ApproveLoanComponent implements OnInit {
* @param router Router.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private dateUtils: Dates,
private loanService: LoansService,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { actionButtonData: any }) => {
this.loanData = data.actionButtonData;
this.currency = data.actionButtonData.currency;
@@ -58,7 +59,7 @@ export class ApproveLoanComponent implements OnInit {
this.loanService.getApproveAssociationsDetails(this.loanId).subscribe((response: any) => {
this.associationData = response;
this.approveLoanForm.patchValue({
'expectedDisbursementDate': new Date(response.timeline.expectedDisbursementDate)
expectedDisbursementDate: new Date(response.timeline.expectedDisbursementDate)
});
});
}
@@ -68,10 +69,16 @@ export class ApproveLoanComponent implements OnInit {
*/
setApproveLoanForm() {
this.approveLoanForm = this.formBuilder.group({
'approvedOnDate': [this.settingsService.businessDate, Validators.required],
'expectedDisbursementDate': [''],
'approvedLoanAmount': [this.loanData.approvalAmount, Validators.required],
'note': ['']
approvedOnDate: [
this.settingsService.businessDate,
Validators.required
],
expectedDisbursementDate: [''],
approvedLoanAmount: [
this.loanData.approvalAmount,
Validators.required
],
note: ['']
});
}
@@ -99,5 +106,4 @@ export class ApproveLoanComponent implements OnInit {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AssetTransferLoanComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AssetTransferLoanComponent ]
})
.compileComponents();
declarations: [AssetTransferLoanComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -11,7 +11,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./asset-transfer-loan.component.scss']
})
export class AssetTransferLoanComponent implements OnInit {
BUYBACK_COMMAND = 'buyback';
SALE_COMMAND = 'sale';
@@ -25,16 +24,18 @@ export class AssetTransferLoanComponent implements OnInit {
/** Sell Loan Form */
saleLoanForm: UntypedFormGroup;
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private externalAssetOwnerService: ExternalAssetOwnerService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
const actionName = this.route.snapshot.params['action'];
this.command = (actionName === 'Sell Loan') ? this.SALE_COMMAND : this.BUYBACK_COMMAND;
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
const actionName = this.route.snapshot.params['action'];
this.command = actionName === 'Sell Loan' ? this.SALE_COMMAND : this.BUYBACK_COMMAND;
}
/**
* Creates the Sell Loan form
@@ -47,7 +48,7 @@ export class AssetTransferLoanComponent implements OnInit {
}
isBuyBack(): boolean {
return (this.command === this.BUYBACK_COMMAND);
return this.command === this.BUYBACK_COMMAND;
}
/**
@@ -55,10 +56,19 @@ export class AssetTransferLoanComponent implements OnInit {
*/
createSaleLoanForm() {
this.saleLoanForm = this.formBuilder.group({
'settlementDate': [this.settingsService.businessDate, Validators.required],
'purchasePriceRatio': ['', Validators.required],
'transferExternalId': '',
'ownerExternalId': ['', Validators.required]
settlementDate: [
this.settingsService.businessDate,
Validators.required
],
purchasePriceRatio: [
'',
Validators.required
],
transferExternalId: '',
ownerExternalId: [
'',
Validators.required
]
});
if (this.isBuyBack()) {
@@ -80,11 +90,10 @@ export class AssetTransferLoanComponent implements OnInit {
dateFormat,
locale
};
this.externalAssetOwnerService.executeExternalAssetOwnerLoanCommand(this.loanId, data, this.command)
this.externalAssetOwnerService
.executeExternalAssetOwnerLoanCommand(this.loanId, data, this.command)
.subscribe((response: any) => {
this.router.navigate(['../../external-asset-owner'], { relativeTo: this.route });
});
});
}
}
@@ -8,9 +8,8 @@ describe('AssignLoanOfficerComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AssignLoanOfficerComponent ]
})
.compileComponents();
declarations: [AssignLoanOfficerComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,7 +13,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./assign-loan-officer.component.scss']
})
export class AssignLoanOfficerComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -32,14 +31,16 @@ export class AssignLoanOfficerComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the assign officer form.
@@ -55,8 +56,14 @@ export class AssignLoanOfficerComponent implements OnInit {
*/
createassignOfficerForm() {
this.assignOfficerForm = this.formBuilder.group({
'toLoanOfficerId': ['', Validators.required],
'assignmentDate': [new Date(), Validators.required]
toLoanOfficerId: [
'',
Validators.required
],
assignmentDate: [
new Date(),
Validators.required
]
});
}
@@ -74,10 +81,8 @@ export class AssignLoanOfficerComponent implements OnInit {
locale
};
data.fromLoanOfficerId = this.dataObject.loanOfficerId || '';
this.loanService.loanActionButtons(this.loanId, 'assignLoanOfficer', data)
.subscribe((response: any) => {
this.router.navigate([`../../general`], { relativeTo: this.route });
this.loanService.loanActionButtons(this.loanId, 'assignLoanOfficer', data).subscribe((response: any) => {
this.router.navigate([`../../general`], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ChargeOffComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ChargeOffComponent ]
})
.compileComponents();
declarations: [ChargeOffComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -35,14 +35,16 @@ export class ChargeOffComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the repayment loan form
@@ -59,10 +61,13 @@ export class ChargeOffComponent implements OnInit {
*/
createChargeoffLoanForm() {
this.chargeoffLoanForm = this.formBuilder.group({
'transactionDate': [this.settingsService.businessDate, Validators.required],
'externalId': '',
'chargeOffReasonId': '',
'note': ''
transactionDate: [
this.settingsService.businessDate,
Validators.required
],
externalId: '',
chargeOffReasonId: '',
note: ''
});
}
@@ -80,10 +85,8 @@ export class ChargeOffComponent implements OnInit {
locale
};
const command = 'charge-off';
this.loanService.submitLoanActionButton(this.loanId, data, command)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, command).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CloseAsRescheduledComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseAsRescheduledComponent ]
})
.compileComponents();
declarations: [CloseAsRescheduledComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,7 +13,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./close-as-rescheduled.component.scss']
})
export class CloseAsRescheduledComponent implements OnInit {
@Input() dataObject: any;
/** Close form. */
@@ -32,14 +31,16 @@ export class CloseAsRescheduledComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the close form.
@@ -54,8 +55,11 @@ export class CloseAsRescheduledComponent implements OnInit {
*/
createCloseForm() {
this.closeLoanForm = this.formBuilder.group({
'transactionDate': [new Date(this.dataObject.date) || new Date(), Validators.required],
'note': []
transactionDate: [
new Date(this.dataObject.date) || new Date(),
Validators.required
],
note: []
});
}
@@ -76,9 +80,8 @@ export class CloseAsRescheduledComponent implements OnInit {
dateFormat,
locale
};
this.loanService.submitLoanActionButton(this.loanId, data, 'close-rescheduled')
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, 'close-rescheduled').subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CreateGuarantorComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateGuarantorComponent ]
})
.compileComponents();
declarations: [CreateGuarantorComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./create-guarantor.component.scss']
})
export class CreateGuarantorComponent implements OnInit, AfterViewInit {
@Input() dataObject: any;
/** New Guarantor Form */
newGuarantorForm: UntypedFormGroup;
@@ -44,13 +43,15 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private clientsService: ClientsService,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -64,11 +65,14 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
/** Create Guarantor Details Form */
createNewGuarantorForm() {
this.newGuarantorForm = this.formBuilder.group({
'existingClient': [''],
'name': ['', Validators.required],
'clientRelationshipTypeId': [''],
'savingsId': [''],
'amount': ['']
existingClient: [''],
name: [
'',
Validators.required
],
clientRelationshipTypeId: [''],
savingsId: [''],
amount: ['']
});
}
@@ -123,10 +127,9 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
if (this.newGuarantorForm.value.existingClient) {
this.newGuarantorForm.get('name').valueChanges.subscribe((value: string) => {
if (value.length >= 2) {
this.clientsService.getFilteredClients('displayName', 'ASC', true, value)
.subscribe((data: any) => {
this.clientsData = data.pageItems;
});
this.clientsService.getFilteredClients('displayName', 'ASC', true, value).subscribe((data: any) => {
this.clientsData = data.pageItems;
});
}
});
}
@@ -155,7 +158,9 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
const dateFormat = this.settingsService.dateFormat;
const prevdob: Date = this.newGuarantorForm.value.dob;
const guarantorTypeId: number = this.newGuarantorForm.value.existingClient ? this.dataObject.guarantorTypeOptions[0].id : this.dataObject.guarantorTypeOptions[2].id;
const guarantorTypeId: number = this.newGuarantorForm.value.existingClient
? this.dataObject.guarantorTypeOptions[0].id
: this.dataObject.guarantorTypeOptions[2].id;
const data = {
...newGuarantorFormData,
locale,
@@ -174,10 +179,8 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
delete data.existingClient;
delete data.name;
this.loanService.createNewGuarantor(this.loanId, data)
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
this.loanService.createNewGuarantor(this.loanId, data).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('DisburseToSavingsAccountComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DisburseToSavingsAccountComponent ]
})
.compileComponents();
declarations: [DisburseToSavingsAccountComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -12,7 +12,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./disburse-to-savings-account.component.scss']
})
export class DisburseToSavingsAccountComponent implements OnInit {
@Input() dataObject: any;
/** Minimum Date allowed. */
@@ -31,13 +30,14 @@ export class DisburseToSavingsAccountComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loanService: LoansService,
private settingsService: SettingsService) {
}
private settingsService: SettingsService
) {}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -52,12 +52,21 @@ export class DisburseToSavingsAccountComponent implements OnInit {
*/
setDisbursementToSavingsForm() {
this.disbursementForm = this.formBuilder.group({
'actualDisbursementDate': [new Date(), Validators.required],
'transactionAmount': [this.dataObject.amount, Validators.required],
'note': ['']
actualDisbursementDate: [
new Date(),
Validators.required
],
transactionAmount: [
this.dataObject.amount,
Validators.required
],
note: ['']
});
if (this.dataObject.fixedEmiAmount) {
this.disbursementForm.addControl('fixedEmiAmount', new UntypedFormControl(this.dataObject.fixedEmiAmount, [Validators.required]));
this.disbursementForm.addControl(
'fixedEmiAmount',
new UntypedFormControl(this.dataObject.fixedEmiAmount, [Validators.required])
);
}
}
@@ -70,7 +79,10 @@ export class DisburseToSavingsAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevActualDisbursementDate: Date = this.disbursementForm.value.actualDisbursementDate;
if (disbursementLoanFormData.actualDisbursementDate instanceof Date) {
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat);
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(
prevActualDisbursementDate,
dateFormat
);
}
const data = {
...disbursementLoanFormData,
@@ -83,5 +95,4 @@ export class DisburseToSavingsAccountComponent implements OnInit {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('DisburseComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DisburseComponent ]
})
.compileComponents();
declarations: [DisburseComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./disburse.component.scss']
})
export class DisburseComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -41,16 +40,17 @@ export class DisburseComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the disbursement loan form
* and initialize with the required values
@@ -69,18 +69,24 @@ export class DisburseComponent implements OnInit {
*/
createDisbursementLoanForm() {
this.disbursementLoanForm = this.formBuilder.group({
'actualDisbursementDate': [this.settingsService.businessDate, Validators.required],
'transactionAmount': ['', Validators.required],
'externalId': '',
'paymentTypeId': '',
'note': ''
actualDisbursementDate: [
this.settingsService.businessDate,
Validators.required
],
transactionAmount: [
'',
Validators.required
],
externalId: '',
paymentTypeId: '',
note: ''
});
}
setDisbursementLoanDetails() {
this.paymentTypes = this.dataObject.paymentTypeOptions;
this.disbursementLoanForm.patchValue({
transactionAmount: this.dataObject.amount,
transactionAmount: this.dataObject.amount
// actualDisbursementDate: new Date(this.dataObject.date)
});
}
@@ -112,7 +118,10 @@ export class DisburseComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevActualDisbursementDate: Date = this.disbursementLoanForm.value.actualDisbursementDate;
if (disbursementLoanFormData.actualDisbursementDate instanceof Date) {
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat);
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(
prevActualDisbursementDate,
dateFormat
);
}
const data = {
...disbursementLoanFormData,
@@ -120,10 +129,8 @@ export class DisburseComponent implements OnInit {
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.loanActionButtons(this.loanId, 'disburse', data )
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
this.loanService.loanActionButtons(this.loanId, 'disburse', data).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}

Some files were not shown because too many files have changed in this diff Show More