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

Enter abstraction period dates for return set up #610

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
12 changes: 12 additions & 0 deletions app/controllers/return-requirements.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,19 @@ async function saveNote (request, h) {
return h.redirect(`/system/return-requirements/${id}/returns-check-your-answers`)
}

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

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

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

module.exports = {
abstractionPeriod,
addANote,
noReturnsCheckYourAnswers,
noReturnsRequired,
Expand Down
12 changes: 12 additions & 0 deletions app/routes/return-requirement.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ const routes = [
},
description: 'Save note'
}
}, {
method: 'GET',
path: '/return-requirements/{sessionId}/abstraction-period',
handler: ReturnRequirementsController.abstractionPeriod,
options: {
auth: {
access: {
scope: ['billing']
}
},
description: 'Returns abstraction period page'
}
}
]

Expand Down
30 changes: 30 additions & 0 deletions app/views/return-requirements/abstraction-period.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends 'layout.njk' %}
{% 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind doing it this way but we need to be consistent. some of the pages have the text in the H1 element. so we either need to change the others to this way or make this the same as those.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertparkinson I've created another branch and moved all title strings in other files to use the set.
I'm lifting this from the prototype, so it's less friction when copying across nunjucks code.

" %}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
{# Back link #}
{{
govukBackLink({
text: 'Back',
href: rootLink + "/points"
})
}}
{% endblock %}

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

<form method="post">
<div class="govuk-body">
{{ govukButton({ text: "Continue" }) }}
</div>
</form>
{% endblock %}
3 changes: 2 additions & 1 deletion app/views/return-requirements/add-a-note.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{% 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 @@ -16,7 +17,7 @@
{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">Add a note</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{title}}</h1>
</div>

<form method="post">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% 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">Check your answers</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{title}}</h1>
</div>

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

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

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

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

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

<h2 class="govuk-heading-m">What happens next</h2>
<h2 class="govuk-heading-m">{{title}}</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>
{% endblock %}
3 changes: 2 additions & 1 deletion app/views/return-requirements/returns-check-your-answers.njk
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% 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">Check your answers</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{title}}</h1>
</div>

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

{% set title = "How do you want to set up the return requirement?" %}
{% set rootLink = "/system/return-requirements/" + id %}

{% block breadcrumbs %}
Expand All @@ -17,7 +18,7 @@
{% block content %}
{# Main heading #}
<div class="govuk-body">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">How do you want to set up the return requirement?</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{title}}</h1>
</div>

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

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

<form method="post">
Expand Down
20 changes: 20 additions & 0 deletions test/controllers/return-requirements.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,24 @@ describe('Return requirements controller', () => {
})
})
})

describe('GET /return-requirements/{sessionId}/abstraction-period', () => {
const options = {
method: 'GET',
url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/abstraction-period',
auth: {
strategy: 'session',
credentials: { scope: ['billing'] }
}
}

describe('when the request succeeds', () => {
it('returns the page successfully', async () => {
const response = await server.inject(options)

expect(response.statusCode).to.equal(200)
expect(response.payload).to.contain('Enter the abstraction period for the return requirement')
})
})
})
})
Loading