Skip to content

Commit

Permalink
Initial page setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozzey committed Dec 27, 2024
1 parent 9fce8fd commit 5235575
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 2 deletions.
3 changes: 1 addition & 2 deletions app/controllers/return-logs.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down
33 changes: 33 additions & 0 deletions app/services/return-logs/edit-return-log.service.js
Original file line number Diff line number Diff line change
@@ -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<object>} 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
}
124 changes: 124 additions & 0 deletions app/views/return-logs/edit.njk
Original file line number Diff line number Diff line change
@@ -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 #}
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<span class="govuk-caption-l">Licence {{ licenceRef }}</span>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-3">{{ pageTitle }}</h1>

{# Bill run meta-data #}
{{ govukSummaryList({
classes: 'govuk-summary-list--no-border',
rows: [
{
key: {
text: 'Return reference',
classes: "meta-data__label"
},
value: {
html: '<span data-test="return-reference">'+ returnReference +'</span>',
classes: "meta-data__value"
}
},
{
key: {
text: 'Site description',
classes: "meta-data__label"
},
value: {
html: '<span data-test="site-description">'+ siteDescription +'</span>',
classes: "meta-data__value"
}
},
{
key: {
text: 'Purposes',
classes: "meta-data__label"
},
value: {
html: '<span data-test="purposes">'+ purposes +'</span>',
classes: "meta-data__value"
}
},
{
key: {
text: 'Returns period',
classes: "meta-data__label"
},
value: {
html: '<span data-test="returns-period">'+ returnsPeriod +'</span>',
classes: "meta-data__value"
}
},
{
key: {
text: 'Abstraction period',
classes: "meta-data__label"
},
value: {
html: '<span data-test="abstraction-period">'+ abstractionPeriod +'</span>',
classes: "meta-data__value"
}
},
{
key: {
text: tariffType,
classes: "meta-data__label"
}
}
]
}) }}
</div>
</div>

{# Link to take you to the View Licence page #}
<p class="govuk-body"><a href='/licences/'+ licenceId +'/summary' class="govuk-link">View licence</a></p>

{# Select how you would like to edit the return #}
<form method="post">
<input type="hidden" name="wrlsCrumb" value="{{wrlsCrumb}}"/>
{{ 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 }) }}
</form>
{% endblock %}

0 comments on commit 5235575

Please sign in to comment.