Skip to content

Commit

Permalink
(feat) Action column only appears if there are any orders with a fulf…
Browse files Browse the repository at this point in the history
…illerStatus of COMPLETED
  • Loading branch information
its-kios09 committed Sep 18, 2024
1 parent 9641f7e commit ae1cc33
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/radiology-tabs/common/groupedOrdersTable.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,26 @@ const GroupedOrdersTable: React.FC<GroupedOrdersTableProps> = (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 (
<div>
<DataTable
Expand Down

0 comments on commit ae1cc33

Please sign in to comment.