Loan Account Term calculation (#1871)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-09-24 23:19:20 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent ab55521a5a
commit adef15df35
13 changed files with 59 additions and 33 deletions
@@ -65,8 +65,8 @@
<mifosx-loan-product-payment-strategy-step
[advancedPaymentAllocations]="advancedPaymentAllocations"
[advancedPaymentAllocationTransactionTypes]="loanProductAndTemplate.advancedPaymentAllocationTransactionTypes"
[paymentAllocationOrderDefault]="loanProductAndTemplate.advancedPaymentAllocationTypes"
[advancedPaymentAllocationTransactionTypes]="loanProductsTemplate.advancedPaymentAllocationTransactionTypes"
[paymentAllocationOrderDefault]="loanProductsTemplate.advancedPaymentAllocationTypes"
(setPaymentAllocation)="setPaymentAllocation($event)"
>
</mifosx-loan-product-payment-strategy-step>
@@ -60,7 +60,9 @@ export class CreateLoanProductComponent implements OnInit {
});
}
ngOnInit() { }
ngOnInit() {
this.buildAdvancedPaymentAllocation();
}
get loanProductDetailsForm() {
return this.loanProductDetailsStep.loanProductDetailsForm;
@@ -85,7 +87,6 @@ export class CreateLoanProductComponent implements OnInit {
}
setPaymentAllocation(paymentAllocation: PaymentAllocation[]): void {
console.log(paymentAllocation);
this.paymentAllocation = paymentAllocation;
}
@@ -53,16 +53,18 @@ export class AdvancedPaymentStrategy {
const advancedPaymentAllocationTypes: PaymentAllocationOrder[] = loanProduct.advancedPaymentAllocationTypes;
const advancedPaymentAllocationFutureInstallmentAllocationRules: FutureInstallmentAllocationRule[] =
loanProduct.advancedPaymentAllocationFutureInstallmentAllocationRules;
loanProduct.paymentAllocation.forEach((item: PaymentAllocation) => {
advancedPaymentAllocation.push({
transaction: this.getItemByCode(item.transactionType, advancedPaymentAllocationTransactionTypes),
paymentAllocationOrder: this.buildCurrentPaymentAllocationOrder(item.paymentAllocationOrder,
advancedPaymentAllocationTypes),
futureInstallmentAllocationRule: this.getItemByCode(item.futureInstallmentAllocationRule,
advancedPaymentAllocationFutureInstallmentAllocationRules),
futureInstallmentAllocationRules: advancedPaymentAllocationFutureInstallmentAllocationRules,
if (loanProduct.paymentAllocation) {
loanProduct.paymentAllocation.forEach((item: PaymentAllocation) => {
advancedPaymentAllocation.push({
transaction: this.getItemByCode(item.transactionType, advancedPaymentAllocationTransactionTypes),
paymentAllocationOrder: this.buildCurrentPaymentAllocationOrder(item.paymentAllocationOrder,
advancedPaymentAllocationTypes),
futureInstallmentAllocationRule: this.getItemByCode(item.futureInstallmentAllocationRule,
advancedPaymentAllocationFutureInstallmentAllocationRules),
futureInstallmentAllocationRules: advancedPaymentAllocationFutureInstallmentAllocationRules,
});
});
});
}
// If this is Empty, add the Default
if (advancedPaymentAllocation.length === 0) {
advancedPaymentAllocation.push({