From 2bff70ca80e40ecadf282a46b50d4faab9b20455 Mon Sep 17 00:00:00 2001 From: Mutesasira Moses Date: Fri, 8 Mar 2024 05:06:28 +0000 Subject: [PATCH] Improve Results and Validation Routing --- frontend/src/App.js | 59 +++---------------- frontend/src/components/Reports/Routine.js | 6 +- .../Reports/routine/statisticsReport.js | 2 +- .../pathology/PathologyDashboard.css | 1 + .../components/resultPage/SearchResultForm.js | 29 +++++++-- .../src/components/validation/SearchForm.js | 13 +++- 6 files changed, 51 insertions(+), 59 deletions(-) diff --git a/frontend/src/App.js b/frontend/src/App.js index 83cb0f0675..e869d4c56c 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -345,66 +345,31 @@ export default function App() { ( - <> - { - (window.location.href = - "/result?type=unit&doRange=false") - } - - )} + component={() => } role="Results" /> ( - <> - { - (window.location.href = - "/result?type=patient&doRange=false") - } - - )} + component={() => } role="Results" /> ( - <> - { - (window.location.href = - "/result?type=order&doRange=false") - } - - )} + component={() => } role="Results" /> ( - <> - { - (window.location.href = - "result?type=date&doRange=false") - } - - )} + component={() => } role="Results" /> ( - <> - { - (window.location.href = - "/result?type=range&doRange=true") - } - - )} + component={() => } role="Results" /> } role="Reports" @@ -434,25 +399,19 @@ export default function App() { ( - <>{(window.location.href = "/validation?type=routine")} - )} + component={() => } role="Validation" /> ( - <>{(window.location.href = "/validation?type=order")} - )} + component={() => } role="Validation" /> ( - <>{(window.location.href = "/validation?type=range")} - )} + component={() => } role="Validation" /> , }, { - link: "/AggregateReports?type=indicator&report=indicatorHaitiLNSPAllTests", + link: "/RoutineReport?type=indicator&report=indicatorHaitiLNSPAllTests", label: }, { - link:"/AggregateReports?type=indicator&report=indicatorCDILNSPHIV", + link:"/RoutineReport?type=indicator&report=indicatorCDILNSPHIV", label: , }, ], diff --git a/frontend/src/components/Reports/routine/statisticsReport.js b/frontend/src/components/Reports/routine/statisticsReport.js index 54ad7a2712..0648e314a0 100644 --- a/frontend/src/components/Reports/routine/statisticsReport.js +++ b/frontend/src/components/Reports/routine/statisticsReport.js @@ -29,7 +29,7 @@ const statisticsReport = () => { const [selectedLabUnits, setSelectedLabUnits] = useState([]); const [selectedPriorities, setSelectedPriorities] = useState([]); const [selectedTimeFrames, setSelectedTimeFrames] = useState([]); - const [selectedYear, setSelectedYear] = useState(new Date().getFullYear()); + const [selectedYear, setSelectedYear] = useState({ value: new Date().getFullYear(), label: new Date().getFullYear()}); const [loading, setLoading] = useState(false); const [notificationVisible, setNotificationVisible] = useState(false); diff --git a/frontend/src/components/pathology/PathologyDashboard.css b/frontend/src/components/pathology/PathologyDashboard.css index 69f167a4e5..38bda3de97 100644 --- a/frontend/src/components/pathology/PathologyDashboard.css +++ b/frontend/src/components/pathology/PathologyDashboard.css @@ -3,6 +3,7 @@ display: grid; grid-template-columns: repeat(4, 1fr); gap: 50px; + padding: 50px; } .dashboard-tile { diff --git a/frontend/src/components/resultPage/SearchResultForm.js b/frontend/src/components/resultPage/SearchResultForm.js index 7e67964c59..6072d706e3 100644 --- a/frontend/src/components/resultPage/SearchResultForm.js +++ b/frontend/src/components/resultPage/SearchResultForm.js @@ -284,10 +284,30 @@ export function SearchResultForm(props) { querySearch(values); } - let displayFormType = new URLSearchParams(window.location.search).get( - "type", - ); - let doRange = new URLSearchParams(window.location.search).get("doRange"); + + var displayFormType = ""; + var doRange = ""; + if(window.location.pathname == "/result"){ + displayFormType = new URLSearchParams(window.location.search).get( + "type", + ); + doRange = new URLSearchParams(window.location.search).get("doRange"); + } else if(window.location.pathname == "/LogbookResults"){ + displayFormType = "unit" ; + doRange = "false"; + } else if(window.location.pathname == "/PatientResults"){ + displayFormType = "patient" ; + doRange = "false"; + }else if(window.location.pathname == "/AccessionResults"){ + displayFormType = "order" ; + doRange = "false"; + }else if(window.location.pathname == "/StatusResults"){ + displayFormType = "date" ; + doRange = "false"; + } else if(window.location.pathname == "/RangeResults"){ + displayFormType = "range" ; + doRange = "true"; + } setSearchBy({ type: displayFormType, doRange: doRange, @@ -295,6 +315,7 @@ export function SearchResultForm(props) { }, []); useEffect(() => { + let accessionNumber = new URLSearchParams(window.location.search).get( "accessionNumber", ); diff --git a/frontend/src/components/validation/SearchForm.js b/frontend/src/components/validation/SearchForm.js index 4f6ff3f535..baafd9a07c 100644 --- a/frontend/src/components/validation/SearchForm.js +++ b/frontend/src/components/validation/SearchForm.js @@ -153,7 +153,18 @@ const SearchForm = (props) => { } useEffect(() => { - let param = new URLSearchParams(window.location.search).get("type"); + var param = ""; + if(window.location.pathname == "/validation"){ + param = new URLSearchParams(window.location.search).get("type"); + } else if(window.location.pathname == "/ResultValidation"){ + param = "routine" ; + } else if(window.location.pathname == "/AccessionValidation"){ + param = "order" ; + }else if(window.location.pathname == "/AccessionValidationRange"){ + param = "range" ; + }else if(window.location.pathname == "/ResultValidationByTestDate"){ + param = "testDate"; + } setSearchBy(param); if (param === "order") { setDoRagnge(false);