Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KHP3-6546 ] Implement ability to move patient from procedure to new queue #64

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/common/groupedOrdersTable.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
import ListOrderDetails from "./listOrderDetails.component";
import Overlay from "../components/overlay/overlay.component";
import { GroupedOrdersTableProps, OrderStatusFilterType } from "../types";
import TransitionLatestQueueEntryButton from "../procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component";

// render Grouped by patient Orders in procedures app
const GroupedOrdersTable: React.FC<GroupedOrdersTableProps> = (props) => {
const workListEntries = props.orders;
const { t } = useTranslation();
const [currentPageSize, setCurrentPageSize] = useState<number>(10);

Check warning on line 36 in src/common/groupedOrdersTable.component.tsx

View workflow job for this annotation

GitHub Actions / build

'setCurrentPageSize' is assigned a value but never used
const [searchString, setSearchString] = useState<string>("");

Check warning on line 37 in src/common/groupedOrdersTable.component.tsx

View workflow job for this annotation

GitHub Actions / build

'setSearchString' is assigned a value but never used
const [activatedOnOrAfterDate, setActivatedOnOrAfterDate] = useState("");

const OrderStatuses = [
Expand Down Expand Up @@ -102,13 +103,26 @@
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" ? (
<TransitionLatestQueueEntryButton patientUuid={patient.patientId} />
) : null,
}));
}, [paginatedResults]);

const showActionColumn = filteredEntries.some(
(order) => order.fulfillerStatus === "COMPLETED"
);

const tableColumns = [
{ 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" },
...(showActionColumn
? [{ id: 2, header: t("action", "Action"), key: "action" }]
: []),
];

return (
<div>
<DataTable
Expand Down
2 changes: 1 addition & 1 deletion src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const configSchema = {
procedureOrderTypeUuid: {
_type: Type.String,
_description: "Procedure Order type UUID",
_default: "4237a01f-29c5-4167-9d8e-96d6e590aa33",
_default: "b4a7c280-369e-4d12-9ce8-18e36783fed6",
},
procedureConceptSetUuid: {
_type: Type.String,
Expand Down
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 "./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 (
<Button
kind="tertiary"
className={styles.addPatientToQueue}
onClick={launchModal}
size="sm"
renderIcon={() => <AirlineManageGates size={18} />}
>
{t("transition", "Transition")}
</Button>
);
};

export default TransitionLatestQueueEntryButton;
Original file line number Diff line number Diff line change
@@ -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: layout.$spacing-05;
}
Loading