Skip to content

Commit 19359c4

Browse files
WEB-446: Validation of re-Age amount during submission with null value (#2876)
LGTM
1 parent 8869115 commit 19359c4

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@
7070
<input matInput formControlName="note" />
7171
</mat-form-field>
7272
<div class="flex-fill">
73-
<span
74-
class="expandcollapsebutton m-l-10 m-t-5 m-b-5 flex-75"
75-
(click)="addTransactionAmount = !addTransactionAmount"
76-
>
73+
<span class="expandcollapsebutton m-l-10 m-t-5 m-b-5 flex-75" (click)="displayTransactionAmount()">
7774
<mat-slide-toggle>
7875
<div>
7976
<span class="m-l-10">{{ 'labels.inputs.Transaction Amount' | translate }}</span>
@@ -87,7 +84,7 @@
8784
[isRequired]="false"
8885
[inputFormControl]="reagingLoanForm.controls.transactionAmount"
8986
[inputLabel]="'Transaction Amount'"
90-
[minVal]="0.01"
87+
[minVal]="loanTransactionData.amount"
9188
[maxVal]="loanTransactionData.amount"
9289
>
9390
</mifosx-input-amount>

src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ export class LoanReagingComponent implements OnInit {
8888
],
8989
transactionAmount: [
9090
,
91-
[Validators.max(this.loanTransactionData.amount)]
91+
[
92+
Validators.min(this.loanTransactionData.amount),
93+
Validators.max(this.loanTransactionData.amount)
94+
]
9295
],
9396
note: '',
9497
externalId: '',
@@ -145,6 +148,13 @@ export class LoanReagingComponent implements OnInit {
145148
});
146149
}
147150

151+
displayTransactionAmount(): void {
152+
this.addTransactionAmount = !this.addTransactionAmount;
153+
this.reagingLoanForm.patchValue({
154+
transactionAmount: null
155+
});
156+
}
157+
148158
submit(): void {
149159
const data = this.prepareReagingData();
150160
if (data['transactionAmount'] === null) {

0 commit comments

Comments
 (0)