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

Post procedure functionality button cleanup #26

Merged
merged 1 commit into from
Apr 10, 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
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
Loading