diff --git a/applications/Unity.AutoUI/cypress/pages/ApplicationsListPage.ts b/applications/Unity.AutoUI/cypress/pages/ApplicationsListPage.ts index 52c129791a..5dc10d1b41 100644 --- a/applications/Unity.AutoUI/cypress/pages/ApplicationsListPage.ts +++ b/applications/Unity.AutoUI/cypress/pages/ApplicationsListPage.ts @@ -338,7 +338,7 @@ export class ApplicationsListPage extends ApplicationsPage { const titles: string[] = Cypress.$($els) .toArray() .map((el: HTMLElement) => - (el.textContent || "").replace(/\s+/g, " ").trim(), + (el.textContent || "").replaceAll(/\s+/g, " ").trim(), ) .filter((t: string) => t.length > 0); return titles; diff --git a/applications/Unity.AutoUI/cypress/pages/ListPages.ts b/applications/Unity.AutoUI/cypress/pages/ListPages.ts index 5cdf7cdb2a..4694e43a88 100644 --- a/applications/Unity.AutoUI/cypress/pages/ListPages.ts +++ b/applications/Unity.AutoUI/cypress/pages/ListPages.ts @@ -543,8 +543,8 @@ export class ApplicationsPage extends ListPage { .find(`td:nth-child(${this.columns.requestedAmount + 1})`) .text() .trim(); - const amount = Number.parseFloat(amountText.replace(/[$,]/g, "")); - if (!isNaN(amount)) { + const amount = Number.parseFloat(amountText.replaceAll(/[$,]/g, "")); + if (!Number.isNaN(amount)) { total += amount; } }) diff --git a/applications/Unity.AutoUI/cypress/regression/ApprovalFlow.cy.ts b/applications/Unity.AutoUI/cypress/regression/ApprovalFlow.cy.ts index afe702025e..9e58c6ddeb 100644 --- a/applications/Unity.AutoUI/cypress/regression/ApprovalFlow.cy.ts +++ b/applications/Unity.AutoUI/cypress/regression/ApprovalFlow.cy.ts @@ -639,7 +639,7 @@ const APPLICATIONS_PATH = "GrantApplications"; // Skip gracefully if the supplier has no site data in this environment cy.get("body").then(($body) => { const rows = $body.find("#SiteInfoTable tbody tr"); - const firstRowText = rows.first().text().replace(/\s+/g, " ").trim(); + const firstRowText = rows.first().text().replaceAll(/\s+/g, " ").trim(); const hasTokenError = $body.text().includes("GetAuthTokenAsync") || $body.text().includes("Error retrieving Token"); diff --git a/applications/Unity.AutoUI/cypress/utilities/TestDataHelper.ts b/applications/Unity.AutoUI/cypress/utilities/TestDataHelper.ts index 25b02c39e2..cfa55d6aa8 100644 --- a/applications/Unity.AutoUI/cypress/utilities/TestDataHelper.ts +++ b/applications/Unity.AutoUI/cypress/utilities/TestDataHelper.ts @@ -81,7 +81,7 @@ export class TestDataHelper { * Parse currency string to number */ static parseCurrency(currencyString: string): number { - return Number.parseFloat(currencyString.replace(/[$,]/g, "")); + return Number.parseFloat(currencyString.replaceAll(/[$,]/g, "")); } /** diff --git a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/ScoresheetConfiguration/ScoresheetModal.cshtml b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/ScoresheetConfiguration/ScoresheetModal.cshtml index c2f3e98ce8..feea3f3f00 100644 --- a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/ScoresheetConfiguration/ScoresheetModal.cshtml +++ b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/ScoresheetConfiguration/ScoresheetModal.cshtml @@ -69,6 +69,6 @@ let src = $('#scoresheetTitle'); let dest = $('#scoresheetName'); let name = src.val().toLowerCase().trim() + '-v1'; - dest.val(name.replace(/\s+/g, "")); + dest.val(name.replaceAll(/\s+/g, "")); } \ No newline at end of file diff --git a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertSectionModal.cshtml b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertSectionModal.cshtml index d03969aa7f..b1f3eeb3d8 100644 --- a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertSectionModal.cshtml +++ b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertSectionModal.cshtml @@ -98,7 +98,7 @@ function onNumberInput(value) { let clamped = Number.parseInt(value, 10); - if (isNaN(clamped)) clamped = 0; + if (Number.isNaN(clamped)) clamped = 0; clamped = Math.min(100, Math.max(0, clamped)); document.getElementById('FieldWidth').value = clamped; document.getElementById('FieldColumns').value = widthToColumns(clamped); diff --git a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertWorksheetModal.cshtml b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertWorksheetModal.cshtml index dca05d5ee9..ce512dbe02 100644 --- a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertWorksheetModal.cshtml +++ b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/WorksheetConfiguration/UpsertWorksheetModal.cshtml @@ -49,7 +49,7 @@ let src = $('#worksheetTitle'); let dest = $('#worksheetName'); let name = src.val().toLowerCase().trim() + '-v1'; - dest.val(name.replace(/\s+/g, "")); + dest.val(name.replaceAll(/\s+/g, "")); } function deleteWorksheet() { diff --git a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/DataGridWidget/Default.js b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/DataGridWidget/Default.js index ba2d1bcb57..4435d2db64 100644 --- a/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/DataGridWidget/Default.js +++ b/applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/DataGridWidget/Default.js @@ -42,7 +42,7 @@ function calculateDatagridColumnSum(table, columnIndex) { let total = 0; table.column(columnIndex).data().each(function (value) { // Remove currency symbols and commas for numeric check - let cleanedValue = value.replace(/[^\d.-]/g, ''); + let cleanedValue = value.replaceAll(/[^\d.-]/g, ''); if (isDatagridCellNumeric(cleanedValue)) { total += Number.parseFloat(cleanedValue); } diff --git a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentApprovals/UpdatePaymentRequestStatusModal.js b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentApprovals/UpdatePaymentRequestStatusModal.js index 1c54e8d999..134986984c 100644 --- a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentApprovals/UpdatePaymentRequestStatusModal.js +++ b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentApprovals/UpdatePaymentRequestStatusModal.js @@ -48,7 +48,7 @@ function closePaymentModal() { } function checkMaxValue(applicationId, input, amountRemaining) { - let enteredValue = Number.parseFloat(input.value.replace(/,/g, "")); + let enteredValue = Number.parseFloat(input.value.replaceAll(',', "")); let remainingErrorId = "#column_" + applicationId + "_remaining_error"; if (amountRemaining < enteredValue) { $(remainingErrorId).css("display", "block"); @@ -113,7 +113,7 @@ function calculateUpdateTotalAmount() { let total = 0; $('.amount').each(function () { // Remove commas and $ symbols before parsing - let rawValue = $(this).val().replace(/[$,]/g, ''); + let rawValue = $(this).val().replaceAll(/[$,]/g, ''); let value = Number.parseFloat(rawValue) || 0; total += value; this.value = upatePaymentNumberFormatter.format(value); diff --git a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/CreatePaymentRequestsModal.js b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/CreatePaymentRequestsModal.js index e3a185a23c..6a11c45d51 100644 --- a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/CreatePaymentRequestsModal.js +++ b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/CreatePaymentRequestsModal.js @@ -57,7 +57,7 @@ function checkMaxValueRequest(applicationId, input, amountRemaining) { validateParentChildAmounts(applicationId); } else { // Use existing remaining amount validation - let enteredValue = Number.parseFloat(input.value.replace(/,/g, '')); + let enteredValue = Number.parseFloat(input.value.replaceAll(',', '')); let remainingErrorId = '#error_column_' + applicationId; if (amountRemaining < enteredValue) { $(remainingErrorId).css('display', 'block'); @@ -94,7 +94,7 @@ function validateAllPaymentAmounts() { ).val() ); let enteredValue = - Number.parseFloat(amountInput.val().replace(/,/g, '')) || 0; + Number.parseFloat(amountInput.val().replaceAll(',', '')) || 0; let remainingErrorId = `#error_column_${correlationId}`; if (enteredValue > remainingAmount) { @@ -127,7 +127,7 @@ function submitPayments() { function calculateTotalAmount() { let total = 0; $('.amount').each(function () { - let value = Number.parseFloat($(this).val().replace(/,/g, '')) || 0; + let value = Number.parseFloat($(this).val().replaceAll(',', '')) || 0; total += value; }); @@ -170,7 +170,7 @@ function formatCurrency(value) { const numericValue = typeof value === 'number' ? value - : Number.parseFloat(String(value ?? '').replace(/,/g, '')); + : Number.parseFloat(String(value ?? '').replaceAll(',', '')); return cadFormatter.format( Number.isFinite(numericValue) ? numericValue : 0 ); @@ -231,7 +231,7 @@ function validateParentChildAmounts(correlationId) { let amountInput = $( `input[name="ApplicationPaymentRequestForm[${itemIndex}].Amount"]` ); - let amount = Number.parseFloat(amountInput.val().replace(/,/g, '')) || 0; + let amount = Number.parseFloat(amountInput.val().replaceAll(',', '')) || 0; groupTotal += amount; } }); diff --git a/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js b/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js index 9df2bf0a7f..e38cc30cb5 100644 --- a/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js +++ b/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Reconciliation/Index.js @@ -38,8 +38,8 @@ $(function () { let filtered_submissions = submissions.filter(x => x.tenant.toLowerCase().includes($('#ReconciliationTenantFilter').val().toLowerCase()) && - (isNaN(dateTo.getTime()) || new Date(x.createdAt) <= dateTo) && - (isNaN(dateFrom.getTime()) || new Date(x.createdAt) >= dateFrom) && + (Number.isNaN(dateTo.getTime()) || new Date(x.createdAt) <= dateTo) && + (Number.isNaN(dateFrom.getTime()) || new Date(x.createdAt) >= dateFrom) && (x.category == $("#ReconciliationCategoryFilter").val() || $("#ReconciliationCategoryFilter").val() == "all") ); diff --git a/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js b/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js index 3b7b834ed4..105d8d3afe 100644 --- a/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js +++ b/applications/Unity.GrantManager/modules/Unity.TenantManagement/src/Unity.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js @@ -191,7 +191,7 @@ function _renderFeatureItem(feature) { let id = 'ft-' + feature.name.replaceAll('.', '-'); - let checked = feature.value === 'true' ? ' checked' : ''; + let checked = (feature.value || '').toLowerCase() === 'true' ? ' checked' : ''; return '