diff --git a/frontend/src/App.js b/frontend/src/App.js index eff531cd88..fb4752152b 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -1,10 +1,11 @@ import React, { useState, useEffect } from "react"; import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; -import { confirmAlert } from "react-confirm-alert"; import { IntlProvider } from "react-intl"; +import { confirmAlert } from "react-confirm-alert"; import Layout from "./components/layout/Layout"; import Home from "./components/Home"; import Login from "./components/Login"; +import LandingPage from "./components/home/LandingPage"; import { Admin } from "./components"; import ResultSearch from "./components/resultPage/ResultSearch"; import UserSessionDetailsContext from "./UserSessionDetailsContext"; @@ -209,6 +210,11 @@ export default function App() { } /> + } + /> = () => { }, [selectedTile]); useEffect(() => { - getFromOpenElisServer("/rest/user-test-sections", (fetchedTestSections) => { - fetchTestSections(fetchedTestSections); - }); + getFromOpenElisServer( + "/rest/user-test-sections/ALL", + (fetchedTestSections) => { + fetchTestSections(fetchedTestSections); + }, + ); return () => { componentMounted.current = false; }; diff --git a/frontend/src/components/home/LandingPage.tsx b/frontend/src/components/home/LandingPage.tsx new file mode 100644 index 0000000000..ceefe6c0b7 --- /dev/null +++ b/frontend/src/components/home/LandingPage.tsx @@ -0,0 +1,194 @@ +import React, { useState, useEffect, useContext } from "react"; +import { + Grid, + Column, + TextInput, + Button, + Checkbox, + Tile, + Form, +} from "@carbon/react"; +import { FormattedMessage, useIntl } from "react-intl"; +import { getFromOpenElisServer, postToOpenElisServer } from "../utils/Utils"; +import { ConfigurationContext } from "../layout/Layout"; +import UserSessionDetailsContext from "../../UserSessionDetailsContext"; + +const LandingPage: React.FC = () => { + const intl = useIntl(); + const [departments, setDepartments] = useState([]); + const [filteredDepartments, setFilteredDepartments] = useState([]); + const [selectedDepartment, setSelectedDepartment] = useState(""); + const [rememberChoice, setRememberChoice] = useState(false); + const [searchTerm, setSearchTerm] = useState(""); + const { configurationProperties } = + useContext(ConfigurationContext); + const { userSessionDetails } = useContext( + UserSessionDetailsContext, + ); + + interface UserSessionDetailsContext { + userSessionDetails: any; + } + + interface ConfigurationContext { + configurationProperties: any; + } + + useEffect(() => { + if ( + configurationProperties.REQUIRE_LAB_UNIT_AT_LOGIN === "false" || + userSessionDetails.loginLabUnit + ) { + const refererUrl = document.referrer; + if (refererUrl.endsWith("/landing")) { + window.location.href = "/"; + } else { + window.location.href = refererUrl; + } + } + getFromOpenElisServer("/rest/user-test-sections/ALL", (response) => { + setDepartments(response); + setFilteredDepartments(response); + }); + }, []); + + const handleSearch = (event) => { + const term = event.target.value.toLowerCase(); + setSearchTerm(term); + setFilteredDepartments( + departments.filter((dept) => dept.value.toLowerCase().includes(term)), + ); + }; + + const handleDepartmentSelect = (departmentId) => { + setSelectedDepartment(departmentId); + }; + + const handleContinue = () => { + if (selectedDepartment) { + // if(rememberChoice){ + // localStorage.setItem("selectedDepartment", selectedDepartment); + // } + postToOpenElisServer( + "/rest/setUserLoginLabUnit/" + selectedDepartment, + {}, + handlePostLabUbit, + ); + } + const refererUrl = document.referrer; + if (refererUrl.endsWith("/landing")) { + window.location.href = "/"; + } else { + window.location.href = refererUrl; + } + }; + + const handlePostLabUbit = (status) => {}; + + return ( + + + +

Welcome!

+

Please select a unit to continue

+
+ +
+ {filteredDepartments?.map((dept) => ( +
handleDepartmentSelect(dept.id)} + > + {dept.value} +
+ ))} +
+ {/* setRememberChoice(e.target.checked)} + /> */} + + +
+
+
+ ); +}; + +export default LandingPage; diff --git a/frontend/src/components/immunohistochemistry/ImmunohistochemistryCaseView.js b/frontend/src/components/immunohistochemistry/ImmunohistochemistryCaseView.js index 68c0f8eb03..3aface80e7 100644 --- a/frontend/src/components/immunohistochemistry/ImmunohistochemistryCaseView.js +++ b/frontend/src/components/immunohistochemistry/ImmunohistochemistryCaseView.js @@ -19,6 +19,7 @@ import { InlineLoading, Toggle, TextArea, + FilterableMultiSelect, } from "@carbon/react"; import { Launch, Subtract } from "@carbon/react/icons"; import { @@ -57,6 +58,9 @@ function ImmunohistochemistryCaseView() { const { userSessionDetails } = useContext(UserSessionDetailsContext); const [immunohistochemistrySampleInfo, setImmunohistochemistrySampleInfo] = useState({ labNumber: "" }); + + const [conclusions, setConclusions] = useState([]); + const [statuses, setStatuses] = useState([]); const [reportTypes, setReportTypes] = useState([]); const [technicianUsers, setTechnicianUsers] = useState([]); @@ -83,6 +87,7 @@ function ImmunohistochemistryCaseView() { diagnosis: "", molecularSubType: "", conclusion: "", + codedConclusions: [], ihcScore: "", ihcRatio: "", averageChrom: "", @@ -174,6 +179,20 @@ function ImmunohistochemistryCaseView() { params[index]["toggled"] = e; setReportParams(params); }; + + useEffect(() => { + componentMounted.current = true; + + getFromOpenElisServer( + "/rest/displayList/PATHOLOGIST_CONCLUSIONS", + setConclusions, + ); + + return () => { + componentMounted.current = false; + }; + }, []); + const createReportParams = (reportType, index) => { switch (reportType) { case "BREAST_CANCER_HORMONE_RECEPTOR": @@ -650,8 +669,57 @@ function ImmunohistochemistryCaseView() { <> + + + + + + + (item ? item.value : "")} + initialSelectedItems={ + reportParams[index]?.codedConclusions + } + onChange={(changes) => { + var params = { ...reportParams }; + if (!params[index]) { + params[index] = {}; + } + params[index].codedConclusions = + changes.selectedItems; + setReportParams(params); + }} + selectionFeedback="top-after-reopen" + /> + + + {reportParams[index] && + reportParams[index]?.codedConclusions.map( + (conclusion, conclusionIndex) => ( + { + var params = { ...reportParams }; + params[index]["codedConclusions"].splice( + conclusionIndex, + 1, + ); + setReportParams(params); + }} + > + {conclusion.value} + + ), + )} + + + - +