Skip to content

Commit

Permalink
Use new return status tag macro in view
Browse files Browse the repository at this point in the history
  • Loading branch information
Cruikshanks committed Jun 16, 2024
1 parent 8077ea1 commit a0b34b5
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions app/views/licences/tabs/returns.njk
Original file line number Diff line number Diff line change
@@ -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 %}

<h2 class="govuk-heading-l">Returns</h2>

Expand All @@ -33,6 +17,10 @@
{% set returnRows = [] %}

{% for returnItem in returns %}
{% set returnStatusTag %}
{{ statusTag(returnItem.status, true) }}
{% endset %}

{% set returnRows = (returnRows.push([
{
html: referenceColumn(returnItem)
Expand All @@ -44,7 +32,7 @@
text: returnItem.dueDate
},
{
html: formatStatus(returnItem.status)
html: returnStatusTag
}
]), returnRows) %}
{% endfor %}
Expand All @@ -71,4 +59,3 @@
{% if pagination.numberOfPages > 1 %}
{{ govukPagination(pagination.component) }}
{% endif %}

0 comments on commit a0b34b5

Please sign in to comment.