Merged PR 2368: case stage ROW updates and case closed variants and adv search fix

Related work items: #23551, #23555, #23559
This commit is contained in:
Robert Bond
2026-06-03 12:44:59 +00:00
parent a9be19b901
commit d0cae0fff1
9 changed files with 160 additions and 33 deletions
+8 -1
View File
@@ -23,9 +23,16 @@ const statusTextMap = {
const StatusDetails = (props) => {
let { t } = useTranslation();
const specialistProcess =
props.searchResultsObj?.searchDetailsObj[0]?.value[0]
?.pinswg_specialistcaseprocess;
console.log(props.currentView?.caseReference?.statuscode);
const stages = getStagesForAppealType(
props.currentView?.caseReference?.appealType,
props.currentView?.caseReference?.statuscode
props.currentView?.caseReference?.statuscode,
specialistProcess
);
const EventView = (eventsArr) => {
@@ -216,7 +216,7 @@ export const stagesByCaseType = {
descriptionKey: "final-comments-desc-callin"
},
{
stageId: 846040020,
stageId: 846040049,
titleKey: "event",
descriptionKey: "event-desc-callin"
},
@@ -378,14 +378,14 @@ export const stagesByCaseType = {
descriptionKey: "case-started-case-in-progress-desc"
},
{
stageId: 846040010,
stageId: 846040062,
titleKey: "statements",
descriptionKey: "statements-desc-order"
},
{
stageId: 846040019,
stageId: 846040055,
titleKey: "final-comments",
descriptionKey: "final-comments-desc-order"
descriptionKey: "final-comments-desc-cpo"
},
{
stageId: 846040037,
@@ -416,7 +416,7 @@ export const stagesByCaseType = {
descriptionKey: "application-registered-desc"
},
{
stageId: 846040036,
stageId: 846040054,
titleKey: "application-start-case-in-progress",
descriptionKey: "application-start-case-in-progress-desc"
},
@@ -426,9 +426,9 @@ export const stagesByCaseType = {
descriptionKey: "statements-desc"
},
{
stageId: 846040019,
stageId: 846040063,
titleKey: "final-comments",
descriptionKey: "statements-desc"
descriptionKey: "final-comments-desc-application"
},
{
stageId: 846040022,
@@ -814,9 +814,30 @@ const normaliseCaseType = (caseType) =>
.replace(/[^A-Z0-9]+/g, "_")
.replace(/^_|_$/g, "");
const resolveStages = (caseTypeOrAppealTypeId) => {
const specialistProcessKeyById = {
// TODO: replace these with the real CRM option-set values
846040000: "RIGHTS_OF_WAY_ORDERS",
846040100: "RIGHTS_OF_WAY_ORDERS",
846040001: "RIGHTS_OF_WAY_ORDERS",
846040101: "RIGHTS_OF_WAY_ORDERS",
846040002: "RIGHTS_OF_WAY_SCHEDULE_14",
846040102: "RIGHTS_OF_WAY_SCHEDULE_14",
846040003: "REQUESTS_FOR_DIRECTION",
846040103: "REQUESTS_FOR_DIRECTION"
};
const appealTypeSpecialistProcessStageMap = {
846040015: specialistProcessKeyById
};
const resolveStages = (caseTypeOrAppealTypeId, specialistProcess) => {
const appealTypeId = Number(caseTypeOrAppealTypeId);
const specialistProcessKey =
appealTypeSpecialistProcessStageMap[appealTypeId]?.[specialistProcess];
const appealTypeKey =
caseTypeKeyByAppealTypeId[Number(caseTypeOrAppealTypeId)];
specialistProcessKey || caseTypeKeyByAppealTypeId[appealTypeId];
const normalised = normaliseCaseType(caseTypeOrAppealTypeId);
@@ -833,14 +854,35 @@ const resolveStages = (caseTypeOrAppealTypeId) => {
return entry;
};
export const getStagesForAppealType = (caseType, currentStageId) => {
const stages = resolveStages(caseType);
const currentStageNumber = Number(currentStageId);
const caseClosedStatusIds = [1000, 5, 6, 846040013, 846040060, 846040059];
const currentIndex = stages.findIndex(
const isCaseClosedStatus = (stageId) =>
caseClosedStatusIds.includes(Number(stageId));
const getStageIndex = (stages, currentStageNumber) => {
const exactIndex = stages.findIndex(
(stage) => Number(stage.stageId) === currentStageNumber
);
if (exactIndex !== -1) return exactIndex;
if (isCaseClosedStatus(currentStageNumber)) {
return stages.findIndex((stage) => stage.titleKey === "case-closed");
}
return -1;
};
export const getStagesForAppealType = (
caseType,
currentStageId,
specialistProcess
) => {
const stages = resolveStages(caseType, specialistProcess);
const currentStageNumber = Number(currentStageId);
const currentIndex = getStageIndex(stages, currentStageNumber);
return stages.map((stage, index) => ({
...stage,
status:
+22
View File
@@ -673,6 +673,28 @@ const SearchResults = (props) => {
: item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
{detailsObj?.pinswg_specialistcaseprocess && (
<>
<br /> <br />
<span>
{router.locale == "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
detailsObj[
"pinswg_specialistcaseprocess@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true
})
: detailsObj[
"pinswg_specialistcaseprocess@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
</span>
</>
)}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">