Skip to content

feature/AB#32503 - Add AutoNumeric for currency input masking#2450

Draft
plavoie-BC wants to merge 4 commits into
devfrom
feature/AB#32503-currency-input-mask
Draft

feature/AB#32503 - Add AutoNumeric for currency input masking#2450
plavoie-BC wants to merge 4 commits into
devfrom
feature/AB#32503-currency-input-mask

Conversation

@plavoie-BC
Copy link
Copy Markdown
Contributor

@plavoie-BC plavoie-BC commented May 13, 2026

Pull request overview

This PR replaces jquery-maskmoney with AutoNumeric to handle currency input masking across the Unity GrantManager portal UI, centralizing initialization via a shared initCurrencyInputs helper and updating bundling/resource mapping to load AutoNumeric globally.

Changes:

  • Added autonumeric dependency and removed jquery-maskmoney; updated resource mapping and lockfile accordingly.
  • Updated multiple components/pages to use initCurrencyInputs(...) and AutoNumeric APIs instead of .maskMoney(...).
  • Added AutoNumeric to the UX2 global script bundle and introduced a shared initCurrencyInputs helper in zone-extensions.js.

@github-actions
Copy link
Copy Markdown

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 703
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces jquery-maskmoney with AutoNumeric to handle currency input masking across the Unity GrantManager portal UI, centralizing initialization via a shared initCurrencyInputs helper and updating bundling/resource mapping to load AutoNumeric globally.

Changes:

  • Added autonumeric dependency and removed jquery-maskmoney; updated resource mapping and lockfile accordingly.
  • Updated multiple components/pages to use initCurrencyInputs(...) and AutoNumeric APIs instead of .maskMoney(...).
  • Added AutoNumeric to the UX2 global script bundle and introduced a shared initCurrencyInputs helper in zone-extensions.js.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
applications/Unity.GrantManager/src/Unity.GrantManager.Web/yarn.lock Locks new autonumeric dependency and related resolution changes.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ProjectInfo/ProjectInfoViewComponent.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ProjectInfo/Default.js Switches currency field updates to AutoNumeric instance updates (with fallback).
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/PaymentConfiguration/PaymentConfigurationViewComponent.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/PaymentConfiguration/Default.js Uses AutoNumeric to read unmasked numeric values; initializes currency inputs via helper.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/FundingAgreementInfo/FundingAgreementInfoViewComponent.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/AssessmentResults/Default.js Replaces .maskMoney(...) usage with initCurrencyInputs(...) and AutoNumeric updates.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/AssessmentResults/Default.cshtml Updates inline initialization to call initCurrencyInputs(...).
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/AssessmentResults/AssessmentResults.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantOrganizationInfo/ApplicantOrganizationInfoViewComponent.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ActionBar/ActionBar.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/GrantApplications/Details.js Replaces custom currency masking init with shared initCurrencyInputs(...).
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/BulkApprovals/ApproveApplicationsModal.cshtml Replaces inline .maskMoney(...) with initCurrencyInputs(...).
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/ApplicantHistory/EditFundingHistoryModal.cshtml Replaces inline .maskMoney(...) with initCurrencyInputs(...).
applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/ApplicantHistory/CreateFundingHistoryModal.cshtml Replaces inline .maskMoney(...) with initCurrencyInputs(...).
applications/Unity.GrantManager/src/Unity.GrantManager.Web/package.json Adds autonumeric and removes jquery-maskmoney.
applications/Unity.GrantManager/src/Unity.GrantManager.Web/abp.resourcemapping.js Removes maskmoney mapping and adds AutoNumeric mapping.
applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/wwwroot/themes/ux2/zone-extensions.js Introduces shared AutoNumeric currency config + initCurrencyInputs; updates reset/init logic.
applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Bundling/UnityThemeUX2GlobalScriptContributor.cs Adds AutoNumeric to the global UX2 script bundle.
applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Views/Shared/Components/PaymentInfo/PaymentInfoViewComponent.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Views/Shared/Components/PaymentInfo/Default.js Initializes currency inputs via shared initCurrencyInputs(...).
applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Views/Shared/Components/PaymentInfo/Default.cshtml Updates inline initialization to call initCurrencyInputs(...).
applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/CreatePaymentRequests.cshtml Replaces inline .maskMoney(...) formatting with initCurrencyInputs(...).
applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentApprovals/UpdatePaymentRequestStatus.cshtml Replaces inline .maskMoney(...) init with initCurrencyInputs(...).
applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/WorksheetInstanceWidget/WorksheetInstanceWidget.cs Removes jquery-maskmoney script from bundle.
applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/WorksheetInstanceWidget/Default.js Replaces custom currency masking init with initCurrencyInputs(...).
applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/CurrencyWidget/Default.js Replaces custom currency masking init with initCurrencyInputs(...).
applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/Components/DataGrid/EditDataRowModal.cshtml Replaces inline .maskMoney(...) init with initCurrencyInputs(...).
Comments suppressed due to low confidence (1)

applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/wwwroot/themes/ux2/zone-extensions.js:404

  • initializeNumericFields() now only calls initCurrencyInputs(). However, .numeric-mask and .percentage-mask classes are still present in the UI (for example ApplicantInfo/Default.cshtml uses numeric-mask and ProjectInfo/Default.cshtml uses percentage-mask), so those inputs will no longer be initialized/masked at all after removing jquery-maskmoney. Consider adding AutoNumeric initialization for these non-currency numeric fields (or a separate initializer) to avoid a regression in formatting/validation behavior.
    initializeNumericFields() {
        initCurrencyInputs(this.form[0]);
    }

}

const currencyConfiguration = {
currencySymbol: AutoNumeric.options.currencySymbol.dollar,
Comment on lines 311 to +316
$el.val(this.originalValues[name]);

// Re-apply any special formatting (like currency masks)
if ($el.hasClass('unity-currency-input') ||
$el.hasClass('numeric-mask') ||
$el.hasClass('percentage-mask')) {
$el.maskMoney('mask', this.originalValues[name]);
$el.hasClass('custom-currency-input')) {
const anElement = AutoNumeric.getAutoNumericElement(element);
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 734
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants