Skip to content

Commit 8ecadcc

Browse files
Merge pull request #3505 from JaySoni1/WEB-921-restrict-negative-values-in-fixed-deposits-frequency-and-period-fields
WEB-921 Restrict negative values in fixed deposits frequency and period fields
2 parents 0810439 + 3fa7730 commit 8ecadcc

4 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h4 class="mat-h4 flex-98">{{ 'labels.heading.Lock-in Period' | translate }}</h4
1212

1313
<mat-form-field class="flex-48">
1414
<mat-label>{{ 'labels.inputs.Frequency' | translate }}</mat-label>
15-
<input type="number" matInput formControlName="lockinPeriodFrequency" />
15+
<input type="number" matInput formControlName="lockinPeriodFrequency" mifosxPositiveInteger />
1616
</mat-form-field>
1717

1818
<mat-form-field class="flex-48">

src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { MatCheckbox } from '@angular/material/checkbox';
2222
import { MatStepperPrevious, MatStepperNext } from '@angular/material/stepper';
2323
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
2424
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
25+
import { PositiveIntegerDirective } from 'app/directives/positive-integer.directive';
2526

2627
/**
2728
* Fixed Deposits Account Settings Step
@@ -36,7 +37,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
3637
MatCheckbox,
3738
MatStepperPrevious,
3839
FaIconComponent,
39-
MatStepperNext
40+
MatStepperNext,
41+
PositiveIntegerDirective
4042
]
4143
})
4244
export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChanges {
@@ -53,7 +55,7 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
5355
/** Maximum date allowed. */
5456
maxDate = new Date();
5557
/** Fixed Deposits Account Settings Form */
56-
fixedDepositAccountSettingsForm: UntypedFormGroup;
58+
fixedDepositAccountSettingsForm!: UntypedFormGroup;
5759
/** Lockin Period Frequency Type Data */
5860
lockinPeriodFrequencyTypeData: any;
5961
/** Period Frequency Type Data */
@@ -63,7 +65,7 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
6365
/** Savings Accounts Data */
6466
savingsAccountsData: any;
6567

66-
maturityInstructionOptions: OptionData[];
68+
maturityInstructionOptions!: OptionData[];
6769

6870
/**
6971
* @param {FormBuilder} formBuilder Form Builder
@@ -98,14 +100,14 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
98100
});
99101
if (this.fixedDepositsAccountProductTemplate.withHoldTax) {
100102
this.fixedDepositAccountSettingsForm.addControl('withHoldTax', new UntypedFormControl(false));
101-
this.fixedDepositAccountSettingsForm.get('withHoldTax').valueChanges.subscribe((value: boolean) => {
103+
this.fixedDepositAccountSettingsForm.get('withHoldTax')!.valueChanges.subscribe((value: boolean) => {
102104
if (value) {
103105
this.fixedDepositAccountSettingsForm.addControl(
104106
'taxGroupId',
105107
new UntypedFormControl({ value: '', disabled: true })
106108
);
107109
this.fixedDepositAccountSettingsForm
108-
.get('taxGroupId')
110+
.get('taxGroupId')!
109111
.patchValue(
110112
this.fixedDepositsAccountProductTemplate.taxGroup &&
111113
this.fixedDepositsAccountProductTemplate.taxGroup.name
@@ -115,7 +117,7 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
115117
}
116118
});
117119
this.fixedDepositAccountSettingsForm
118-
.get('withHoldTax')
120+
.get('withHoldTax')!
119121
.patchValue(this.fixedDepositsAccountTemplate.withHoldTax);
120122
} else {
121123
this.fixedDepositAccountSettingsForm.removeControl('withHoldTax');
@@ -162,29 +164,29 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
162164
* Subscribes to value changes and sets new form controls accordingly.
163165
*/
164166
buildDependencies() {
165-
this.fixedDepositAccountSettingsForm.get('transferInterestToSavings').valueChanges.subscribe((value: boolean) => {
167+
this.fixedDepositAccountSettingsForm.get('transferInterestToSavings')!.valueChanges.subscribe((value: boolean) => {
166168
if (value) {
167169
this.fixedDepositAccountSettingsForm.addControl(
168170
'linkAccountId',
169171
new UntypedFormControl('', Validators.required)
170172
);
171173
this.fixedDepositAccountSettingsForm
172-
.get('linkAccountId')
174+
.get('linkAccountId')!
173175
.patchValue(
174176
this.fixedDepositsAccountTemplate.linkedAccount && this.fixedDepositsAccountTemplate.linkedAccount.id
175177
);
176178
} else {
177179
this.fixedDepositAccountSettingsForm.removeControl('linkAccountId');
178180
}
179181
});
180-
this.fixedDepositAccountSettingsForm.get('maturityInstructionId').valueChanges.subscribe((value: number) => {
182+
this.fixedDepositAccountSettingsForm.get('maturityInstructionId')!.valueChanges.subscribe((value: number) => {
181183
if (value > 100) {
182184
this.fixedDepositAccountSettingsForm.addControl(
183185
'transferToSavingsId',
184186
new UntypedFormControl('', Validators.required)
185187
);
186188
this.fixedDepositAccountSettingsForm
187-
.get('transferToSavingsId')
189+
.get('transferToSavingsId')!
188190
.patchValue(
189191
this.fixedDepositsAccountTemplate.transferToSavingsId &&
190192
this.fixedDepositsAccountTemplate.transferToSavingsId.id

src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<mat-form-field class="flex-48">
2525
<mat-label>{{ 'labels.inputs.Deposit Period' | translate }}</mat-label>
26-
<input type="number" matInput formControlName="depositPeriod" required />
26+
<input type="number" matInput formControlName="depositPeriod" mifosxPositiveInteger required />
2727
<mat-error>
2828
{{ 'labels.inputs.Deposit Period' | translate }} {{ 'labels.commons.is' | translate }}
2929
<strong>{{ 'labels.commons.required' | translate }}</strong>

src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { MatDivider } from '@angular/material/divider';
1616
import { MatStepperPrevious, MatStepperNext } from '@angular/material/stepper';
1717
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
1818
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
19+
import { PositiveIntegerDirective } from 'app/directives/positive-integer.directive';
1920

2021
/**
2122
* Fixed Deposits Terms Step
@@ -30,7 +31,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
3031
MatDivider,
3132
MatStepperPrevious,
3233
FaIconComponent,
33-
MatStepperNext
34+
MatStepperNext,
35+
PositiveIntegerDirective
3436
]
3537
})
3638
export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges {
@@ -47,7 +49,7 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
4749
/** Maximum date allowed. */
4850
maxDate = new Date();
4951
/** Fixed Deposits Account Terms Form */
50-
fixedDepositAccountTermsForm: UntypedFormGroup;
52+
fixedDepositAccountTermsForm!: UntypedFormGroup;
5153
/** Interest Compounding Period Type Data */
5254
interestCompoundingPeriodTypeData: any;
5355
/** Interest Posting Period Type Data */

0 commit comments

Comments
 (0)