Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
melkam-mekonnen committed Aug 19, 2024
1 parent 513ac71 commit 0a8406f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import React, { useEffect, useState } from "react";
import { EncounterList } from "@ohri/openmrs-esm-ohri-commons-lib";
import {
FAMILY_INDEX_CASE_CONTACTS_ENCOUNTER_TYPE
} from "../../../constants";
import { getData } from "../../encounterUtils";
import { moduleName } from "../../../index";
import { fetchIdentifiers } from "../../../api/api";

const columns = [
{
Expand Down Expand Up @@ -64,9 +65,17 @@ const columns = [
},
];

const FamilyIndexCaseContacts: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const FamilyIndexCaseContacts: React.FC<{ patientUuid: string }> = ({ patientUuid }) => {
const [hasMRN, setHasMRN] = useState(false);
const [hideAddButton, setHideAddButton] = useState(true);
useEffect(() => {
(async () => {
const identifiers = await fetchIdentifiers(patientUuid);
if (identifiers?.find((e) => e.identifierType.display === "MRN")) {
setHasMRN(true);
}
})();
});
return (
<>
<EncounterList
Expand All @@ -79,7 +88,7 @@ const FamilyIndexCaseContacts: React.FC<{ patientUuid: string }> = ({
launchOptions={{
displayText: "Add",
moduleName: moduleName,
hideFormLauncher: true,
hideFormLauncher: hideAddButton,
}}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import React, { useEffect, useState } from "react";
import { EncounterList } from "@ohri/openmrs-esm-ohri-commons-lib";
import {
PARTNER_INDEX_CASE_INFORMATION_ENCOUNTER_TYPE
} from "../../../constants";
import { getData } from "../../encounterUtils";
import { moduleName } from "../../../index";
import { fetchIdentifiers } from "../../../api/api";

const columns = [
{
Expand Down Expand Up @@ -71,9 +72,17 @@ const columns = [
},
];

const PartnerIndexCaseInformation: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const PartnerIndexCaseInformation: React.FC<{ patientUuid: string }> = ({ patientUuid }) => {
const [hasMRN, setHasMRN] = useState(false);
const [hideAddButton, setHideAddButton] = useState(true);
useEffect(() => {
(async () => {
const identifiers = await fetchIdentifiers(patientUuid);
if (identifiers?.find((e) => e.identifierType.display === "MRN")) {
setHasMRN(true);
}
})();
});
return (
<>
<EncounterList
Expand All @@ -86,7 +95,7 @@ const PartnerIndexCaseInformation: React.FC<{ patientUuid: string }> = ({
launchOptions={{
displayText: "Add",
moduleName: moduleName,
hideFormLauncher: true,
hideFormLauncher: hideAddButton,
}}
/>
</>
Expand Down
19 changes: 14 additions & 5 deletions src/views/index-case-testing/tabs/ict-screening.component.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import React, { useEffect, useState } from "react";
import { EncounterList } from "@ohri/openmrs-esm-ohri-commons-lib";
import {
ICT_SCREENING_ENCOUNTER_TYPE,
} from "../../../constants";
import { getData } from "../../encounterUtils";
import { moduleName } from "../../../index";
import { fetchIdentifiers } from "../../../api/api";

const columns = [
{
Expand Down Expand Up @@ -64,9 +65,17 @@ const columns = [
},
];

const ICTScreening: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const ICTScreening: React.FC<{ patientUuid: string }> = ({ patientUuid }) => {
const [hasMRN, setHasMRN] = useState(false);
const [hideAddButton, setHideAddButton] = useState(true);
useEffect(() => {
(async () => {
const identifiers = await fetchIdentifiers(patientUuid);
if (identifiers?.find((e) => e.identifierType.display === "MRN")) {
setHasMRN(true);
}
})();
});
return (
<>
<EncounterList
Expand All @@ -79,7 +88,7 @@ const ICTScreening: React.FC<{ patientUuid: string }> = ({
launchOptions={{
displayText: "Add",
moduleName: moduleName,
hideFormLauncher: true,
hideFormLauncher: hideAddButton,
}}
/>
</>
Expand Down

0 comments on commit 0a8406f

Please sign in to comment.