Fix to display the Advance Payment Allocation data in Loan Product general tab (#1875)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-10-10 01:53:43 -03:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 0bcf780a9f
commit 61f3ec24e9
3 changed files with 14 additions and 1 deletions
@@ -336,7 +336,8 @@
<span fxFlex="60%">
<mat-accordion>
<mifosx-view-advance-paymeny-allocation *ngFor="let paymentAllocation of loanProduct.paymentAllocation"
[paymentAllocation]="paymentAllocation">
[paymentAllocation]="paymentAllocation"
[advancePaymentAllocationData]="advancePaymentAllocationData">
</mifosx-view-advance-paymeny-allocation>
</mat-accordion>
</span>
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AdvancePaymentAllocationData } from '../../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
@Component({
selector: 'mifosx-general-tab',
@@ -15,6 +16,8 @@ export class GeneralTabComponent implements OnInit {
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId'];
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId'];
advancePaymentAllocationData: AdvancePaymentAllocationData | null = null;
constructor(private route: ActivatedRoute) {
this.route.data.subscribe((data: { loanProduct: any }) => {
this.loanProduct = data.loanProduct;
@@ -17,16 +17,25 @@ export class ViewAdvancePaymenyAllocationComponent implements OnInit {
}
transactionTypeValue(code: string): string {
if (this.advancePaymentAllocationData == null) {
return code;
}
const transactionType = this.advancePaymentAllocationData.transactionTypes.find(t => t.code === code);
return transactionType.value;
}
allocationRuleValue(code: string): string {
if (this.advancePaymentAllocationData == null) {
return code;
}
const allocationType = this.advancePaymentAllocationData.allocationTypes.find(t => t.code === code);
return allocationType.value;
}
futureInstallmentRuleValue(code: string): string {
if (this.advancePaymentAllocationData == null) {
return code;
}
const futureInstallmentAllocationRule = this.advancePaymentAllocationData.futureInstallmentAllocationRules.find(t => t.code === code);
return futureInstallmentAllocationRule.value;
}