From 65e749ee04cb11ee52fb66d63893ff808f6d8929 Mon Sep 17 00:00:00 2001 From: Ojwang' Antony Date: Wed, 24 Jan 2024 12:03:46 +0300 Subject: [PATCH] clean up order colours (#4) --- .../laboratory-order.component.tsx | 6 ++--- .../laboratory-order.resource.ts | 3 ++- src/results/result-form.resource.ts | 27 ++++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/patient-chart/laboratory-order.component.tsx b/src/patient-chart/laboratory-order.component.tsx index 47885cd..3234829 100644 --- a/src/patient-chart/laboratory-order.component.tsx +++ b/src/patient-chart/laboratory-order.component.tsx @@ -239,7 +239,7 @@ const LaboratoryOrder: React.FC = ({ content: ( <> {entry.orders.map((order) => { - if (order?.type === "testorder") { + if (order?.type === "testorder" && order?.action === "NEW") { return ( = ({ ) : ( )} - - {/* */} ), }, @@ -408,7 +406,7 @@ const LaboratoryOrder: React.FC = ({ ))} - {row.isExpanded ? ( + {!row.isExpanded ? ( { 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 diff --git a/src/results/result-form.resource.ts b/src/results/result-form.resource.ts index 0f9c957..7bf2f3a 100644 --- a/src/results/result-form.resource.ts +++ b/src/results/result-form.resource.ts @@ -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 } }