From 85d28acb65203c4e901e6c24bccd8429f5c2e1f0 Mon Sep 17 00:00:00 2001 From: Jose Alberto Hernandez Date: Wed, 9 Jul 2025 15:10:07 -0500 Subject: [PATCH] WEB-252: Buy Down fee adjustment template pop up window - Adjustment button active / not active --- .../make-account-transfers.component.ts | 1 - .../make-repayment.component.ts | 2 -- .../transactions-tab.component.ts | 24 ++++++++++++------- .../view-transaction.component.ts | 1 - ...savings-active-client-members.component.ts | 1 - .../shared/form-dialog/form-group.service.ts | 17 ++++++++++--- .../formfield/formfield.component.html | 6 +++++ .../formfield/model/formfield-base.ts | 12 ++++++++++ .../audit-trails/audit-trail.datasource.ts | 2 -- 9 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/app/account-transfers/make-account-transfers/make-account-transfers.component.ts b/src/app/account-transfers/make-account-transfers/make-account-transfers.component.ts index e4329fc8c..d66a000c6 100644 --- a/src/app/account-transfers/make-account-transfers/make-account-transfers.component.ts +++ b/src/app/account-transfers/make-account-transfers/make-account-transfers.component.ts @@ -120,7 +120,6 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit { this.id = this.route.snapshot.queryParams['savingsId']; this.interbank = this.route.snapshot.queryParams['interbank'] === 'true'; this.balance = this.router.getCurrentNavigation().extras.state.balance; - console.log('is interbank?', this.interbank); break; default: this.accountTypeId = '0'; diff --git a/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts b/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts index b44e3c058..cef96422a 100644 --- a/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts @@ -71,8 +71,6 @@ export class MakeRepaymentComponent implements OnInit { */ ngOnInit() { this.command = this.dataObject.type.code.split('.')[1]; - console.log(this.command); - console.log(this.dataObject.type); this.maxDate = this.settingsService.businessDate; this.createRepaymentLoanForm(); this.setRepaymentLoanDetails(); diff --git a/src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts b/src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts index bf03a9706..aef50020a 100644 --- a/src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts +++ b/src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { ActivatedRoute, Router, RouterLink } from '@angular/router'; -import { UntypedFormControl, ReactiveFormsModule } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; +import { UntypedFormControl, Validators } from '@angular/forms'; import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { @@ -29,9 +29,9 @@ import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base'; import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { AlertService } from 'app/core/alert/alert.service'; import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base'; -import { NgIf, NgClass } from '@angular/common'; +import { NgClass } from '@angular/common'; import { MatCheckbox } from '@angular/material/checkbox'; -import { MatButton, MatIconButton } from '@angular/material/button'; +import { MatIconButton } from '@angular/material/button'; import { ExternalIdentifierComponent } from '../../../shared/external-identifier/external-identifier.component'; import { MatMenuTrigger, MatMenu, MatMenuItem } from '@angular/material/menu'; import { MatIcon } from '@angular/material/icon'; @@ -472,8 +472,11 @@ export class TransactionsTabComponent implements OnInit { value: transactionAmount, type: 'number', required: true, - max: transactionAmount, min: 0.001, + max: transactionAmount, + validators: [ + Validators.min(0.001), + Validators.max(transactionAmount)], order: 2 }) @@ -481,7 +484,8 @@ export class TransactionsTabComponent implements OnInit { const data = { title: `Adjustment ${transaction.type.value} Transaction`, layout: { addButtonText: 'Adjustment' }, - formfields: formfields + formfields: formfields, + pristine: false }; const chargebackDialogRef = this.dialog.open(FormDialogComponent, { data }); chargebackDialogRef.afterClosed().subscribe((response: { data: any }) => { @@ -544,8 +548,11 @@ export class TransactionsTabComponent implements OnInit { value: transactionAmount, type: 'number', required: true, - max: transactionAmount, min: 0.001, + max: transactionAmount, + validators: [ + Validators.min(0.001), + Validators.max(transactionAmount)], order: 2 }) @@ -553,7 +560,8 @@ export class TransactionsTabComponent implements OnInit { const data = { title: `Adjustment ${transaction.type.value} Transaction`, layout: { addButtonText: 'Adjustment' }, - formfields: formfields + formfields: formfields, + pristine: false }; const chargebackDialogRef = this.dialog.open(FormDialogComponent, { data }); chargebackDialogRef.afterClosed().subscribe((response: { data: any }) => { diff --git a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts index 869ebac2a..7065d5f61 100644 --- a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts +++ b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts @@ -204,7 +204,6 @@ export class ViewTransactionComponent implements OnInit { * Undo the loans transaction */ undoTransaction() { - console.log(this.transactionData); const accountId = this.route.snapshot.params['loanId']; if (this.transactionType.contractTermination) { diff --git a/src/app/savings/savings-account-stepper/savings-active-client-members/savings-active-client-members.component.ts b/src/app/savings/savings-account-stepper/savings-active-client-members/savings-active-client-members.component.ts index f254a90b8..88e3f2bf4 100644 --- a/src/app/savings/savings-account-stepper/savings-active-client-members/savings-active-client-members.component.ts +++ b/src/app/savings/savings-account-stepper/savings-active-client-members/savings-active-client-members.component.ts @@ -54,7 +54,6 @@ export class SavingsActiveClientMembersComponent implements OnInit { dataSource: any; ngOnInit(): void { - console.log('Active Client Members in LoansActiveClientMembersComponent:', this.activeClientMembers); this.dataSource = new MatTableDataSource(this.activeClientMembers); } get selectedClientMembers() { diff --git a/src/app/shared/form-dialog/form-group.service.ts b/src/app/shared/form-dialog/form-group.service.ts index a281a2e2d..71f9e4cef 100644 --- a/src/app/shared/form-dialog/form-group.service.ts +++ b/src/app/shared/form-dialog/form-group.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms'; +import { UntypedFormControl, UntypedFormGroup, ValidatorFn, Validators } from '@angular/forms'; import { FormfieldBase } from './formfield/model/formfield-base'; @@ -14,10 +14,21 @@ export class FormGroupService { formfields.forEach((formfield) => { group[formfield.controlName] = formfield.required - ? new UntypedFormControl(formfield.value, Validators.required) - : new UntypedFormControl(formfield.value); + ? new UntypedFormControl(formfield.value, this.buildValidators(formfield)) + : new UntypedFormControl(formfield.value, this.buildValidators(formfield)); }); return new UntypedFormGroup(group); } + + buildValidators(formfield: FormfieldBase): ValidatorFn[] { + let validators: ValidatorFn[] = []; + if (formfield.required) { + validators.push(Validators.required); + } + if (formfield.validators) { + formfield.validators.forEach((validator: ValidatorFn) => validators.push(validator)); + } + return validators; + } } diff --git a/src/app/shared/form-dialog/formfield/formfield.component.html b/src/app/shared/form-dialog/formfield/formfield.component.html index d6aeac0b6..360bea335 100644 --- a/src/app/shared/form-dialog/formfield/formfield.component.html +++ b/src/app/shared/form-dialog/formfield/formfield.component.html @@ -10,6 +10,12 @@ [formControlName]="formfield.controlName" [required]="formfield.required" /> + + {{ 'labels.commons.Maximum Value must be' | translate }} {{ formfield.max }} + + + {{ 'labels.commons.Minimum Value must be' | translate }} {{ formfield.min }} + { pageIndex: number = 0, limit: number = 10 ) { - console.log(pageIndex); - console.log(limit); this.auditTrailsSubject.next([]); this.systemService .getAuditTrails(filterBy, orderBy, sortOrder, pageIndex * limit, limit)