Skip to content

Commit

Permalink
Merge branch 'master' into feat/CIV-15084-test
Browse files Browse the repository at this point in the history
  • Loading branch information
ShwetaTandel-hmcts authored Oct 24, 2024
2 parents 76ef3dd + b364923 commit 628a69e
Show file tree
Hide file tree
Showing 32 changed files with 378 additions and 200 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ReferenceNumberValidator implements ValidatorConstraintInterface {

export class ApplyHelpFeesReferenceForm {

@IsDefined({message: 'ERRORS.VALID_YES_NO_SELECTION_UPPER'})
@IsDefined({message: 'ERRORS.VALID_YES_NO_SELECTION_ALT'})
option: string;
@ValidateIf(o => o.isReferenceRequired())
@IsDefined({message: 'ERRORS.VALID_ENTER_REFERENCE_NUMBER'})
Expand Down
280 changes: 150 additions & 130 deletions src/main/modules/i18n/locales/cy.json

Large diffs are not rendered by default.

26 changes: 23 additions & 3 deletions src/main/modules/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@
},
"ACCEPT_DEFENDANT_OFFER": {
"ACCEPT_ISNTALMENTS": "I'll accept certain instalments per month",
"ENTER_AMOUNT": "Enter the amount in £",
"ENTER_AMOUNT": "Amount in £",
"N245": "N245 form",
"N245_AFTER": " that they completed. You should read this before responding.",
"N245_BEFORE": "The defendant's offer will be set out in the ",
Expand Down Expand Up @@ -2923,6 +2923,22 @@
"APPLICATION": "Application",
"APPLICATION_ID": "Application ID",
"APPLICATION_TYPE": "Application type",
"APPLICATION_TYPE_CCD": {
"ADJOURN_HEARING": "Adjourn a hearing",
"AMEND_A_STMT_OF_CASE": "Amend a statement of case",
"EXTEND_TIME": "Extend time",
"OTHER": "Other",
"OTHER_OPTION": "Other option",
"RELIEF_FROM_SANCTIONS": "Relief from sanctions",
"SET_ASIDE_JUDGEMENT":"Set aside judgment",
"SETTLE_BY_CONSENT": "Settle by consent",
"STAY_THE_CLAIM": "Stay the claim",
"STRIKE_OUT": "Strike out",
"SUMMARY_JUDGMENT": "Summary judgment",
"UNLESS_ORDER": "Unless order",
"VARY_ORDER": "Vary order",
"VARY_PAYMENT_TERMS_OF_JUDGMENT": "Vary payment terms of judgment"
},
"COMPLETE": "Complete",
"DETAILS": "Details",
"IN_PROGRESS": "In progress",
Expand Down Expand Up @@ -3140,7 +3156,7 @@
"PAGE_TITLE": "Provide more information to the court",
"TITLE": "Provide more information to the court",
"TEXT_INPUT": "Enter the information requested by the court",
"TEXT_INPUT_HINT": "Write in short sentences and paragraphs.",
"TEXT_INPUT_HINT": "Write in short sentences and paragraphs. Any text you enter will not be translated into Welsh.",
"CONTENT_1": "You have the option of entering the information requested by the court or uploading documents containing the information requested.",
"CONTENT_2_1": "If you're not sure what to write, refer to the ",
"CONTENT_2_2": "court document",
Expand Down Expand Up @@ -3563,6 +3579,7 @@
"CHECK_YOUR_ANSWERS_CORRECT": "I confirm the documents are correct and understand that I cannot withdraw documents once I have submitted them.",
"CHECK_YOUR_ANSWERS_VALIDATION": "Tell us if you confirm the documents are correct.",
"CHECK_YOUR_ANSWERS_DOCUMENT_UPLOADED": "Document uploaded",
"CHECK_YOUR_ANSWERS_DOCUMENT_UPLOADED_2": "Uploaded document",
"COSTS": "Costs",
"COSTS_HINT": "A detailed list of the costs you have incurred in making or defending the claim, for example photocopying, getting copies of contracts, include receipts",
"DISCLOSURE": "Disclosure",
Expand Down Expand Up @@ -4364,7 +4381,7 @@
"YOU_WILL_BE_ASKED": "You will be asked some questions to check you are eligible to use this service.",
"CLAIM_TITLE": "Claiming interest:",
"MAKE_A_CLAIM": "Make a court claim for money: Make a claim - GOV.UK (www.gov.uk)",
"CLAIM_INTEREST": "You can only use this service if any claim for interest is made at the same rate and from the same date.To claim interest at different rates or for different periods of time, you should issue your claim on paper. More information on how to do this can be found at MAKE_A_CLAIM"
"CLAIM_INTEREST": "You can only use this service if any claim for interest is made at the same rate and from the same date. To claim interest at different rates or for different periods of time, you should issue your claim on paper. More information on how to do this can be found at MAKE_A_CLAIM."
},
"SUPPORT_REQUIRED": {
"ADD_ANOTHER": "Add another person",
Expand Down Expand Up @@ -4435,6 +4452,8 @@
"SUBTITLE": "Acceptable documents formats",
"TITLE": "Upload documents",
"TYPE_OF_DOCUMENT": "Type of document",
"UPLOADED_FILES": "Uploaded document",
"UPLOADED_FILES_2": "Uploaded document",
"UPLOAD": "Upload a file",
"TYPE_OF_DOCUMENT_EXAMPLE": "For example, contract, invoice, receipt, email, text message, photo, social media message",
"DOCUMENT_ISSUE_DATE": "Date document was issued or message was sent",
Expand Down Expand Up @@ -5170,6 +5189,7 @@
"VALID_YES_NO_SELECTION_VARIATION_2": "Please select yes or no",
"VALID_YES_NO_SELECTION_OPTION2": "Please select yes or no",
"VALID_YES_NO_SELECTION_UPPER": "Please select Yes or No",
"VALID_YES_NO_SELECTION_ALT": "Please select Yes or No",
"VALID_ENTER_TYPE_OF_DOCUMENT": "You must enter type of document",
"VALID_ENTER_YOUR_NAME": "You must enter your name",
"VALID_ENTER_WITNESS_NAME": "You must enter name of witness",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ const gaServiceClient: GaServiceClient = new GaServiceClient(generalAppApiBaseUr
gaAdditionalDocCheckAnswerController.get(GA_UPLOAD_ADDITIONAL_DOCUMENTS_CYA_URL, (async (req: AppRequest, res: Response, next: NextFunction) => {
try {
const { appId, id: claimId } = req.params;
const lng = req.query.lang ? req.query.lang : req.cookies.lang;
const claimIdPrettified = caseNumberPrettify(claimId);
const claim = await getClaimDetailsById(req);
const cancelUrl = await getCancelUrl(claimId, claim);
const backLinkUrl = constructResponseUrlWithIdAndAppIdParams(claimId, appId, GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL);
const summaryRows = buildSummarySectionForAdditionalDoc(claim.generalApplication.uploadAdditionalDocuments, claimId, appId);
const summaryRows = buildSummarySectionForAdditionalDoc(claim.generalApplication.uploadAdditionalDocuments, claimId, appId, lng);
res.render(viewPath, { backLinkUrl, cancelUrl, claimIdPrettified, claim, summaryRows });
} catch (error) {
next(error);
Expand All @@ -43,4 +44,4 @@ gaAdditionalDocCheckAnswerController.post(GA_UPLOAD_ADDITIONAL_DOCUMENTS_CYA_URL
}
}) as RequestHandler);

export default gaAdditionalDocCheckAnswerController;
export default gaAdditionalDocCheckAnswerController;
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ uploadAdditionalDocumentsController.get(GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL, (asy
const redisKey = generateRedisKey(req);
const claim = await getClaimDetailsById(req);
const gaDetails = claim.generalApplication;
const lng = req.query.lang ? req.query.lang : req.cookies.lang;

if (req.session?.fileUpload) {
const parsedData = JSON.parse(req?.session?.fileUpload);
Expand All @@ -39,7 +40,7 @@ uploadAdditionalDocumentsController.get(GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL, (asy
}
const cancelUrl = await getCancelUrl(id, claim);
const backLinkUrl = constructResponseUrlWithIdAndAppIdParams(id,gaId, GA_VIEW_APPLICATION_URL);
const formattedSummary = getSummaryList(gaDetails.uploadAdditionalDocuments, id, gaId);
const formattedSummary = getSummaryList(gaDetails.uploadAdditionalDocuments, id, gaId, lng);
res.render(viewPath, { cancelUrl, backLinkUrl, form, formattedSummary });
} catch (err) {
next(err);
Expand Down Expand Up @@ -78,4 +79,4 @@ uploadAdditionalDocumentsController.post(GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL, upl
}
}));

export default uploadAdditionalDocumentsController;
export default uploadAdditionalDocumentsController;
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ helpWithApplicationFeeContinueController.post(GA_APPLY_HELP_WITH_FEES, (async (r
const isAdditionalFeeType = req.query.additionalFeeTypeFlag === 'true';
const lng = req.query.lang ? req.query.lang : req.cookies.lang;
const genAppId = req.params.appId;
const form = new GenericForm(new GenericYesNo(req.body.option, t('ERRORS.VALID_YES_NO_SELECTION_UPPER', { lng })));
const form = new GenericForm(new GenericYesNo(req.body.option, t('ERRORS.VALID_YES_NO_SELECTION_ALT', { lng })));
await form.validate();
if (form.hasErrors()) {
await renderView(res, req, form, claimId, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getClaimById } from 'modules/utilityService';
import {dateTimeFormat} from 'common/utils/dateUtils';
import {Claim} from 'models/claim';
import {CivilServiceClient} from 'client/civilServiceClient';
import {displayToEnumKey} from 'services/translation/convertToCUI/cuiTranslation';

const applicationSummaryController = Router();
const viewPath = 'features/generalApplication/applications-summary';
Expand All @@ -36,11 +37,12 @@ applicationSummaryController.get(GA_APPLICATION_SUMMARY_URL, async (req: AppRequ
for (const application of applications) {
const index = applications.indexOf(application);
const status = getApplicationStatus(application.state);
const type = displayToEnumKey(application.case_data?.applicationTypes);
applicationsRows.push({
state: t(`PAGES.GENERAL_APPLICATION.SUMMARY.STATES.${application.state}`, {lng}),
status: t(`PAGES.GENERAL_APPLICATION.SUMMARY.${status}`, {lng}),
statusColor: StatusColor[status],
types: application.case_data?.applicationTypes,
types: t(`PAGES.GENERAL_APPLICATION.SUMMARY.APPLICATION_TYPE_CCD.${type}`, {lng}),
id: application.id,
createdDate: dateTimeFormat(getApplicationCreatedDate(ccdClaim, application.id), lng),
applicationUrl: getViewApplicationUrl(claimId, claim, application,index),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {AppRequest} from 'common/models/AppRequest';
import {getCancelUrl} from 'services/features/generalApplication/generalApplicationService';
import {generateRedisKeyForGA} from 'modules/draft-store/draftStoreService';
import {getClaimById} from 'modules/utilityService';
import {t} from 'i18next';
import {HearingSupport} from 'models/generalApplication/hearingSupport';
import {Claim} from 'models/claim';
import {
getHearingSupportCaption,
getRespondToApplicationCaption,
saveRespondentHearingSupport,
} from 'services/features/generalApplication/response/generalApplicationResponseService';
Expand All @@ -30,7 +30,8 @@ async function renderView(gaResponse: GaResponse, claim: Claim, form: GenericFor
const headerTitle = getRespondToApplicationCaption(gaResponse.generalApplicationType, lang);
const cancelUrl = await getCancelUrl(req.params.id, claim);
const backLinkUrl = constructResponseUrlWithIdAndAppIdParams(req.params.id, req.params.appId, GA_RESPONSE_UNAVAILABLE_HEARING_DATES_URL);
res.render(viewPath, { form, cancelUrl, backLinkUrl, headerTitle, headingTitle: t('PAGES.GENERAL_APPLICATION.HEARING_SUPPORT.TITLE') });
const headingTitle = getHearingSupportCaption(lang);
res.render(viewPath, { form, cancelUrl, backLinkUrl, headerTitle, headingTitle });
}

hearingSupportResponseController.get(GA_RESPONSE_HEARING_SUPPORT_URL, (async (req: AppRequest, res: Response, next: NextFunction) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { CivilServiceClient } from 'client/civilServiceClient';
import { GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL } from 'routes/urls';
import { getClaimById } from 'modules/utilityService';
import { GeneralApplication } from 'common/models/generalApplication/GeneralApplication';
import { changeLabel } from 'common/utils/checkYourAnswer/changeButton';
import { PaymentSuccessfulSectionBuilder } from '../claim/paymentSuccessfulSectionBuilder';
import { getLng } from 'common/utils/languageToggleUtils';
import { constructResponseUrlWithIdAndAppIdParams } from 'common/utils/urlFormatter';
Expand All @@ -24,16 +23,17 @@ const logger = Logger.getLogger('additionalDocumentService');
const civilServiceApiBaseUrl = config.get<string>('services.civilService.url');
const civilServiceClientForDocRetrieve: CivilServiceClient = new CivilServiceClient(civilServiceApiBaseUrl, true);

export const getSummaryList = (additionalDocumentsList: UploadAdditionalDocument[], claimId: string, gaId: string): SummarySection => {
export const getSummaryList = (additionalDocumentsList: UploadAdditionalDocument[], claimId: string, gaId: string, lng: any): SummarySection => {
let index = 0;
const toc = t('PAGES.UPLOAD_DOCUMENTS.TYPE_OF_DOCUMENT', {lng});
const formattedSummary = summarySection(
{
title: '',
summaryRows: [],
});
additionalDocumentsList.forEach((uploadDocument: UploadAdditionalDocument) => {
index = index + 1;
formattedSummary.summaryList.rows.push(summaryRow('Type of document', uploadDocument.typeOfDocument));
formattedSummary.summaryList.rows.push(summaryRow(toc, uploadDocument.typeOfDocument));
formattedSummary.summaryList.rows.push(summaryRow(uploadDocument.caseDocument.documentName, '', `${constructResponseUrlWithIdAndAppIdParams(claimId, gaId, GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL)}?indexId=${index}`, 'Remove document'));
});
return formattedSummary;
Expand Down Expand Up @@ -95,11 +95,14 @@ export const prepareCCDData = (uploadAdditionalDocuments: UploadAdditionalDocume
});
};

export const buildSummarySectionForAdditionalDoc = (additionalDocumentsList: UploadAdditionalDocument[], claimId: string, gaId: string) => {
export const buildSummarySectionForAdditionalDoc = (additionalDocumentsList: UploadAdditionalDocument[], claimId: string, gaId: string, lng: any) => {
const rows: SummaryRow[] = [];
const toc = t('PAGES.UPLOAD_DOCUMENTS.TYPE_OF_DOCUMENT', {lng});
const uf = t('PAGES.UPLOAD_EVIDENCE_DOCUMENTS.CHECK_YOUR_ANSWERS_DOCUMENT_UPLOADED_2', {lng});
const changeLabel = (): string => t('COMMON.BUTTONS.CHANGE', {lng});
additionalDocumentsList.forEach(doc => {
rows.push(summaryRow('Type of document', doc.typeOfDocument));
rows.push(summaryRow('Uploaded document', doc.caseDocument.documentName, GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL.replace(':id', claimId).replace(':gaId', gaId), changeLabel('en')));
rows.push(summaryRow(toc, doc.typeOfDocument));
rows.push(summaryRow(uf, doc.caseDocument.documentName, GA_UPLOAD_ADDITIONAL_DOCUMENTS_URL.replace(':id', claimId).replace(':gaId', gaId), changeLabel()));
});
return rows;
};
Expand All @@ -121,4 +124,4 @@ export const getContentForCloseButton = (redirectUrl: string) => {
return new PaymentSuccessfulSectionBuilder()
.addButton('COMMON.BUTTONS.CLOSE_AND_RETURN_TO_DASHBOARD', redirectUrl)
.build();
};
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {YesNo, YesNoUpperCamelCase} from 'common/form/models/yesNo';
import {YesNo} from 'common/form/models/yesNo';
import { HearingSupport, SupportType } from 'common/models/generalApplication/hearingSupport';
import { ProposedPaymentPlanOption } from 'common/models/generalApplication/response/acceptDefendantOffer';
import { GaResponse } from 'common/models/generalApplication/response/gaResponse';
Expand Down Expand Up @@ -44,7 +44,7 @@ export const getSummarySections = (claimId: string, appId: string, gaResponse: G
return [
formattedRow('PAGES.GENERAL_APPLICATION.ACCEPT_DEFENDANT_OFFER.TITLE',
acceptOffer?.option,
yesNoFormatter,
yesNoFormatter2,
constructResponseUrlWithIdAndAppIdParams(claimId, appId, GA_ACCEPT_DEFENDANT_OFFER_URL)),
(acceptOffer?.option === YesNo.NO)
? row('PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER_RESPONSE.PROPOSED_PAYMENT_PLAN',
Expand All @@ -57,15 +57,15 @@ export const getSummarySections = (claimId: string, appId: string, gaResponse: G
const agreeToOrderSection = (): SummaryRow[] =>
[formattedRow('PAGES.GENERAL_APPLICATION.AGREE_TO_ORDER.TITLE',
gaResponse?.agreeToOrder,
yesNoFormatter,
yesNoFormatter4,
constructResponseUrlWithIdAndAppIdParams(claimId, appId, GA_AGREE_TO_ORDER_URL))];

const respondentAgreementSection = (): SummaryRow[] =>
[formattedRow('PAGES.GENERAL_APPLICATION.RESPONDENT_AGREEMENT.TITLE',
gaResponse?.respondentAgreement,
ra => (ra?.option === YesNo.YES)
? yesNoFormatter(ra?.option as YesNo)
: `${yesNoFormatter(ra?.option as YesNo)}<br/>${ra?.reasonForDisagreement}`,
? yesNoFormatter2(ra?.option as YesNo)
: `${yesNoFormatter2(ra?.option as YesNo)}<br/>${ra?.reasonForDisagreement}`,
constructResponseUrlWithIdAndAppIdParams(claimId, appId, GA_RESPONDENT_AGREEMENT_URL))];

const hearingArrangementSections = (): SummaryRow[] => {
Expand Down Expand Up @@ -93,14 +93,14 @@ export const getSummarySections = (claimId: string, appId: string, gaResponse: G
const href = `${constructResponseUrlWithIdAndAppIdParams(claimId, appId, GA_RESPONDENT_WANT_TO_UPLOAD_DOCUMENT_URL)}`;
let rowValue: string;
if (wantToUploadDocuments === YesNo.YES) {
rowValue = `<p class="govuk-border-colour-border-bottom-1 govuk-!-padding-bottom-2 govuk-!-margin-top-0">${t('COMMON.VARIATION.YES', {lng})}</p>`;
rowValue = `<p class="govuk-border-colour-border-bottom-1 govuk-!-padding-bottom-2 govuk-!-margin-top-0">${t('COMMON.VARIATION_2.YES', {lng})}</p>`;
rowValue += '<ul class="no-list-style">';
gaResponse.uploadEvidenceDocuments.forEach(uploadGAFile => {
rowValue += `<li>${uploadGAFile.caseDocument.documentName}</li>`;
});
rowValue += '</ul>';
} else {
rowValue = t('COMMON.VARIATION.NO', {lng});
rowValue = t('COMMON.VARIATION_2.NO', {lng});
}
rows.push(
summaryRow(t('PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.UPLOAD_DOCUMENTS', {lng}), rowValue, href, changeLabel()),
Expand Down Expand Up @@ -160,14 +160,15 @@ export const getSummarySections = (claimId: string, appId: string, gaResponse: G
.filter((key: keyof HearingSupport) => !!hearingSupport[key].selected)
.map(key => listItemCaption(`PAGES.GENERAL_APPLICATION.HEARING_SUPPORT.SUPPORT.${getCaption(key as SupportType)}`))
.join('');
const noSupport = yesNoFormatter(YesNo.NO);
return selectedHtml
? [row(
'PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.NEED_ADJUSTMENTS',
`<ul class="no-list-style">${selectedHtml}</ul>`,
GA_RESPONSE_HEARING_SUPPORT_URL)]
: [row(
'PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.NEED_ADJUSTMENTS',
YesNoUpperCamelCase.NO,
noSupport,
GA_RESPONSE_HEARING_SUPPORT_URL)];
} else {
return [];
Expand All @@ -192,6 +193,10 @@ export const getSummarySections = (claimId: string, appId: string, gaResponse: G

const yesNoFormatter = (yesNo: YesNo): string => t(`COMMON.VARIATION.${yesNo.toUpperCase()}`, {lng});

const yesNoFormatter2 = (yesNo: YesNo): string => t(`COMMON.VARIATION_2.${yesNo.toUpperCase()}`, {lng});

const yesNoFormatter4 = (yesNo: YesNo): string => t(`COMMON.VARIATION_4.${yesNo.toUpperCase()}`, {lng});

return [
agreeToOrderSection,
acceptOfferSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ export function getRespondToApplicationCaption(generalAppTypes: ApplicationTypeO
{ lng: getLng(lng), interpolation: { escapeValue: false }, applicationType});
}

export function getUnavailableHearingDateCaption(lng: string): string {
return t('PAGES.GENERAL_APPLICATION.UNAVAILABLE_HEARING_DATES.TITLE', { lng: getLng(lng) });
}

export function getHearingSupportCaption(lng: string): string {
return t('PAGES.GENERAL_APPLICATION.HEARING_SUPPORT.TITLE', { lng: getLng(lng) });
}

export const saveRespondentHearingArrangement = async (redisKey: string, hearingArrangement: HearingArrangement): Promise<void> => {
try {
const gaResponse = await getDraftGARespondentResponse(redisKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,6 @@ function toCUIClaimGeneralApplications(ccdClaimGeneralApplications: CCDGeneralAp
return claimGeneralApplications;
}

const displayToEnumKey = (displayValue: string): ApplicationTypeOption => {
export const displayToEnumKey = (displayValue: string): ApplicationTypeOption => {
return (Object.keys(selectedApplicationTypeByOptions) as Array<keyof typeof selectedApplicationTypeByOptions>)
.find(key => selectedApplicationTypeByOptions[key]?.[2] === displayValue) as ApplicationTypeOption | undefined;};
Loading

0 comments on commit 628a69e

Please sign in to comment.