WEB-446: Optional transaction amount on re-age submission
This commit is contained in:
+8
-5
@@ -11,6 +11,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { ReAgePreviewDialogComponent } from './re-age-preview-dialog/re-age-preview-dialog.component';
|
||||
import { InputAmountComponent } from 'app/shared/input-amount/input-amount.component';
|
||||
import { LoanTransactionTemplate } from 'app/loans/models/loan-transaction-type.model';
|
||||
import { MatSlideToggle } from '@angular/material/slide-toggle';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loan-reaging',
|
||||
@@ -18,7 +19,8 @@ import { LoanTransactionTemplate } from 'app/loans/models/loan-transaction-type.
|
||||
styleUrls: ['./loan-reaging.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
InputAmountComponent
|
||||
InputAmountComponent,
|
||||
MatSlideToggle
|
||||
]
|
||||
})
|
||||
export class LoanReagingComponent implements OnInit {
|
||||
@@ -38,6 +40,7 @@ export class LoanReagingComponent implements OnInit {
|
||||
maxDate = new Date();
|
||||
|
||||
loanTransactionData: LoanTransactionTemplate | null = null;
|
||||
addTransactionAmount = false;
|
||||
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
@@ -84,7 +87,7 @@ export class LoanReagingComponent implements OnInit {
|
||||
this.reAgeInterestHandlingOptions[0]
|
||||
],
|
||||
transactionAmount: [
|
||||
this.loanTransactionData.amount,
|
||||
,
|
||||
[Validators.max(this.loanTransactionData.amount)]
|
||||
],
|
||||
note: '',
|
||||
@@ -143,10 +146,10 @@ export class LoanReagingComponent implements OnInit {
|
||||
}
|
||||
|
||||
submit(): void {
|
||||
if (this.reagingLoanForm.invalid) {
|
||||
return;
|
||||
}
|
||||
const data = this.prepareReagingData();
|
||||
if (data['transactionAmount'] === null) {
|
||||
delete data['transactionAmount'];
|
||||
}
|
||||
this.loanService.submitLoanActionButton(this.loanId, data, 'reAge').subscribe({
|
||||
next: (response: any) => {
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
|
||||
Reference in New Issue
Block a user