From 6c27f4932874db1c4335e54febbedc15ad487801 Mon Sep 17 00:00:00 2001 From: jonathangoulding Date: Tue, 18 Jun 2024 14:54:24 +0100 Subject: [PATCH] Add requirements for returns view page https://eaflood.atlassian.net/browse/WATER-4422 The requirements for return journey has been built and the check page has been finished. This showed a page with requirements for returns allowing users to make changes to requirements for returns. This piece of work will replicate the requirements for returns check page but will not allow users to make changes (the card and information is identical, apart from the title and a return reference). There will be a link "View" on the licence set up page that links to this page. That is added as part of this change. Work for this was done here - https://github.com/DEFRA/water-abstraction-system/pull/1054 --- .../return-requirements/view.service.js | 27 +++ app/views/return-requirements/view.njk | 172 ++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 app/services/return-requirements/view.service.js create mode 100644 app/views/return-requirements/view.njk diff --git a/app/services/return-requirements/view.service.js b/app/services/return-requirements/view.service.js new file mode 100644 index 0000000000..5551834ce6 --- /dev/null +++ b/app/services/return-requirements/view.service.js @@ -0,0 +1,27 @@ +'use strict' + +/** + * Orchestrates fetching and presenting the data for `/return-requirements/{sessionId}/view` page + * @module ViewService + */ + +const FetchRequirementsForReturnsService = require('./fetch-requirements-for-returns.service.js') + +/** + * Orchestrates fetching and presenting the data for `/return-requirements/{sessionId}/view` page + * + * @param {string} returnVersionId - The UUID for return requirement version + * + * @returns {Promise} page data needed by the view template + */ +async function go (returnVersionId) { + // const requirementsForReturns = await FetchRequirementsForReturnsService.go(returnVersionId) + + return { + activeNavBar: 'search' + } +} + +module.exports = { + go +} diff --git a/app/views/return-requirements/view.njk b/app/views/return-requirements/view.njk new file mode 100644 index 0000000000..9621966e48 --- /dev/null +++ b/app/views/return-requirements/view.njk @@ -0,0 +1,172 @@ +{% extends 'layout.njk' %} +{% from "govuk/components/back-link/macro.njk" import govukBackLink %} +{% from "govuk/components/summary-list/macro.njk" import govukSummaryList %} +{% from "macros/charge-version-status-tag.njk" import statusTag %} + +{% macro newLine(array) %} + {% for item in array %} +

{{ item }}

+ {% endfor %} +{% endmacro %} + +{% block breadcrumbs %} + {# Back link #} + {{ govukBackLink({ + text: 'Back', + href: '/system/licences/' + licenceId + '/set-up' + }) }} +{% endblock %} + +{% block content %} + {# Main heading #} +
+

+ Licence {{ licenceRef }} + {{ pageTitle }} +

+ {{ statusTag(status) }} +
+ +
+
+ {{ govukSummaryList({ + classes: 'govuk-!-margin-bottom-2', + rows: [ + { + classes: 'govuk-summary-list govuk-summary-list__row--no-border', + key: { + text: "Reason" + }, + value: { + html: '' + reason + '' + } + }, + { + classes: 'govuk-summary-list govuk-summary-list__row--no-border', + key: { + text: "Start date" + }, + value: { + html: '' + startDate + '' + } + } + ] + }) }} +
+
+ +
+

Requirements for returns

+ {% for requirement in requirements %} + {% set rowIndex = loop.index0 %} +
+ {{ govukSummaryList({ + card: { + title: { + html: "

Return reference " + requirement.returnReference + "

" + requirement.title + } + }, + attributes: { + 'data-test': 'requirement-' + rowIndex + }, + classes: "govuk-summary-list--no-border", + rows: [ + { + key: { + text: "Purpose" + }, + value: { + html: '' + newLine(requirement.purposes) + '' + } + }, + { + key: { + text: "Points" + }, + value: { + html: '' + newLine(requirement.points) + '' + } + }, + { + key: { + text: "Abstraction period" + }, + value: { + html: '

' + requirement.abstractionPeriod + '

' + } + }, + { + key: { + text: "Returns cycle" + }, + value: { + html: '

' + requirement.returnsCycle + '

' + } + }, + { + key: { + text: "Site description" + }, + value: { + html: '

' + requirement.siteDescription + '

' + } + }, + { + key: { + text: "Collection" + }, + value: { + html: '

' + requirement.frequencyCollected | capitalize + '

' + } + }, + { + key: { + text: "Reporting" + }, + value: { + html: '

' + requirement.frequencyReported | capitalize + '

' + } + }, + { + key: { + text: "Agreements exceptions" + }, + value: { + html: '

' + requirement.agreementsExceptions + '

' + } + } + ] + }) }} +
+ {% endfor %} +
+ +
+ {{ govukSummaryList({ + classes: 'govuk-!-margin-bottom-2', + rows: [ + { + classes: 'govuk-summary-list', + key: { + text: 'Additional submission options', + classes: "govuk-heading-m govuk-!-width-one-half" + }, + value: { + text: '' + } + }, + { + classes: 'govuk-summary-list govuk-summary-list__row--no-border', + key: { + text: 'Multiple upload', + classes: "govuk-body " + }, + value: { + text: additionalSubmissionOptions.multipleUpload + } + } + ] + }) }} +
+ +{% endblock %}