diff --git a/frontend/cypress/e2e/modifyOrder.cy.js b/frontend/cypress/e2e/modifyOrder.cy.js
index 6df6bcd2ee..0b257b216a 100644
--- a/frontend/cypress/e2e/modifyOrder.cy.js
+++ b/frontend/cypress/e2e/modifyOrder.cy.js
@@ -102,7 +102,7 @@ describe("Modify Order search by patient ", function () {
);
});
});
-
+ //TO DO needs fixing
it("Should be able to search by respective patient ", function () {
cy.wait(1000);
modifyOrderPage.clickRespectivePatient();
diff --git a/frontend/cypress/pages/ModifyOrderPage.js b/frontend/cypress/pages/ModifyOrderPage.js
index c1f6eda74c..efddfb1e1f 100644
--- a/frontend/cypress/pages/ModifyOrderPage.js
+++ b/frontend/cypress/pages/ModifyOrderPage.js
@@ -41,9 +41,9 @@ class ModifyOrderPage {
clickRespectivePatient() {
return cy
- .get(
- ":nth-child(2) > :nth-child(1) > .cds--radio-button-wrapper > .cds--radio-button__label > .cds--radio-button__appearance",
- )
+ .get('tbody tr')
+ .first()
+ .find('.cds--radio-button__appearance')
.click();
}
}
diff --git a/frontend/src/components/addOrder/Index.js b/frontend/src/components/addOrder/Index.js
index 7eca6c5a1c..ea10879042 100755
--- a/frontend/src/components/addOrder/Index.js
+++ b/frontend/src/components/addOrder/Index.js
@@ -45,6 +45,7 @@ const Index = () => {
const [orderFormValues, setOrderFormValues] = useState(SampleOrderFormValues);
const [samples, setSamples] = useState([sampleObject]);
const [errors, setErrors] = useState([]);
+ const [isSubmitting, setIsSubmitting] = useState(false);
let SampleTypes = [];
let sampleTypeMap = {};
@@ -536,6 +537,7 @@ const Index = () => {
};
const handlePost = (status) => {
+ setIsSubmitting(false);
if (status === 200) {
showAlertMessage(
,
@@ -562,6 +564,11 @@ const Index = () => {
const handleSubmitOrderForm = (e) => {
e.preventDefault();
+ // Prevent multiple submissions.
+ if (isSubmitting) {
+ return;
+ }
+ setIsSubmitting(true);
if ("years" in orderFormValues.patientProperties) {
delete orderFormValues.patientProperties.years;
}
@@ -802,7 +809,9 @@ const Index = () => {
diff --git a/frontend/src/components/admin/reflexTests/ReflexRuleForm.js b/frontend/src/components/admin/reflexTests/ReflexRuleForm.js
index 035ec8988c..d696a6b681 100644
--- a/frontend/src/components/admin/reflexTests/ReflexRuleForm.js
+++ b/frontend/src/components/admin/reflexTests/ReflexRuleForm.js
@@ -87,6 +87,7 @@ function ReflexRule() {
}); //{field :{index :{field_index:[]}}}
const [counter, setCounter] = useState(0);
const [loading, setLoading] = useState(true);
+ const [isSubmitting, setIsSubmitting] = useState(false);
const [errors, setErrors] = useState({});
const { notificationVisible, setNotificationVisible, addNotification } =
useContext(NotificationContext);
@@ -340,6 +341,7 @@ function ReflexRule() {
};
const handleSubmited = (status, index) => {
+ setIsSubmitting(false);
setNotificationVisible(true);
if (status == "200") {
const element = document.getElementById("submit_" + index);
@@ -360,6 +362,10 @@ function ReflexRule() {
const handleSubmit = (event, index) => {
event.preventDefault();
+ if (isSubmitting) {
+ return;
+ }
+ setIsSubmitting(true);
console.debug(JSON.stringify(ruleList[index]));
postToOpenElisServer(
"/rest/reflexrule",
@@ -737,7 +743,13 @@ function ReflexRule() {
<>