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 missing titles in returns reqs. set up pages #651

Merged
merged 14 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions app/controllers/return-requirements.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function abstractionPeriod (request, h) {

return h.view('return-requirements/abstraction-period.njk', {
activeNavBar: 'search',
pageTitle: 'Enter the abstraction period for the return requirement',
...session
})
}
Expand All @@ -27,6 +28,7 @@ async function addNote (request, h) {

return h.view('return-requirements/add-note.njk', {
activeNavBar: 'search',
pageTitle: 'Add a note',
...session
})
}
Expand All @@ -38,6 +40,7 @@ async function agreementsExceptions (request, h) {

return h.view('return-requirements/agreements-exceptions.njk', {
activeNavBar: 'search',
pageTitle: 'Select agreements and exceptions for the return requirement',
...session
})
}
Expand All @@ -47,6 +50,7 @@ async function approved (request, h) {

return h.view('return-requirements/approved.njk', {
activeNavBar: 'search',
pageTitle: 'Returns requirements approved',
licenceId
})
}
Expand All @@ -58,6 +62,7 @@ async function checkYourAnswers (request, h) {

return h.view('return-requirements/check-your-answers.njk', {
activeNavBar: 'search',
pageTitle: `Check the return requirements for ${session?.data?.licence?.licenceHolder}`,
...session
})
}
Expand All @@ -69,6 +74,7 @@ async function frequencyCollected (request, h) {

return h.view('return-requirements/frequency-collected.njk', {
activeNavBar: 'search',
pageTitle: 'Select how often readings or volumes are collected',
...session
})
}
Expand All @@ -80,17 +86,7 @@ async function frequencyReported (request, h) {

return h.view('return-requirements/frequency-reported.njk', {
activeNavBar: 'search',
...session
})
}

async function noReturnsCheckYourAnswers (request, h) {
const { sessionId } = request.params

const session = await SessionModel.query().findById(sessionId)

return h.view('return-requirements/no-returns-check-your-answers.njk', {
activeNavBar: 'search',
pageTitle: 'Select how often collected readings or volumes are reported',
...session
})
}
Expand All @@ -112,6 +108,7 @@ async function points (request, h) {

return h.view('return-requirements/points.njk', {
activeNavBar: 'search',
pageTitle: 'Select the points for the return requirement',
...session
})
}
Expand All @@ -123,6 +120,7 @@ async function purpose (request, h) {

return h.view('return-requirements/purpose.njk', {
activeNavBar: 'search',
pageTitle: 'Select the purpose for the return requirement',
...session
})
}
Expand All @@ -134,6 +132,7 @@ async function reason (request, h) {

return h.view('return-requirements/reason.njk', {
activeNavBar: 'search',
pageTitle: 'Select the reason for the return requirement',
...session
})
}
Expand All @@ -145,6 +144,7 @@ async function returnsCycle (request, h) {

return h.view('return-requirements/returns-cycle.njk', {
activeNavBar: 'search',
pageTitle: 'Select the returns cycle for the return requirement',
...session
})
}
Expand All @@ -156,6 +156,7 @@ async function setup (request, h) {

return h.view('return-requirements/setup.njk', {
activeNavBar: 'search',
pageTitle: 'How do you want to set up the return requirement?',
...session
})
}
Expand All @@ -167,6 +168,7 @@ async function siteDescription (request, h) {

return h.view('return-requirements/site-description.njk', {
activeNavBar: 'search',
pageTitle: 'Enter a site description for the return requirement',
...session
})
}
Expand All @@ -178,6 +180,7 @@ async function startDate (request, h) {

return h.view('return-requirements/start-date.njk', {
activeNavBar: 'search',
pageTitle: 'Select the start date for the return requirement',
...session
})
}
Expand All @@ -201,7 +204,11 @@ async function submitAgreementsExceptions (request, h) {
}

async function submitCheckYourAnswers (request, h) {
const { licenceId } = request.params
const { sessionId } = request.params

const session = await SessionModel.query().findById(sessionId)

const { id: licenceId } = session.data.licence

return h.redirect(`/system/return-requirements/${licenceId}/approved`)
}
Expand All @@ -218,12 +225,6 @@ async function submitFrequencyReported (request, h) {
return h.redirect(`/system/return-requirements/${sessionId}/agreements-exceptions`)
}

async function submitNoReturnsCheckYourAnswers (request, h) {
const { licenceId } = request.params

return h.redirect(`/system/return-requirements/${licenceId}/approved`)
}

async function submitNoReturnsRequired (request, h) {
const { sessionId } = request.params
const validation = NoReturnsRequiredValidator.go(request.payload)
Expand All @@ -233,7 +234,7 @@ async function submitNoReturnsRequired (request, h) {
return h.view('return-requirements/no-returns-required.njk', pageData)
}

return h.redirect(`/system/return-requirements/${sessionId}/no-returns-check-your-answers`)
return h.redirect(`/system/return-requirements/${sessionId}/check-your-answers`)
}

async function submitPoints (request, h) {
Expand Down Expand Up @@ -292,7 +293,6 @@ module.exports = {
checkYourAnswers,
frequencyCollected,
frequencyReported,
noReturnsCheckYourAnswers,
noReturnsRequired,
points,
purpose,
Expand All @@ -307,7 +307,6 @@ module.exports = {
submitCheckYourAnswers,
submitFrequencyCollected,
submitFrequencyReported,
submitNoReturnsCheckYourAnswers,
submitNoReturnsRequired,
submitPoints,
submitPurpose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ const { reasonNewRequirementsFields } = require('../../lib/static-lookups.lib.js
function go (session, error = null) {
const data = {
id: session.id,
activeNavBar: 'search',
errorMessage: _error(session, error),
errorMessage: _error(error),
licenceRef: session.data.licence.licenceRef,
radioItems: _radioButtons(session)
radioItems: _radioItems(session)
}

return data
}

function _error (session, error) {
function _error (error) {
if (!error) {
return null
}
Expand All @@ -31,7 +30,7 @@ function _error (session, error) {
return errorMessage
}

function _radioButtons (session) {
function _radioItems (_session) {
const radioItems = [
{
value: reasonNewRequirementsFields[0],
Expand Down
28 changes: 1 addition & 27 deletions app/routes/return-requirement.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const routes = [
{
method: 'POST',
path: '/return-requirements/{sessionId}/check-your-answers',
handler: ReturnRequirementsController.checkYourAnswers,
handler: ReturnRequirementsController.submitCheckYourAnswers,
options: {
auth: {
access: {
Expand Down Expand Up @@ -172,32 +172,6 @@ const routes = [
description: 'Submit how often collected readings or volumes are reported'
}
},
{
method: 'GET',
path: '/return-requirements/{sessionId}/no-returns-check-your-answers',
handler: ReturnRequirementsController.noReturnsCheckYourAnswers,
options: {
auth: {
access: {
scope: ['billing']
}
},
description: 'Check your answers'
}
},
{
method: 'POST',
path: '/return-requirements/{sessionId}/no-returns-check-your-answers',
handler: ReturnRequirementsController.submitNoReturnsCheckYourAnswers,
options: {
auth: {
access: {
scope: ['billing']
}
},
description: 'Submit check your answers'
}
},
{
method: 'GET',
path: '/return-requirements/{sessionId}/no-returns-required',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ const SessionModel = require('../../models/session.model.js')
*/
async function go (sessionId, error = null) {
const session = await SessionModel.query().findById(sessionId)
const pageData = NoReturnsRequiredPresenter.go(session, error)
const formattedData = NoReturnsRequiredPresenter.go(session, error)

return pageData
return {
activeNavBar: 'search',
pageTitle: 'Why are no returns required?',
...formattedData
}
}

module.exports = {
Expand Down
4 changes: 1 addition & 3 deletions app/views/return-requirements/abstraction-period.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set title = "Enter the abstraction period for the return requirement
" %}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
Expand All @@ -19,7 +17,7 @@
{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ title }}</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ pageTitle }}</h1>
</div>

<form method="post">
Expand Down
3 changes: 1 addition & 2 deletions app/views/return-requirements/add-note.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set title = "Add a note" %}
{% set rootLink = "/system/return-requirements/" + id %}
{% block breadcrumbs %}
{# Back link #}
Expand All @@ -17,7 +16,7 @@
{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{title}}</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ pageTitle }}</h1>
</div>

<form method="post">
Expand Down
3 changes: 1 addition & 2 deletions app/views/return-requirements/agreements-exceptions.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set title = "Select agreements and exceptions for the return requirement" %}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
Expand All @@ -18,7 +17,7 @@
{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ title }}</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ pageTitle }}</h1>
</div>

<form method="post">
Expand Down
8 changes: 3 additions & 5 deletions app/views/return-requirements/approved.njk
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{% extends 'layout.njk' %}
{% from "govuk/components/panel/macro.njk" import govukPanel %}

{% set title = "What happens next" %}

{% block content %}
{{ govukPanel({
titleText: "Returns requirements approved",
titleText: pageTitle,
classes: "govuk-!-margin-bottom-4"
}) }}

<h2 class="govuk-heading-m">{{title}}</h2>
<h2 class="govuk-heading-m">What happens next</h2>
<p class="govuk-body">These return requirements are now active and returns will be opened for this licence in the next returns cycle.</p>
<p class="govuk-body">
<a href="/licences/{{ licenceId }}" class="govuk-link">Return to licence set up</a>
<a href="/licences/{{ licenceId }}#charge" class="govuk-link">Return to licence set up</a>
</p>
{% endblock %}
4 changes: 1 addition & 3 deletions app/views/return-requirements/check-your-answers.njk
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{% extends 'layout.njk' %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set title = "Check your answers" %}

{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{title}}</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ pageTitle }}</h1>
</div>

<form method="post">
Expand Down
3 changes: 1 addition & 2 deletions app/views/return-requirements/frequency-collected.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set title = "Select how often readings or volumes are collected" %}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
Expand All @@ -18,7 +17,7 @@
{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ title }}</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ pageTitle }}</h1>
</div>

<form method="post">
Expand Down
3 changes: 1 addition & 2 deletions app/views/return-requirements/frequency-reported.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% set title = "Select how often collected readings or volumes are reported" %}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
Expand All @@ -18,7 +17,7 @@
{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ title }}</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ pageTitle }}</h1>
</div>

<form method="post">
Expand Down
Loading
Loading