-
Notifications
You must be signed in to change notification settings - Fork 2
HDPI-5180: Create gen app skeleton journey #930
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
9e2d78f
HDPI-5180: Create gen app skeleton journey
scottstewart-sl 8a94076
Merge remote-tracking branch 'origin/master' into HDPI-5180_gen_app_s…
scottstewart-sl c3882a0
Merge remote-tracking branch 'origin/master' into HDPI-5180_gen_app_s…
scottstewart-sl 55690ec
HDPI-5180: Update CYA page for gen apps
scottstewart-sl 0b59970
HDPI-5180: Fix lint issues
scottstewart-sl 13fbd73
HDPI-5180: Fix unit test following property name change
scottstewart-sl 378da77
HDPI-5180: Use Continue button for now
scottstewart-sl 1a2adc3
HDPI-5180: Fix accidental space
scottstewart-sl ee93665
HDPI-5180: Remove Suspend as is no longer in scope
scottstewart-sl ee0c5d4
Merge branch 'master' into HDPI-5180_gen_app_skeleton
scottstewart-sl ff8cbf2
HDPI-5180: Resolve PR comments
scottstewart-sl 5c8d84c
Merge branch 'HDPI-5180_gen_app_skeleton' of github.com:hmcts/pcs-fro…
scottstewart-sl 7868fa8
Merge branch 'master' into HDPI-5180_gen_app_skeleton
scottstewart-sl e3f7e04
HDPI-5180: Use entity encoding in another HTML page title
scottstewart-sl 735f105
Merge remote-tracking branch 'origin/master' into HDPI-5180_gen_app_s…
scottstewart-sl 3fdd1b5
HDPI-5180: Adding placeholder banner to pages
scottstewart-sl 8a27cf6
HDPI-5180: Update brace-expansion to resolve CVE
scottstewart-sl 4064415
Merge remote-tracking branch 'origin/master' into HDPI-5180_gen_app_s…
scottstewart-sl ff80075
Merge branch 'master' into HDPI-5180_gen_app_skeleton
scottstewart-sl b929a54
Merge branch 'master' into HDPI-5180_gen_app_skeleton
scottstewart-sl ac758c9
Merge branch 'master' into HDPI-5180_gen_app_skeleton
scottstewart-sl e7e89b4
HDPI-5180: Fix merge issue
scottstewart-sl b692503
Merge branch 'master' into HDPI-5180_gen_app_skeleton
scottstewart-sl ee103ba
Merge branch 'master' into HDPI-5180_gen_app_skeleton
srinijg 8bd26b6
Merge branch 'master' into HDPI-5180_gen_app_skeleton
scottstewart-sl aa0a479
Merge branch 'master' into HDPI-5180_gen_app_skeleton
srinijg 151a179
Merge branch 'master' into HDPI-5180_gen_app_skeleton
srinijg 253c858
Merge branch 'master' into HDPI-5180_gen_app_skeleton
srinijg 7f55d97
Merge branch 'master' into HDPI-5180_gen_app_skeleton
srinijg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/assets/locales/cy/makeAnApplication/checkYourAnswers.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "pageTitle": "cyCheck your answers", | ||
| "caption": "cyMake an application", | ||
| "heading": "cyCheck your answers (placeholder)", | ||
| "buttons": { | ||
| "submitApplication": "cySubmit application" | ||
| }, | ||
| "answers": { | ||
| "chooseAnApplication": { | ||
| "label": "cyType of application", | ||
| "changeHint": "cyChange type of application", | ||
| "options": { | ||
| "ADJOURN": "cyAsk to adjourn (delay) the hearing", | ||
| "SET_ASIDE": "cyAsk the court to change (set aside) their decision to evict you", | ||
| "SOMETHING_ELSE": "cySomething else" | ||
| } | ||
| } | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
src/main/assets/locales/cy/makeAnApplication/chooseAnApplication.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "pageTitle": "cyChoose an application", | ||
| "caption": "cyMake an application", | ||
| "heading": "cyChoose an application", | ||
| "question": "cyWhat do you want to apply for?", | ||
| "hintText": "cySome optional hint text here (placeholder)", | ||
| "options": { | ||
| "adjourn": { | ||
| "label": "cyAsk to adjourn (delay) the hearing" | ||
| }, | ||
| "setAside": { | ||
| "label": "cyAsk the court to change (set aside) their decision to evict you" | ||
| }, | ||
| "somethingElse": { | ||
| "label": "cySomething else" | ||
| } | ||
| }, | ||
| "errors": { | ||
| "typeOfApplication": "cyYou must select an type of application to apply for" | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
src/main/assets/locales/en/makeAnApplication/checkYourAnswers.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "pageTitle": "Check your answers", | ||
| "caption": "Make an application", | ||
| "heading": "Check your answers", | ||
| "buttons": { | ||
| "submitApplication": "Submit application" | ||
| }, | ||
| "answers": { | ||
| "chooseAnApplication": { | ||
| "label": "Type of application", | ||
| "changeHint": "Change type of application", | ||
| "options": { | ||
| "ADJOURN": "Ask to adjourn (delay) the hearing", | ||
| "SET_ASIDE": "Ask the court to change (set aside) their decision to evict you", | ||
| "SOMETHING_ELSE": "Something else" | ||
| } | ||
| } | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
src/main/assets/locales/en/makeAnApplication/chooseAnApplication.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "pageTitle": "Choose an application", | ||
| "caption": "Make an application", | ||
| "heading": "Choose an application", | ||
| "question": "What do you want to apply for?", | ||
| "hintText": "Some optional hint text here (placeholder)", | ||
| "options": { | ||
| "adjourn": { | ||
| "label": "Ask to adjourn (delay) the hearing" | ||
| }, | ||
| "setAside": { | ||
| "label": "Ask the court to change (set aside) their decision to evict you" | ||
| }, | ||
| "somethingElse": { | ||
| "label": "Something else" | ||
| } | ||
| }, | ||
| "errors": { | ||
| "typeOfApplication": "You must select an type of application to apply for" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/steps/make-an-application/check-your-answers/checkYourAnswers.njk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| {% extends "stepsTemplate.njk" %} | ||
| {% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %} | ||
| {% from "govuk/components/button/macro.njk" import govukButton %} | ||
| {% from "govuk/components/summary-list/macro.njk" import govukSummaryList %} | ||
| {% from "macros/csrf.njk" import csrfProtection %} | ||
|
|
||
| {# GOV.UK pattern: [Browser title] - HM Courts & Tribunals Service – GOV.UK #} | ||
| {% block pageTitle %}{{ t('pageTitle') }} – HM Courts & Tribunals Service – GOV.UK{% endblock %} | ||
|
|
||
| {% block mainContent %} | ||
| {% if errorSummary %} | ||
| {{ govukErrorSummary(errorSummary) }} | ||
| {% endif %} | ||
|
|
||
| <span class="govuk-caption-xl">{{ caption }}</span> | ||
| <h1 class="govuk-heading-l">{{ heading }}</h1> | ||
|
|
||
| <div class="govuk-notification-banner" role="region" aria-labelledby="experimental-banner"> | ||
| <div class="govuk-notification-banner__content"> | ||
| <p class="govuk-notification-banner__heading" id="experimental-banner"> | ||
| Placeholder page | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| {{ govukSummaryList(summaryData) }} | ||
|
|
||
| <form method="post" action="{{ url }}" novalidate> | ||
| <div class="govuk-button-group"> | ||
| {{ govukButton({ | ||
| text: buttons.submitApplication, | ||
| attributes: { type: 'submit', name: 'action', value: 'submit' } | ||
| }) }} | ||
| </div> | ||
|
|
||
| {{ csrfProtection(csrfToken) }} | ||
| </form> | ||
| {% endblock %} | ||
|
|
95 changes: 95 additions & 0 deletions
95
src/main/steps/make-an-application/check-your-answers/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import type { Request, Response } from 'express'; | ||
| import type { TFunction } from 'i18next'; | ||
|
|
||
| import { CitizenGenAppRequest } from '../../../interfaces/ccdCase.interface'; | ||
| import type { StepDefinition } from '../../../interfaces/stepFormData.interface'; | ||
| import { createGetController, createStepNavigation, getTranslationFunction } from '../../../modules/steps'; | ||
| import { getDashboardUrl } from '../../../routes/dashboard'; | ||
| import { ccdCaseService } from '../../../services/ccdCaseService'; | ||
| import { MAKE_AN_APPLICATION_ROUTE, flowConfig } from '../flow.config'; | ||
|
|
||
| const STEP_NAME = 'check-your-answers'; | ||
| const stepNavigation = createStepNavigation(flowConfig); | ||
|
|
||
| export const step: StepDefinition = { | ||
| url: `${MAKE_AN_APPLICATION_ROUTE}/check-your-answers`, | ||
| name: STEP_NAME, | ||
| view: 'make-an-application/check-your-answers/checkYourAnswers.njk', | ||
| stepDir: __dirname, | ||
| getController: () => { | ||
| return createGetController( | ||
| 'make-an-application/check-your-answers/checkYourAnswers.njk', | ||
| STEP_NAME, | ||
| stepNavigation, | ||
| (req: Request) => { | ||
| const t: TFunction = getTranslationFunction(req, STEP_NAME, ['common']); | ||
|
|
||
| const formData = req.session.formData; | ||
|
|
||
| if (!formData) { | ||
| throw Error('No existing formData in session'); | ||
| } | ||
|
|
||
| const typeOfApplication = formData['choose-an-application']['typeOfApplication']; | ||
|
|
||
| return { | ||
| summaryData: { | ||
| rows: [ | ||
| { | ||
| key: { | ||
| text: t('answers.chooseAnApplication.label'), | ||
| }, | ||
| value: { | ||
| text: t(`answers.chooseAnApplication.options.${typeOfApplication}`), | ||
|
paddy-hmcts marked this conversation as resolved.
|
||
| }, | ||
| actions: { | ||
| items: [ | ||
| { | ||
| href: './choose-an-application', | ||
| text: t('change'), | ||
|
paddy-hmcts marked this conversation as resolved.
|
||
| visuallyHiddenText: t('answers.chooseAnApplication.changeHint'), | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
| }, | ||
| 'makeAnApplication' | ||
| ); | ||
| }, | ||
| postController: { | ||
| post: async (req: Request, res: Response) => { | ||
| const formData = req.session.formData; | ||
|
|
||
| const ccdCase = res.locals.validatedCase; | ||
|
scottstewart-sl marked this conversation as resolved.
|
||
| if (!ccdCase) { | ||
| throw Error('No existing case details in session'); | ||
| } | ||
|
|
||
| if (!formData) { | ||
| throw Error('No existing formData in session'); | ||
| } | ||
|
|
||
| const citizenGenAppRequest: CitizenGenAppRequest = { | ||
| applicationType: formData['choose-an-application']['typeOfApplication'], | ||
| }; | ||
|
|
||
| await ccdCaseService.submitGeneralApplication(req.session?.user?.accessToken, { | ||
| id: ccdCase.id, | ||
| data: { | ||
| citizenGenAppRequest, | ||
| }, | ||
| }); | ||
|
|
||
| const redirectPath = getDashboardUrl(ccdCase.id); | ||
|
|
||
| if (!redirectPath) { | ||
| return res.status(500).send('Unable to determine next step'); | ||
| } | ||
|
|
||
| res.redirect(303, redirectPath); | ||
| }, | ||
| }, | ||
| }; | ||
46 changes: 46 additions & 0 deletions
46
src/main/steps/make-an-application/choose-an-application/chooseAnApplication.njk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| {% extends "stepsTemplate.njk" %} | ||
| {% from "govuk/components/button/macro.njk" import govukButton %} | ||
| {% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %} | ||
| {% from "govuk/components/radios/macro.njk" import govukRadios %} | ||
| {% from "macros/csrf.njk" import csrfProtection %} | ||
|
|
||
| {# GOV.UK pattern: [Browser title] - HM Courts & Tribunals Service – GOV.UK #} | ||
| {% block pageTitle %}{{ pageTitle }} – HM Courts & Tribunals Service – GOV.UK{% endblock %} | ||
|
|
||
| {% block mainContent %} | ||
| {% if errorSummary %} | ||
| {{ govukErrorSummary(errorSummary) }} | ||
| {% endif %} | ||
|
|
||
| <span class="govuk-caption-xl">{{ caption }}</span> | ||
| <h1 class="govuk-heading-l">{{ heading }}</h1> | ||
|
|
||
| <div class="govuk-notification-banner" role="region" aria-labelledby="experimental-banner"> | ||
| <div class="govuk-notification-banner__content"> | ||
| <p class="govuk-notification-banner__heading" id="experimental-banner"> | ||
| Placeholder page | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| <form method="post" action="{{ url }}" novalidate> | ||
|
|
||
| {% for field in fields %} | ||
| {% if field.componentType == 'radios' %} | ||
| {{ govukRadios(field.component) }} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| <div class="govuk-button-group"> | ||
| {{ govukButton({ | ||
| text: t('buttons.continue', { ns: 'common' }), | ||
| attributes: { type: 'submit', name: 'action', value: 'continue' } | ||
| }) }} | ||
| <p class="govuk-body"> | ||
| <a href="{{ dashboardUrl }}" class="govuk-link">{{ cancel }}</a> | ||
| </p> | ||
| </div> | ||
|
|
||
| {{ csrfProtection(csrfToken) }} | ||
| </form> | ||
| {% endblock %} |
41 changes: 41 additions & 0 deletions
41
src/main/steps/make-an-application/choose-an-application/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import type { StepDefinition } from '../../../interfaces/stepFormData.interface'; | ||
| import { createFormStep } from '../../../modules/steps'; | ||
| import { flowConfig } from '../flow.config'; | ||
|
|
||
| export const step: StepDefinition = createFormStep({ | ||
| stepName: 'choose-an-application', | ||
| journeyFolder: 'makeAnApplication', | ||
| stepDir: __dirname, | ||
| flowConfig, | ||
| customTemplate: `${__dirname}/chooseAnApplication.njk`, | ||
| fields: [ | ||
| { | ||
| name: 'typeOfApplication', | ||
| type: 'radio', | ||
| required: true, | ||
| translationKey: { label: 'question' }, | ||
| legendClasses: 'govuk-fieldset__legend--m', | ||
| options: [ | ||
| { | ||
| value: 'ADJOURN', | ||
| translationKey: 'options.adjourn.label', | ||
| // TODO: Hint text translation support to be added as part of HDPI-5208 | ||
| hint: 'You can apply to delay the hearing until a later date.', | ||
| }, | ||
| { | ||
| value: 'SET_ASIDE', | ||
| translationKey: 'options.setAside.label', | ||
| // TODO: Hint text translation support to be added as part of HDPI-5208 | ||
| hint: `You can ask the court to set aside the possession order if you have good reason. | ||
| For example, if you were unable to attend the court hearing because you were ill.`, | ||
| }, | ||
| { value: 'SOMETHING_ELSE', translationKey: 'options.somethingElse.label' }, | ||
| ], | ||
| }, | ||
| ], | ||
| translationKeys: { | ||
| pageTitle: 'pageTitle', | ||
| caption: 'caption', | ||
| heading: 'heading', | ||
| }, | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.