diff --git a/frontend/src/components/admin/Admin.js b/frontend/src/components/admin/Admin.js index d597a5337d..59eb79dae0 100644 --- a/frontend/src/components/admin/Admin.js +++ b/frontend/src/components/admin/Admin.js @@ -29,24 +29,6 @@ function Admin() { - {/* - - - - */} - {/* - - - - */} diff --git a/frontend/src/components/modifyOrder/ModifyOrder.js b/frontend/src/components/modifyOrder/ModifyOrder.js index 047ad6376a..9345e2a00d 100644 --- a/frontend/src/components/modifyOrder/ModifyOrder.js +++ b/frontend/src/components/modifyOrder/ModifyOrder.js @@ -1,6 +1,17 @@ import React, { useContext, useEffect, useState, useRef } from "react"; -import { useParams } from 'react-router-dom'; -import { Button, ProgressIndicator, ProgressStep, Stack ,Breadcrumb ,BreadcrumbItem ,Grid,Column ,Section ,Tag} from "@carbon/react"; +import { useParams } from "react-router-dom"; +import { + Button, + ProgressIndicator, + ProgressStep, + Stack, + Breadcrumb, + BreadcrumbItem, + Grid, + Column, + Section, + Tag, +} from "@carbon/react"; import EditSample from "./EditSample"; import AddOrder from "../addOrder/AddOrder"; import "../addOrder/add-order.scss"; @@ -10,7 +21,7 @@ import { AlertDialog, NotificationKinds } from "../common/CustomNotification"; import { postToOpenElisServer, getFromOpenElisServer } from "../utils/Utils"; import EditOrderEntryAdditionalQuestions from "./EditOrderEntryAdditionalQuestions"; import OrderSuccessMessage from "../addOrder/OrderSuccessMessage"; -import { FormattedMessage ,useIntl} from "react-intl"; +import { FormattedMessage, useIntl } from "react-intl"; export let sampleObject = { index: 0, @@ -45,25 +56,25 @@ const ModifyOrder = () => { let accessionNumber = new URLSearchParams(window.location.search).get( "accessionNumber", ); - accessionNumber = accessionNumber?accessionNumber:"" ; - patientId =patientId?patientId:""; + accessionNumber = accessionNumber ? accessionNumber : ""; + patientId = patientId ? patientId : ""; getFromOpenElisServer( "/rest/SampleEdit?patientId=" + patientId + "&accessionNumber=" + accessionNumber, - loadOrderValues, + loadOrderValues, ); return () => { componentMounted.current = false; - } + }; }, []); const loadOrderValues = (data) => { if (componentMounted.current) { setOrderFormValues(data); } - } + }; const { notificationVisible, setNotificationVisible, setNotificationBody } = useContext(NotificationContext); @@ -93,7 +104,7 @@ const ModifyOrder = () => { const handleSubmitOrderForm = (e) => { e.preventDefault(); setPage(page + 1); - console.log(JSON.stringify(orderFormValues)) + console.log(JSON.stringify(orderFormValues)); // postToOpenElisServer( // "/rest/SamplePatientEntry", // JSON.stringify(orderFormValues), @@ -183,19 +194,23 @@ const ModifyOrder = () => { }; const intl = useIntl(); - return ( <> - - {intl.formatMessage({ id: "home.label" })} - {intl.formatMessage({ id: "label.search.patient" })} + + + {intl.formatMessage({ id: "home.label" })} + + + {intl.formatMessage({ id: "label.search.patient" })} +
-
- {orderFormValues?.patientName ? (
+
+ {orderFormValues?.sampleOrderItems ? ( +
: @@ -234,7 +249,7 @@ const ModifyOrder = () => {
{" "} - {" "} + {" "}
)} @@ -245,81 +260,85 @@ const ModifyOrder = () => {
{notificationVisible === true ? : ""} -
-

- -

- {page <= orderPageNumber && ( - handleTabClickHandler(e)} - > - } - /> - } + {orderFormValues?.sampleOrderItems && ( +
+

+ +

+ {page <= orderPageNumber && ( + handleTabClickHandler(e)} + > + + } + /> + } + /> + } + /> + + )} + {page === programPageNumber && ( + - } + )} + {page === samplePageNumber && ( + + )} + {page === orderPageNumber && ( + - - )} - {page === programPageNumber && ( - - )} - {page === samplePageNumber && ( - - )} - {page === orderPageNumber && ( - - )} - - {page === successMsgPageNumber && ( - - )} -
- {page !== firstPageNumber && page <= orderPageNumber && ( - )} - {page < orderPageNumber && ( - + {page === successMsgPageNumber && ( + )} +
+ {page !== firstPageNumber && page <= orderPageNumber && ( + + )} - {page === orderPageNumber && ( - - )} + {page < orderPageNumber && ( + + )} + + {page === orderPageNumber && ( + + )} +
-
+ )}
diff --git a/frontend/src/languages/en.json b/frontend/src/languages/en.json index 5335d953e9..0a6298c88d 100644 --- a/frontend/src/languages/en.json +++ b/frontend/src/languages/en.json @@ -292,9 +292,6 @@ "search.label.sample" : "Select Sample Status" , "pathology.label.report" : "Pathology Report", "patient.natioanalid":"National ID", - "sample.label.orderpanel":"Order Panels" - - - - + "sample.label.orderpanel":"Order Panels", + "sample.label.noorder":"Order Doesnt Exist" } diff --git a/frontend/src/languages/fr.json b/frontend/src/languages/fr.json index a604c96bfa..90f9ded3f8 100644 --- a/frontend/src/languages/fr.json +++ b/frontend/src/languages/fr.json @@ -289,5 +289,7 @@ "search.label.test" : "Sélectionnez le nom du test", "search.label.sample" : "Sélectionnez l'état de l'échantillon", "pathology.label.report": "Rapport de Pathologie", - "patient.nationalid": "Identifiant National" + "patient.nationalid": "Identifiant National", + "sample.label.orderpanel": "Panels de commande", + "sample.label.noorder": "La commande n'existe pas" } diff --git a/src/main/java/org/openelisglobal/program/dao/ProgramSampleDAOImpl.java b/src/main/java/org/openelisglobal/program/dao/ProgramSampleDAOImpl.java index 5fafadcd21..90a4961860 100644 --- a/src/main/java/org/openelisglobal/program/dao/ProgramSampleDAOImpl.java +++ b/src/main/java/org/openelisglobal/program/dao/ProgramSampleDAOImpl.java @@ -10,33 +10,30 @@ @Component @Transactional public class ProgramSampleDAOImpl extends BaseDAOImpl implements ProgramSampleDAO { + ProgramSampleDAOImpl() { super(ProgramSample.class); } - + @Override - public ProgramSample getProgrammeSampleBySample(Integer sampleId , String programName) { - String className; - switch (programName.toLowerCase()) { - case "pathology": + public ProgramSample getProgrammeSampleBySample(Integer sampleId, String programName) { + + String className = "PathologySample"; + if (programName != null) { + if (programName.toLowerCase().contains("pathology")) { className = "PathologySample"; - break; - case "immunohistochemistry": + } else if (programName.toLowerCase().contains("immunohistochemistry")) { className = "ImmunohistochemistrySample"; - break; - case "cytology": + } else if (programName.toLowerCase().contains("cytology")) { className = "CytologySample"; - break; - default: - className = "PathologySample"; - break; + } } - - String sql = "from "+ className +" ps where ps.sample.id = :sampleId"; + + String sql = "from " + className + " ps where ps.sample.id = :sampleId"; Query query = entityManager.unwrap(Session.class).createQuery(sql, ProgramSample.class); query.setParameter("sampleId", sampleId); query.setMaxResults(1); - ProgramSample programme = (ProgramSample)query.uniqueResult(); + ProgramSample programme = (ProgramSample) query.uniqueResult(); return programme; } }