Skip to content

Commit

Permalink
(feat) added add patient to queue button
Browse files Browse the repository at this point in the history
  • Loading branch information
its-kios09 committed Aug 5, 2024
1 parent d432224 commit a0322a5
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/components/orders-table/orders-data-table.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import { useLabOrders } from "../../laboratory-resource";
import dayjs from "dayjs";
import { isoDateTimeString } from "../../constants";
import useSearchResults from "./orders-data-table.resource";

interface OrdersDataTableProps {
useFilter?: boolean;
actionsSlotName?: string;
Expand Down Expand Up @@ -207,7 +206,6 @@ const OrdersDataTable: React.FC<OrdersDataTableProps> = ({
redirectToResultsViewer,
redirectToOrders,
actionsSlotName,
fulfillerStatus,
]);

if (isLoading) {
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export const rejectLabRequestAction = getAsyncLifecycle(
() => import("./lab-tabs/actions/reject-lab-request-action.component"),
options
);
export const addPatientToQueue = getAsyncLifecycle(
() => import("./lab-tabs/actions/add-patient-to-queue.component"),
options
);

export function startupApp() {
defineConfigSchema(moduleName, configSchema);
Expand Down
14 changes: 14 additions & 0 deletions src/lab-tabs/actions/actions.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
@use '@carbon/styles/scss/spacing';
@use '@carbon/styles/scss/type';
.menuItem {
max-width: none;
}
.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 spacing.$spacing-04;
gap: 1rem;

}

37 changes: 37 additions & 0 deletions src/lab-tabs/actions/add-patient-to-queue.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from "react";
import { useTranslation } from "react-i18next";
import styles from "./actions.scss";
import { showModal } from "@openmrs/esm-framework";
import { Button } from "@carbon/react";
import { AirlineManageGates } from "@carbon/react/icons";

interface AddPatientToQueueButtonProps {
patientUuid: string;
}

const AddPatientToQueueButton: React.FC<AddPatientToQueueButtonProps> = ({
patientUuid,
}) => {
const { t } = useTranslation();

const launchModal = () => {
const dispose = showModal("add-patient-to-queue-entry-modal", {
closeModal: () => dispose(),
patientUuid,
});
};

return (
<Button
kind="tertiary"
className={styles.addPatientToQueue}
onClick={launchModal}
size="sm"
renderIcon={() => <AirlineManageGates size={18} />}
>
{t("addToAQueue", "Add to a queue")}
</Button>
);
};

export default AddPatientToQueueButton;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const CompletedLabRequestsTable: React.FC = () => {
<OrdersDataTable
fulfillerStatus="COMPLETED"
excludeCanceledAndDiscontinuedOrders={false}
actionsSlotName="completed-lab-extension-slot"
actionsSlotName="add-patient-to-queue-slot"
/>
);
};
Expand Down
5 changes: 5 additions & 0 deletions src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"component": "pickupLabRequestAction",
"slot": "tests-ordered-actions-slot"
},
{
"name": "add-patient-to-queue-button",
"component": "addPatientToQueue",
"slot": "add-patient-to-queue-slot"
},
{
"name": "reject-lab-request-tests-ordered-action",
"component": "rejectLabRequestAction",
Expand Down

0 comments on commit a0322a5

Please sign in to comment.