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"
|
[loansAccountProductTemplate]="loansAccountProductTemplate"
|
||||||
[loansAccountTemplate]="loansAccountTemplate"
|
[loansAccountTemplate]="loansAccountTemplate"
|
||||||
[loansAccountFormValid]="loansAccountFormValid"
|
[loansAccountFormValid]="loansAccountFormValid"
|
||||||
|
[loansSavingsAccountLinked]="loansSavingsAccountLinked"
|
||||||
>
|
>
|
||||||
</mifosx-loans-account-charges-step>
|
</mifosx-loans-account-charges-step>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|||||||
@@ -119,6 +119,10 @@ export class CreateLoansAccountComponent {
|
|||||||
return this.loansAccountDetailsForm.valid && this.loansAccountTermsForm.valid;
|
return this.loansAccountDetailsForm.valid && this.loansAccountTermsForm.valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get loansSavingsAccountLinked() {
|
||||||
|
return this.loansAccountDetailsStep.loansAccountDetailsForm.get('linkAccountId').value;
|
||||||
|
}
|
||||||
|
|
||||||
/** Gets principal Amount */
|
/** Gets principal Amount */
|
||||||
get loanPrincipal() {
|
get loanPrincipal() {
|
||||||
return this.loansAccountTermsStep.loansAccountTermsForm.value.principal;
|
return this.loansAccountTermsStep.loansAccountTermsForm.value.principal;
|
||||||
|
|||||||
+8
@@ -34,6 +34,8 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
|
|||||||
@Input() loansAccountFormValid: boolean;
|
@Input() loansAccountFormValid: boolean;
|
||||||
/** active Client Members in case of GSIM Account */
|
/** active Client Members in case of GSIM Account */
|
||||||
@Input() activeClientMembers?: any;
|
@Input() activeClientMembers?: any;
|
||||||
|
// returns the chosen savings account linked to the loan account
|
||||||
|
@Input() loansSavingsAccountLinked: any;
|
||||||
|
|
||||||
/** Charges Data */
|
/** Charges Data */
|
||||||
chargeData: any;
|
chargeData: any;
|
||||||
@@ -111,6 +113,12 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges {
|
|||||||
if (this.loansAccountProductTemplate) {
|
if (this.loansAccountProductTemplate) {
|
||||||
this.loanPurposeOptions = this.loansAccountProductTemplate.loanPurposeOptions;
|
this.loanPurposeOptions = this.loansAccountProductTemplate.loanPurposeOptions;
|
||||||
this.chargeData = this.loansAccountProductTemplate.chargeOptions;
|
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) {
|
if (this.loansAccountProductTemplate.overdueCharges) {
|
||||||
this.overDueChargesDataSource = this.loansAccountProductTemplate.overdueCharges;
|
this.overDueChargesDataSource = this.loansAccountProductTemplate.overdueCharges;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user