Skip to content

Commit 85d28ac

Browse files
author
Jose Alberto Hernandez
committed
WEB-252: Buy Down fee adjustment template pop up window - Adjustment button active / not active
1 parent b9d8bd2 commit 85d28ac

File tree

9 files changed

+48
-18
lines changed

9 files changed

+48
-18
lines changed

src/app/account-transfers/make-account-transfers/make-account-transfers.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
120120
this.id = this.route.snapshot.queryParams['savingsId'];
121121
this.interbank = this.route.snapshot.queryParams['interbank'] === 'true';
122122
this.balance = this.router.getCurrentNavigation().extras.state.balance;
123-
console.log('is interbank?', this.interbank);
124123
break;
125124
default:
126125
this.accountTypeId = '0';

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ export class MakeRepaymentComponent implements OnInit {
7171
*/
7272
ngOnInit() {
7373
this.command = this.dataObject.type.code.split('.')[1];
74-
console.log(this.command);
75-
console.log(this.dataObject.type);
7674
this.maxDate = this.settingsService.businessDate;
7775
this.createRepaymentLoanForm();
7876
this.setRepaymentLoanDetails();

src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, OnInit, ViewChild } from '@angular/core';
2-
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
3-
import { UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
2+
import { ActivatedRoute, Router } from '@angular/router';
3+
import { UntypedFormControl, Validators } from '@angular/forms';
44
import { MatPaginator } from '@angular/material/paginator';
55
import { MatSort } from '@angular/material/sort';
66
import {
@@ -29,9 +29,9 @@ import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
2929
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
3030
import { AlertService } from 'app/core/alert/alert.service';
3131
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
32-
import { NgIf, NgClass } from '@angular/common';
32+
import { NgClass } from '@angular/common';
3333
import { MatCheckbox } from '@angular/material/checkbox';
34-
import { MatButton, MatIconButton } from '@angular/material/button';
34+
import { MatIconButton } from '@angular/material/button';
3535
import { ExternalIdentifierComponent } from '../../../shared/external-identifier/external-identifier.component';
3636
import { MatMenuTrigger, MatMenu, MatMenuItem } from '@angular/material/menu';
3737
import { MatIcon } from '@angular/material/icon';
@@ -472,16 +472,20 @@ export class TransactionsTabComponent implements OnInit {
472472
value: transactionAmount,
473473
type: 'number',
474474
required: true,
475-
max: transactionAmount,
476475
min: 0.001,
476+
max: transactionAmount,
477+
validators: [
478+
Validators.min(0.001),
479+
Validators.max(transactionAmount)],
477480
order: 2
478481
})
479482

480483
];
481484
const data = {
482485
title: `Adjustment ${transaction.type.value} Transaction`,
483486
layout: { addButtonText: 'Adjustment' },
484-
formfields: formfields
487+
formfields: formfields,
488+
pristine: false
485489
};
486490
const chargebackDialogRef = this.dialog.open(FormDialogComponent, { data });
487491
chargebackDialogRef.afterClosed().subscribe((response: { data: any }) => {
@@ -544,16 +548,20 @@ export class TransactionsTabComponent implements OnInit {
544548
value: transactionAmount,
545549
type: 'number',
546550
required: true,
547-
max: transactionAmount,
548551
min: 0.001,
552+
max: transactionAmount,
553+
validators: [
554+
Validators.min(0.001),
555+
Validators.max(transactionAmount)],
549556
order: 2
550557
})
551558

552559
];
553560
const data = {
554561
title: `Adjustment ${transaction.type.value} Transaction`,
555562
layout: { addButtonText: 'Adjustment' },
556-
formfields: formfields
563+
formfields: formfields,
564+
pristine: false
557565
};
558566
const chargebackDialogRef = this.dialog.open(FormDialogComponent, { data });
559567
chargebackDialogRef.afterClosed().subscribe((response: { data: any }) => {

src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ export class ViewTransactionComponent implements OnInit {
204204
* Undo the loans transaction
205205
*/
206206
undoTransaction() {
207-
console.log(this.transactionData);
208207
const accountId = this.route.snapshot.params['loanId'];
209208

210209
if (this.transactionType.contractTermination) {

src/app/savings/savings-account-stepper/savings-active-client-members/savings-active-client-members.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export class SavingsActiveClientMembersComponent implements OnInit {
5454

5555
dataSource: any;
5656
ngOnInit(): void {
57-
console.log('Active Client Members in LoansActiveClientMembersComponent:', this.activeClientMembers);
5857
this.dataSource = new MatTableDataSource<any>(this.activeClientMembers);
5958
}
6059
get selectedClientMembers() {

src/app/shared/form-dialog/form-group.service.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
2+
import { UntypedFormControl, UntypedFormGroup, ValidatorFn, Validators } from '@angular/forms';
33

44
import { FormfieldBase } from './formfield/model/formfield-base';
55

@@ -14,10 +14,21 @@ export class FormGroupService {
1414

1515
formfields.forEach((formfield) => {
1616
group[formfield.controlName] = formfield.required
17-
? new UntypedFormControl(formfield.value, Validators.required)
18-
: new UntypedFormControl(formfield.value);
17+
? new UntypedFormControl(formfield.value, this.buildValidators(formfield))
18+
: new UntypedFormControl(formfield.value, this.buildValidators(formfield));
1919
});
2020

2121
return new UntypedFormGroup(group);
2222
}
23+
24+
buildValidators(formfield: FormfieldBase): ValidatorFn[] {
25+
let validators: ValidatorFn[] = [];
26+
if (formfield.required) {
27+
validators.push(Validators.required);
28+
}
29+
if (formfield.validators) {
30+
formfield.validators.forEach((validator: ValidatorFn) => validators.push(validator));
31+
}
32+
return validators;
33+
}
2334
}

src/app/shared/form-dialog/formfield/formfield.component.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
[formControlName]="formfield.controlName"
1111
[required]="formfield.required"
1212
/>
13+
<mat-error *ngIf="form.controls[formfield.controlName].hasError('max')">
14+
<strong>{{ 'labels.commons.Maximum Value must be' | translate }} {{ formfield.max }}</strong>
15+
</mat-error>
16+
<mat-error *ngIf="form.controls[formfield.controlName].hasError('min')">
17+
<strong>{{ 'labels.commons.Minimum Value must be' | translate }} {{ formfield.min }}</strong>
18+
</mat-error>
1319

1420
<mat-select
1521
*ngIf="formfield.controlType === 'select'"

src/app/shared/form-dialog/formfield/model/formfield-base.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import { ValidatorFn } from '@angular/forms';
2+
13
export class FormfieldBase {
24
controlType: string;
35
controlName: string;
6+
type: string;
47
label: string;
58
value: any;
69
required: boolean;
710
order: number;
11+
validators?: ValidatorFn[];
12+
min?: number | null;
13+
max?: number | null;
814

915
constructor(
1016
options: {
@@ -14,6 +20,9 @@ export class FormfieldBase {
1420
value?: any;
1521
required?: boolean;
1622
order?: number;
23+
validators?: ValidatorFn[];
24+
min?: number | null;
25+
max?: number | null;
1726
} = {}
1827
) {
1928
this.controlType = options.controlType || '';
@@ -22,5 +31,8 @@ export class FormfieldBase {
2231
this.value = options.value === undefined ? '' : options.value;
2332
this.required = !!options.required;
2433
this.order = options.order === undefined ? 1 : options.order;
34+
this.validators = options.validators === undefined ? [] : options.validators;
35+
this.min = options.min === undefined ? null : options.min;
36+
this.max = options.max === undefined ? null : options.max;
2537
}
2638
}

src/app/system/audit-trails/audit-trail.datasource.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ export class AuditTrailsDataSource implements DataSource<any> {
3939
pageIndex: number = 0,
4040
limit: number = 10
4141
) {
42-
console.log(pageIndex);
43-
console.log(limit);
4442
this.auditTrailsSubject.next([]);
4543
this.systemService
4644
.getAuditTrails(filterBy, orderBy, sortOrder, pageIndex * limit, limit)

0 commit comments

Comments
 (0)