Skip to content

Commit

Permalink
NFDIV-4203: Update hub page for international address (#3878)
Browse files Browse the repository at this point in the history
* NFDIV-4203: Remove unused code

* NFDIV-4203: Update hub page for international adress

* NFDIV-4203: Refactor code

* NFDIV-4203: Add Welsh translation, refactor other code

* NFDIV-4203: Fix logic

* NFDIV-4206: Add logic for represented respondent and HWF (#3880)

* NFDIV-4206: Add logic for represented respondent and HWF

* NFDIV-4207: Add state to template selector for HWF cannot upload documents

* NFDIV-4210: Update hub page when respondent represented and international address (#3884)

* NFDIV-4210: Update hub page when respodent represented and international address

* NFDIV-4210: Fix issue with progress bar

* NFDIV-4210: Use correct function
  • Loading branch information
FaisalMoJ authored Sep 24, 2024
1 parent 752f77e commit 905cf12
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 22 deletions.
6 changes: 0 additions & 6 deletions src/main/steps/applicant1/hub-page/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ const cy: typeof en = ({
}: CommonContent) => ({
title: `${getName(userCase, 'applicant1')} & ${getName(userCase, 'applicant2')}`,
referenceNumber: `Cyfeirnod: ${referenceNumber}`,
applicationSubmitted: 'Application submitted',
response: 'Response',
conditionalOrderApplication: 'Conditional order application',
conditionalOrderGranted: 'Conditional order granted',
finalOrderApplication: 'Final order application',
applicationEnded: isDivorce ? 'Divorced' : 'Civil partnership ended',
subHeading1:
userCase.state === 'AwaitingClarification' ? 'Beth sydd angen i chi ei wneud nawr' : 'Diweddariad diweddaraf',
subHeading2: 'Gwybodaeth ddefnyddiol',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Checkbox } from '../../../../app/case/case';
import { DivorceOrDissolution, State, YesOrNo } from '../../../../app/case/definition';
import { HubTemplate } from '../../../common/hubTemplates';
import { currentStateFn } from '../../../state-sequence';
import { getSoleHubTemplate } from '../sole/soleTemplateSelector';

import { getJointHubTemplate } from './jointTemplateSelector';

Expand Down Expand Up @@ -168,4 +170,14 @@ describe('JointTemplateSelector test', () => {
const jointTemplate = getJointHubTemplate(theState, userCase);
expect(jointTemplate).toBe(HubTemplate.AwaitingDocuments);
});

test('should show /awaiting-documents.njk for state AwaitingHWFDecision and reason is "cannot upload documents"', () => {
const userCaseWithApplicant1CannotUploadDocuments = {
...userCase,
applicant1CannotUpload: Checkbox.Checked,
};
const theState = displayState.at(State.AwaitingHWFDecision);
const soleTemplate = getSoleHubTemplate(theState, userCaseWithApplicant1CannotUploadDocuments, false, false);
expect(soleTemplate).toBe(HubTemplate.AwaitingDocuments);
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CaseWithId } from '../../../../app/case/case';
import { CaseWithId, Checkbox } from '../../../../app/case/case';
import { State, YesOrNo } from '../../../../app/case/definition';
import { HubTemplate } from '../../../common/hubTemplates';
import { StateSequence } from '../../../state-sequence';
Expand Down Expand Up @@ -64,6 +64,8 @@ export const getJointHubTemplate = (
}
case State.AwaitingDocuments:
return HubTemplate.AwaitingDocuments;
case State.AwaitingHWFDecision:
return userCase.applicant1CannotUpload === Checkbox.Checked ? HubTemplate.AwaitingDocuments : HubTemplate.Holding;
default: {
if (
displayState.isAfter('Holding') &&
Expand Down
29 changes: 26 additions & 3 deletions src/main/steps/applicant1/hub-page/sole/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ import dayjs from 'dayjs';

import { getFormattedDate } from '../../../../app/case/answers/formatDate';
import { Checkbox } from '../../../../app/case/case';
import { AlternativeServiceType, DocumentType, State, YesOrNo } from '../../../../app/case/definition';
import {
AlternativeServiceType,
Applicant2Represented,
DocumentType,
State,
YesOrNo,
} from '../../../../app/case/definition';
import { TranslationFn } from '../../../../app/controller/GetController';
import { SupportedLanguages } from '../../../../modules/i18n';
import { isCountryUk } from '../../../applicant1Sequence';
import type { CommonContent } from '../../../common/common.content';
import { currentStateFn } from '../../../state-sequence';
import { FINALISING_YOUR_APPLICATION, HOW_YOU_CAN_PROCEED } from '../../../urls';
Expand All @@ -17,12 +24,19 @@ const en = (
alternativeServiceType: AlternativeServiceType
) => ({
aosAwaitingOrDrafted: {
line1: `Your application will be checked by court staff. You will receive an email notification by ${getFormattedDate(
line1: `Your application ${
userCase.applicant1AlreadyAppliedForHelpPaying === YesOrNo.YES ? 'and help with fees reference number ' : ''
} will be checked by court staff. You will receive an email notification by ${getFormattedDate(
dayjs(userCase.dateSubmitted).add(config.get('dates.applicationSubmittedOffsetDays'), 'day')
)} confirming whether it has been accepted. Check your junk or spam email folder.`,
line2: `Your ${partner} will then be sent a copy of the application. They will be asked to check the information and respond. If they do not respond then you will be told what you can do next to progress the application.`,
line3: `If you want to ‘serve’ (send) the documents to your ${partner} yourself then phone ${telephoneNumber} to request it. Otherwise the court will do it.`,
line4: `If you want the court to serve (send) the application to be served by post instead of by email, then phone ${telephoneNumber}.`,
line5: `The address you have provided for your ${partner} is outside of England and Wales. That means you are responsible for ‘serving’ (sending) the court documents, which notify your ${partner} about ${
isDivorce ? 'the divorce' : 'ending the civil partnership'
}`,
line6: `You will receive the documents that you need to send to your ${partner} by email and letter, after the application has been checked.`,
line7: `Your ${partner}’s solicitor will be contacted by the court, and asked to confirm they are representing them. They will be sent a copy of the application and asked to respond.`,
},
aosDue: {
line1: `Your ${partner} should have responded to your ${
Expand Down Expand Up @@ -293,13 +307,18 @@ const cy: typeof en = (
alternativeServiceType: AlternativeServiceType
) => ({
aosAwaitingOrDrafted: {
line1: `Bydd eich cais yn cael ei wirio gan staff y llys. Fe gewch neges e-bost erbyn ${getFormattedDate(
line1: `Bydd staff y llys yn gwirio eich cais ${
userCase.applicant1AlreadyAppliedForHelpPaying === YesOrNo.YES ? 'a’ch cyfeirnod Help i Dalu Ffioedd' : ''
}. Fe gewch neges e-bost erbyn ${getFormattedDate(
dayjs(userCase.dateSubmitted).add(config.get('dates.applicationSubmittedOffsetDays'), 'day'),
SupportedLanguages.Cy
)} yn cadarnhau p’un a yw wedi’i dderbyn. Gwiriwch eich ffolder ‘junk’ neu ‘spam’.`,
line2: `Yna fe anfonir copi o’r cais at eich ${partner}. Fe ofynnir iddynt wirio’r wybodaeth ac ymateb. Os na fyddant yn ymateb, fe ddywedir wrthych beth allwch ei wneud nesaf i symud y cais yn ei flaen.`,
line3: `Os ydych eisiau ‘cyflwyno’ (anfon) y dogfennau at eich ${partner} eich hun, yna ffoniwch ${telephoneNumber} i ofyn am gael gwneud hynny. Fel arall, bydd y llys yn gwneud hyn ar eich rhan.`,
line4: `Os ydych eisiau i’r llys gyflwyno (anfon) y cais i’w gyflwyno drwy’r post yn hytrach na drwy e-bost, ffoniwch ${telephoneNumber}.`,
line5: `Mae’r cyfeiriad rydych wedi’i ddarparu ar gyfer eich ${partner} y tu allan i Gymru a Lloegr. Mae hynny’n golygu mai chi sy’n gyfrifol am ‘gyflwyno’ (anfon) dogfennau’r llys, sy’n hysbysu’ch ${partner} am yr ysgariad.`,
line6: `Fe gewch y dogfennau y bydd angen i chi eu hanfon at eich ${partner} drwy e-bost a llythyr, ar ôl i’r cais gael ei wirio.`,
line7: `Bydd y llys yn cysylltu â chyfreithiwr eich ${partner} ac yn gofyn iddynt gadarnhau eu bod yn eu cynrychioli. Fe anfonir copi o’r cais atynt ac fe ofynnir iddynt ymateb.`,
},
aosDue: {
line1: `Dylai eich ${partner} fod wedi ymateb i'ch ${
Expand Down Expand Up @@ -624,6 +643,8 @@ export const generateContent: TranslationFn = content => {
...(userCase.applicant1CannotUploadDocuments || []),
...(userCase.applicant2CannotUploadDocuments || []),
]);
const isRespondentOverseas = !isCountryUk(userCase.applicant2AddressCountry);
const isRespondentRepresented = userCase.applicant1IsApplicant2Represented === Applicant2Represented.YES;
return {
...languages[language](content, alternativeServiceType),
displayState,
Expand All @@ -637,5 +658,7 @@ export const generateContent: TranslationFn = content => {
hasApplicant1AppliedForFinalOrderFirst,
isFinalOrderCompleteState,
cannotUploadDocuments,
isRespondentOverseas,
isRespondentRepresented,
};
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{% for property, line in aosAwaitingOrDrafted %}
<p class="govuk-body">{{ line }}</p>
{% endfor %}
<p class="govuk-body">{{ aosAwaitingOrDrafted.line1 }}</p>
{% if isRespondentOverseas %}
{% if isRespondentRepresented %}
<p class="govuk-body">{{ aosAwaitingOrDrafted.line7 }}</p>
{% else %}
<p class="govuk-body">{{ aosAwaitingOrDrafted.line2 }}</p>
{% endif %}
<p class="govuk-body">{{ aosAwaitingOrDrafted.line5 }}</p>
<p class="govuk-body">{{ aosAwaitingOrDrafted.line6 }}</p>
{% elif isRespondentRepresented %}
<p class="govuk-body">{{ aosAwaitingOrDrafted.line7 }}</p>
{% else %}
<p class="govuk-body">{{ aosAwaitingOrDrafted.line2 }}</p>
<p class="govuk-body">{{ aosAwaitingOrDrafted.line3 }}</p>
<p class="govuk-body">{{ aosAwaitingOrDrafted.line4 }}</p>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,14 @@ describe('SoleTemplateSelector test', () => {
const jointTemplate = getJointHubTemplate(theState, userCase);
expect(jointTemplate).toBe(HubTemplate.AwaitingDocuments);
});

test('should show /awaiting-documents.njk for state AwaitingHWFDecision and reason is "cannot upload documents"', () => {
const userCaseWithApplicant1CannotUploadDocuments = {
...userCase,
applicant1CannotUpload: Checkbox.Checked,
};
const theState = displayState.at(State.AwaitingHWFDecision);
const soleTemplate = getSoleHubTemplate(theState, userCaseWithApplicant1CannotUploadDocuments, false, false);
expect(soleTemplate).toBe(HubTemplate.AwaitingDocuments);
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from 'dayjs';

import { CaseWithId } from '../../../../app/case/case';
import { CaseWithId, Checkbox } from '../../../../app/case/case';
import { ServiceApplicationRefusalReason, State, YesOrNo } from '../../../../app/case/definition';
import { HubTemplate } from '../../../common/hubTemplates';
import { StateSequence } from '../../../state-sequence';
Expand Down Expand Up @@ -100,6 +100,10 @@ export const getSoleHubTemplate = (
case State.PendingHearingOutcome:
case State.PendingHearingDate:
return HubTemplate.PendingHearingOutcome;
case State.AwaitingHWFDecision:
return userCase.applicant1CannotUpload === Checkbox.Checked
? HubTemplate.AwaitingDocuments
: HubTemplate.AosAwaitingOrDrafted;
case State.AwaitingDocuments:
return HubTemplate.AwaitingDocuments;
default: {
Expand Down
4 changes: 2 additions & 2 deletions src/main/steps/applicant1/hub-page/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
{% include "./sole/hub.njk" %}
{% endblock %}
{% endif %}
{% if not displayState.at('AwaitingDocuments') %}
<h3 class="govuk-heading-s">{{ subHeading3 }}</h3>
{% if displayState.isAfter('AwaitingDocuments') or displayState.isAtOrAfter('AwaitingHWFDecision') %}
<h3 class="govuk-heading-s">{{ subHeading2 }}</h3>
<p class="govuk-body">
<a class="govuk-link" href="https://www.gov.uk/money-property-when-relationship-ends" target="_blank">{{ line1 }}
</a>
Expand Down
12 changes: 6 additions & 6 deletions src/main/steps/common/progress-bar.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
label: {
html: textWithVisuallyHiddenSpan(submitted, displayState.isAtOrAfter('Submitted'))
},
complete: displayState.isAtOrAfter('Submitted'),
active: displayState.at('AwaitingDocuments')
complete: displayState.isAtOrAfter('Submitted') or displayState.at('AwaitingHWFDecision'),
active: displayState.at('AwaitingDocuments') and not (displayState.isAtOrAfter('Submitted') or displayState.at('AwaitingHWFDecision'))
}, {
label: {
html: textWithVisuallyHiddenSpan(courtChecks, displayState.isAfter('Submitted'))
},
complete: displayState.isAfter('Submitted'),
active: displayState.isAfter('Submitted')
active: displayState.isAfter('Submitted') or displayState.at('AwaitingHWFDecision')
}, {
label: {
html: textWithVisuallyHiddenSpan(conditionalOrder, displayState.isAtOrAfter('AwaitingLegalAdvisorReferral'))
Expand All @@ -35,14 +35,14 @@
label: {
html: textWithVisuallyHiddenSpan(submitted, displayState.isAtOrAfter('Submitted'))
},
complete: displayState.isAtOrAfter('Submitted'),
active: displayState.at('AwaitingDocuments')
complete: displayState.isAtOrAfter('Submitted') or displayState.at('AwaitingHWFDecision'),
active: displayState.at('AwaitingDocuments') and not (displayState.isAtOrAfter('Submitted') or displayState.at('AwaitingHWFDecision'))
}, {
label: {
html: textWithVisuallyHiddenSpan(courtChecks, displayState.isBefore('Submitted'))
},
complete: displayState.isAfter('Submitted'),
active: displayState.isAtOrAfter('AwaitingAos')
active: displayState.isAtOrAfter('AwaitingAos') or displayState.at('AwaitingHWFDecision')
}, {
label: {
html: textWithVisuallyHiddenSpan(response, displayState.isAfter('IssuedToBailiff'))
Expand Down

0 comments on commit 905cf12

Please sign in to comment.