Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix review licence page #902

Merged
merged 11 commits into from
Apr 16, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function go (billRun, licence) {
status: licence[0].status,
licenceHolder: licence[0].licenceHolder
},
elementsInReview: _elementsInReview(licence[0]),
matchedReturns: _matchedReturns(licence[0].reviewReturns),
unmatchedReturns: _unmatchedReturns(licence[0].reviewReturns),
chargeData: _prepareChargeData(licence, billRun)
Expand Down Expand Up @@ -127,6 +128,18 @@ function _contactName (billingAccount) {
return null
}

function _elementsInReview (licence) {
const hasReviewStatus = licence.reviewChargeVersions.some((chargeVersion) => {
Beckyrose200 marked this conversation as resolved.
Show resolved Hide resolved
return chargeVersion.reviewChargeReferences.some((chargeReference) => {
return chargeReference.reviewChargeElements.some((chargeElement) => {
return chargeElement.status === 'review'
})
})
})

return hasReviewStatus
}

function _financialYear (financialYearEnding) {
const startYear = financialYearEnding - 1
const endYear = financialYearEnding
Expand Down
8 changes: 8 additions & 0 deletions app/views/bill-runs/review-licence.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% from "govuk/components/summary-list/macro.njk" import govukSummaryList %}
{% from "govuk/components/details/macro.njk" import govukDetails %}
{% from "macros/review-status-tag.njk" import statusTag %}
{% from "govuk/components/inset-text/macro.njk" import govukInsetText %}

{% block breadcrumbs %}
{# Back link #}
Expand Down Expand Up @@ -41,6 +42,13 @@
</a></li>
</ul>

{# ------------- Licence in review text --------------- #}
Beckyrose200 marked this conversation as resolved.
Show resolved Hide resolved
{% if elementsInReview === true %}
{{ govukInsetText({
text: "There are elements in review"
}) }}
{% endif %}

{# ------------- Charge Periods --------------- #}
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('Review Licence presenter', () => {
status: 'ready',
licenceHolder: 'Licence Holder Ltd'
},
elementsInReview: false,
Beckyrose200 marked this conversation as resolved.
Show resolved Hide resolved
matchedReturns: [
{
returnId: 'v1:1:01/60/28/3437:17061181:2022-04-01:2023-03-31',
Expand Down
Loading