fix: Prevent account transfer charges when no savings account is linked (#2364)
- Added getter to check if a savings account is linked (loansSavingsAccountLinked). - Filtered out charges with 'Account transfer' payment mode when no savings account is linked.
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
[loansAccountProductTemplate]="loansAccountProductTemplate"
|
||||
[loansAccountTemplate]="loansAccountTemplate"
|
||||
[loansAccountFormValid]="loansAccountFormValid"
|
||||
[loansSavingsAccountLinked]="loansSavingsAccountLinked"
|
||||
>
|
||||
</mifosx-loans-account-charges-step>
|
||||
</mat-step>
|
||||
|
||||
@@ -119,6 +119,10 @@ export class CreateLoansAccountComponent {
|
||||
return this.loansAccountDetailsForm.valid && this.loansAccountTermsForm.valid;
|
||||
}
|
||||
|
||||
get loansSavingsAccountLinked() {
|
||||
return this.loansAccountDetailsStep.loansAccountDetailsForm.get('linkAccountId').value;
|
||||
}
|
||||
|
||||
/** Gets principal Amount */
|
||||
get loanPrincipal() {
|
||||
return this.loansAccountTermsStep.loansAccountTermsForm.value.principal;
|
||||
|
||||
+8
@@ -34,6 +34,8 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
|
||||
@Input() loansAccountFormValid: boolean;
|
||||
/** active Client Members in case of GSIM Account */
|
||||
@Input() activeClientMembers?: any;
|
||||
// returns the chosen savings account linked to the loan account
|
||||
@Input() loansSavingsAccountLinked: any;
|
||||
|
||||
/** Charges Data */
|
||||
chargeData: any;
|
||||
@@ -111,6 +113,12 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
|
||||
if (this.loansAccountProductTemplate) {
|
||||
this.loanPurposeOptions = this.loansAccountProductTemplate.loanPurposeOptions;
|
||||
this.chargeData = this.loansAccountProductTemplate.chargeOptions;
|
||||
// filter chargeData to have charges that have chargePaymentMode not 'Account Transfer' if loansSavingsAccountLinked is false
|
||||
if (!this.loansSavingsAccountLinked) {
|
||||
this.chargeData = this.chargeData.filter(
|
||||
(charge: any) => charge.chargePaymentMode?.value != 'Account transfer'
|
||||
);
|
||||
}
|
||||
if (this.loansAccountProductTemplate.overdueCharges) {
|
||||
this.overDueChargesDataSource = this.loansAccountProductTemplate.overdueCharges;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user