diff --git a/app/controllers/return-logs.controller.js b/app/controllers/return-logs.controller.js index 1f768418c..89627c355 100644 --- a/app/controllers/return-logs.controller.js +++ b/app/controllers/return-logs.controller.js @@ -9,8 +9,7 @@ const EditReturnLogService = require('../services/return-logs/edit-return-log.se async function edit(request, h) { const { returnLogId } = request.params - - const pageData = EditReturnLogService.go(returnLogId) + const pageData = await EditReturnLogService.go(returnLogId) return h.view('return-logs/edit.njk', { activeNavBar: 'search', ...pageData }) } diff --git a/app/services/return-logs/edit-return-log.service.js b/app/services/return-logs/edit-return-log.service.js new file mode 100644 index 000000000..6765df9f8 --- /dev/null +++ b/app/services/return-logs/edit-return-log.service.js @@ -0,0 +1,33 @@ +'use strict' + +/** + * Orchestrates fetching and presenting the data needed for the how to edit an abstraction return page + * @module EditReturnLogService + */ + +/** + * Orchestrates fetching and presenting the data needed for the how to edit an abstraction return page + * + * @param {string} returnLogId - The ID of the return log to edit + * + * @returns {Promise} page data needed by the view template + */ +async function go(returnLogId) { + return { + returnLogId, + pageTitle: 'Abstraction return', + licenceRef: '12/345', + returnReference: '123456789', + siteDescription: 'River Swale - Helperby SP1,2,3,4,5 (GW)', + purposes: 'Potable Water Supply Direct', + returnsPeriod: 'From 1 July 2024 to 30 September 2024', + abstractionPeriod: 'From 1 April to 31 March', + tariffType: 'Standard tariff', + queryText: 'Record under query', + licenceId: 'd4ba7029-8716-4538-8092-0f39a196f132' + } +} + +module.exports = { + go +} diff --git a/app/views/return-logs/edit.njk b/app/views/return-logs/edit.njk new file mode 100644 index 000000000..8526f4b04 --- /dev/null +++ b/app/views/return-logs/edit.njk @@ -0,0 +1,124 @@ +{% extends 'layout.njk' %} +{% from "govuk/components/back-link/macro.njk" import govukBackLink %} +{% from "govuk/components/button/macro.njk" import govukButton %} +{% from "govuk/components/radios/macro.njk" import govukRadios %} +{% from "govuk/components/summary-list/macro.njk" import govukSummaryList %} + +{% block breadcrumbs %} + {# Back link #} + {{ govukBackLink({ + text: 'Back', + href: '/return-logs/'+ returnLogId +'/view' + }) }} +{% endblock %} + +{% block content %} + {# Main heading #} +
+
+ Licence {{ licenceRef }} +

{{ pageTitle }}

+ + {# Bill run meta-data #} + {{ govukSummaryList({ + classes: 'govuk-summary-list--no-border', + rows: [ + { + key: { + text: 'Return reference', + classes: "meta-data__label" + }, + value: { + html: ''+ returnReference +'', + classes: "meta-data__value" + } + }, + { + key: { + text: 'Site description', + classes: "meta-data__label" + }, + value: { + html: ''+ siteDescription +'', + classes: "meta-data__value" + } + }, + { + key: { + text: 'Purposes', + classes: "meta-data__label" + }, + value: { + html: ''+ purposes +'', + classes: "meta-data__value" + } + }, + { + key: { + text: 'Returns period', + classes: "meta-data__label" + }, + value: { + html: ''+ returnsPeriod +'', + classes: "meta-data__value" + } + }, + { + key: { + text: 'Abstraction period', + classes: "meta-data__label" + }, + value: { + html: ''+ abstractionPeriod +'', + classes: "meta-data__value" + } + }, + { + key: { + text: tariffType, + classes: "meta-data__label" + } + } + ] + }) }} +
+
+ + {# Link to take you to the View Licence page #} +

View licence

+ + {# Select how you would like to edit the return #} +
+ + {{ govukRadios({ + name: "howToEdit", + fieldset: { + legend: { + text: "How would you like to edit this return?", + isPageHeading: true, + classes: "govuk-fieldset__legend--l" + } + }, + items: [ + { + value: '/return-logs/'+ returnLogId +'/edit/single-volume', + text: "Enter individual volumes" + }, + { + value: '/return-logs/'+ returnLogId +'/edit/new-volumes', + text: "Enter new volumes or readings" + }, + { + value: '/return-logs/'+ returnLogId +'/edit/nil-return', + text: "Enter a nil return" + }, + { + value: '/return-logs/'+ returnLogId +'/edit/query', + text: queryText + } + ] + }) }} + + {{ govukButton({ text: "Continue", preventDoubleClick: true }) }} +
+{% endblock %}