From 015ea1b0c0df88a0040c06da0f3db47c946bbfd0 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:16:24 +0200 Subject: [PATCH] UI fixes for application list --- .../views/partials/js-applications.twig | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/cp/resources/views/partials/js-applications.twig b/cp/resources/views/partials/js-applications.twig index 188a1b9..5447608 100644 --- a/cp/resources/views/partials/js-applications.twig +++ b/cp/resources/views/partials/js-applications.twig @@ -17,6 +17,8 @@ var actionButtons = ''; // Common action button for all statuses + actionButtons += ` `; + actionButtons += ` `; actionButtons += ` `; actionButtons += ``; @@ -36,6 +38,21 @@ return createBadge(statusArray, 'info'); } + function statusFormatter(cell) { + var statusArray = cell.getValue(); + var rowData = cell.getRow().getData(); // Get the entire row data + + // Function to create a badge + function createBadge(text, badgeClass) { + return `${text}`; + } + + // Check if statusArray is empty or not + if (statusArray && Array.isArray(statusArray) && statusArray.length > 0) { + return statusArray.map(item => createBadge(item.status, 'lime')).join(' '); + } + } + var searchTerm = ""; // global variable to hold the search term function updateSearchTerm(term) { @@ -49,10 +66,11 @@ paginationSize: 10, ajaxURL: "/api/records/application", ajaxParams: { - join: "contact" + join: "contact", + join: "application_status" }, ajaxURLGenerator: function(url, config, params) { - var queryParts = ["join=contact"]; + var queryParts = ["join=contact", "join=application_status"]; // Handle search term if (searchTerm) { @@ -90,10 +108,11 @@ resizableColumns:false, columns:[ {formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0}, - {title:"Name", field:"name", width:200, headerSort:false, formatter: domainLinkFormatter, responsive:0}, - {title:"Applicant", width:200, field:"registrant.identifier", headerSort:false, responsive:2}, + {title:"Name", field:"name", width:250, headerSort:false, formatter: domainLinkFormatter, responsive:0}, + {title:"Applicant", width:150, field:"registrant.identifier", headerSort:false, responsive:2}, {title:"Creation Date", width:250, minWidth:150, field:"crdate", headerSort:false, responsive:2}, - {title:"Phase", width:250, minWidth:150, field:"phase_type", formatter: phaseFormatter, headerSort:false, responsive:2}, + {title:"Phase", width:150, minWidth:100, field:"phase_type", formatter: phaseFormatter, headerSort:false, responsive:2}, + {title:"Status", width:200, field:"application_status", formatter: statusFormatter, headerSort:false, download:false, responsive:2}, {title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }}, ], placeholder:function(){