From 66acb88a1de2ae5d23614686ba7a2840370656b0 Mon Sep 17 00:00:00 2001 From: Sasha Dresden Date: Mon, 29 Jul 2024 17:09:13 -0400 Subject: [PATCH 1/2] Make form submission blur focused element to allow validation. Make autocomplete inputs update on change. Fix currency number input validation issue. --- .../cypress/e2e/pages/f3xCashOnHandPage.ts | 2 +- .../feedback-overlay.component.ts | 2 + .../debug-login/debug-login.component.html | 19 +- .../debug-login/debug-login.component.ts | 2 + .../security-notice.component.ts | 2 + .../f1m/main-form/main-form.component.ts | 3 +- .../cash-on-hand.component.html | 7 +- .../create-workflow/cash-on-hand.component.ts | 2 + .../create-f3x-step1.component.ts | 6 +- .../shared/main-form-base.component.ts | 7 +- .../submit-report-step1.component.ts | 6 +- .../submit-report-step2.component.ts | 2 + .../contact-dialog.component.ts | 3 +- .../contact-lookup.component.spec.ts | 20 +- .../contact-lookup.component.ts | 15 +- .../amount-input/amount-input.component.html | 24 +- .../amount-input.component.spec.ts | 6 +- .../debt-input/debt-input.component.html | 29 +- .../election-input.component.html | 13 +- .../input-number/input-number.component.html | 46 + .../input-number/input-number.component.scss | 0 .../input-number.component.spec.ts | 563 ++++++++++ .../input-number/input-number.component.ts | 959 ++++++++++++++++++ .../loan-agreement-input.component.html | 38 +- .../loan-info-input.component.html | 21 +- .../double-transaction-type-base.component.ts | 2 + .../transaction-type-base.component.ts | 4 +- .../triple-transaction-type-base.component.ts | 2 + front-end/src/app/shared/shared.module.ts | 7 +- .../src/app/shared/utils/form.utils.spec.ts | 36 + front-end/src/app/shared/utils/form.utils.ts | 9 + .../src/app/shared/utils/schema.utils.ts | 19 +- .../update-current-user.component.ts | 2 + 33 files changed, 1738 insertions(+), 140 deletions(-) create mode 100644 front-end/src/app/shared/components/inputs/input-number/input-number.component.html create mode 100644 front-end/src/app/shared/components/inputs/input-number/input-number.component.scss create mode 100644 front-end/src/app/shared/components/inputs/input-number/input-number.component.spec.ts create mode 100644 front-end/src/app/shared/components/inputs/input-number/input-number.component.ts create mode 100644 front-end/src/app/shared/utils/form.utils.spec.ts create mode 100644 front-end/src/app/shared/utils/form.utils.ts diff --git a/front-end/cypress/e2e/pages/f3xCashOnHandPage.ts b/front-end/cypress/e2e/pages/f3xCashOnHandPage.ts index abb6fb39fb..bcebe3e850 100644 --- a/front-end/cypress/e2e/pages/f3xCashOnHandPage.ts +++ b/front-end/cypress/e2e/pages/f3xCashOnHandPage.ts @@ -12,7 +12,7 @@ export const defaultFormData: F3xCashOnHandFormData = { export class F3xCashOnHandPage { static enterFormData(formData: F3xCashOnHandFormData) { - cy.get('p-inputnumber[formcontrolname="L6a_cash_on_hand_jan_1_ytd"]').safeType(formData['cashOnHand']); + cy.get('app-input-number[formcontrolname="L6a_cash_on_hand_jan_1_ytd"]').safeType(formData['cashOnHand']); PageUtils.calendarSetValue('p-calendar[formcontrolname="cash_on_hand_date"]', formData['date']); } } diff --git a/front-end/src/app/layout/feedback-overlay/feedback-overlay.component.ts b/front-end/src/app/layout/feedback-overlay/feedback-overlay.component.ts index 73c7d4316b..c5206e6ca1 100644 --- a/front-end/src/app/layout/feedback-overlay/feedback-overlay.component.ts +++ b/front-end/src/app/layout/feedback-overlay/feedback-overlay.component.ts @@ -3,6 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Store } from '@ngrx/store'; import { Feedback } from 'app/shared/models/feedback.model'; import { FeedbackService } from 'app/shared/services/feedback.service'; +import { blurActiveInput } from 'app/shared/utils/form.utils'; import { singleClickEnableAction } from 'app/store/single-click.actions'; import { OverlayPanel } from 'primeng/overlaypanel'; @@ -50,6 +51,7 @@ export class FeedbackOverlayComponent { save() { this.formSubmitted = true; + blurActiveInput(this.form); if (this.form.invalid) { this.store.dispatch(singleClickEnableAction()); return; diff --git a/front-end/src/app/login/debug-login/debug-login.component.html b/front-end/src/app/login/debug-login/debug-login.component.html index 8af9cd8b7a..6219342738 100644 --- a/front-end/src/app/login/debug-login/debug-login.component.html +++ b/front-end/src/app/login/debug-login/debug-login.component.html @@ -5,26 +5,12 @@

Debug Login Form