Skip to content

Commit

Permalink
EPP-103 upload eu passport
Browse files Browse the repository at this point in the history
- add create html for upload passport
- add content in pages.json
- add section in summary-data-section
- update index.js with the new page
- add in validation.json and config.js max limit error message in case limit increase more than 1.
  • Loading branch information
PaolaDMadd-Pro committed Feb 11, 2025
1 parent 8db83fa commit db95192
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 20 deletions.
39 changes: 23 additions & 16 deletions apps/epp-amend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
backLink: '/application-type',
fields: ['amend-licence-number'],
next: '/name-on-licence',
locals: { captionHeading: 'Section 1 of 20' }
locals: { captionHeading: 'Section 1 of 23' }
},
'/name-on-licence': {
fields: [
Expand All @@ -28,12 +28,12 @@ module.exports = {
'amend-lastname'
],
next: '/date-of-birth',
locals: { captionHeading: 'Section 2 of 20' }
locals: { captionHeading: 'Section 2 of 23' }
},
'/date-of-birth': {
fields: ['amend-date-of-birth'],
next: '/home-address',
locals: { captionHeading: 'Section 3 of 20' }
locals: { captionHeading: 'Section 3 of 23' }
},
'/home-address': {
behaviours: [PostcodeValidation],
Expand All @@ -46,14 +46,14 @@ module.exports = {
'amend-country'
],
next: '/contact-details',
locals: { captionHeading: 'Section 4 of 20' }
locals: { captionHeading: 'Section 4 of 23' }
},
'/contact-details': {
fields: [
'amend-phone-number',
'amend-email'
],
locals: {captionHeading: 'Section 5 of 20'},
locals: {captionHeading: 'Section 5 of 23'},
next: '/amend-details'
},
'/amend-details': {
Expand All @@ -74,7 +74,7 @@ module.exports = {
}
}
],
locals: {captionHeading: 'Section 6 of 20'},
locals: {captionHeading: 'Section 6 of 23'},
next: '/new-name'
},
'/new-name': {
Expand All @@ -86,7 +86,7 @@ module.exports = {
'amend-new-date-name-changed'
],
next: '/identity-details',
locals: { captionHeading: 'Section 7 of 20' },
locals: { captionHeading: 'Section 7 of 23' },
behaviours: [AfterDateOfBirth]
},
'/identity-details': {
Expand All @@ -107,23 +107,30 @@ module.exports = {
}
],

locals: { captionHeading: 'Section 8 of 20' },
locals: { captionHeading: 'Section 8 of 23' },
next: '/upload-driving-licence'
},
'/upload-british-passport': {
behaviours: [SaveDocument('amend-british-passport', 'file-upload'), RemoveDocument('amend-british-passport')],
fields: ['file-upload'],
continueOnEdit: true,
next: '/change-home-address',
locals: { captionHeading: 'Section 9 of 20' }
locals: { captionHeading: 'Section 9 of 23' }
},
'/upload-passport': {
next: '/change-home-address',
locals: { captionHeading: 'Section 9 of 20' }
behaviours: [SaveDocument('amend-passport', 'file-upload'), RemoveDocument('amend-passport')],
fields: ['file-upload'],
continueOnEdit: true,
next: '/upload-certificate-conduct',
locals: { captionHeading: 'Section 9 of 23' }
},
'/upload-driving-licence': {
next: '/change-home-address',
locals: { captionHeading: 'Section 9 of 20' }
locals: { captionHeading: 'Section 9 of 23' }
},
'/upload-certificate-conduct': {
next: '/change-home-address',
locals: { captionHeading: 'Section 9 of 23' }
},
'/change-home-address': {
fields: ['amend-home-address-options'],
Expand All @@ -143,7 +150,7 @@ module.exports = {
}
}
],
locals: { captionHeading: 'Section 10 of 20' },
locals: { captionHeading: 'Section 10 of 23' },
next: '/new-address'
},
'/new-address': {
Expand All @@ -158,7 +165,7 @@ module.exports = {
],
behaviours: [AfterDateOfBirth, PostcodeValidation],
next: '/upload-proof-address',
locals: { captionHeading: 'Section 11 of 20' }
locals: { captionHeading: 'Section 11 of 23' }
},
'/upload-proof-address': {
next: '/section-twelve'
Expand All @@ -169,7 +176,7 @@ module.exports = {
},
'/change-substances': {
fields: ['amend-explosive-precusor-type'],
locals: { captionHeading: 'Section 13 of 20' },
locals: { captionHeading: 'Section 13 of 23' },
next: '/section-fourteen'
},
'/section-fourteen': {
Expand All @@ -178,7 +185,7 @@ module.exports = {
},
'/select-precursor': {
fields: ['amend-precursor-field'],
locals: { captionHeading: 'Section 15 of 20' },
locals: { captionHeading: 'Section 15 of 23' },
next: '/section-sixteen'
},
'/section-sixteen': {
Expand Down
17 changes: 16 additions & 1 deletion apps/epp-amend/sections/summary-data-sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,23 @@ module.exports = {

return null;
}
}
},
{
step: '/upload-passport',
field: 'amend-passport',
parse: (documents, req) => {
if (
req.sessionModel
.get('steps')
.includes('/upload-passport') &&
documents?.length > 0
) {
return documents.map(file => file.name);
}

return null;
}
}
]
},
'amend-home-address-options': {
Expand Down
3 changes: 2 additions & 1 deletion apps/epp-amend/translations/src/en/journey.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"header": "Explosives precursors and poisons licensing",
"phase": "beta",
"serviceName": "Amend an explosives and precursor chemicals licence"
"serviceName": "Amend an explosives and precursor chemicals licence",
"error": "Error"
}
16 changes: 15 additions & 1 deletion apps/epp-amend/translations/src/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@
"header": "Upload British passport",
"label": "Upload a file",
"hint": "Your file must be JPEG, PDF or PNG and be 25MB or less",
"paragraph1": "Attach an image of your British passport as proof of your identity. the image must be",
"paragraph1": "Attach an image of your British passport as proof of your identity. The image must be",
"link": "https://www.gov.uk/government/publications/explosives-precursors-licence-applications-countersignatory/explosives-precursors-and-poisons-licence-applications-how-to-get-documents-countersigned",
"link-text" : "signed by your countersignatory (opens in a new tab).",
"uploading-document": "Document uploading",
"not-uploaded": "No files uploaded",
"uploaded": "File uploaded"
},
"upload-passport" : {
"header": "Upload passport",
"label": "Upload a file",
"hint": "Your file must be JPEG, PDF or PNG and be 25MB or less",
"paragraph1": "Attach an image of your passport from the EU, Switzerland, Norway, Iceland or Liechtenstein as proof of your identity. The image must be ",
"link": "https://www.gov.uk/government/publications/explosives-precursors-licence-applications-countersignatory/explosives-precursors-and-poisons-licence-applications-how-to-get-documents-countersigned",
"link-text" : "signed by your countersignatory (opens in a new tab).",
"uploading-document": "Document uploading",
Expand Down Expand Up @@ -146,6 +157,9 @@
"amend-british-passport" : {
"label": "British passport attachment"
},
"amend-passport" : {
"label": "Passport attachment"
},
"amend-new-country": {
"label": "Country"
},
Expand Down
3 changes: 2 additions & 1 deletion apps/epp-amend/translations/src/en/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"required": "Select a file to upload",
"maxFileSize": "The selected file must 25MB or smaller",
"fileType": "The selected file must be a JPG, PDF or PNG",
"maxAmendBritishPassport": "You can only upload up to {{maxAmendBritishPassport}} files or less. Remove a file before uploading another "
"maxAmendBritishPassport": "You can only upload up to {{maxAmendBritishPassport}} files or less. Remove a file before uploading another",
"maxAmendPassport": "You can only upload up to {{maxAmendPassport}} files or less. Remove a file before uploading another"
},
"amend-new-name-title": {
"required" : "Select the title of your new name"
Expand Down
48 changes: 48 additions & 0 deletions apps/epp-amend/views/upload-passport.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{<partials-page}}
{{$encoding}}enctype="multipart/form-data" name="file-upload-form" {{/encoding}}
{{$page-content}}
<p>{{#t}}pages.upload-passport.paragraph1{{/t}}
<a class="govuk-link" href="{{#t}}pages.upload-passport.link{{/t}}" rel="noreferrer noopener" target="_blank">{{#t}}pages.upload-passport.link-text{{/t}}</a>
</p>
<div class="govuk-form-group" id="hofFileUpload">
<label class="govuk-label" for="file-upload">
<h2>{{#t}}pages.upload-passport.label{{/t}}</h2>
<span class="govuk-hint">{{#t}}pages.upload-passport.hint{{/t}}</span>
</label>
<p id="file-upload-error-maxFileSize" class="govuk-error-message govuk-!-display-none">
<span id="validation-error" class="govuk-visually-hidden">{{#t}}journey.error{{/t}}:</span> {{#t}}validation.file-upload.maxFileSize{{/t}}
</p>
<p id="file-upload-error-fileType" class="govuk-error-message govuk-!-display-none">
<span id="validation-error" class="govuk-visually-hidden">{{#t}}journey.error{{/t}}:</span> {{#t}}validation.file-upload.fileType{{/t}}
</p>
<input class="govuk-file-upload" id="file-upload" name="file-upload" type="file" value="amend-passport">
<div id="upload-page-loading-spinner" class="spinner-container">
<div class="spinner-loader"></div>
<span class="spinner-message">{{#t}}pages.upload-passport.uploading-document{{/t}}</span>
</div>
</div>
{{^values.amend-passport}}
<h2 class="govuk-heading-m">{{#t}}pages.upload-passport.not-uploaded{{/t}}</h2>
{{/values.amend-passport}}
{{#values.amend-passport.length}}
<br>
<h2 class="govuk-heading-m">{{#t}}pages.upload-passport.uploaded{{/t}}</h2>
<div id="uploaded-documents" class="govuk-width-container">
{{#values.amend-passport}}
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
{{name}}
</div>
<div class="govuk-grid-column-one-quarter">
<a href="?delete={{id}}" class="govuk-link">{{#t}}buttons.remove{{/t}}</a>
</div>
</div>
<div class="file-upload-hrline"></div>
{{/values.amend-passport}}
</div>
{{/values.amend-passport.length}}
<button class="govuk-button" name="requireFileUpload" value="amend-passport">
{{#t}}buttons.continue{{/t}}
</button>
{{/page-content}}
{{/partials-page}}
5 changes: 5 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ module.exports = {
allowMultipleUploads: false,
limit: 1,
limitValidationError: 'maxAmendBritishPassport'
},
'amend-passport': {
allowMultipleUploads: false,
limit: 1,
limitValidationError: 'maxAmendPassport'
}
}
},
Expand Down

0 comments on commit db95192

Please sign in to comment.