@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { LoansService } from '../loans.service';
|
||||
|
||||
// Custom Imports
|
||||
@@ -26,12 +26,14 @@ export class LoansViewComponent implements OnInit {
|
||||
taskPermissionName: string
|
||||
}[]
|
||||
};
|
||||
loanId: number;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { loanDetailsData: any, }) => {
|
||||
this.loanDetailsData = data.loanDetailsData;
|
||||
console.log('loandata:: ', this.loanDetailsData);
|
||||
});
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -39,7 +41,6 @@ export class LoansViewComponent implements OnInit {
|
||||
this.recalculateInterest = this.loanDetailsData.recalculateInterest || true;
|
||||
this.status = this.loanDetailsData.status.value;
|
||||
|
||||
console.log('status: ', this.status);
|
||||
// Defines the buttons based on the status of the loan account
|
||||
if (this.status === 'Submitted and pending approval') {
|
||||
this.buttons = ButtonConfig['Submitted and pending approval'];
|
||||
@@ -102,10 +103,14 @@ export class LoansViewComponent implements OnInit {
|
||||
} else if (this.status === 'Overpaid') {
|
||||
this.buttons = ButtonConfig['Overpaid'];
|
||||
} else if (this.status === 'Closed (written off)') {
|
||||
this.buttons = ButtonConfig['Closed (written off)'];
|
||||
this.buttons = ButtonConfig['ClosedWrittenOff'];
|
||||
}
|
||||
console.log('this.buttons: ', this.buttons);
|
||||
|
||||
}
|
||||
|
||||
loanAction(button: string) {
|
||||
button = button.replace(' ', '-').toLowerCase();
|
||||
this.router.navigate([button], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user