Merged PR 2350: added in count on case status dropdown

added in count on case status dropdown

Related work items: #23447
This commit is contained in:
Robert Bond
2026-05-28 09:02:30 +00:00
parent 905c82f598
commit 24cd7000f7
4 changed files with 147 additions and 15 deletions
+27 -13
View File
@@ -3,9 +3,10 @@ import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form";
import { useEffect, useState } from "react";
import transLookup from "../../data/lookuptranslations.json";
import { statusValues } from "../utils/caseStagesObj";
import { getCaseStatus } from "../../actions/services/caseDirectService";
const required = (errorMsg) => (value) =>
value || typeof value === "number" ? undefined : errorMsg;
@@ -177,16 +178,8 @@ const RenderCaseStatusList = ({
)
? ""
: router.locale == "cy"
? jsonpath({
path:
'$..[?(@ && @.statuscode=="' +
optionsObj[key]
.statuscode +
'")].value_cy',
json: optionsObj,
eval: true
})
: optionsObj[key].value ||
? `${optionsObj[key].value_cy} (${optionsObj[key].caseCount || 0})`
: `${optionsObj[key].value} (${optionsObj[key].caseCount || 0})` ||
t(
"case:summary-no-date-entered-label"
)}
@@ -206,6 +199,27 @@ let AdvancedSearch = (props) => {
const router = useRouter();
const { locale } = router;
const [caseStatusValues, setCaseStatusValues] = useState([]);
useEffect(() => {
const fetchCaseStatus = async () => {
try {
const response = await getCaseStatus();
setCaseStatusValues(
Array.isArray(response?.data)
? response.data
: response?.data?.value || response || []
);
} catch (error) {
console.error("Failed to fetch case statuses", error);
setCaseStatusValues([]);
}
};
fetchCaseStatus();
}, []);
const {
LPAData,
onSubmit,
@@ -691,7 +705,7 @@ let AdvancedSearch = (props) => {
name="statusCode"
id="statusCode"
component={RenderCaseStatusList}
optionsObj={statusValues}
optionsObj={caseStatusValues}
//validate={[required]}
label={t(
"search:case-status-label"