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-49 Upload EU Passport Page #62

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
6 changes: 5 additions & 1 deletion apps/epp-new/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ module.exports = {
}
},
'/upload-passport': {
fields: [],
behaviours: [
SaveDocument('new-renew-eu-passport', 'file-upload'),
RemoveDocument('new-renew-eu-passport')
],
fields: ['file-upload'],
next: '/upload-certificate-conduct',
locals: {
sectionNo: {
Expand Down
14 changes: 14 additions & 0 deletions apps/epp-new/sections/summary-data-sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,20 @@ module.exports = {
return documents.map(file => file.name);
}

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

return null;
}
}
Expand Down
15 changes: 15 additions & 0 deletions apps/epp-new/translations/src/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@
"countersignatory-contact":{
"header": "Countersignatory's contact details"
},
"upload-passport": {
"header": "Upload passport",
"p1": "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)",
"upload-file": "Upload a file",
"file-format": "Your file must be JPEG, PDF or PNG, and be 25MB or less",
"no-file-uploaded": "No files uploaded",
"you-have-uploaded": "You have uploaded",
"files": "file(s)",
"uploading-document": "Uploading your document..."
},
"confirm": {
"header": "Check your answers",
"title": "Check your answers – Apply for an explosives precursors and poisons licence",
Expand Down Expand Up @@ -203,6 +215,9 @@
},
"new-renew-british-passport": {
"label": "Image of passport"
},
"new-renew-eu-passport": {
"label": "Image of passport"
}
},
"complete": {
Expand Down
3 changes: 2 additions & 1 deletion apps/epp-new/translations/src/en/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@
"unsaved": "Your file could not be uploaded – try again",
"maxFileSize": "The selected file must be 25MB or smaller",
"fileType": "The selected file must be a JPG, PDF or PNG",
"maxNewRenewBritishPassport" : "You can only upload upto {{maxNewRenewBritishPassport}} files or less. Remove a file before uploading another"
"maxNewRenewBritishPassport" : "You can only upload upto {{maxNewRenewBritishPassport}} files or less. Remove a file before uploading another",
"maxNewRenewEuPassport" : "You can only upload upto {{maxNewRenewEuPassport}} files or less. Remove a file before uploading another"
},
"new-renew-countersignatory-title": {
"required": "Select your countersignatory's title"
Expand Down
58 changes: 58 additions & 0 deletions apps/epp-new/views/upload-passport.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{<partials-page}} {{$encoding}}enctype="multipart/form-data" name="file-upload-form" {{/encoding}}
{{$page-content}}
<p class="govuk-body">{{#t}}pages.upload-passport.p1{{/t}}
<a class="govuk-link" href="{{#t}}pages.upload-passport.link{{/t}}" target="_blank" rel="noreferrer noopener">
{{#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.upload-file{{/t}}</h2>
<span class="govuk-hint">{{#t}}pages.upload-passport.file-format{{/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="new-renew-eu-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.new-renew-eu-passport}}
<h2 class="govuk-heading-m">{{#t}}pages.upload-passport.no-file-uploaded{{/t}}</h2>
{{/values.new-renew-eu-passport}}

{{#values.new-renew-eu-passport.length}}
<h2 class="govuk-heading-m">{{#t}}pages.upload-passport.you-have-uploaded{{/t}} {{values.new-renew-eu-passport.length}} {{#t}}pages.upload-passport.files{{/t}}</h2>

<div id="uploaded-documents" class="govuk-width-container">
{{#values.new-renew-eu-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.new-renew-eu-passport}}
</div>

{{/values.new-renew-eu-passport.length}}


<button class="govuk-button" name="requireFileUpload" value="new-renew-eu-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 @@ -60,6 +60,11 @@ module.exports = {
allowMultipleUploads: false,
limit: 1,
limitValidationError: 'maxNewRenewBritishPassport'
},
'new-renew-eu-passport': {
allowMultipleUploads: false,
limit: 1,
limitValidationError: 'maxNewRenewEuPassport'
}
}
},
Expand Down