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

(feat) U4X-764: Date Filter for Referred Samples #16

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,8 @@ const LaboratoryActiveTestOrderResults: React.FC<
> = ({ patientUuid }) => {
const { t } = useTranslation();

const {
enableSendingLabTestsByEmail,
laboratoryEncounterTypeUuid,
artCardEncounterTypeUuid,
laboratoryOrderTypeUuid,
} = useConfig();
const { enableSendingLabTestsByEmail, laboratoryEncounterTypeUuid } =
useConfig();

const displayText = t(
"activelLaboratoryTestsDisplayTextTitle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
formatDate,
parseDate,
ErrorState,
showModal,
useConfig,
} from "@openmrs/esm-framework";

Expand Down Expand Up @@ -41,7 +40,6 @@

import {
Printer,
MailAll,
Checkmark,
SendAlt,
NotSent,
Expand Down Expand Up @@ -81,12 +79,8 @@
> = ({ patientUuid }) => {
const { t } = useTranslation();

const {
enableSendingLabTestsByEmail,
laboratoryEncounterTypeUuid,
artCardEncounterTypeUuid,
laboratoryOrderTypeUuid,
} = useConfig();
const { enableSendingLabTestsByEmail, laboratoryEncounterTypeUuid } =
useConfig();

const displayText = t(
"referralLaboratoryTestsDisplayTextTitle",
Expand All @@ -113,17 +107,11 @@
const sortedLabRequests = useMemo(() => {
return [...items]
?.filter((item) => {
const { encounterType, orders } = item || {};
const { uuid: encounterTypeUuid } = encounterType || {};

// Check if the encounterType UUID matches either of the specified UUIDs

// Filter orders to only include those with the matching orderType UUID
const { orders } = item || {};
const matchingOrders = orders?.filter(
(order) => order?.instructions === REFERINSTRUCTIONS
);

// Return the item only if it has matching encounterType and at least one matching order
return matchingOrders?.length > 0;
})
?.sort((a, b) => {
Expand Down Expand Up @@ -159,23 +147,6 @@
setInitialTests(sortedLabRequests);
}, [sortedLabRequests]);

const EmailButtonAction: React.FC = () => {
const launchSendEmailModal = useCallback(() => {
const dispose = showModal("send-email-dialog", {
closeModal: () => dispose(),
});
}, []);

return (
<Button
kind="ghost"
size="sm"
onClick={(e) => launchSendEmailModal()}
renderIcon={(props) => <MailAll size={16} {...props} />}
/>
);
};

const EditReferralAction: React.FC<EditReferralActionProps> = ({
formUuid,
encounterUuid,
Expand Down Expand Up @@ -305,11 +276,10 @@
encounterUuid={entry[index]?.uuid}
/>
<PrintButtonAction encounter={entry} />
{enableSendingLabTestsByEmail && <EmailButtonAction />}
</div>
),
}));
}, [enableSendingLabTestsByEmail, laboratoryOrders]);

Check warning on line 282 in src/patient-chart/laboratory-order-referals/laboratory-order-referals.component.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useMemo has an unnecessary dependency: 'enableSendingLabTestsByEmail'. Either exclude it or remove the dependency array

if (isLoading) {
return <DataTableSkeleton role="progressbar" />;
Expand All @@ -336,14 +306,7 @@
headers={tableReferralHeaders}
useZebraStyles
>
{({
rows,
headers,
getHeaderProps,
getTableProps,
getRowProps,
onInputChange,
}) => (
{({ rows, headers, getHeaderProps, getTableProps, getRowProps }) => (
<TableContainer className={styles.tableContainer}>
<TableToolbar
style={{
Expand All @@ -353,7 +316,7 @@
backgroundColor: "color",
}}
>
<TableToolbarContent>
<TableToolbarContent className={styles.referalFilter}>
<div
style={{
fontSize: "10px",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@
margin-right: -50%;
}
}

.referalFilter {
display: flex;
flex-direction: row;
align-items: right;
margin: 0.9rem;
}
1 change: 0 additions & 1 deletion src/patient-chart/patient-laboratory-results.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { EmptyState } from "@openmrs/esm-patient-common-lib";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import LaboratoryActiveTestOrderResults from "./laboratory-active-test-order/laboratory-active-test-order-results.component";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import React, { useMemo } from "react";
import styles from "./print-results-summary.scss";
import { formatDate, parseDate } from "@openmrs/esm-framework";
import logoImg from "../../../assets/logo/moh_logo_without_word.png";
import { Identifier, PatientResource } from "../../utils/functions";
import { useTranslation } from "react-i18next";
import PrintResultsTable from "./print-results-table.component";
import { Result } from "../patient-laboratory-order-results.resource";

Expand Down
3 changes: 0 additions & 3 deletions src/referred-orders/referred-orders.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ import {
TableToolbarSearch,
Layer,
Tile,
DatePicker,
DatePickerInput,
} from "@carbon/react";
import { getStatusColor, useOrderDate } from "../utils/functions";
import styles from "./referred-orders.scss";
import dayjs from "dayjs";
import { REFERINSTRUCTIONS } from "../constants";

const ReferredOrdersList: React.FC = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/reject-order/reject-order-dialog.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const RejectOrderDialog: React.FC<RejectOrderDialogProps> = ({
fulfillerComment: notes,
};
RejectOrder(order.uuid, payload).then(
(resp) => {
() => {
showSnackbar({
isLowContrast: true,
title: t("rejectOrder", "Rejected Order"),
Expand Down
1 change: 0 additions & 1 deletion src/results/result-form-field.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { TextInput, Select, SelectItem } from "@carbon/react";
import { useTranslation } from "react-i18next";
import { ConceptReference } from "./result-form.resource";
import { Controller } from "react-hook-form";
import { min } from "rxjs/operators";

interface ResultFormFieldProps {
concept: ConceptReference;
Expand Down
2 changes: 1 addition & 1 deletion src/summary-tiles/laboratory-summary.resource.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useSWR, { mutate } from "swr";
import useSWR from "swr";
import useSWRImmutable from "swr/immutable";
import {
FetchResponse,
Expand Down
3 changes: 1 addition & 2 deletions src/summary-tiles/summary-tile.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Tile, Button } from "@carbon/react";
import { ArrowRight } from "@carbon/react/icons";
import { Tile } from "@carbon/react";
import styles from "./summary-tile.scss";

interface SummaryTileProps {
Expand Down
7 changes: 1 addition & 6 deletions src/tests-ordered/lab-tests/lab-tests.resource.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
FetchResponse,
openmrsFetch,
restBaseUrl,
useConfig,
} from "@openmrs/esm-framework";
import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
import useSWR from "swr";
import { Result } from "../../patient-chart/patient-laboratory-order-results.resource";
export function useGetLabOrders(encounterUuid: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/orders-table/orders-data-table.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useMemo } from "react";
import React, { useState } from "react";
import {
DataTable,
Pagination,
Expand Down
Loading