Skip to content

Commit

Permalink
(refactor) O3-3202 Deeplink Lab App Orders to Patient Chart Orders (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
kb019 authored May 18, 2024
1 parent 6884201 commit 982cb17
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
17 changes: 14 additions & 3 deletions src/components/orders-table/orders-data-table.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const OrdersDataTable: React.FC<OrdersDataTableProps> = ({
excludeCanceledAndDiscontinuedOrders = true,
}) => {
const { t } = useTranslation();
const { targetPatientDashboard } = useConfig();
const {
targetPatientDashboard: { redirectToResultsViewer, redirectToOrders },
} = useConfig();
const [filter, setFilter] = useState<FulfillerStatus>(null);
const { labOrders, isLoading } = useLabOrders(
useFilter ? filter : fulfillerStatus,
Expand Down Expand Up @@ -128,7 +130,11 @@ const OrdersDataTable: React.FC<OrdersDataTableProps> = ({
),
patient: (
<ConfigurableLink
to={`\${openmrsSpaBase}/patient/${order.patient?.uuid}/chart/${targetPatientDashboard}`}
to={`\${openmrsSpaBase}/patient/${order.patient?.uuid}/chart/${
fulfillerStatus == "COMPLETED"
? redirectToResultsViewer
: redirectToOrders
}`}
>
{order.patient?.display.split("-")[1]}
</ConfigurableLink>
Expand Down Expand Up @@ -156,7 +162,12 @@ const OrdersDataTable: React.FC<OrdersDataTableProps> = ({
</CustomOverflowMenu>
),
}));
}, [paginatedLabOrders, targetPatientDashboard, actionsSlotName]);
}, [

Check warning on line 165 in src/components/orders-table/orders-data-table.component.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useMemo has a missing dependency: 'fulfillerStatus'. Either include it or remove the dependency array
paginatedLabOrders,
redirectToResultsViewer,
redirectToOrders,
actionsSlotName,
]);

if (isLoading) {
return <DataTableSkeleton role="progressbar" />;
Expand Down
16 changes: 13 additions & 3 deletions src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@ export const configSchema = {
_description: "Uuid for orderType",
},
targetPatientDashboard: {
_type: Type.String,
_default: "Results Viewer",
redirectToResultsViewer: {
_type: Type.String,
_default: "Results Viewer",
_description:
"Redirects to Results Viewer in patient chart dashboard from lab app.",
},
redirectToOrders: {
_type: Type.String,
_default: "Orders",
_description:
"Redirects to Orders in patient chart dashboard from lab app.",
},
_description:
"The patient chart dashboard to navigate to from the lab app.",
},
};

export type Config = {
laboratoryOrderTypeUuid: string;
targetPatientDashboard: string;
targetPatientDashboard: Object;
};

0 comments on commit 982cb17

Please sign in to comment.