From a0b34b5c5afa38720ef92e5ea12598307567d53e Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Sun, 16 Jun 2024 12:16:58 +0100 Subject: [PATCH] Use new return status tag macro in view --- app/views/licences/tabs/returns.njk | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/app/views/licences/tabs/returns.njk b/app/views/licences/tabs/returns.njk index db2861f6a5..fb8873657c 100644 --- a/app/views/licences/tabs/returns.njk +++ b/app/views/licences/tabs/returns.njk @@ -1,23 +1,7 @@ {% from "govuk/components/pagination/macro.njk" import govukPagination %} {% from "govuk/components/table/macro.njk" import govukTable %} -{% from "govuk/components/tag/macro.njk" import govukTag %} -{% macro formatStatus(status) %} - {% if status === 'COMPLETE' %} - {{ govukTag({ - text: status, - classes: "govuk-tag--green" - }) }} - - {% elseif status === 'OVERDUE' %} - {{ govukTag({ - text: status, - classes: "govuk-tag--red" - }) }} - {% else %} - {{ status }} - {% endif %} -{% endmacro %} +{% from "macros/return-status-tag.njk" import statusTag %}

Returns

@@ -33,6 +17,10 @@ {% set returnRows = [] %} {% for returnItem in returns %} + {% set returnStatusTag %} + {{ statusTag(returnItem.status, true) }} + {% endset %} + {% set returnRows = (returnRows.push([ { html: referenceColumn(returnItem) @@ -44,7 +32,7 @@ text: returnItem.dueDate }, { - html: formatStatus(returnItem.status) + html: returnStatusTag } ]), returnRows) %} {% endfor %} @@ -71,4 +59,3 @@ {% if pagination.numberOfPages > 1 %} {{ govukPagination(pagination.component) }} {% endif %} -