Skip to content

Commit

Permalink
Merge pull request #26 from njorocs/post-report-btn
Browse files Browse the repository at this point in the history
Post procedure functionality button cleanup
  • Loading branch information
jecihjoy authored Apr 10, 2024
2 parents 41f37e4 + 9201abf commit 4504c9e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 27 deletions.
49 changes: 36 additions & 13 deletions src/referred-procedures/referred-procedures.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,31 @@ const WorkList: React.FC<WorklistProps> = ({ fulfillerStatus }) => {
];

const tableRows = useMemo(() => {
const ResultsOrder: React.FC<ResultsOrderProps> = ({
order,
patientUuid,
}) => {
return (
<Button
kind="ghost"
onClick={() => {
launchOverlay(
t("postProcedureResultForm", "Procedure report form"),
<PostProcedureForm patientUuid={patientUuid} procedure={order} />
);
}}
renderIcon={(props) => (
<Tooltip
align="top"
label={t("procedureOutcome", "Procedure Outcome")}
>
<Scalpel size={16} {...props} />
</Tooltip>
)}
/>
);
};

const Instructions: React.FC<InstructionsProps> = ({ order }) => {
const launchProcedureInstructionsModal = useCallback(() => {
const dispose = showModal("procedure-instructions-modal", {
Expand Down Expand Up @@ -242,23 +267,21 @@ const WorkList: React.FC<WorklistProps> = ({ fulfillerStatus }) => {
orderer: { content: <span>{entry.orderer.display}</span> },
orderType: { content: <span>{entry?.orderType?.display}</span> },
priority: { content: <span>{entry.urgency}</span> },
start: {
content: (
<>
<StartOrder order={paginatedWorkListEntries[index]} />
</>
),
},
actions: {
content: (
<>
<Instructions order={entry} />
<Button
onClick={() =>
launchOverlay(
t("postProcedureForm", "Post procedure form"),
<PostProcedureForm
patientUuid={entry.patient.uuid}
procedure={entry}
/>
)
}
>
{t("postProcedureForm", "Post procedure form")}
</Button>
<ResultsOrder
patientUuid={entry.patient.uuid}
order={paginatedWorkListEntries[index]}
/>
<RejectOrder order={paginatedWorkListEntries[index]} />
</>
),
Expand Down
48 changes: 34 additions & 14 deletions src/work-list/work-list.component.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useMemo, useCallback } from "react";
import { useTranslation } from "react-i18next";
import { TrashCan, Information } from "@carbon/react/icons";
import { Scalpel, TrashCan, Information } from "@carbon/react/icons";
import {
DataTable,
DataTableSkeleton,
Expand Down Expand Up @@ -52,6 +52,10 @@ interface RejectOrderProps {
interface InstructionsProps {
order: Result;
}
interface ResultsOrderProps {
order: Result;
patientUuid: string;
}

const WorkList: React.FC<WorklistProps> = ({ fulfillerStatus }) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -178,6 +182,31 @@ const WorkList: React.FC<WorklistProps> = ({ fulfillerStatus }) => {
];

const tableRows = useMemo(() => {
const ResultsOrder: React.FC<ResultsOrderProps> = ({
order,
patientUuid,
}) => {
return (
<Button
kind="ghost"
onClick={() => {
launchOverlay(
t("postProcedureResultForm", "Procedure report form"),
<PostProcedureForm patientUuid={patientUuid} procedure={order} />
);
}}
renderIcon={(props) => (
<Tooltip
align="top"
label={t("procedureOutcome", "Procedure Outcome")}
>
<Scalpel size={16} {...props} />
</Tooltip>
)}
/>
);
};

const Instructions: React.FC<InstructionsProps> = ({ order }) => {
const launchProcedureInstructionsModal = useCallback(() => {
const dispose = showModal("procedure-instructions-modal", {
Expand Down Expand Up @@ -250,20 +279,11 @@ const WorkList: React.FC<WorklistProps> = ({ fulfillerStatus }) => {
content: (
<>
<Instructions order={entry} />
<ResultsOrder
patientUuid={entry.patient.uuid}
order={paginatedWorkListEntries[index]}
/>
<RejectOrder order={paginatedWorkListEntries[index]} />
<Button
onClick={() =>
launchOverlay(
t("postProcedureForm", "Post procedure form"),
<PostProcedureForm
patientUuid={entry.patient.uuid}
procedure={entry}
/>
)
}
>
{t("postProcedureForm", "Post procedure form")}
</Button>
</>
),
},
Expand Down

0 comments on commit 4504c9e

Please sign in to comment.