Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirvanjha2004 authored Jan 8, 2025
2 parents d7725fd + af133c8 commit d5c5d38
Show file tree
Hide file tree
Showing 20 changed files with 254 additions and 246 deletions.
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/modifyOrder.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions frontend/cypress/pages/ModifyOrderPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/components/addOrder/Index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -536,6 +537,7 @@ const Index = () => {
};

const handlePost = (status) => {
setIsSubmitting(false);
if (status === 200) {
showAlertMessage(
<FormattedMessage id="save.order.success.msg" />,
Expand All @@ -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;
}
Expand Down Expand Up @@ -802,7 +809,9 @@ const Index = () => {
<Button
kind="primary"
className="forwardButton"
disabled={errors?.errors?.length > 0 ? true : false}
disabled={
isSubmitting || errors?.errors?.length > 0 ? true : false
}
onClick={handleSubmitOrderForm}
>
<FormattedMessage id="label.button.submit" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const CalculatedValue: React.FC<CalculatedValueProps> = () => {
const [sampleList, setSampleList] = useState([]);
const [sampleTestList, setSampleTestList] = useState(TestListObj);
const [loading, setLoading] = useState(true);
const [isSubmitting, setIsSubmitting] = useState(false);
const { notificationVisible, setNotificationVisible, addNotification } =
useContext<NotificationContextType>(NotificationContext);
const [mathFunctions, setMathFunctions] = useState([mathFunction]);
Expand Down Expand Up @@ -342,6 +343,7 @@ const CalculatedValue: React.FC<CalculatedValueProps> = () => {
};

const handleCalculationSubmited = (status, index) => {
setIsSubmitting(false);
setNotificationVisible(true);
if (status == "200") {
const element = document.getElementById(
Expand Down Expand Up @@ -373,6 +375,10 @@ const CalculatedValue: React.FC<CalculatedValueProps> = () => {

const handleSubmit = (event: any, index: number) => {
event.preventDefault();
if (isSubmitting) {
return;
}
setIsSubmitting(true);
let mathematicalOperation = "";
calculationList[index]["operations"].forEach(
(operation, operationIndex) => {
Expand Down Expand Up @@ -943,6 +949,7 @@ const CalculatedValue: React.FC<CalculatedValueProps> = () => {
type="submit"
kind="primary"
size="sm"
disabled={isSubmitting}
>
<FormattedMessage id="label.button.submit" />
</Button>
Expand Down
18 changes: 14 additions & 4 deletions frontend/src/components/admin/reflexTests/ReflexRuleForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -340,6 +341,7 @@ function ReflexRule() {
};

const handleSubmited = (status, index) => {
setIsSubmitting(false);
setNotificationVisible(true);
if (status == "200") {
const element = document.getElementById("submit_" + index);
Expand All @@ -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",
Expand Down Expand Up @@ -737,7 +743,13 @@ function ReflexRule() {
<>
<TextInput
name="value"
type="text"
type={
testResultList[index][
condition_index
]["type"] === "N"
? "number"
: "text"
}
id={
index +
"_" +
Expand Down Expand Up @@ -1137,9 +1149,7 @@ function ReflexRule() {
</div>
<Button
id={"submit_" + index}
disabled={
Object.keys(errors).length === 0 ? false : true
}
disabled={isSubmitting}
type="submit"
kind="tertiary"
size="sm"
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/cytology/CytologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function CytologyCaseView() {
const [reportTypes, setReportTypes] = useState([]);
const [slidesToAdd, setSlidesToAdd] = useState(1);
const [isConfirmOpen, setConfirmOpen] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
const [reportParams, setReportParams] = useState({
0: {
submited: false,
Expand All @@ -108,6 +109,7 @@ function CytologyCaseView() {
async function displayStatus(response) {
var body = await response.json();
console.debug(body);
setIsSubmitting(false);
var status = response.status;
setNotificationVisible(true);
if (status == "200") {
Expand Down Expand Up @@ -173,6 +175,10 @@ function CytologyCaseView() {
});

const save = (e) => {
if (isSubmitting) {
return;
}
setIsSubmitting(true);
let specimenAdequacy = null;
if (pathologySampleInfo.specimenAdequacy) {
specimenAdequacy = pathologySampleInfo.specimenAdequacy;
Expand Down Expand Up @@ -418,6 +424,7 @@ function CytologyCaseView() {
<Column lg={16} md={8} sm={4}>
<Button
id="pathology_save"
disabled={isSubmitting}
onClick={(e) => {
e.preventDefault();
save(e);
Expand Down Expand Up @@ -1705,6 +1712,7 @@ function CytologyCaseView() {
<Column lg={16}>
<Button
id="pathology_save2"
disabled={isSubmitting}
onClick={(e) => {
e.preventDefault();
save(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function ImmunohistochemistryCaseView() {
const [pagination, setPagination] = useState(false);
const [currentApiPage, setCurrentApiPage] = useState(null);
const [totalApiPages, setTotalApiPages] = useState(null);
const [isSubmitting, setIsSubmitting] = useState(false);
const [reportParams, setReportParams] = useState({
0: {
erPercent: "",
Expand Down Expand Up @@ -108,6 +109,7 @@ function ImmunohistochemistryCaseView() {
async function displayStatus(response) {
var body = await response.json();
console.debug(body);
setIsSubmitting(false);
var status = response.status;
setNotificationVisible(true);
if (status == "200") {
Expand Down Expand Up @@ -875,6 +877,10 @@ function ImmunohistochemistryCaseView() {
});

const save = () => {
if (isSubmitting) {
return;
}
setIsSubmitting(true);
let submitValues = {
assignedTechnicianId: immunohistochemistrySampleInfo.assignedTechnicianId,
assignedPathologistId:
Expand Down Expand Up @@ -1024,6 +1030,7 @@ function ImmunohistochemistryCaseView() {
<Column lg={16} md={8} sm={4}>
<Button
id="pathology_save"
disabled={isSubmitting}
onClick={(e) => {
e.preventDefault();
save(e);
Expand Down Expand Up @@ -1633,6 +1640,7 @@ function ImmunohistochemistryCaseView() {
<Column>
<Button
id="pathology_save2"
disabled={isSubmitting}
onClick={(e) => {
e.preventDefault();
save(e);
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/layout/search/searchBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
.search-input {
width: 100%;
position: relative;

}

.search-bar-container:hover {
Expand Down Expand Up @@ -52,11 +51,8 @@
cursor: pointer;
}


/* Large screens (1208px and up) */
@media (min-width: 1208px) {


.search-bar-container {
width: 45%;
margin-top: 0%;
Expand All @@ -77,7 +73,7 @@
right: 130px;
box-shadow: 0em 0.1em 0.5em #ccc;
}

.patientHead {
overflow-y: auto;
width: 600px;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/layout/search/searchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ const SearchBar = (props) => {
);
};

export default SearchBar;
export default SearchBar;
10 changes: 9 additions & 1 deletion frontend/src/components/modifyOrder/ModifyOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const ModifyOrder = () => {
const [orderFormValues, setOrderFormValues] = useState(ModifyOrderFormValues);
const [samples, setSamples] = useState([sampleObject]);
const [errors, setErrors] = useState([]);
const [isSubmitting, setIsSubmitting] = useState(false);

useEffect(() => {
componentMounted.current = true;
Expand Down Expand Up @@ -110,6 +111,7 @@ const ModifyOrder = () => {
};

const handlePost = (status) => {
setIsSubmitting(false);
if (status === 200) {
showAlertMessage(
<FormattedMessage id="save.order.success.msg" />,
Expand All @@ -124,6 +126,10 @@ const ModifyOrder = () => {
};
const handleSubmitOrderForm = (e) => {
e.preventDefault();
if (isSubmitting) {
return;
}
setIsSubmitting(true);
setPage(page + 1);
orderFormValues.sampleOrderItems.modified = true;
//remove display Lists rom the form
Expand Down Expand Up @@ -337,7 +343,9 @@ const ModifyOrder = () => {
kind="primary"
className="forwardButton"
onClick={handleSubmitOrderForm}
disabled={errors?.errors?.length > 0 ? true : false}
disabled={
isSubmitting || errors?.errors?.length > 0 ? true : false
}
>
<FormattedMessage id="label.button.submit" />
</Button>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/pathology/PathologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function PathologyCaseView() {
const [pagination, setPagination] = useState(false);
const [currentApiPage, setCurrentApiPage] = useState(null);
const [totalApiPages, setTotalApiPages] = useState(null);
const [isSubmitting, setIsSubmitting] = useState(false);
const [reportParams, setReportParams] = useState({
0: {
submited: false,
Expand All @@ -80,6 +81,7 @@ function PathologyCaseView() {
async function displayStatus(response) {
var body = await response.json();
console.debug(body);
setIsSubmitting(false);
var status = response.status;
setNotificationVisible(true);
if (status == "200") {
Expand Down Expand Up @@ -145,6 +147,10 @@ function PathologyCaseView() {
});

const save = (e) => {
if (isSubmitting) {
return;
}
setIsSubmitting(true);
let submitValues = {
assignedTechnicianId: pathologySampleInfo.assignedTechnicianId,
assignedPathologistId: pathologySampleInfo.assignedPathologistId,
Expand Down Expand Up @@ -375,6 +381,7 @@ function PathologyCaseView() {
<Column lg={16} md={8} sm={4}>
<Button
id="pathology_save"
disabled={isSubmitting}
onClick={(e) => {
e.preventDefault();
save(e);
Expand Down Expand Up @@ -1267,6 +1274,7 @@ function PathologyCaseView() {
<Column lg={16}>
<Button
id="pathology_save2"
disabled={isSubmitting}
onClick={(e) => {
e.preventDefault();
save(e);
Expand Down
Loading

0 comments on commit d5c5d38

Please sign in to comment.