Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPP-146 amend CHANGE SUBSTANCES page #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/epp-amend/fields/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ module.exports = {
legend: { className: 'bold' },
validate: ['required', 'date', 'before']
}),
'amend-change-substances-options': {
mixin: 'radio-group',
legend: {
className: 'govuk-label--m'
},
className: ['govuk-radios', 'govuk-radios--inline'],
options: ['yes', 'no'],
validate: 'required'
},
'amend-precursor-field': {
mixin: 'select',
validate: ['required'],
Expand Down
26 changes: 23 additions & 3 deletions apps/epp-amend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,31 @@ module.exports = {
next: '/change-substances'
},
'/change-substances': {
fields: ['amend-explosive-precusor-type'],
fields: ['amend-change-substances-options'],
forks: [
{
target: '/countersignatory-details',
condition: req =>
req.sessionModel.get('amend-change-substances-options') === 'no'
&& req.sessionModel.get('amend-name-options') === 'yes'
|| req.sessionModel.get('amend-home-address-options') === 'yes'
Copy link
Contributor

@vivekkumar-ho vivekkumar-ho Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should extract these conditions into a function or variable for readability and also reusability in case we would need to use the same conditions on any other route.

},
{
target: '/no-details-amend',
condition: req =>
req.sessionModel.get('amend-change-substances-options') === 'no'
&& req.sessionModel.get('amend-name-options') === 'no'
&& req.sessionModel.get('amend-home-address-options') === 'no'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}
],
continueOnEdit: true,
locals: { captionHeading: 'Section 13 of 23' },
next: '/section-fourteen'
next: '/explosives-precursors'
},
'/no-details-amend': {
locals: { captionHeading: 'Section 13 of 23'}
},
'/section-fourteen': {
'/explosives-precursors': {
fields: ['amend-poison-type'],
next: '/select-precursor'
},
Expand Down
8 changes: 8 additions & 0 deletions apps/epp-amend/sections/summary-data-sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ module.exports = {
}
]
},
'amend-change-substances': {
steps: [
{
step: '/change-home-address',
field: 'amend-change-substances-options'
}
]
},
'amend-explosives-precursor': {
steps: [
{
Expand Down
11 changes: 11 additions & 0 deletions apps/epp-amend/translations/src/en/fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@
"legend": "What date did you change your address?",
"hint": " For example, 30 09 1969"
},
"amend-change-substances-options":{
"legend": "Do you need to amend the substances on your licence?",
"options": {
"yes": {
"label": "Yes"
},
"no": {
"label": "No"
}
}
},
"amend-precursor-field": {
"hint": "Select an explosives precursor",
"options":{
Expand Down
13 changes: 13 additions & 0 deletions apps/epp-amend/translations/src/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
"not-uploaded": "No files uploaded",
"uploaded": "File uploaded"
},
"change-substances": {
"header": "Change in substances",
"paragraph1": "You must amend the substances on your licence if you:",
"li1": "need to add or remove substances you can acquire, possess or use",
"li2": "need to change the concentration or volume of substances that your licence covers",
"li3": "have changed your storage or usage address since your current licence was issued"
},
"select-precursor": {
"header": "Explosives precursors",
"p1": "Tell us which explosives precursors you want to import acquire use or possess.",
Expand Down Expand Up @@ -100,6 +107,9 @@
"amend-new-home-address": {
"header": "New address"
},
"amend-change-substances": {
"header": "Amend substances"
},
"amend-explosives-precursor": {
"header": "Explosives precursors"
}
Expand Down Expand Up @@ -177,6 +187,9 @@
"amend-new-country": {
"label": "Country"
},
"amend-home-address-options": {
"label": "Do you need to amend the substances on your licence?"
},
"amend-precursor-field": {
"label": "Explosives precursor"
}
Expand Down
17 changes: 17 additions & 0 deletions apps/epp-amend/views/change-substances.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{<partials-page}}
{{$page-content}}
<div>
<p class="govuk-body">{{#t}}pages.change-substances.paragraph1{{/t}}</p>
<ul class="govuk-list govuk-list--bullet">
<li>{{#t}}pages.change-substances.li1{{/t}}</li>
<li>{{#t}}pages.change-substances.li2{{/t}}</li>
<li>{{#t}}pages.change-substances.li3{{/t}}</li>
</ul>
</div>

{{#fields}}
{{#renderField}}amend-change-substances-options{{/renderField}}
{{/fields}}
{{#input-submit}}continue{{/input-submit}}
{{/page-content}}
{{/partials-page}}