Skip to content

Commit

Permalink
Add missing return requirement set up reasons (#1169)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4265

> Part of the work to migrate return requirements from NALD to WRLS

It appears the design we implemented for the 'Select the reason' page of the returns required setup journey was missing 2 options. Somewhere between testing and pulling together the wire frames, they got left off.

This change adds the missing options to the page.

For reference, they are

- Change to requirements for returns
- Error correction
  • Loading branch information
Cruikshanks authored Jul 8, 2024
1 parent 5933403 commit 3a6b47b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions app/lib/static-lookups.lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const returnRequirementFrequencies = {

const returnRequirementReasons = {
'abstraction-below-100-cubic-metres-per-day': 'Abstraction amount below 100 cubic metres per day',
'change-to-return-requirements': 'Change to requirements for returns',
'change-to-special-agreement': 'Change to special agreement',
'error-correction': 'Error correction',
'extension-of-licence-validity': 'Limited extension of licence validity (LEV)',
'major-change': 'Major change',
'minor-change': 'Minor change',
Expand Down
18 changes: 4 additions & 14 deletions app/validators/return-requirements/reason.validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@

const Joi = require('joi')

const VALID_VALUES = [
'change-to-special-agreement',
'name-or-address-change',
'transfer-and-now-chargeable',
'extension-of-licence-validity',
'major-change',
'minor-change',
'new-licence-in-part-succession-or-licence-apportionment',
'new-licence',
'new-special-agreement',
'succession-or-transfer-of-licence',
'succession-to-remainder-licence-or-licence-apportionment'
]
const { returnRequirementReasons } = require('../../lib/static-lookups.lib.js')

const errorMessage = 'Select the reason for the requirements for returns'

Expand All @@ -32,10 +20,12 @@ const errorMessage = 'Select the reason for the requirements for returns'
* any errors are found the `error:` property will also exist detailing what the issues were
*/
function go (data) {
const validValues = Object.keys(returnRequirementReasons)

const schema = Joi.object({
reason: Joi.string()
.required()
.valid(...VALID_VALUES)
.valid(...validValues)
.messages({
'any.required': errorMessage,
'any.only': errorMessage,
Expand Down
10 changes: 10 additions & 0 deletions app/views/return-requirements/reason.njk
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,21 @@
}
},
items: [
{
text: 'Change to requirements for returns',
value: 'change-to-return-requirements',
checked: 'change-to-return-requirements' === reason
},
{
text: 'Change to special agreement',
value: 'change-to-special-agreement',
checked: 'change-to-special-agreement' === reason
},
{
text: 'Error correction',
value: 'error-correction',
checked: 'error-correction' === reason
},
{
text: 'Licence holder name or address change',
value: 'name-or-address-change',
Expand Down

0 comments on commit 3a6b47b

Please sign in to comment.