From a84f8617d4a4008fd1a941f0fd812181b57ec468 Mon Sep 17 00:00:00 2001 From: "Aditya @ArchLinux" <132184385+adityadeshlahre@users.noreply.github.com> Date: Tue, 25 Jun 2024 01:19:16 +0530 Subject: [PATCH] minor fixes 00 --- .../resultsReferredOut/ReferredOutTests.js | 104 +++++++----------- 1 file changed, 39 insertions(+), 65 deletions(-) diff --git a/frontend/src/components/resultPage/resultsReferredOut/ReferredOutTests.js b/frontend/src/components/resultPage/resultsReferredOut/ReferredOutTests.js index 6b6d836d9e..be2ab47402 100644 --- a/frontend/src/components/resultPage/resultsReferredOut/ReferredOutTests.js +++ b/frontend/src/components/resultPage/resultsReferredOut/ReferredOutTests.js @@ -61,6 +61,7 @@ function ReferredOutTests(props) { const componentMounted = useRef(false); const [page, setPage] = useState(1); + const [searchButton, setSearchButton] = useState(true); const [pageSize, setPageSize] = useState(10); const [testUnits, setTestUnits] = useState([]); const [testUnitsIdList, setTestUnitsIdList] = useState([]); @@ -73,7 +74,6 @@ function ReferredOutTests(props) { const [dateType, setDateType] = useState(dateTypeList[0].value); const [loading, setLoading] = useState(false); const [searchType, setSearchType] = useState(""); - const [innitialized, setInnitialized] = useState(false); const [tests, setTests] = useState([]); const [testSections, setTestSections] = useState([]); const [responseData, setResponseData] = useState({}); @@ -94,7 +94,9 @@ function ReferredOutTests(props) { `&testIds=`, )}&_testIds=1&labNumber=${ referredOutTestsFormValues.labNumberInput - }&dateOfBirthSearchValue=&selPatient=${ + }&dateOfBirthSearchValue=${ + referredOutTestsFormValues.dateOfBirth + }&selPatient=${ referredOutTestsFormValues.selectedPatientId }&_analysisIds=on`, handleResponseData, @@ -109,6 +111,7 @@ function ReferredOutTests(props) { testNamesIdList, referredOutTestsFormValues.labNumberInput, referredOutTestsFormValues.selectedPatientId, + referredOutTestsFormValues.dateOfBirth, ]); const handleReferredOutPatient = () => { @@ -146,6 +149,7 @@ function ReferredOutTests(props) { labNumberInput: e.target.value, }); setSearchType(referredOutTestsFormValues.searchTypeValues[1]); + setSearchButton(false); } const getSelectedPatient = (patient) => { @@ -154,6 +158,7 @@ function ReferredOutTests(props) { ...referredOutTestsFormValues, selectedPatientId: patient.patientPK, }); + setSearchButton(false); }; const getDataOfBirth = (patient) => { @@ -162,6 +167,7 @@ function ReferredOutTests(props) { ...referredOutTestsFormValues, dateOfBirth: patient.birthDateForDisplay, }); + setSearchButton(false); }; const handleDatePickerChangeDate = (datePicker, date) => { @@ -228,6 +234,7 @@ function ReferredOutTests(props) { value: test.value, })); setTestNamesPair(testNamesPair); + setSearchButton(false); } if (testUnits.testUnits) { var testUnitsIdList = testUnits.testUnits.map((test) => test.id); @@ -239,6 +246,7 @@ function ReferredOutTests(props) { value: test.value, })); setTestUnitsPair(testUnitsPair); + setSearchButton(false); } }, [testNames, testUnits]); @@ -280,29 +288,10 @@ function ReferredOutTests(props) { }; setReferredOutTestsFormValues(searchValues); handleSubmit(searchValues); + setSearchButton(false); } }, [referredOutTestsFormValues]); - useEffect(() => { - if (!innitialized) { - // let updatedDate = encodeDate(configurationProperties.currentDateAsText); - let updatedDate = configurationProperties.currentDateAsText; - setReferredOutTestsFormValues({ - ...referredOutTestsFormValues, - dateOfBirth: updatedDate, - startDate: "", - endDate: "", - }); - } - if (referredOutTestsFormValues.dateOfBirth != "") { - setInnitialized(true); - } - }, [ - referredOutTestsFormValues, - innitialized, - configurationProperties.currentDateAsText, - ]); - useEffect(() => { if (selectedRowIds.length > 0) { const selectedAnalysisIds = selectedRowIds.map((index) => { @@ -369,10 +358,17 @@ function ReferredOutTests(props) { { + setSearchButton(false); + }} >
-

@@ -485,6 +487,7 @@ function ReferredOutTests(props) { setSearchType( referredOutTestsFormValues.searchTypeValues[0], ); + setSearchButton(false); }} selectionFeedback="top-after-reopen" /> @@ -525,6 +528,7 @@ function ReferredOutTests(props) { setSearchType( referredOutTestsFormValues.searchTypeValues[0], ); + setSearchButton(false); }} selectionFeedback="top-after-reopen" /> @@ -552,6 +556,7 @@ function ReferredOutTests(props) {
-
- - - - -
); } export default injectIntl(ReferredOutTests); - -// selPatient is not getting filled