{
);
let searchResultCases = searchResult.Cases?.map((element) => {
return {
- title: element.id + " - " + element.name,
- content: element.desc,
+ title: element.id + " - " + element.issuetype,
+ content: element.individualid,
subtitle: GENERIC_NAME,
link: "/private/cases/" + element.id + "/details",
imgIcon: require("../../assets/CasesIcon.png"),
@@ -77,10 +77,6 @@ const Cases = () => {
});
if (searchResultCases) {
- console.log({
- searchResultCases: searchResultCases,
- totalCount: searchResult.totalCount,
- });
dispatch(
setsearchCaseResult({
searchResult: searchResultCases,
diff --git a/app/caseflow_web/src/components/Dashboard/Dashboard.tsx b/app/caseflow_web/src/components/Dashboard/Dashboard.tsx
index 3068e8d04..1a9d9013f 100644
--- a/app/caseflow_web/src/components/Dashboard/Dashboard.tsx
+++ b/app/caseflow_web/src/components/Dashboard/Dashboard.tsx
@@ -3,9 +3,12 @@ import Search from "../Search/Search";
import "./dashboard.scss";
import CaseList from "../CaseList/CaseList";
import MyTask from "../MyTask/MyTask";
-import { fetchRecentCaseList } from "../../services/CaseService";
+import { fetchRecentCaseList, searchCases } from "../../services/CaseService";
import { Typography } from "@mui/material";
import { GENERIC_NAME } from "../../apiManager/endpoints/config";
+import { useDispatch, useSelector } from "react-redux";
+import { setsearchCaseResult } from "../../reducers/newCaseReducer";
+import { State } from "../../interfaces/stateInterface";
const caseListProps = {
title: "Recent " + GENERIC_NAME,
@@ -17,6 +20,45 @@ const caseListProps = {
const Dashboard = () => {
const [recentCases, setrecentCases] = useState([]);
+ const [searchField, setSearchField] = useState("");
+ const [searchColumn, setSearchColumn] = useState("name");
+
+ const dispatch = useDispatch();
+ const searchResults = useSelector(
+ (state: State) => state.cases.searchCaseResult
+ );
+
+ const searchCasesDetails = async () => {
+ let searchResult = await searchCases(
+ searchField,
+ searchColumn,
+ 1,
+ "id",
+ true,
+ true,
+ null,
+ null
+ );
+ let searchResultCases = searchResult.Cases?.map((element) => {
+ return {
+ title: element.id + " - " + element.issuetype,
+ content: element.individualid,
+ subtitle: GENERIC_NAME,
+ link: "/private/cases/" + element.id + "/details",
+ imgIcon: require("../../assets/CasesIcon.png"),
+ };
+ });
+
+ if (searchResultCases) {
+ dispatch(
+ setsearchCaseResult({
+ searchResult: searchResultCases,
+ totalCount: searchResult.totalCount,
+ })
+ );
+ }
+ };
+
const recentCaseList = async () => {
let recentCases = await fetchRecentCaseList();
recentCases = recentCases.filter((element, index) => {
@@ -28,9 +70,10 @@ const Dashboard = () => {
useEffect(() => {
recentCaseList();
}, []);
+ useEffect(() => {
+ searchCasesDetails();
+ }, [searchField, searchColumn]);
- const [searchField, setSearchField] = useState("");
- const [searchColumn, setSearchColumn] = useState("name");
const [dropDownArray, setdropDownArray] = useState(["Name", "Description"]);
return (
@@ -42,8 +85,7 @@ const Dashboard = () => {
+ setSearchColumn={setSearchColumn} dropDownValues={searchResults} >