From fef53eaba5ab0b450c4e887e83a65ad5dbcda4c5 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Wed, 5 Feb 2025 13:49:27 +0000 Subject: [PATCH 01/13] EPP-49 upload passport initial commit --- apps/epp-new/index.js | 1 + apps/epp-new/translations/src/en/pages.json | 15 ++++++ apps/epp-new/views/upload-passport.html | 58 +++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 apps/epp-new/views/upload-passport.html diff --git a/apps/epp-new/index.js b/apps/epp-new/index.js index 4337ad7..73c7cb0 100644 --- a/apps/epp-new/index.js +++ b/apps/epp-new/index.js @@ -203,6 +203,7 @@ module.exports = { } }, '/upload-passport': { + // TODO: Add behaviour and field once EPP-48 is merged fields: [], next: '/upload-certificate-conduct', locals: { diff --git a/apps/epp-new/translations/src/en/pages.json b/apps/epp-new/translations/src/en/pages.json index bed22ea..a6864a4 100644 --- a/apps/epp-new/translations/src/en/pages.json +++ b/apps/epp-new/translations/src/en/pages.json @@ -72,6 +72,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", @@ -163,6 +175,9 @@ }, "new-renew-countersignatory-phone-number": { "label": "Phone number" + }, + "new-renew-passport": { + "label": "Image of passport" } }, "complete": { diff --git a/apps/epp-new/views/upload-passport.html b/apps/epp-new/views/upload-passport.html new file mode 100644 index 0000000..af91c28 --- /dev/null +++ b/apps/epp-new/views/upload-passport.html @@ -0,0 +1,58 @@ +{{{{#t}}pages.upload-passport.p1{{/t}} + + {{#t}}pages.upload-passport.link-text{{/t}} + +

+ +
+ +

+ {{#t}}journey.error{{/t}}: {{#t}}validation.file-upload.maxFileSize{{/t}} +

+

+ {{#t}}journey.error{{/t}}: {{#t}}validation.file-upload.fileType{{/t}} +

+ + +
+
+ {{#t}}pages.upload-passport.uploading-document{{/t}} +
+ +
+ +{{^values.new-renew-passport}} +

{{#t}}pages.upload-passport.no-file-uploaded{{/t}}

+{{/values.new-renew-passport}} + +{{#values.new-renew-passport.length}} +

{{#t}}pages.upload-passport.you-have-uploaded{{/t}} {{values.new-renew-passport.length}} {{#t}}pages.upload-passport.files{{/t}}

+ +
+ {{#values.new-renew-passport}} +
+
+ {{name}} +
+ +
+
+ {{/values.new-renew-passport}} +
+ +{{/values.new-renew-passport.length}} + + + + +{{/page-content}} +{{/partials-page}} \ No newline at end of file From 7399c4bd4b53187d7e23530231ea14dd26fc693c Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 7 Feb 2025 09:15:03 +0000 Subject: [PATCH 02/13] EPP-49 retrofit file upload core functionality --- apps/epp-new/index.js | 7 +++++-- apps/epp-new/sections/summary-data-sections.js | 14 ++++++++++++++ apps/epp-new/translations/src/en/validation.json | 3 ++- config.js | 5 +++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/apps/epp-new/index.js b/apps/epp-new/index.js index ffa8a35..6c3feb0 100644 --- a/apps/epp-new/index.js +++ b/apps/epp-new/index.js @@ -227,8 +227,11 @@ module.exports = { } }, '/upload-passport': { - // TODO: Add behaviour and field once EPP-48 is merged - fields: [], + behaviours: [ + SaveDocument('new-renew-passport', 'file-upload'), + RemoveDocument('new-renew-passport') + ], + fields: ['file-upload'], next: '/upload-certificate-conduct', locals: { sectionNo: { diff --git a/apps/epp-new/sections/summary-data-sections.js b/apps/epp-new/sections/summary-data-sections.js index 5c14b6f..d1280c7 100644 --- a/apps/epp-new/sections/summary-data-sections.js +++ b/apps/epp-new/sections/summary-data-sections.js @@ -235,6 +235,20 @@ module.exports = { return documents.map(file => file.name); } + return null; + } + }, + { + step: '/upload-passport', + field: 'new-renew-passport', + parse: (documents, req) => { + if ( + req.sessionModel.get('steps').includes('/upload-passport') && + documents?.length > 0 + ) { + return documents.map(file => file.name); + } + return null; } } diff --git a/apps/epp-new/translations/src/en/validation.json b/apps/epp-new/translations/src/en/validation.json index 03b8234..35538e9 100644 --- a/apps/epp-new/translations/src/en/validation.json +++ b/apps/epp-new/translations/src/en/validation.json @@ -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", + "maxNewRenewPassport" : "You can only upload upto {{maxNewRenewPassport}} files or less. Remove a file before uploading another" }, "new-renew-countersignatory-title": { "required": "Select your countersignatory's title" diff --git a/config.js b/config.js index 50988b6..d0b0a32 100644 --- a/config.js +++ b/config.js @@ -60,6 +60,11 @@ module.exports = { allowMultipleUploads: false, limit: 1, limitValidationError: 'maxNewRenewBritishPassport' + }, + 'new-renew-passport': { + allowMultipleUploads: false, + limit: 1, + limitValidationError: 'maxNewRenewPassport' } } }, From dc7ff1cb5e17c79001e467f896effab953eb8215 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 7 Feb 2025 13:27:54 +0000 Subject: [PATCH 03/13] EPP-49 updated field name --- apps/epp-new/index.js | 4 ++-- apps/epp-new/sections/summary-data-sections.js | 2 +- apps/epp-new/translations/src/en/pages.json | 2 +- .../translations/src/en/validation.json | 2 +- apps/epp-new/views/upload-passport.html | 18 +++++++++--------- config.js | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/epp-new/index.js b/apps/epp-new/index.js index f37d96a..5177953 100644 --- a/apps/epp-new/index.js +++ b/apps/epp-new/index.js @@ -255,8 +255,8 @@ module.exports = { }, '/upload-passport': { behaviours: [ - SaveDocument('new-renew-passport', 'file-upload'), - RemoveDocument('new-renew-passport') + SaveDocument('new-renew-eu-passport', 'file-upload'), + RemoveDocument('new-renew-eu-passport') ], fields: ['file-upload'], next: '/upload-certificate-conduct', diff --git a/apps/epp-new/sections/summary-data-sections.js b/apps/epp-new/sections/summary-data-sections.js index 94e27f0..f4b44a9 100644 --- a/apps/epp-new/sections/summary-data-sections.js +++ b/apps/epp-new/sections/summary-data-sections.js @@ -223,7 +223,7 @@ module.exports = { }, { step: '/upload-passport', - field: 'new-renew-passport', + field: 'new-renew-eu-passport', parse: (documents, req) => { if ( req.sessionModel.get('steps').includes('/upload-passport') && diff --git a/apps/epp-new/translations/src/en/pages.json b/apps/epp-new/translations/src/en/pages.json index 1fdf95c..db11f2c 100644 --- a/apps/epp-new/translations/src/en/pages.json +++ b/apps/epp-new/translations/src/en/pages.json @@ -216,7 +216,7 @@ "new-renew-british-passport": { "label": "Image of passport" }, - "new-renew-passport": { + "new-renew-eu-passport": { "label": "Image of passport" } }, diff --git a/apps/epp-new/translations/src/en/validation.json b/apps/epp-new/translations/src/en/validation.json index 35538e9..8cd28ff 100644 --- a/apps/epp-new/translations/src/en/validation.json +++ b/apps/epp-new/translations/src/en/validation.json @@ -186,7 +186,7 @@ "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", - "maxNewRenewPassport" : "You can only upload upto {{maxNewRenewPassport}} 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" diff --git a/apps/epp-new/views/upload-passport.html b/apps/epp-new/views/upload-passport.html index af91c28..50ea2a1 100644 --- a/apps/epp-new/views/upload-passport.html +++ b/apps/epp-new/views/upload-passport.html @@ -17,7 +17,7 @@

{{#t}}pages.upload-passport.upload-file{{/t}}

{{#t}}journey.error{{/t}}: {{#t}}validation.file-upload.fileType{{/t}}

- +
@@ -26,15 +26,15 @@

{{#t}}pages.upload-passport.upload-file{{/t}}

-{{^values.new-renew-passport}} +{{^values.new-renew-eu-passport}}

{{#t}}pages.upload-passport.no-file-uploaded{{/t}}

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

{{#t}}pages.upload-passport.you-have-uploaded{{/t}} {{values.new-renew-passport.length}} {{#t}}pages.upload-passport.files{{/t}}

+{{#values.new-renew-eu-passport.length}} +

{{#t}}pages.upload-passport.you-have-uploaded{{/t}} {{values.new-renew-eu-passport.length}} {{#t}}pages.upload-passport.files{{/t}}

- {{#values.new-renew-passport}} + {{#values.new-renew-eu-passport}}
{{name}} @@ -44,13 +44,13 @@

{{#t}}pages.upload-passport.you-have-uploaded{{/t}}

- {{/values.new-renew-passport}} + {{/values.new-renew-eu-passport}}
-{{/values.new-renew-passport.length}} +{{/values.new-renew-eu-passport.length}} - diff --git a/config.js b/config.js index d0b0a32..fb6395f 100644 --- a/config.js +++ b/config.js @@ -61,10 +61,10 @@ module.exports = { limit: 1, limitValidationError: 'maxNewRenewBritishPassport' }, - 'new-renew-passport': { + 'new-renew-eu-passport': { allowMultipleUploads: false, limit: 1, - limitValidationError: 'maxNewRenewPassport' + limitValidationError: 'maxNewRenewEuPassport' } } }, From b24014454595223b13bc93fe989a04f517c58dac Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 7 Feb 2025 15:10:27 +0000 Subject: [PATCH 04/13] EPP-49 confirm page condition corrected --- apps/epp-new/sections/summary-data-sections.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/epp-new/sections/summary-data-sections.js b/apps/epp-new/sections/summary-data-sections.js index f4b44a9..3b17c1e 100644 --- a/apps/epp-new/sections/summary-data-sections.js +++ b/apps/epp-new/sections/summary-data-sections.js @@ -45,8 +45,7 @@ module.exports = { field: 'othernames', changeLink: '/new-and-renew/other-names-summary', parse: (list, req) => { - if (req.sessionModel.get('new-renew-other-names') === 'no' || - !req.sessionModel.get('steps').includes('/other-names-summary')) { + if (req.sessionModel.get('new-renew-other-names') === 'no') { return null; } return req.sessionModel.get('othernames')?.aggregatedValues.length > 0 ? From e84b7b3559131ad917930526810ba11bcc986dde Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 7 Feb 2025 15:23:20 +0000 Subject: [PATCH 05/13] EPP-49 use util to format date --- apps/epp-new/sections/summary-data-sections.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/apps/epp-new/sections/summary-data-sections.js b/apps/epp-new/sections/summary-data-sections.js index 3b17c1e..77502de 100644 --- a/apps/epp-new/sections/summary-data-sections.js +++ b/apps/epp-new/sections/summary-data-sections.js @@ -1,22 +1,12 @@ 'use strict'; -const moment = require('moment'); - const config = require('../../../config'); +const { getFormattedDate } = require("../../../utilities/helpers"); const dateFormatter = new Intl.DateTimeFormat( config.dateLocales, config.dateFormat ); -const dateParser = value => { - if(value && moment(value, 'DD MMMM YYYY').isValid()) { - return dateFormatter.format( - new Date(value) - ); - } - return value; -}; - module.exports = { 'your-name': { steps: [ @@ -54,7 +44,7 @@ module.exports = { field.field === 'new-renew-other-name-start-date' || field.field === 'new-renew-other-name-stop-date' ) { - field.parsed = dateParser(field.parsed); + field.parsed = getFormattedDate(field.parsed); } return field.parsed; }).filter(Boolean).join('\n')).join('\n \n') : null; From 82db44f66d9400eaed48e44383e328c3d94e0cb7 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 7 Feb 2025 15:49:31 +0000 Subject: [PATCH 06/13] EPP-49 fixed linting issue --- apps/epp-new/sections/summary-data-sections.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/epp-new/sections/summary-data-sections.js b/apps/epp-new/sections/summary-data-sections.js index 77502de..ec9deca 100644 --- a/apps/epp-new/sections/summary-data-sections.js +++ b/apps/epp-new/sections/summary-data-sections.js @@ -1,7 +1,7 @@ 'use strict'; const config = require('../../../config'); -const { getFormattedDate } = require("../../../utilities/helpers"); +const { getFormattedDate } = require('../../../utilities/helpers'); const dateFormatter = new Intl.DateTimeFormat( config.dateLocales, config.dateFormat From 510eed52a8e537814426cad682f6732843de51fe Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Mon, 10 Feb 2025 15:13:30 +0000 Subject: [PATCH 07/13] EPP-49 format file upload docs on confirm page --- apps/epp-new/sections/summary-data-sections.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/epp-new/sections/summary-data-sections.js b/apps/epp-new/sections/summary-data-sections.js index ec9deca..5a4db8b 100644 --- a/apps/epp-new/sections/summary-data-sections.js +++ b/apps/epp-new/sections/summary-data-sections.js @@ -204,7 +204,7 @@ module.exports = { .includes('/upload-british-passport') && documents?.length > 0 ) { - return documents.map(file => file.name); + return documents.map(file => file?.name)?.join('\n\n'); } return null; From 86cec33f07e8c6b6ac12d392fdbce816be34eca7 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Mon, 10 Feb 2025 15:49:55 +0000 Subject: [PATCH 08/13] EPP-49 updated files uploaded label --- apps/epp-new/translations/src/en/pages.json | 3 +-- apps/epp-new/views/upload-passport.html | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/epp-new/translations/src/en/pages.json b/apps/epp-new/translations/src/en/pages.json index db11f2c..8e2a9d4 100644 --- a/apps/epp-new/translations/src/en/pages.json +++ b/apps/epp-new/translations/src/en/pages.json @@ -96,8 +96,7 @@ "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)", + "files-uploaded": "Files uploaded", "uploading-document": "Uploading your document..." }, "confirm": { diff --git a/apps/epp-new/views/upload-passport.html b/apps/epp-new/views/upload-passport.html index 50ea2a1..9140e01 100644 --- a/apps/epp-new/views/upload-passport.html +++ b/apps/epp-new/views/upload-passport.html @@ -31,7 +31,7 @@

{{#t}}pages.upload-passport.no-file-uploaded{{/t}}{{#t}}pages.upload-passport.you-have-uploaded{{/t}} {{values.new-renew-eu-passport.length}} {{#t}}pages.upload-passport.files{{/t}}

+

{{#t}}pages.upload-passport.files-uploaded{{/t}}

{{#values.new-renew-eu-passport}} From ab939928ba4989d2ef9b5444fabb3769e652b893 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Mon, 10 Feb 2025 19:19:26 +0000 Subject: [PATCH 09/13] EPP-49 format attachments on confirm page --- apps/epp-new/sections/summary-data-sections.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/epp-new/sections/summary-data-sections.js b/apps/epp-new/sections/summary-data-sections.js index 5a4db8b..b720a53 100644 --- a/apps/epp-new/sections/summary-data-sections.js +++ b/apps/epp-new/sections/summary-data-sections.js @@ -218,7 +218,7 @@ module.exports = { req.sessionModel.get('steps').includes('/upload-passport') && documents?.length > 0 ) { - return documents.map(file => file.name); + return documents.map(file => file?.name)?.join('\n\n'); } return null; From f17fa20842c7f3fee71eff5150e4bdf94299a887 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Tue, 11 Feb 2025 17:03:19 +0000 Subject: [PATCH 10/13] EPP-49 resolve conflicts --- config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 439dabb..6e4461d 100644 --- a/config.js +++ b/config.js @@ -66,11 +66,11 @@ module.exports = { limit: 1, limitValidationError: 'maxAmendBritishPassport' }, - 'new-renew-eu-passport': { + 'new-renew-eu-passport': { allowMultipleUploads: false, limit: 1, limitValidationError: 'maxNewRenewEuPassport' - } + } } }, sectionDetails: { From ea471494b8d6ebc15f66ffbd788e0249edb0ead7 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Tue, 11 Feb 2025 17:29:58 +0000 Subject: [PATCH 11/13] EPP-49 updated journey content for all flows --- apps/epp-amend/translations/src/en/journey.json | 3 ++- apps/epp-new/translations/src/en/journey.json | 3 ++- apps/epp-renew/translations/src/en/journey.json | 3 ++- apps/epp-replace/translations/src/en/journey.json | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/epp-amend/translations/src/en/journey.json b/apps/epp-amend/translations/src/en/journey.json index bc0c359..de42492 100644 --- a/apps/epp-amend/translations/src/en/journey.json +++ b/apps/epp-amend/translations/src/en/journey.json @@ -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" } diff --git a/apps/epp-new/translations/src/en/journey.json b/apps/epp-new/translations/src/en/journey.json index 523f7e0..b7053b0 100644 --- a/apps/epp-new/translations/src/en/journey.json +++ b/apps/epp-new/translations/src/en/journey.json @@ -2,5 +2,6 @@ "header": "Explosives precursors and poisons licensing", "phase": "beta", "serviceNameNew": "Apply for an explosives and precursor chemicals licence", - "serviceNameRenew": "Renew an explosives and precursor chemicals licence" + "serviceNameRenew": "Renew an explosives and precursor chemicals licence", + "error": "Error" } diff --git a/apps/epp-renew/translations/src/en/journey.json b/apps/epp-renew/translations/src/en/journey.json index d739219..bf26707 100644 --- a/apps/epp-renew/translations/src/en/journey.json +++ b/apps/epp-renew/translations/src/en/journey.json @@ -1,5 +1,6 @@ { "header": "Explosives precursors and poisons licensing", "phase": "beta", - "serviceName": "Renew an explosives and precursor chemicals licence" + "serviceName": "Renew an explosives and precursor chemicals licence", + "error": "Error" } diff --git a/apps/epp-replace/translations/src/en/journey.json b/apps/epp-replace/translations/src/en/journey.json index e641a23..83a464c 100644 --- a/apps/epp-replace/translations/src/en/journey.json +++ b/apps/epp-replace/translations/src/en/journey.json @@ -1,5 +1,6 @@ { "header": "Explosives precursors and poisons licensing", "phase": "beta", - "serviceName": "Replace an explosives and precursor chemicals licence" + "serviceName": "Replace an explosives and precursor chemicals licence", + "error": "Error" } From 1c989548dd4790d1302a1fd2faea7001b4352002 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Wed, 12 Feb 2025 10:14:09 +0000 Subject: [PATCH 12/13] EPP-49 updated confirm page label --- apps/epp-new/translations/src/en/pages.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/epp-new/translations/src/en/pages.json b/apps/epp-new/translations/src/en/pages.json index f297f76..c3346c3 100644 --- a/apps/epp-new/translations/src/en/pages.json +++ b/apps/epp-new/translations/src/en/pages.json @@ -222,10 +222,10 @@ "label": "Driving Licence" }, "new-renew-british-passport": { - "label": "Image of passport" + "label": "British passport attachment" }, "new-renew-eu-passport": { - "label": "Image of passport" + "label": "Passport attachment" } }, "complete": { From d4b196d95d12888678fa006c0db7abbb419b5066 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Wed, 12 Feb 2025 11:34:56 +0000 Subject: [PATCH 13/13] EPP-49 removed error key from amend journey --- apps/epp-amend/translations/src/en/journey.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/epp-amend/translations/src/en/journey.json b/apps/epp-amend/translations/src/en/journey.json index de42492..bc0c359 100644 --- a/apps/epp-amend/translations/src/en/journey.json +++ b/apps/epp-amend/translations/src/en/journey.json @@ -1,6 +1,5 @@ { "header": "Explosives precursors and poisons licensing", "phase": "beta", - "serviceName": "Amend an explosives and precursor chemicals licence", - "error": "Error" + "serviceName": "Amend an explosives and precursor chemicals licence" }