Skip to content

Commit 2653c93

Browse files
authored
Merge pull request #1916 from bcgov/dev
Dev
2 parents d756414 + 7d4588e commit 2653c93

97 files changed

Lines changed: 17562 additions & 2744 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

applications/Unity.AutoUI/package-lock.json

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<!-- Suppress NU1701 warnings for Microsoft.Extensions.Compliance.Abstractions -->
5+
<!-- This package works correctly with .NET 9.0 despite targeting older frameworks -->
6+
<!-- Suppress MSB3277 warnings for EntityFrameworkCore.Relational version conflicts -->
7+
<!-- These conflicts don't cause runtime issues in this solution -->
8+
<NoWarn>$(NoWarn);NU1701;MSB3277</NoWarn>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<!-- Explicitly reference compatible version to avoid transitive dependency warnings -->
13+
<PackageReference Include="Microsoft.Extensions.Compliance.Abstractions" Version="9.5.0" />
14+
15+
</ItemGroup>
16+
17+
</Project>

applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/DataGridWidget/Default.js

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -105,37 +105,36 @@ $(function () {
105105
handleEditDatagridRowModalResult(response);
106106
});
107107

108+
// Function to calculate sum for a specific column
109+
function calculateColumnSum(table, columnIndex) {
110+
let total = 0;
111+
table.column(columnIndex).data().each(function (value) {
112+
// Remove currency symbols and commas for numeric check
113+
let cleanedValue = value.replace(/[^\d.-]/g, '');
114+
if (isNumeric(cleanedValue)) {
115+
total += parseFloat(cleanedValue);
116+
}
117+
});
118+
return total;
119+
}
120+
108121
// Function to update totals
109122
function updateTotals(table, fieldId) {
110123
// Iterate through each input field that has the id pattern 'total-{key}'
111124
$('#summary-' + fieldId + ' input[id^="total-"]').each(function () {
112125
let inputId = $(this).attr('id');
113126
let key = inputId.replace('total-', '');
114-
let total = 0;
115-
let headerFound = false;
116-
127+
117128
// Find the corresponding column in the DataTable by matching the key
118-
table.columns().header().each(function (header, index) {
119-
if ($(header).text() === key) {
120-
headerFound = true;
121-
// Sum up all numeric values in the column
122-
table.column(index).data().each(function (value, rowIndex) {
123-
// Remove currency symbols and commas for numeric check
124-
let cleanedValue = value.replace(/[^\d.-]/g, '');
125-
126-
if (isNumeric(cleanedValue)) {
127-
total += parseFloat(cleanedValue);
128-
}
129-
});
130-
}
131-
});
132-
133-
// Update the input field with the calculated total only if the header is found
134-
if (headerFound) {
129+
let columnIndex = getColumnIndex(table, key);
130+
131+
if (columnIndex !== -1) {
132+
let total = calculateColumnSum(table, columnIndex);
133+
134+
// Update the input field with the calculated total
135135
if ($(this).data('field-type') === 'Currency') {
136136
$(this).val(formatCurrency(total));
137-
}
138-
else {
137+
} else {
139138
$(this).val(total);
140139
}
141140
}
@@ -278,23 +277,33 @@ $(function () {
278277
return availableOptions;
279278
}
280279

280+
// Function to configure action buttons for a table cell
281+
function configureActionButtonForCell(cell) {
282+
cell.innerHTML = getEditRowButtonTemplate(); // Add edit button to each cell
283+
284+
// Attach click event handler to the newly added button
285+
$(cell).find('.row-edit-btn').on('click', function () {
286+
let button = this; // `this` refers to the button element
287+
editDataRow(button);
288+
});
289+
}
290+
291+
// Function to setup the actions column
292+
function setupActionsColumn(table, columnIndex) {
293+
table.column(columnIndex).header().innerHTML = 'Actions'; // Update column header if needed
294+
table.column(columnIndex).nodes().each(function (cell) {
295+
configureActionButtonForCell(cell);
296+
});
297+
}
298+
281299
function configureTable(table, fieldId) {
282300
// Move buttons to custom container
283301
table.buttons().container().prependTo(`#btn-container-${fieldId}`);
284302

285303
// Add edit buttons to the last column (Actions)
286304
table.columns().every(function (index) {
287305
if (index === table.columns().count() - 1) { // Check if it is the last column
288-
table.column(index).header().innerHTML = 'Actions'; // Update column header if needed
289-
table.column(index).nodes().each(function (cell) {
290-
cell.innerHTML = getEditRowButtonTemplate(); // Add edit button to each cell
291-
292-
// Attach click event handler to the newly added button
293-
$(cell).find('.row-edit-btn').on('click', function () {
294-
let button = this; // `this` refers to the button element
295-
editDataRow(button);
296-
});
297-
});
306+
setupActionsColumn(table, index);
298307
}
299308
});
300309
}

0 commit comments

Comments
 (0)