Skip to content

Commit

Permalink
Select agreements and exceptions (#624)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4279

This page allows the user to enter the frequency that readings are recorded.

This is a stub page.
  • Loading branch information
Demwunz authored Dec 29, 2023
1 parent bca4dd1 commit 9bf2f1f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
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,6 +140,17 @@ async function saveNote (request, h) {
return h.redirect(`/system/return-requirements/${id}/returns-check-your-answers`)
}

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

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

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

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

Expand Down Expand Up @@ -170,6 +181,7 @@ module.exports = {
reasonNewRequirements,
requirementsApproved,
returnsCheckYourAnswers,
returnsSettings,
returnsHowDoYouWant,
saveNoReturnsCheckYourAnswers,
saveNoReturnsRequired,
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}/settings',
handler: ReturnRequirementsController.returnsSettings,
options: {
auth: {
access: {
scope: ['billing']
}
},
description: 'Select how often collected readings or volumes are reported'
}
}, {
method: 'GET',
path: '/return-requirements/{sessionId}/purpose',
Expand Down
29 changes: 29 additions & 0 deletions app/views/return-requirements/settings.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends 'layout.njk' %}
{% 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 %}
{# Back link #}
{{
govukBackLink({
text: 'Back',
href: rootLink + "/frequency"
})
}}
{% 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 %}
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 @@ -192,6 +192,26 @@ describe('Return requirements controller', () => {
})
})

describe('GET /return-requirements/{sessionId}/settings', () => {
const options = {
method: 'GET',
url: '/return-requirements/64924759-8142-4a08-9d1e-1e902cd9d316/settings',
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('Select agreements and exceptions for the return requirement')
})
})
})

describe('GET /return-requirements/{sessionId}/purpose', () => {
const options = {
method: 'GET',
Expand Down

0 comments on commit 9bf2f1f

Please sign in to comment.