Skip to content

Commit

Permalink
Merge pull request #99 from companieshouse/IDVA5-467-which-name-is-re…
Browse files Browse the repository at this point in the history
…gistered-with-AML

next page url fix
  • Loading branch information
atedros-ch authored Feb 20, 2024
2 parents 1d4e7e1 + 596919f commit 94777cb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion locales/cy/name-registered-with-aml.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"nameRegisteredWithAmlBothOption": "Both welsh",
"nameRegisteredWithAmlContinueBtn": "Continue welsh",

"error-nameRegisteredWithAmlSelectRadio" : "Select which name is registered welsh"
"error-nameRegisteredWithAmlSelectRadio" : "Select which name is registered with your AML supervisory body welsh"
}
2 changes: 1 addition & 1 deletion locales/en/name-registered-with-aml.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"nameRegisteredWithAmlBothOption": "Both",
"nameRegisteredWithAmlContinueBtn": "Continue",

"error-nameRegisteredWithAmlSelectRadio" : "Select which name is registered"
"error-nameRegisteredWithAmlSelectRadio" : "Select which name is registered with your AML supervisory body"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { validationResult } from "express-validator";
import * as config from "../../../config";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { SOLE_TRADER_SECTOR_YOU_WORK_IN, LIMITED_NAME_REGISTERED_WITH_AML, LIMITED_WHAT_IS_YOUR_ROLE, BASE_URL } from "../../../types/pageURL";
import { SOLE_TRADER_SECTOR_YOU_WORK_IN, LIMITED_NAME_REGISTERED_WITH_AML, LIMITED_WHAT_IS_YOUR_ROLE, BASE_URL, YOUR_BUSINESS_MUST_BE_REGISTERED_KICKOUT, SOLE_TRADER_OTHER_TYPE_OFBUSINESS } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
const lang = selectLang(req.query.lang);
Expand All @@ -21,6 +21,7 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
const lang = selectLang(req.query.lang);
const locales = getLocalesService();
const errorList = validationResult(req);
const selectedOption = req.body.nameRegisteredWithAml;
if (!errorList.isEmpty()) {
const pageProperties = getPageProperties(formatValidationError(errorList.array(), lang));
res.status(400).render(config.LIMITED_NAME_REGISTERED_WITH_AML, {
Expand All @@ -32,7 +33,15 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
});
} else {
const nextPageUrl = addLangToUrl(BASE_URL + SOLE_TRADER_SECTOR_YOU_WORK_IN, lang);
res.redirect(nextPageUrl);
const nextPageUrlForBoth = addLangToUrl(BASE_URL + YOUR_BUSINESS_MUST_BE_REGISTERED_KICKOUT, lang);
// res.redirect(nextPageUrl);
switch (selectedOption) {
case "YOUR_NAME":
res.redirect(nextPageUrlForBoth); // Redirect to another page whne your name selected
break;
default:
res.redirect(nextPageUrl); // Redirect to the sector page for the other 2 options
}
}
} catch (error) {
next(error);
Expand Down
4 changes: 4 additions & 0 deletions src/main/types/pageURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ export const HEALTHCHECK = "/healthcheck";
export const LIMITED_NAME_REGISTERED_WITH_AML = LIMITED + "/name-registered-with-aml";

export const LIMITED_WHAT_IS_YOUR_ROLE = LIMITED + "/what-is-your-role";

export const LIMITED_KICK_OUT = LIMITED + "/what-is-your-role";

export const YOUR_BUSINESS_MUST_BE_REGISTERED_KICKOUT = LIMITED + "/your-business-must-be-aml-registered";
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

<main>
<form action="" method="POST">
{% include "partials/user_name.njk" %}
<div class="govuk-form-group">
{{ govukRadios({
errorMessage: errors.nameRegisteredWithAml if errors,
Expand Down

0 comments on commit 94777cb

Please sign in to comment.