From 209f2b499ab8e1db33f4a5823460b69038f47c8a Mon Sep 17 00:00:00 2001 From: jabahum Date: Mon, 28 Oct 2024 11:26:49 +0300 Subject: [PATCH 1/5] initial commit --- .../laboratory-order-referals.component.tsx | 67 ++++--------------- .../laboratory-order-referals.scss | 7 ++ .../referred-date-filter.component.tsx | 41 ++++++++++++ 3 files changed, 60 insertions(+), 55 deletions(-) create mode 100644 src/patient-chart/laboratory-order-referals/referred-date-filter.component.tsx diff --git a/src/patient-chart/laboratory-order-referals/laboratory-order-referals.component.tsx b/src/patient-chart/laboratory-order-referals/laboratory-order-referals.component.tsx index 1d9bb7d6..ffa7ec33 100644 --- a/src/patient-chart/laboratory-order-referals/laboratory-order-referals.component.tsx +++ b/src/patient-chart/laboratory-order-referals/laboratory-order-referals.component.tsx @@ -11,7 +11,6 @@ import { formatDate, parseDate, ErrorState, - showModal, useConfig, } from "@openmrs/esm-framework"; @@ -27,7 +26,6 @@ import { TableRow, TableToolbar, TableToolbarContent, - TableToolbarSearch, Layer, Tag, Tile, @@ -41,7 +39,6 @@ import { import { Printer, - MailAll, Checkmark, SendAlt, NotSent, @@ -62,6 +59,8 @@ import { } from "@openmrs/esm-patient-common-lib"; import { mutate } from "swr"; import { REFERINSTRUCTIONS } from "../../constants"; +import ReferredDateFilter from "./referred-date-filter.component"; +import { date } from "zod"; interface LaboratoryOrderReferalResultsProps { patientUuid: string; @@ -81,18 +80,16 @@ const LaboratoryOrderReferalResults: React.FC< > = ({ patientUuid }) => { const { t } = useTranslation(); - const { - enableSendingLabTestsByEmail, - laboratoryEncounterTypeUuid, - artCardEncounterTypeUuid, - laboratoryOrderTypeUuid, - } = useConfig(); + const { enableSendingLabTestsByEmail, laboratoryEncounterTypeUuid } = + useConfig(); const displayText = t( "referralLaboratoryTestsDisplayTextTitle", "Laboratory Referral Tests" ); + const [orderDate, setOrderDate] = useState(""); + const { items, currentPage, @@ -113,17 +110,11 @@ const LaboratoryOrderReferalResults: React.FC< const sortedLabRequests = useMemo(() => { return [...items] ?.filter((item) => { - const { encounterType, orders } = item || {}; - const { uuid: encounterTypeUuid } = encounterType || {}; - - // Check if the encounterType UUID matches either of the specified UUIDs - - // Filter orders to only include those with the matching orderType UUID + const { orders } = item || {}; const matchingOrders = orders?.filter( (order) => order?.instructions === REFERINSTRUCTIONS ); - // Return the item only if it has matching encounterType and at least one matching order return matchingOrders?.length > 0; }) ?.sort((a, b) => { @@ -137,11 +128,6 @@ const LaboratoryOrderReferalResults: React.FC< const [laboratoryOrders, setLaboratoryOrders] = useState(sortedLabRequests); const [initialTests, setInitialTests] = useState(sortedLabRequests); - const handleChange = useCallback((event) => { - const searchText = event?.target?.value?.trim().toLowerCase(); - setSearchTerm(searchText); - }, []); - useEffect(() => { if (!searchTerm) { setLaboratoryOrders(initialTests); @@ -159,23 +145,6 @@ const LaboratoryOrderReferalResults: React.FC< setInitialTests(sortedLabRequests); }, [sortedLabRequests]); - const EmailButtonAction: React.FC = () => { - const launchSendEmailModal = useCallback(() => { - const dispose = showModal("send-email-dialog", { - closeModal: () => dispose(), - }); - }, []); - - return ( -