Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5e7acbf
create final situation interstitial page
AlexBuzea Mar 19, 2026
098a233
fix linting issues
AlexBuzea Mar 19, 2026
56061ac
almost final dependant children page
AlexBuzea Mar 23, 2026
84cee34
changing payload to send dependantChildrenDetails value as empty stri…
AlexBuzea Mar 24, 2026
4d4c559
Merge remote-tracking branch 'origin/master' into HDPI-3566-situation…
AlexBuzea Mar 24, 2026
de980e2
fixing linting issues
AlexBuzea Mar 24, 2026
0b28922
removing logging
AlexBuzea Mar 24, 2026
f5f8fa5
more linting..
AlexBuzea Mar 24, 2026
8db0d88
adding other dependants page
AlexBuzea Mar 24, 2026
e118cf6
fixing linting issue..
AlexBuzea Mar 24, 2026
ae7fcb5
changing caption font size to 24px from 27px
AlexBuzea Mar 24, 2026
c61d359
added radio buttons selections and routing to repaymentsAgreed placeh…
AlexBuzea Mar 25, 2026
306ba65
Merge branch 'master' into HDPI-3566-situation-interstitial-dependant…
AlexBuzea Mar 25, 2026
0272c6c
renaming translation file to correct camelcasing as was working previ…
AlexBuzea Mar 26, 2026
14b9a13
Merge remote-tracking branch 'origin/master' into HDPI-3566-situation…
AlexBuzea Mar 26, 2026
992bcdc
Yes/No/NotSure type options to the common translations and changing t…
AlexBuzea Mar 26, 2026
83a222e
Merge remote-tracking branch 'origin/master' into HDPI-3566-situation…
AlexBuzea Mar 26, 2026
c8500c4
changing translation label from hint to paragraph and making the sect…
AlexBuzea Mar 26, 2026
d09bcd8
Merge branch 'master' into HDPI-3566-situation-interstitial-dependant…
AlexBuzea Mar 26, 2026
9a246e8
matching types with ccd ones
AlexBuzea Mar 26, 2026
d5196e5
Merge branch 'master' into HDPI-3566-situation-interstitial-dependant…
AlexBuzea Mar 27, 2026
76bddc0
small refactor to remove types on unused parameters
AlexBuzea Mar 27, 2026
2d3d8db
Merge branch 'master' into HDPI-3566-situation-interstitial-dependant…
AlexBuzea Mar 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/assets/locales/cy/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
"start": "cyStart",
"submit": "cySubmit"
},
"options": {
"yes": "cyYes",
"no": "cyNo",
"or": "cyor",
"imNotSure": "cyI'm not sure"
},
"change": "cyChange",
"chooseOption": "cyChoose an option",
"back": "cyBack",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"pageTitle": "cyDependant children",
"caption": "cyRespond to a property possession claim",
"heading": "cyDo you have any dependant children?",
"dependantChildrenParagraph": "cyDependant children are children you look after financially.",
"dependantChildrenDetailsLabel": "cyGive details about your dependant children",
"dependantChildrenDetailsHint": "cyYou should include details about how many dependant children you have and how old they are",
"errors": {
"dependantChildren": "cySelect if you have any dependant children.",
"dependantChildrenDetails": "cyGive details about your dependant children."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"pageTitle": "cyOther dependants",
"caption": "cyRespond to a property possession claim",
"heading": "cyDo you have any other dependants?",
"otherDependantsParagraph": "cyDependants are people you look after financially, like elderly relatives.",
"otherDependantDetailsLabel": "cyGive details about your other dependants",
"otherDependantDetailsHint": "cyYou should include details about how many other dependants you have, how old they are and anything else you think the court should know about them",
"errors": {
"otherDependants": "cySelect if you have any other dependants.",
"otherDependantDetails": "cyGive details about your other dependants."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pageTitle": "cyHome and circumstances",
"caption": "cyRespond to a property possession claim",
"heading": "cyYour household and circumstances",
"paragraph1": "cyYou must now answer some questions about your household and personal circumstances. This will help a judge understand your situation.",
"paragraph2": "cyYou’ll be asked about:",
"bullet1": "cyany dependants you have (people you look after financially)",
"bullet2": "cyother adults that live in your home",
"bullet3": "cywhether you would have anywhere else to live if you were asked to leave your home",
"bullet4": "cyany personal circumstances that have led to your case that you think a judge should know about",
"bullet5": "cyany exceptional hardship you’d experience if you were asked to leave your home",
"paragraph3": "cyThe claimant will be able to see your answers."
}
6 changes: 6 additions & 0 deletions src/main/assets/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
"start": "Start",
"submit": "Submit"
},
"options": {
"yes": "Yes",
"no": "No",
"or": "or",
"imNotSure": "I'm not sure"
},
"change": "Change",
"back": "Back",
"date": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"pageTitle": "Dependant children",
"caption": "Respond to a property possession claim",
"heading": "Do you have any dependant children?",
"dependantChildrenParagraph": "Dependant children are children you look after financially.",
"dependantChildrenDetailsLabel": "Give details about your dependant children",
"dependantChildrenDetailsHint": "You should include details about how many dependant children you have and how old they are",
"errors": {
"dependantChildren": "Select if you have any dependant children.",
"dependantChildrenDetails": "Give details about your dependant children."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"pageTitle": "Other dependants",
"caption": "Respond to a property possession claim",
"heading": "Do you have any other dependants?",
"otherDependantsParagraph": "Dependants are people you look after financially, like elderly relatives.",
"otherDependantDetailsLabel": "Give details about your other dependants",
"otherDependantDetailsHint": "You should include details about how many other dependants you have, how old they are and anything else you think the court should know about them",
"errors": {
"otherDependants": "Select if you have any other dependants.",
"otherDependantDetails": "Give details about your other dependants."
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"pageTitle": "Repayments agreed",
"pageTitle": "Repayments agreed (placeholder)",
"caption": "Respond to a property possession claim"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pageTitle": "Home and circumstances",
"caption": "Respond to a property possession claim",
"heading": "Your household and circumstances",
"paragraph1": "You must now answer some questions about your household and personal circumstances. This will help a judge understand your situation.",
"paragraph2": "You’ll be asked about:",
"bullet1": "any dependants you have (people you look after financially)",
"bullet2": "other adults that live in your home",
"bullet3": "whether you would have anywhere else to live if you were asked to leave your home",
"bullet4": "any personal circumstances that have led to your case that you think a judge should know about",
"bullet5": "any exceptional hardship you’d experience if you were asked to leave your home",
"paragraph3": "The claimant will be able to see your answers."
}
24 changes: 19 additions & 5 deletions src/main/interfaces/ccdCase.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ export enum CaseState {
SUBMITTED = 'Submitted',
}

export type YesNoValue = 'YES' | 'NO' | null;
export type ContactPreference = 'EMAIL' | 'POST' | null;
export type VerticalYesNoValue = 'YES' | 'NO' | null;
export type YesNoValue = 'Yes' | 'No';

export type YesNoNotSureValue = 'YES' | 'NO' | 'NOT_SURE';

export type ContactPreference = 'EMAIL' | 'POST' | null;

export interface HouseholdCircumstances {
dependantChildren?: YesNoValue;
dependantChildrenDetails?: string;
otherDependants?: YesNoValue;
otherDependantDetails?: string;
}

export interface CcdUserCase {
id: string;
state: CaseState;
Expand Down Expand Up @@ -36,28 +45,33 @@ export interface Address {
Country?: string;
}

export interface CaseData {
possessionClaimResponse?: PossessionClaimResponse;
}

export interface PossessionClaimResponse {
defendantContactDetails?: {
party?: {
firstName?: string;
lastName?: string;
address?: Address;
phoneNumberProvided?: YesNoValue;
phoneNumberProvided?: VerticalYesNoValue;
phoneNumber?: string;
emailAddress?: string;
};
};
defendantResponses?: {
tenancyStartDateCorrect?: string;
tenancyStartDate?: string;
contactByPhone?: YesNoValue;
contactByText?: YesNoValue;
contactByPhone?: VerticalYesNoValue;
contactByText?: VerticalYesNoValue;
preferenceType?: ContactPreference;
freeLegalAdvice?: string;
defendantNameConfirmation?: string;
dateOfBirth?: string;
landlordRegistered?: YesNoNotSureValue;
landlordLicensed?: YesNoNotSureValue;
householdCircumstances?: HouseholdCircumstances;
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
{% extends "stepsTemplate.njk" %}
{% from "govuk/components/radios/macro.njk" import govukRadios %}
{% from "macros/stepButtons.njk" import stepButtons %}
{% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %}
{% from "macros/csrf.njk" import csrfProtection %}

{% block pageTitle %}{{ pageTitle }} – HM Courts & Tribunals Service – GOV.UK{% endblock %}

{% block mainContent %}
{% if errorSummary %}
{{ govukErrorSummary(errorSummary) }}
{% endif %}
<h1 class="govuk-heading-l">Do you have any other dependants? (placeholder)</h1>
<p class="govuk-body">This is a placeholder for Do You Have Any Other Dependants step.</p>
{% if caption %}
<span class="govuk-caption-l">{{ caption }}</span>
{% endif %}
{% if heading %}
<h1 class="govuk-heading-l">{{ heading }}</h1>
{% endif %}
{% if paragraph %}
<p class="govuk-body">{{ paragraph }}</p>
{% endif %}

<form method="post" action="{{ url }}">
{% for field in fields %}
{% if field.component and field.componentType %}
{% if field.componentType == 'radios' %}
{{ govukRadios(field.component) }}
{% endif %}
{% endif %}
{% endfor %}

{{ stepButtons(continue, saveForLater) }}
{{ csrfProtection(csrfToken) }}
</form>
Expand Down
97 changes: 96 additions & 1 deletion src/main/steps/respond-to-claim/any-other-dependants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import type {
CaseData,
HouseholdCircumstances,
PossessionClaimResponse,
YesNoValue,
} from '../../../interfaces/ccdCase.interface';
import type { StepDefinition } from '../../../interfaces/stepFormData.interface';
import { buildCcdCaseForPossessionClaimResponse } from '../../utils/populateResponseToClaimPayloadmap';
import { flowConfig } from '../flow.config';

import { createFormStep } from '@modules/steps';
Expand All @@ -8,6 +15,94 @@ export const step: StepDefinition = createFormStep({
journeyFolder: 'respondToClaim',
stepDir: __dirname,
flowConfig,
fields: [],
customTemplate: `${__dirname}/anyOtherDependants.njk`,
translationKeys: {
pageTitle: 'pageTitle',
heading: 'heading',
caption: 'caption',
paragraph: 'otherDependantsParagraph',
},
beforeRedirect: async req => {
const otherDependants: string = req.body?.otherDependants;

if (!otherDependants) {
return;
}

const enumMapping: Record<string, YesNoValue> = {
yes: 'Yes',
no: 'No',
};

const otherDependantsCcd = enumMapping[otherDependants];
if (!otherDependantsCcd) {
return;
}

const otherDependantDetails: string | undefined =
otherDependantsCcd === 'Yes' ? req.body?.['otherDependants.otherDependantDetails'] : undefined;

const possessionClaimResponse: PossessionClaimResponse = {
defendantResponses: {
householdCircumstances: {
otherDependants: otherDependantsCcd,
otherDependantDetails: otherDependantDetails ?? '',
},
},
};
await buildCcdCaseForPossessionClaimResponse(req, possessionClaimResponse);
},
getInitialFormData: req => {
const caseData: CaseData | undefined = req.res?.locals?.validatedCase?.data;
const householdCircumstances: HouseholdCircumstances | undefined =
caseData?.possessionClaimResponse?.defendantResponses?.householdCircumstances;
const otherDependantsCcd: YesNoValue | undefined = householdCircumstances?.otherDependants;

if (!otherDependantsCcd) {
return {};
}

if (otherDependantsCcd === 'Yes') {
const otherDependantDetails: string | undefined = householdCircumstances?.otherDependantDetails;
return {
otherDependants: 'yes',
'otherDependants.otherDependantDetails': otherDependantDetails ?? '',
};
}

return { otherDependants: 'no' };
},
fields: [
{
name: 'otherDependants',
type: 'radio',
required: true,
legendClasses: 'govuk-visually-hidden',
translationKey: {
label: 'heading',
},
errorMessage: 'errors.otherDependants',
options: [
{
value: 'yes',
translationKey: 'options.yes',
subFields: {
otherDependantDetails: {
name: 'otherDependantDetails',
type: 'character-count',
required: true,
maxLength: 500,
translationKey: {
label: 'otherDependantDetailsLabel',
hint: 'otherDependantDetailsHint',
},
labelClasses: 'govuk-label--s',
errorMessage: 'errors.otherDependantDetails',
},
},
},
{ value: 'no', translationKey: 'options.no' },
],
},
],
});
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
{% extends "stepsTemplate.njk" %}
{% from "govuk/components/radios/macro.njk" import govukRadios %}
{% from "macros/stepButtons.njk" import stepButtons %}
{% from "govuk/components/error-summary/macro.njk" import govukErrorSummary %}
{% from "macros/csrf.njk" import csrfProtection %}

{% block pageTitle %}{{ pageTitle }} &ndash; HM Courts &amp; Tribunals Service &ndash; GOV.UK{% endblock %}

{% block mainContent %}
{% if errorSummary %}
{{ govukErrorSummary(errorSummary) }}
{% endif %}
<h1 class="govuk-heading-l">Do You Have Any Dependant Children? (placeholder)</h1>
<p class="govuk-body">This is a placeholder for Do You Have Any Dependant Children step.</p>
{% if caption %}
<span class="govuk-caption-l">{{ caption }}</span>
{% endif %}
{% if heading %}
<h1 class="govuk-heading-l">{{ heading }}</h1>
{% endif %}
{% if paragraph %}
<p class="govuk-body">{{ paragraph }}</p>
{% endif %}

<form method="post" action="{{ url }}">
{% for field in fields %}
{% if field.component and field.componentType %}
{% if field.componentType == 'radios' %}
{{ govukRadios(field.component) }}
{% endif %}
{% endif %}
{% endfor %}

{{ stepButtons(continue, saveForLater) }}
{{ csrfProtection(csrfToken) }}
</form>
Expand Down
Loading
Loading