Skip to content

Commit

Permalink
clean up order colours (openmrs#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojwanganto authored Jan 24, 2024
1 parent f64f60e commit 65e749e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 2 additions & 4 deletions src/patient-chart/laboratory-order.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const LaboratoryOrder: React.FC<LaboratoryOrderOverviewProps> = ({
content: (
<>
{entry.orders.map((order) => {
if (order?.type === "testorder") {
if (order?.type === "testorder" && order?.action === "NEW") {
return (
<Tag
style={{
Expand Down Expand Up @@ -286,8 +286,6 @@ const LaboratoryOrder: React.FC<LaboratoryOrderOverviewProps> = ({
) : (
<PrintButtonAction encounter={entry} />
)}

{/* <EmailButtonAction /> */}
</div>
),
},
Expand Down Expand Up @@ -408,7 +406,7 @@ const LaboratoryOrder: React.FC<LaboratoryOrderOverviewProps> = ({
</TableCell>
))}
</TableExpandRow>
{row.isExpanded ? (
{!row.isExpanded ? (
<TableExpandedRow
className={styles.expandedActiveVisitRow}
colSpan={headers.length + 2}
Expand Down
3 changes: 2 additions & 1 deletion src/patient-chart/laboratory-order.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,12 @@ export interface OrderType {
export const getOrderColor = (activated: string, stopped: string) => {
const numAct = formatWaitTime(activated);
let testStopped: Number;

if (stopped === null) {
testStopped = 0;
}

if (numAct >= 0 && testStopped == 0) {
if (numAct >= 0 && testStopped === 0) {
return "#6F6F6F"; // #6F6F6F
} else {
return "green"; // green
Expand Down
27 changes: 14 additions & 13 deletions src/results/result-form.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,25 +334,26 @@ export async function UpdateOrderResult(
orderPayload: any
) {
const abortController = new AbortController();
const updateOrderCall = await openmrsFetch(`/ws/rest/v1/order`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
signal: abortController.signal,
body: orderPayload,
});

if (updateOrderCall.status === 201) {
return await openmrsFetch(`/ws/rest/v1/encounter/${encounterUuid}`, {
const updateResults = await openmrsFetch(
`/ws/rest/v1/encounter/${encounterUuid}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
signal: abortController.signal,
body: obsPayload,
}
);

if (updateResults.status === 201) {
return await openmrsFetch(`/ws/rest/v1/order`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
signal: abortController.signal,
body: orderPayload,
});
} else {
// handle errors
}
}

0 comments on commit 65e749e

Please sign in to comment.