Files
cbsnexora/src/app/loans/loans-view/repayment-schedule-tab/repayment-schedule-tab.component.ts
T
2022-12-26 14:25:49 -06:00

38 lines
1.4 KiB
TypeScript

import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'mifosx-repayment-schedule-tab',
templateUrl: './repayment-schedule-tab.component.html',
styleUrls: ['./repayment-schedule-tab.component.scss']
})
export class RepaymentScheduleTabComponent implements OnInit {
/** Loan Repayment Schedule Details Data */
@Input() repaymentScheduleDetails: any = null;
loanDetailsDataRepaymentSchedule: any = [];
/** Stores if there is any waived amount */
isWaived: boolean;
/** Columns to be displayed in original schedule table. */
displayedColumns: string[] = ['number', 'days', 'date', 'paiddate', 'check', 'balanceOfLoan', 'principalDue', 'interest', 'fees', 'penalties', 'due', 'paid', 'inadvance', 'late', 'waived', 'outstanding'];
/**
* Retrieves the loans with associations data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe((data: { loanDetailsData: any }) => {
this.loanDetailsDataRepaymentSchedule = data.loanDetailsData ? data.loanDetailsData.repaymentSchedule : [];
});
}
ngOnInit() {
if (this.repaymentScheduleDetails == null) {
this.repaymentScheduleDetails = this.loanDetailsDataRepaymentSchedule;
}
this.isWaived = this.repaymentScheduleDetails.totalWaived > 0;
}
}