diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index e3f5f72032..75edb814c3 100755
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -61,7 +61,7 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
- "prettier": "^3.3.2",
+ "prettier": "^3.4.2",
"sass": "^1.57.1"
}
},
@@ -15012,9 +15012,9 @@
}
},
"node_modules/prettier": {
- "version": "3.3.2",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz",
- "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==",
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
+ "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
"dev": true,
"bin": {
"prettier": "bin/prettier.cjs"
diff --git a/frontend/package.json b/frontend/package.json
index 21de11ac57..c8ecb33633 100755
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -86,7 +86,7 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
- "prettier": "^3.3.2",
+ "prettier": "^3.4.2",
"sass": "^1.57.1"
}
}
diff --git a/frontend/src/components/admin/program/ProgramManagement.js b/frontend/src/components/admin/program/ProgramManagement.js
index 573cae5d5e..8b0349edc7 100644
--- a/frontend/src/components/admin/program/ProgramManagement.js
+++ b/frontend/src/components/admin/program/ProgramManagement.js
@@ -153,10 +153,11 @@ function ProgramManagement() {
useEffect(() => {
componentMounted.current = true;
getFromOpenElisServer("/rest/displayList/PROGRAM", fetchPrograms);
- getFromOpenElisServer(
- "/rest/displayList/TEST_SECTION_ACTIVE",
- fetchTestSections,
- );
+ // getFromOpenElisServer(
+ // "/rest/displayList/TEST_SECTION_ACTIVE",
+ // fetchTestSections,
+ // );
+ getFromOpenElisServer("/rest/user-test-sections/ALL", fetchTestSections);
return () => {
componentMounted.current = false;
diff --git a/frontend/src/components/layout/search/searchBar.css b/frontend/src/components/layout/search/searchBar.css
index e202ea237d..6e9b048cc5 100644
--- a/frontend/src/components/layout/search/searchBar.css
+++ b/frontend/src/components/layout/search/searchBar.css
@@ -17,7 +17,6 @@
.search-input {
width: 100%;
position: relative;
-
}
.search-bar-container:hover {
@@ -52,11 +51,8 @@
cursor: pointer;
}
-
/* Large screens (1208px and up) */
@media (min-width: 1208px) {
-
-
.search-bar-container {
width: 45%;
margin-top: 0%;
@@ -77,7 +73,7 @@
right: 130px;
box-shadow: 0em 0.1em 0.5em #ccc;
}
-
+
.patientHead {
overflow-y: auto;
width: 600px;
diff --git a/frontend/src/components/layout/search/searchBar.js b/frontend/src/components/layout/search/searchBar.js
index a3223b6b28..e1db0c5216 100644
--- a/frontend/src/components/layout/search/searchBar.js
+++ b/frontend/src/components/layout/search/searchBar.js
@@ -148,4 +148,4 @@ const SearchBar = (props) => {
);
};
-export default SearchBar;
\ No newline at end of file
+export default SearchBar;
diff --git a/frontend/src/components/reports/Routine.js b/frontend/src/components/reports/Routine.js
index d9ac90221c..af9b62b456 100644
--- a/frontend/src/components/reports/Routine.js
+++ b/frontend/src/components/reports/Routine.js
@@ -23,6 +23,16 @@ export const RoutineReportsMenu = {
},
],
},
+ {
+ title: ,
+ icon: IbmWatsonDiscovery,
+ SideNavMenuItem: [
+ {
+ link: "/RoutineReport?type=patient&report=CSVPatientStatusReport",
+ label: ,
+ },
+ ],
+ },
{
title: ,
icon: Microscope,
diff --git a/frontend/src/components/reports/routine/ActivityReport.js b/frontend/src/components/reports/routine/ActivityReport.js
index ee0c9cd9c1..3b7c5cb5a5 100644
--- a/frontend/src/components/reports/routine/ActivityReport.js
+++ b/frontend/src/components/reports/routine/ActivityReport.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useState, useRef } from "react";
+import React, { useEffect, useState, useRef, useContext } from "react";
import { FormattedMessage, useIntl } from "react-intl";
import {
Form,
@@ -21,11 +21,14 @@ import "../../Style.css";
import { getFromOpenElisServer } from "../../utils/Utils";
import { encodeDate } from "../../utils/Utils";
import config from "../../../config.json";
+import { ConfigurationContext } from "../layout/Layout";
+import UserSessionDetailsContext from "../../UserSessionDetailsContext";
const ActivityReport = ({ report }) => {
const intl = useIntl();
const [loading, setLoading] = useState(true);
const [notificationVisible, setNotificationVisible] = useState(false);
+ const { userSessionDetails } = useContext(UserSessionDetailsContext);
const [reportFormValues, setReportFormValues] = useState({
startDate: null,
endDate: null,
@@ -59,16 +62,18 @@ const ActivityReport = ({ report }) => {
setLoading(true);
let reportType = "";
let additionalParams = "";
- switch (selectedReportType) {
- case "byTest":
+ switch (
+ report // Changed from selectedReportType to report
+ ) {
+ case "activityReportByTest":
reportType = "activityReportByTest";
additionalParams = "report=activityReportByTest";
break;
- case "byPanel":
+ case "activityReportByPanel":
reportType = "activityReportByPanel";
additionalParams = "report=activityReportByPanel";
break;
- case "byUnit":
+ case "activityReportByTestSection":
reportType = "activityReportByTestSection";
additionalParams = "report=activityReportByTestSection";
break;
@@ -77,15 +82,38 @@ const ActivityReport = ({ report }) => {
}
const baseParams = `${additionalParams}&type=indicator&report=${reportType}`;
const baseUrl = `${config.serverBaseUrl}/ReportPrint`;
- const url = `${baseUrl}?${baseParams}&lowerDateRange=${reportFormValues.startDate}&upperDateRange=${reportFormValues.endDate}`;
+ const url = `${baseUrl}?${baseParams}&lowerDateRange=${reportFormValues.startDate}&upperDateRange=${reportFormValues.endDate}&value=${reportFormValues.value}`;
window.open(url, "_blank");
setLoading(false);
setNotificationVisible(true);
};
const setDataList = (data) => {
- setList(data);
- console.log("data: ", data);
+ console.log("Raw API data: ", data);
+
+ if (
+ report === "activityReportByTestSection" &&
+ userSessionDetails?.userLabRolesMap
+ ) {
+ // Get departments where user has Reports role
+ const authorizedDepartments = Object.entries(
+ userSessionDetails.userLabRolesMap,
+ )
+ .filter(([dept, roles]) => roles.includes("Reports"))
+ .map(([dept]) => dept);
+
+ console.log("Authorized departments: ", authorizedDepartments);
+
+ // Filter data to only show authorized departments
+ const filteredData = data.filter((item) =>
+ authorizedDepartments.includes(item.value),
+ );
+
+ console.log("Filtered data: ", filteredData);
+ setList(filteredData);
+ } else {
+ setList(data);
+ }
setLoading(false);
};
@@ -93,18 +121,17 @@ const ActivityReport = ({ report }) => {
switch (report) {
case "activityReportByTest":
getFromOpenElisServer("/rest/test-list", setDataList);
- console.log("list: ", list);
break;
case "activityReportByPanel":
getFromOpenElisServer("/rest/panels", setDataList);
break;
case "activityReportByTestSection":
- getFromOpenElisServer("/rest/test-sections", setDataList);
+ getFromOpenElisServer("/rest/user-test-sections/ALL", setDataList);
break;
default:
break;
}
- }, [report]);
+ }, [report, userSessionDetails]); // Added userSessionDetails to dependencies
return (
<>
@@ -127,7 +154,7 @@ const ActivityReport = ({ report }) => {
@@ -159,9 +186,7 @@ const ActivityReport = ({ report }) => {
/>
- hihih
-
-
+
{list && list.length > 0 && (