From 9641f7e735ed02bc9fa6b454327033a88f0cdd64 Mon Sep 17 00:00:00 2001 From: its-kios09 Date: Wed, 18 Sep 2024 14:29:15 +0300 Subject: [PATCH 1/3] (feat) added a functionality to send back patient to queue from radiology --- .../common/groupedOrdersTable.component.tsx | 11 ++++++ ...on-latest-queue-entry-button.component.tsx | 37 +++++++++++++++++++ .../transition-latest-queue-entry-button.scss | 13 +++++++ 3 files changed, 61 insertions(+) create mode 100644 src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component.tsx create mode 100644 src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss diff --git a/src/radiology-tabs/common/groupedOrdersTable.component.tsx b/src/radiology-tabs/common/groupedOrdersTable.component.tsx index 6541e3f..8ad911e 100644 --- a/src/radiology-tabs/common/groupedOrdersTable.component.tsx +++ b/src/radiology-tabs/common/groupedOrdersTable.component.tsx @@ -22,6 +22,7 @@ import { TableToolbarSearch, } from "@carbon/react"; import ListOrderDetails from "./listOrderDetails.component"; +import TransitionLatestQueueEntryButton from "../test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component"; // render Grouped by patient Orders in radiology module const GroupedOrdersTable: React.FC = (props) => { @@ -68,12 +69,22 @@ const GroupedOrdersTable: React.FC = (props) => { patientname: patient.orders[0].patient?.display?.split("-")[1], orders: patient.orders, totalorders: patient.orders?.length, + fulfillerStatus: patient.orders[0].fulfillerStatus, + action: + patient.orders[0].fulfillerStatus === "COMPLETED" ? ( + + ) : null, })); }, [paginatedResults]); const tableColumns = [ { id: 0, header: t("patient", "Patient"), key: "patientname" }, { id: 1, header: t("totalorders", "Total Orders"), key: "totalorders" }, + { + id: 2, + header: t("actionButton", "Action"), + key: "action", + }, ]; return (
diff --git a/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component.tsx b/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component.tsx new file mode 100644 index 0000000..c9c918d --- /dev/null +++ b/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component.tsx @@ -0,0 +1,37 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import styles from "./transition-latest-queue-entry-button.scss"; +import { showModal } from "@openmrs/esm-framework"; +import { Button } from "@carbon/react"; +import { AirlineManageGates } from "@carbon/react/icons"; + +interface TransitionLatestQueueEntryButtonProps { + patientUuid: string; +} + +const TransitionLatestQueueEntryButton: React.FC< + TransitionLatestQueueEntryButtonProps +> = ({ patientUuid }) => { + const { t } = useTranslation(); + + const launchModal = () => { + const dispose = showModal("transition-patient-to-latest-queue-modal", { + closeModal: () => dispose(), + patientUuid, + }); + }; + + return ( + + ); +}; + +export default TransitionLatestQueueEntryButton; diff --git a/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss b/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss new file mode 100644 index 0000000..3208152 --- /dev/null +++ b/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss @@ -0,0 +1,13 @@ +@use '@carbon/layout'; +@use '@carbon/styles/scss/type'; + +.addPatientToQueue { + --cds-layout-size-height-context: var(--cds-layout-size-height-sm, 2rem); + --cds-layout-size-height: var(--cds-layout-size-height-context); + display: flex; + align-items: center; + justify-content: center; + text-align: center; + padding: 0 layout.$spacing-04; + gap: 1rem; +} From ae1cc331fb1d4263eb990a04bf6e5b130e4b9a98 Mon Sep 17 00:00:00 2001 From: its-kios09 Date: Thu, 19 Sep 2024 01:41:44 +0300 Subject: [PATCH 2/3] (feat) Action column only appears if there are any orders with a fulfillerStatus of COMPLETED --- .../common/groupedOrdersTable.component.tsx | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/radiology-tabs/common/groupedOrdersTable.component.tsx b/src/radiology-tabs/common/groupedOrdersTable.component.tsx index 8ad911e..8806b08 100644 --- a/src/radiology-tabs/common/groupedOrdersTable.component.tsx +++ b/src/radiology-tabs/common/groupedOrdersTable.component.tsx @@ -77,15 +77,26 @@ const GroupedOrdersTable: React.FC = (props) => { })); }, [paginatedResults]); - const tableColumns = [ - { id: 0, header: t("patient", "Patient"), key: "patientname" }, - { id: 1, header: t("totalorders", "Total Orders"), key: "totalorders" }, - { - id: 2, - header: t("actionButton", "Action"), - key: "action", - }, - ]; + const tableColumns = useMemo(() => { + const showActionColumn = workListEntries.some( + (order) => order.fulfillerStatus === "COMPLETED" + ); + + const columns = [ + { id: 0, header: t("patient", "Patient"), key: "patientname" }, + { id: 1, header: t("totalorders", "Total Orders"), key: "totalorders" }, + ]; + + if (showActionColumn) { + columns.push({ + id: 2, + header: t("actionButton", "Action"), + key: "action", + }); + } + + return columns; + }, [workListEntries, t]); return (
Date: Thu, 19 Sep 2024 09:58:25 +0300 Subject: [PATCH 3/3] (refactor)updated accordance with PR suggestion --- src/radiology-tabs/common/groupedOrdersTable.component.tsx | 4 ++-- .../transition-latest-queue-entry-button.scss | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/radiology-tabs/common/groupedOrdersTable.component.tsx b/src/radiology-tabs/common/groupedOrdersTable.component.tsx index 8806b08..63c4d6f 100644 --- a/src/radiology-tabs/common/groupedOrdersTable.component.tsx +++ b/src/radiology-tabs/common/groupedOrdersTable.component.tsx @@ -83,14 +83,14 @@ const GroupedOrdersTable: React.FC = (props) => { ); const columns = [ - { id: 0, header: t("patient", "Patient"), key: "patientname" }, + { id: 0, header: t("patientName", "Patient Name"), key: "patientname" }, { id: 1, header: t("totalorders", "Total Orders"), key: "totalorders" }, ]; if (showActionColumn) { columns.push({ id: 2, - header: t("actionButton", "Action"), + header: t("action", "Action"), key: "action", }); } diff --git a/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss b/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss index 3208152..326b443 100644 --- a/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss +++ b/src/radiology-tabs/test-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss @@ -9,5 +9,5 @@ justify-content: center; text-align: center; padding: 0 layout.$spacing-04; - gap: 1rem; + gap: layout.$spacing-05; }