Skip to content

Commit ade91f7

Browse files
authored
Merge pull request #2553 from JohnAlva/fix_recurrend
WEB-248: Fix Recurrent Deposit
2 parents 72097b6 + a53a775 commit ade91f7

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

src/app/deposits/recurring-deposits/recurring-deposits-account-actions/close-recurring-deposits-account/close-recurring-deposits-account.component.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ <h3 class="mat-h3 flex-fill">{{ title }}</h3>
4848
</mat-error>
4949
</mat-form-field>
5050

51+
<mat-form-field *ngIf="closeRecurringDepositForm.contains('toSavingsAccountId')">
52+
<mat-label>{{ 'labels.inputs.Transfer to Savings' | translate }}</mat-label>
53+
<mat-select required formControlName="toSavingsAccountId">
54+
<mat-option *ngFor="let account of savingsAccountsData" [value]="account.id">
55+
{{ account.accountNo }}
56+
</mat-option>
57+
</mat-select>
58+
<mat-error *ngIf="closeRecurringDepositForm.controls.toSavingsAccountId.hasError('required')">
59+
{{ 'labels.inputs.Transfer to savings account' | translate }} {{ 'labels.commons.is' | translate }}
60+
<strong>{{ 'labels.commons.required' | translate }}</strong>
61+
</mat-error>
62+
</mat-form-field>
63+
64+
<mat-form-field *ngIf="closeRecurringDepositForm.contains('transferDescription')">
65+
<mat-label>{{ 'labels.inputs.Transfer Description' | translate }}</mat-label>
66+
<input matInput formControlName="transferDescription" />
67+
</mat-form-field>
68+
5169
<mat-form-field>
5270
<mat-label>{{ 'labels.inputs.Payment Type Id' | translate }}</mat-label>
5371
<mat-select formControlName="paymentTypeId" required>

src/app/deposits/recurring-deposits/recurring-deposits-account-actions/close-recurring-deposits-account/close-recurring-deposits-account.component.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/** Angular Imports */
22
import { Component, OnInit } from '@angular/core';
3-
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
3+
import {
4+
UntypedFormGroup,
5+
UntypedFormBuilder,
6+
Validators,
7+
ReactiveFormsModule,
8+
UntypedFormControl
9+
} from '@angular/forms';
410
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
511

612
/** Custom Services */
@@ -35,6 +41,8 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
3541
accountId: string;
3642
/** Show payment details */
3743
showPaymentDetails = false;
44+
/** Savings Account Data */
45+
savingsAccountsData: any;
3846
/** Minimum Date allowed. */
3947
minDate = new Date(2000, 0, 1);
4048
/** Maximum Date allowed. */
@@ -59,6 +67,7 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
5967
private settingsService: SettingsService
6068
) {
6169
this.route.data.subscribe((data: { recurringDepositsAccountActionData: any }) => {
70+
this.savingsAccountsData = data.recurringDepositsAccountActionData.savingsAccounts;
6271
this.maturityAmount = data.recurringDepositsAccountActionData.maturityAmount;
6372
this.onAccountClosureOptions = data.recurringDepositsAccountActionData.onAccountClosureOptions;
6473
this.paymentTypes = data.recurringDepositsAccountActionData.paymentTypeOptions;
@@ -74,6 +83,7 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
7483
ngOnInit() {
7584
this.maxDate = this.settingsService.businessDate;
7685
this.createcloseRecurringDepositForm();
86+
this.addTransferDetails();
7787
}
7888

7989
/**
@@ -95,7 +105,7 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
95105
Validators.required
96106
],
97107
accountNumber: '',
98-
chequeNumber: '',
108+
checkNumber: '',
99109
routingCode: '',
100110
receiptNumber: '',
101111
bankNumber: '',
@@ -109,6 +119,20 @@ export class CloseRecurringDepositsAccountComponent implements OnInit {
109119
toggleDisplay() {
110120
this.showPaymentDetails = !this.showPaymentDetails;
111121
}
122+
addTransferDetails() {
123+
this.closeRecurringDepositForm.get('onAccountClosureId').valueChanges.subscribe((id: any) => {
124+
if (id === 200) {
125+
this.closeRecurringDepositForm.addControl(
126+
'toSavingsAccountId',
127+
new UntypedFormControl('', Validators.required)
128+
);
129+
this.closeRecurringDepositForm.addControl('transferDescription', new UntypedFormControl(''));
130+
} else {
131+
this.closeRecurringDepositForm.removeControl('toSavingsAccountId');
132+
this.closeRecurringDepositForm.removeControl('transferDescription');
133+
}
134+
});
135+
}
112136

113137
/**
114138
* Submits the close recurring deposit form

0 commit comments

Comments
 (0)