Skip to content

Commit

Permalink
[ASL-4413] HBA upload functionality in PPL transfer journeys (#1577)
Browse files Browse the repository at this point in the history
* Latest functional and content changes towards ASL-4413, including those cherry picked from commit b77a538

* - Content updates for various journey points of establishment transfer, as set out in the copy deck, as part of ASL-4413
- Content updates for various journey points of change in project licence holder, as set out in the copy deck, as part of ASL-4413

* transfer anf amendment success page content changed.

* action = update for license holder change.

* More content updates to journey point 5 for both journeys (ASL-4421)

* redirecting to upload-hba.jsx page.

* content added proposed PPL license holder, for confirm-hba.jsx page.

* content updated for confirm-hba page.

* confirm-hba.jsx warning text content chanage.

* switch btw transfer/amendment journey content update.

* confirm-hba.jsx content changed for transfer and amendment journey done.

* confirm-hba.jsx content warning to use their own json data for amendment/ transfer journey.

* task view page content update on activity comp, reworded.

* task view pages content updated for ProfileDetails.

* props added to ProfileLink.

* refactored task-details & extend logic, lint fixes.

* existing test typo fixed for this branch.

* test aded for upload-hba transfer journey.

* transfer and amendment upload-jsx to use seperate content intro keys.

* radio button for confirm-hba.jsx content overriden.

* test passing, lint passing. DONE

* Update view.js - remove console.log()

* Provisionally adding back Applicant label

---------

Co-authored-by: Ishaq <[email protected]>
  • Loading branch information
edemirbag and farrukhishaq authored May 15, 2024
1 parent 3248e91 commit d7116fe
Show file tree
Hide file tree
Showing 20 changed files with 224 additions and 60 deletions.
2 changes: 1 addition & 1 deletion pages/common/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ module.exports = {
},
success: {
whatNext: {
title: 'What happens next?'
title: 'What happens next'
}
},
notifications: {
Expand Down
38 changes: 33 additions & 5 deletions pages/success/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,21 @@ module.exports = {
title: 'Approved'
},
whatNext: {
body: `This request has been approved.`,
body: ``,
internal: 'The relevant people have been emailed.',
external: ''
},
taskLink: {
before: 'You can ',
linkText: 'view the history of this request.'
before: '',
linkText: 'View history of application'
}
},
'rejected': {
panel: {
title: 'Rejected'
title: 'Refused'
},
whatNext: {
body: `This request has been rejected.`,
body: `This request has been refused.`,
internal: 'The relevant people have been emailed.'
},
taskLink: {
Expand Down Expand Up @@ -205,5 +205,33 @@ The relevant people have been emailed.`
before: 'You can ',
linkText: 'view the history of this request.'
}
},
'licence-amended': {
panel: {
title: 'Licence amended'
},
whatNext: {
body: `This request has been approved.`,
internal: 'The relevant people have been emailed.',
external: ''
},
taskLink: {
before: 'You can ',
linkText: 'view the history of this request.'
}
},
'pil-transfer': {
panel: {
title: 'Transfer approved'
},
whatNext: {
body: `This request has been approved.`,
internal: 'The relevant people have been emailed.',
external: ''
},
taskLink: {
before: 'You can ',
linkText: 'view the history of this request.'
}
}
};
12 changes: 12 additions & 0 deletions pages/success/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const getTaskLabel = task => {
case 'project':
if (action === 'grant-ra') {
return 'Retrospective assessment';
} else if (action === 'transfer') {
return 'Project licence transfer';
} else if (action === 'update') {
return 'Project licence amendment';
}
return `${upperFirst(model)} ${taskType}`;

Expand Down Expand Up @@ -96,6 +100,14 @@ const getSuccessType = task => {
if (['discarded-by-applicant', 'discarded-by-asru'].includes(task.status)) {
return 'discarded';
}
// HBA amendment licence holder content change on success
if (task?.type === 'amendment' && task?.data?.model === 'project') {
return 'licence-amended';
}
// HBA PPL transfer establishment content change on success
if (task?.type === 'transfer' && task?.data?.model === 'project') {
return 'pil-transfer';
}

return task.status;
};
Expand Down
35 changes: 20 additions & 15 deletions pages/task/content/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ module.exports = {
},
'returned-to-applicant': {
state: 'Returned',
action: 'Return to applicant',
action: {
default: 'Return with comments',
transfer: 'Return transfer request with comments',
amendment: 'Return amendment with comments'
},
hint: {
application: 'The application will be returned to the applicant with your comments.',
amendment: 'The amendment will be returned to the applicant with your comments.',
revocation: 'The revocation request will be returned to the applicant with your comments.',
transfer: 'The transfer request will be returned to the applicant with your comments.',
review: 'The review request will be returned to the applicant with your comments.',
ra: 'The assessment will be returned to the applicant with your comments.'
application: 'Return application with comments.',
revocation: 'Return revocation request with comments.',
review: 'Return review request with comments.',
ra: 'Return assessment with comments.'
},
confirmTitle: {
transfer: 'Return transfer request'
},
log: 'Returned by',
currentlyWith: '**Currently with:** Applicant'
Expand Down Expand Up @@ -236,20 +241,20 @@ module.exports = {
rejected: {
state: 'Rejected',
action: {
application: 'Reject application',
amendment: 'Reject amendment',
revocation: 'Reject revocation',
transfer: 'Reject transfer request',
ra: 'Reject retrospective assessment'
application: 'Refuse application',
amendment: 'Refuse amendment',
revocation: 'Refuse revocation',
transfer: 'Refuse transfer request',
ra: 'Refuse retrospective assessment'
},
hint: {
application: 'The applicant will need to create a new application to apply for this type of licence in the future.',
amendment: 'The applicant will need to create a new amendment to submit these changes again.',
amendment: 'The applicant will need to create a new amendment in the future, if required.',
revocation: 'The applicant will need to create a new revocation request for this licence to be revoked.',
transfer: 'The applicant will need to create a new transfer request.',
transfer: 'The applicant will need to create a new transfer request in the future, if required.',
ra: 'The applicant will need to create a new assessment.'
},
log: 'Rejected by'
log: 'Refused by'
},
'intention-to-refuse': {
state: 'Returned',
Expand Down
5 changes: 3 additions & 2 deletions pages/task/read/content/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module.exports = {
label: ''
},
comment: {
label: '{{#commentRequired}}Reason for {{commentLabel}}{{/commentRequired}}{{^commentRequired}}Remarks (optional){{/commentRequired}}',
hint: 'Your {{#commentRequired}}reason{{/commentRequired}}{{^commentRequired}}remarks{{/commentRequired}} will be recorded and visible to relevant establishment and Home Office personnel.'
label: '{{#commentRequired}}Reason for {{commentLabel}}{{/commentRequired}}{{^commentRequired}}Comments (optional){{/commentRequired}}',
hint: 'Your {{#commentRequired}}reason{{/commentRequired}}{{^commentRequired}}comments{{/commentRequired}} will be recorded and visible to relevant establishment and Home Office staff.'
},
assignedTo: {
label: 'Assign to:'
Expand Down Expand Up @@ -109,6 +109,7 @@ module.exports = {
global: 'Name',
applicant: 'Applicant',
licenceHolder: 'Licence holder',
amendment: 'Current licence holder',
pelh: 'Establishment licence holder',
nprc: 'Named person responsible for compliance'
}
Expand Down
20 changes: 17 additions & 3 deletions pages/task/read/content/confirm-hba.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,37 @@ module.exports = merge({}, baseContent, {
establishment: {
label: 'Establishment:'
},
currentEstablishment: {
label: 'Current establishment:'
},
proposedEstablishment: {
label: 'Proposed establishment:'
},
applicant: {
label: 'Applicant:'
},
pplHolder: {
label: 'PPL holder:'
},
proposedApplicant: {
label: 'Proposed PPL licence holder:'
},
hbaFilename: {
label: 'Selected HBA file:',
download: 'Download file'
},
confirmHba: {
label: 'What do you want to do?',
options: {
yes: 'Confirm and continue to grant or amend licence',
yes: 'Confirm and continue to amend licence',
no: 'Discard selected file and choose another'
}
}
},
warning:
'Once confirmed, this HBA file in ASPeL (not SharePoint) will be the single point of reference for this {{type}}, for future assessment and audit purposes.',
warning: {
transfer: 'Once confirmed, this HBA file in ASPeL (not SharePoint) will be the single point of reference for this transfer request, for future assessment and audit purposes.',
amendment: 'Once confirmed, this HBA file in ASPeL (not SharePoint) will be the single point of reference for this amendment, for future assessment and audit purposes.'
},
errors: {
confirmHba: {
required: 'Select an option',
Expand Down
2 changes: 1 addition & 1 deletion pages/task/read/content/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = merge({}, baseContent, {
'awerb-no-review-reason'
])
},
hba: 'Selected harm benefit analysis file: ',
hba: 'Selected HBA file: ',
declaration: {
title: 'Declaration',
endorsed: {
Expand Down
3 changes: 2 additions & 1 deletion pages/task/read/content/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ module.exports = {
resolved: {
hint: {
application: 'Upload the harm benefit analysis and a new licence will be granted.',
amendment: 'Upload the harm benefit analysis file and the existing licence will be updated.'
amendment: 'Upload the harm benefit analysis file and the existing licence will be updated.',
transfer: 'Upload the harm benefit analysis and the licence will be transferred to the proposed establishment.'
}
}
},
Expand Down
5 changes: 4 additions & 1 deletion pages/task/read/content/upload-hba.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ const tasks = require('../../content/tasks');
module.exports = merge({}, baseContent, {
tasks,
title: 'Upload harm benefit analysis file',
intro: `To {{action}} this licence you must upload the PPL assessment form containing the harm benefit analysis (HBA) for this {{type}}.
intro: `To {{action}} the licence you must upload the PPL assessment form containing the harm benefit analysis (HBA) for this {{type}}.
The HBA will be visible to ASRU only.`,
transferIntro: `To approve this transfer you must upload the PPL assessment form containing the harm benefit analysis (HBA) for this request.
The HBA will be visible to ASRU.`,
fields: {
upload: {
label: 'Upload {{#model.hbaToken}}new {{/model.hbaToken}}file',
Expand Down
24 changes: 24 additions & 0 deletions pages/task/read/routers/confirm-hba.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ const { get } = require('lodash');

module.exports = (config) => {
const app = Router({ mergeParams: true });
function confirmHbaSchema(taskType) {
let actionMessage = '';
switch (taskType) {
case 'grant':
actionMessage = 'Confirm and continue to grant licence';
break;
case 'transfer':
actionMessage = 'Confirm and continue to approve transfer';
break;
case 'amendment':
actionMessage = 'Confirm and continue to amend licence';
break;
}
return actionMessage;
}

app.get('/', async (req, res, next) => {
const { hbaToken, hbaFilename } = req.task.data.meta;
Expand All @@ -26,9 +41,18 @@ module.exports = (config) => {
console.error('No HBA detected, redirecting back to task page');
return res.redirect(req.buildRoute('task.read'));
}

// content overiden for radio buttons.
schema.confirmHba.options.forEach(option => {
if (option.value === 'yes') {
option.label = confirmHbaSchema(req.task.type);
}
});

next();
});

// this middleware is used to create radio buttons...
app.use(
form({
schema,
Expand Down
4 changes: 2 additions & 2 deletions pages/task/read/routers/confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = (config) => {

const values = get(req, `session.form[${req.task.id}].values`, {});
const status = values.status;
if (model === 'project' && action === 'grant' && status === 'resolved') {
if (model === 'project' && ['grant', 'transfer', 'update'].includes(action) && status === 'resolved') {
const { hbaToken, hbaFilename } = req.task.data.meta;

if (!hbaToken) {
Expand Down Expand Up @@ -80,7 +80,7 @@ module.exports = (config) => {
set(res.locals.static, 'inspector', req.user.profile);
set(
res.locals.static,
'content.status.intention-to-refuse.action',
'content.status.intention-to-refuse.action.default',
'Give reason for refusal'
);
}
Expand Down
2 changes: 1 addition & 1 deletion pages/task/read/routers/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ module.exports = () => {

const { status } = req.form.values;

if (model === 'project' && action === 'grant' && status === 'resolved') {
if (model === 'project' && ['grant', 'transfer', 'update'].includes(action) && status === 'resolved') {
return res.redirect(req.buildRoute('task.read.uploadHba'));
}

Expand Down
4 changes: 2 additions & 2 deletions pages/task/read/views/adjusted-wording.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const getActionAdjustedWording = (action, type) => {
};

const getTypeAdjustedWording = (action, type) => {
return isAmendment(action, type) ? 'amendment' : 'application';
return isAmendment(action, type) ? 'amendment' : 'transfer';
};

const isAmendment = (action, type) => {
return action === 'grant' && type === 'amendment';
return ['update', 'grant'].includes(action) && type === 'amendment';
};

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion pages/task/read/views/components/activity-log.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function Comment({ changedBy, comment }) {
comment && (
<div className="comment">
{changedBy.id && (
<p className="author">{`${changedBy.firstName} ${changedBy.lastName} remarked:`}</p>
<p className="author">{`${changedBy.firstName} ${changedBy.lastName} commented:`}</p>
)}
<Inset>
<Markdown className="content">{comment}</Markdown>
Expand Down
4 changes: 3 additions & 1 deletion pages/task/read/views/components/task-details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function ProjectTitle({ project, establishment }) {
function ProfileLink({ profile, establishment, type }) {
const { isAsru } = useSelector(state => state.static);
const label = `${profile.firstName} ${profile.lastName}`;

return (
<Fragment>
<dt><Snippet>{`profileLink.${type}`}</Snippet></dt>
Expand Down Expand Up @@ -107,7 +108,8 @@ function ProjectDetails({ task }) {
const version = useSelector(state => state.static.version);
const establishment = useSelector(state => state.static.establishment) || task.data.establishment;
const isApplication = task.type === 'application';
const profileType = isApplication ? 'applicant' : 'licenceHolder';
const isAmendment = task.type === 'amendment';
const profileType = isApplication ? 'applicant' : isAmendment ? 'amendment' : 'licenceHolder';

const profile = isApplication
? project.licenceHolder
Expand Down
Loading

0 comments on commit d7116fe

Please sign in to comment.