Skip to content

Commit

Permalink
Merge pull request #27 from companieshouse/feature/add-confirm-compan…
Browse files Browse the repository at this point in the history
…y-screen

Add static content for confirm company screen
  • Loading branch information
PhilipGlover authored Mar 1, 2024
2 parents 7a0fb61 + 192d8a5 commit 52b9113
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 72 deletions.
10 changes: 10 additions & 0 deletions locales/cy/confirm-company.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"confirm_company_main_title": "Cadarnhau mai hwn yw’r cwmni cywir",
"confirm_company_company_name": "Enw’r cwmni",
"confirm_company_company_number": "Rhif y cwmni",
"confirm_company_company_status": "Statws",
"confirm_company_incorporation_date": "Dyddiad corffori",
"confirm_company_company_type": "Math o gwmni",
"confirm_company_registered_office_address": "Cyfeiriad swyddfa gofrestredig",
"confirm_company_choose_different_company": "Dewis cwmni gwahanol"
}
6 changes: 6 additions & 0 deletions locales/cy/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"global_banner_new_service": "Mae hwn yn wasanaeth newydd - bydd eich ",
"global_banner_feedback_link": "adborth",
"global_banner_help_improve": " yn ein helpu i'w wella.",
"global_confirm_continue_button": "Cadarnhau a pharhau"
}
10 changes: 10 additions & 0 deletions locales/en/confirm-company.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"confirm_company_main_title": "Confirm this is the correct company",
"confirm_company_company_name": "Company name",
"confirm_company_company_number": "Company number",
"confirm_company_company_status": "Status",
"confirm_company_incorporation_date": "Incorporation date",
"confirm_company_company_type": "Company type",
"confirm_company_registered_office_address": "Registered office address",
"confirm_company_choose_different_company": "Choose a different company"
}
6 changes: 6 additions & 0 deletions locales/en/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"global_banner_new_service": "This is a new service - your ",
"global_banner_feedback_link": "feedback",
"global_banner_help_improve": " will help us to improve it.",
"global_confirm_continue_button": "Confirm and continue"
}
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const servicePathPrefix = "/persons-with-significant-control-verification
export const Urls = {
ACCESSIBILITY_STATEMENT: "/persons-with-significant-control-verification",
START: "/start",
SKELETON_ONE: "/skeleton_one",
CONFIRM_COMPANY: "/confirm-company",
SKELETON_TWO: "/skeleton_two",
SKELETON_THREE: "/skeleton_three",
SKELETON_FOUR: "/skeleton_four",
Expand All @@ -19,7 +19,7 @@ export const PrefixedUrls = {
ACCESSIBILITY_STATEMENT: servicePathPrefix + Urls.ACCESSIBILITY_STATEMENT,
START: servicePathPrefix + Urls.START,
HEALTHCHECK: servicePathPrefix + Urls.HEALTHCHECK,
SKELETON_ONE: servicePathPrefix + Urls.SKELETON_ONE,
CONFIRM_COMPANY: servicePathPrefix + Urls.CONFIRM_COMPANY,
SKELETON_TWO: servicePathPrefix + Urls.SKELETON_TWO,
SKELETON_THREE: servicePathPrefix + Urls.SKELETON_THREE,
SKELETON_FOUR: servicePathPrefix + Urls.SKELETON_FOUR,
Expand Down
5 changes: 2 additions & 3 deletions src/router.dispatch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Do Router dispatch here, i.e. map incoming routes to appropriate router
import { Application, Request, Response, Router } from "express";
import startRouter from "./routers/startRouter";
import { StartRouter, SkeletonOneRouter, SkeletonTwoRouter, SkeletonThreeRouter, SkeletonFourRouter, SkeletonFiveRouter, SkeletonSixRouter } from "./routers/__utils";
import { StartRouter, ConfirmCompanyRouter, SkeletonTwoRouter, SkeletonThreeRouter, SkeletonFourRouter, SkeletonFiveRouter, SkeletonSixRouter } from "./routers/__utils";
import { Urls, servicePathPrefix } from "./constants";

const routerDispatch = (app: Application) => {
Expand All @@ -12,7 +11,7 @@ const routerDispatch = (app: Application) => {

router.use("/", StartRouter);
router.use("/start", StartRouter);
router.use(Urls.SKELETON_ONE, SkeletonOneRouter);
router.use(Urls.CONFIRM_COMPANY, ConfirmCompanyRouter);
router.use(Urls.SKELETON_TWO, SkeletonTwoRouter);
router.use(Urls.SKELETON_THREE, SkeletonThreeRouter);
router.use(Urls.SKELETON_FOUR, SkeletonFourRouter);
Expand Down
4 changes: 2 additions & 2 deletions src/routers/__utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import StartRouter from "./../startRouter";
import SkeletonOneRouter from "./../skeleton.one.router";
import ConfirmCompanyRouter from "./../confirmCompanyRouter";
import SkeletonTwoRouter from "./../skeleton.two.router";
import SkeletonThreeRouter from "./../skeleton.three.router";
import SkeletonFourRouter from "./../skeleton.four.router";
import SkeletonFiveRouter from "./../skeleton.five.router";
import SkeletonSixRouter from "./../skeleton.six.router";
export { StartRouter, SkeletonOneRouter, SkeletonTwoRouter, SkeletonThreeRouter, SkeletonFourRouter, SkeletonFiveRouter, SkeletonSixRouter };
export { StartRouter, ConfirmCompanyRouter, SkeletonTwoRouter, SkeletonThreeRouter, SkeletonFourRouter, SkeletonFiveRouter, SkeletonSixRouter };
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { NextFunction, Request, Response, Router } from "express";
import { SkeletonOneHandler } from "./handlers/skeleton_one";
import { ConfirmCompanyHandler } from "./handlers/confirmCompany/confirmCompany";
import { handleExceptions } from "../utils/async.handler";
import logger from "../lib/Logger";
const router: Router = Router();

router.get("/", handleExceptions(async (req: Request, res: Response) => {
const handler = new SkeletonOneHandler();
router.get("/", handleExceptions(async (req: Request, res: Response, _next: NextFunction) => {
const handler = new ConfirmCompanyHandler();
const { templatePath, viewData } = handler.executeGet(req, res);
res.render(templatePath, viewData);
}));
Expand Down
42 changes: 42 additions & 0 deletions src/routers/handlers/confirmCompany/confirmCompany.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Request, Response } from "express";
import {
BaseViewData,
GenericHandler,
ViewModel
} from "../generic";
import logger from "../../../lib/Logger";
import { PrefixedUrls } from "../../../constants";
import { selectLang, getLocalesService, getLocaleInfo } from "../../../utils/localise";

interface ConfirmCompanyViewData extends BaseViewData {
}

export class ConfirmCompanyHandler extends GenericHandler<ConfirmCompanyViewData> {

private static templatePath = "router_views/confirmCompany/confirmCompany";

public getViewData (req: Request): ConfirmCompanyViewData {

const baseViewData = super.getViewData(req);
const lang = selectLang(req.query.lang);
const locales = getLocalesService();

return {
...baseViewData,
...getLocaleInfo(locales, lang),
title: "Confirm Company",
currentUrl: PrefixedUrls.CONFIRM_COMPANY,
backURL: PrefixedUrls.START
};
}

public executeGet (req: Request, _response: Response): ViewModel<ConfirmCompanyViewData> {
logger.info(`ConfirmCompanyHandler execute called`);
const viewData = this.getViewData(req);

return {
templatePath: ConfirmCompanyHandler.templatePath,
viewData
};
}
}
38 changes: 0 additions & 38 deletions src/routers/handlers/skeleton_one/index.ts

This file was deleted.

7 changes: 4 additions & 3 deletions src/views/partials/__header.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
<strong class="govuk-tag govuk-phase-banner__content__tag">
beta
</strong>
<span class="govuk-phase-banner__text">
This is a new service – your <a class="govuk-link" href="#">feedback</a> will help us to improve it.
</span>
<span class="govuk-phase-banner__text">
{{ i18n.global_banner_new_service }}
<a class="govuk-link" href="#">{{ i18n.global_banner_feedback_link }}</a>{{ i18n.global_banner_help_improve }}
</span>
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/partials/banner.njk
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@
</a>
</div>
<div class="govuk-header__content">
<a href="#" class="govuk-header__link govuk-header__link--service-name">Provide identity verification details for a PSC or relevant legal entity</a>
<a href="#" class="govuk-header__link govuk-header__link--service-name">{{ i18n.start_main_title }}</a>
</div>
95 changes: 95 additions & 0 deletions src/views/router_views/confirmCompany/confirmCompany.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{% extends "layouts/default.njk" %}

{% from "govuk/components/button/macro.njk" import govukButton %}
{% from "govuk/components/summary-list/macro.njk" import govukSummaryList %}

{% set title = i18n.confirm_company_main_title %}

{% block pageTitle %}
{% include "includes/page-title.html" %}
{% endblock %}
{% block backLink %}
{% include "includes/back-link.html" %}
{% endblock %}

{% block main_content %}
<div class="govuk-grid-row">
<h1 class="govuk-heading-l">{{ i18n.confirm_company_main_title }}</h1>
<form action="" method="post">

{{ govukSummaryList({
rows: [
{
key: {
id: "confirm-company-name",
text: i18n.confirm_company_company_name
},
value: {
text: company.companyName
}
},
{
key: {
id: "confirm-company-number",
classes: "govuk-!-width-full",
text: i18n.confirm_company_company_number
},
value: {
text: company.companyNumber
}
},
{
key: {
id: "confirm-company-status",
text: i18n.confirm_company_company_status
},
value: {
text: company.companyStatus
}
},
{
key: {
id: "confirm-company-incorporation-date",
text: i18n.confirm_company_incorporation_date
},
value: {
text: company.dateOfCreation
}
},
{
key: {
id: "confirm-company-type",
text: i18n.confirm_company_company_type
},
value: {
text: company.type
}
},
{
key: {
id: "confirm-company-registered-office-address",
text: i18n.confirm_company_registered_office_address
},
value: {
html: address

}
}
]
}) }}

<input type="hidden" name="lang" value="{{lang}}">
{{ govukButton({
attributes: {
id: "submit",
"data-event-id": "confirm-and-continue-button"
},
text: i18n.global_confirm_continue_button
}) }}
</form>
<p class="govuk-body">
<a title="{{i18n.confirm_company_choose_different_company }}" class="govuk-link" href="/appoint-update-remove-company-officer/company-number?lang={{lang}}" data-event-id="choose-a-different-company-link">{{ i18n.confirm_company_choose_different_company }}</a>
</p>
</div>
</div>
{% endblock %}
18 changes: 0 additions & 18 deletions src/views/router_views/skeleton_one/skeleton_one.njk

This file was deleted.

2 changes: 1 addition & 1 deletion src/views/router_views/start/start.njk
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
{% set startButtonText %}{{ i18n.start_button }}{% endset %}
{{ govukButton({
text: startButtonText,
href: Urls.SKELETON_ONE,
href: Urls.CONFIRM_COMPANY,
classes: "govuk-button--start govuk-!-margin-top-2 govuk-!-margin-bottom-8",
isStartButton: true
}) }}
Expand Down

0 comments on commit 52b9113

Please sign in to comment.