Skip to content

Commit

Permalink
Merge pull request #1008 from bcgov/bugfix/AB#27741-checkbox-serializ…
Browse files Browse the repository at this point in the history
…ation

bugfix/AB#27741 - checkboxgroup render error
  • Loading branch information
samsaravillo authored Jan 21, 2025
2 parents 959d0fa + aefab4b commit b94d481
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@

// Update checkboxes which are serialized if unchecked
$(`#paymentInfoForm input:checkbox`).each(function () {
paymentInfoForm[this.name] = (this.checked).toString();
paymentInfoObj[this.name] = (this.checked).toString();
});

// Make sure all the custom fields are set in the custom fields object
if (typeof Flex === 'function') {
Flex?.setCustomFields(paymentInfoObj);
}

paymentInfoObj['correlationId'] = formVersionId;
paymentInfoObj['worksheetId'] = worksheetId;
updatePaymentInfo(applicationId, paymentInfoObj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ $(function () {
$('table[data-resize-aware="true"]:visible').each(function () {
const table = $(this).DataTable();
try {
table.columns.adjust().draw();
table.columns.adjust().draw();
}
catch {
console.error(`Adjust width failed for table ${$(this).id}:`, error);
Expand Down Expand Up @@ -746,6 +746,14 @@ const Flex = class {

formObject.CustomFields[input.name] = input.value;
}

static setCustomFields(customFieldsObj) {
for (const key in customFieldsObj) {
if (customFieldsObj.hasOwnProperty(key) && key.startsWith('custom_')) {
customFieldsObj.CustomFields[key] = customFieldsObj[key];
}
}
}
}

function uploadApplicationFiles(inputId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
let applicationId = document.getElementById('ApplicantInfoViewApplicationId').value;
let formData = $("#ApplicantInfoForm").serializeArray();
let ApplicantInfoObj = {};
let formVersionId = $("#ApplicationFormVersionId").val();
let formVersionId = $("#ApplicationFormVersionId").val();
let worksheetId = $("#ApplicantInfo_WorksheetId").val();

$.each(formData, function (_, input) {
if (typeof Flex === 'function' && Flex?.isCustomField(input)) {
$.each(formData, function (_, input) {
if (typeof Flex === 'function' && Flex?.isCustomField(input)) {
Flex.includeCustomFieldObj(ApplicantInfoObj, input);
}
else {
Expand All @@ -23,7 +23,7 @@
ApplicantInfoObj[input.name.split(".")[1]] = null;
}

if (input.name == 'ApplicantId' || input.name == 'SupplierNumber' || input.name == 'OriginalSupplierNumber') {
if (input.name == 'ApplicantId' || input.name == 'SupplierNumber' || input.name == 'OriginalSupplierNumber') {
ApplicantInfoObj[input.name] = input.value;
}
}
Expand All @@ -34,12 +34,15 @@
ApplicantInfoObj[this.name] = (this.checked).toString();
});

try {
// Make sure all the custom fields are set in the custom fields object
if (typeof Flex === 'function') {
Flex?.setCustomFields(ApplicantInfoObj);
}

if (ApplicantInfoObj["SupplierNumber"]+"" != "undefined"
&& ApplicantInfoObj["SupplierNumber"]+"" != ""
&& ApplicantInfoObj["SupplierNumber"]+"" != ApplicantInfoObj["OriginalSupplierNumber"]+"")
{
try {
if (ApplicantInfoObj["SupplierNumber"] + "" != "undefined"
&& ApplicantInfoObj["SupplierNumber"] + "" != ""
&& ApplicantInfoObj["SupplierNumber"] + "" != ApplicantInfoObj["OriginalSupplierNumber"] + "") {
$('.cas-spinner').show();
}

Expand All @@ -58,7 +61,7 @@
})
.then(function () {
$('.cas-spinner').hide();
}).catch(function(){
}).catch(function () {
$('.cas-spinner').hide();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
assessmentResultObj[this.name] = (this.checked).toString();
});


// Make sure all the custom fields are set in the custom fields object
if (typeof Flex === 'function') {
Flex?.setCustomFields(assessmentResultObj);
}

try {
assessmentResultObj['correlationId'] = formVersionId;
assessmentResultObj['worksheetId'] = worksheetId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
projectInfoObj[this.name] = (this.checked).toString();
});

// Make sure all the custom fields are set in the custom fields object
if (typeof Flex === 'function') {
Flex?.setCustomFields(projectInfoObj);
}

projectInfoObj['correlationId'] = formVersionId;
projectInfoObj['worksheetId'] = worksheetId;
updateProjectInfo(applicationId, projectInfoObj);
Expand Down

0 comments on commit b94d481

Please sign in to comment.