Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
jabahum committed Oct 31, 2023
1 parent f796df9 commit ecbdb8b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 12 deletions.
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "src/index.ts",
"source": true,
"scripts": {
"start": "openmrs develop --backend https://ugandaemr-backend.mets.or.ug",
"start": "openmrs develop --backend http://194.163.171.253:8282",
"serve": "webpack serve --mode=development",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env analyze=true",
Expand Down Expand Up @@ -46,11 +46,7 @@
},
"dependencies": {
"@carbon/react": "^1.14.0",
"@types/nodemailer-express-handlebars": "^4.0.4",
"handlebars": "^4.7.8",
"lodash-es": "^4.17.21",
"nodemailer": "^6.9.7",
"nodemailer-express-handlebars": "^6.1.0",
"react-to-print": "^2.14.15"
},
"peerDependencies": {
Expand All @@ -76,7 +72,6 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^28.1.8",
"@types/nodemailer": "^6.4.13",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
"@types/react-router": "^5.1.20",
Expand Down
34 changes: 33 additions & 1 deletion src/queue-list/lab-tests/lab-tests.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { useGetLabOrders } from "./lab-tests.resource";

import { DataTableSkeleton } from "@carbon/react";
import { ErrorState } from "@openmrs/esm-framework";

const LabTests = () => {
return <span>Lab Tests</span>;
const { t } = useTranslation();

// get lab orders
const { data: labOrders, isLoading, isError } = useGetLabOrders("");

if (isLoading) {
return <DataTableSkeleton role="progressbar" />;
}

if (isError) {
return <ErrorState error={isError} headerTitle={"Results Error"} />;
}

// const filteredItems = labOrders.orders.filter(
// (ob) => ob?.order?.type === "testorder"
// );

let columns = [
{
id: 1,
header: t("date", "Date"),
key: "date",
},
{ id: 2, header: t("orderNumber", "Order Number"), key: "orderNumber" },
{ id: 3, header: t("order", "Order"), key: "order" },

{ id: 5, header: t("actions", "Actions"), key: "actions" },
];
};

export default LabTests;
17 changes: 14 additions & 3 deletions src/queue-list/lab-tests/lab-tests.resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
export function useLabTests() {
import { FetchResponse, openmrsFetch, useConfig } from "@openmrs/esm-framework";
import useSWR from "swr";
import { EncounterResponse } from "../../patient-chart/laboratory-item/view-laboratory-item.resource";
export function useGetLabOrders(encounterUuid: string) {
const apiUrl = `/ws/rest/v1/encounter/${encounterUuid}`;

const { data, error, isLoading } = useSWR<{ data: EncounterResponse }, Error>(
apiUrl,
openmrsFetch
);

return {
data: {},
count: 0,
data: data.data ? data.data.orders : "",
isLoading,
isError: error,
};
}
2 changes: 1 addition & 1 deletion src/queue-list/laboratory-patient-list.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const LaboratoryPatientList: React.FC<LaboratoryPatientListProps> = () => {

const { patientQueueEntries, isLoading } = usePatientQueuesList(
session?.sessionLocation?.uuid,
status
"pending"
);

const pageSizes = [10, 20, 30, 40, 50];
Expand Down
2 changes: 1 addition & 1 deletion src/summary-tiles/laboratory-summary-tiles.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const LaboratorySummaryTiles: React.FC = () => {
const { t } = useTranslation();
const { metrics, isError, isLoading } = useMetrics();

if (isLoading) {
if (isLoading || isError) {
return <DataTableSkeleton role="progressbar" />;
}

Expand Down

0 comments on commit ecbdb8b

Please sign in to comment.