From f91b744d43a59056b0e72c60173f6f8d4ea94064 Mon Sep 17 00:00:00 2001 From: JamesPasta Date: Fri, 29 May 2026 10:18:04 -0700 Subject: [PATCH] bugfix/AB#33258-Refactor Payment Requests table rendering and update applicant ID handling --- .../Pages/PaymentRequests/Index.js | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js index b09e87e7a3..f2deb13b7c 100644 --- a/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js +++ b/applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentRequests/Index.js @@ -141,8 +141,7 @@ $(function () { } } } - }, - + } ]; let responseCallback = function (result) { @@ -390,11 +389,11 @@ $(function () { const safeApplicantName = $.fn.dataTable.render.text().display(applicantName); if (type === 'display' && abp.auth.isGranted('GrantApplicationManagement.Applicants.ViewList')) { - const applicantId = row?.correlationId; + const applicantId = row?.id; const isGuid = applicantId && guidPattern.test(applicantId); - if (row?.correlationProvider === 'Application' && isGuid) { - return `${safeApplicantName}`; + if (isGuid) { + return `${safeApplicantName}`; } return safeApplicantName; @@ -413,11 +412,26 @@ $(function () { className: 'data-table-header text-nowrap', index: columnIndex, render: function (data, type, row) { - if (row.correlationProvider === 'Application' && data?.length > 0) { - return `${data}`; + let code = (typeof data !== 'string' || data.trim() === '') ? '' : data; + + if (type === 'sort' || type === 'filter') { + return code; } - return data || null; + const safeCode = $.fn.dataTable.render.text().display(code); + + if (type === 'display' && abp.auth.isGranted('GrantApplicationManagement.Applicants.ViewList')) { + const applicantId = row?.id; + const isGuid = applicantId && guidPattern.test(applicantId); + + if (isGuid) { + return `${safeCode}`; + } + + return safeCode; + } + + return code || null; } }; } @@ -518,9 +532,21 @@ $(function () { data: 'status', className: 'data-table-header', index: columnIndex, - render: function (data) { - let statusColor = getStatusTextColor(data); - return `` + l(`Enum:PaymentRequestStatus.${data}`) + ''; + render: function (data, type, row) { + const statusText = data ? l(`Enum:PaymentRequestStatus.${data}`) : ''; + + if (type === 'sort' || type === 'filter') { + return statusText; + } + + const safeStatus = $.fn.dataTable.render.text().display(statusText); + + if (type === 'display') { + let statusColor = getStatusTextColor(data); + return `` + safeStatus + ''; + } + + return statusText; } }; } @@ -576,7 +602,7 @@ $(function () { title: l('ApplicationPaymentListTable:CASResponse'), name: 'CASResponse', data: 'casResponse', - className: 'data-table-header', + className: 'data-table-header notexport', index: columnIndex, render: function (data) { if (data + "" !== "undefined" && data?.length > 0) {