Skip to content

Commit

Permalink
Removed add buttons from ICT forms: family contact, partner and scree…
Browse files Browse the repository at this point in the history
…ning
  • Loading branch information
melkam-mekonnen committed Aug 19, 2024
1 parent 728dc52 commit 845dea0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React, { useEffect, useState } from "react";
import React from "react";
import { EncounterList } from "@ohri/openmrs-esm-ohri-commons-lib";
import {
FAMILY_INDEX_CASE_CONTACTS_ENCOUNTER_TYPE,
MRN_NULL_WARNING,
FAMILY_INDEX_CASE_CONTACTS_ENCOUNTER_TYPE
} from "../../../constants";
import { getData } from "../../encounterUtils";
import { moduleName } from "../../../index";
import styles from "../../../root.scss";
import { fetchIdentifiers } from "../../../api/api";

const columns = [
{
Expand Down Expand Up @@ -70,15 +67,6 @@ const columns = [
const FamilyIndexCaseContacts: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const [hasMRN, setHasMRN] = useState(false);
useEffect(() => {
(async () => {
const identifiers = await fetchIdentifiers(patientUuid);
if (identifiers?.find((e) => e.identifierType.display === "MRN")) {
setHasMRN(true);
}
})();
});
return (
<>
<EncounterList
Expand All @@ -91,10 +79,9 @@ const FamilyIndexCaseContacts: React.FC<{ patientUuid: string }> = ({
launchOptions={{
displayText: "Add",
moduleName: moduleName,
hideFormLauncher: !hasMRN,
hideFormLauncher: true,
}}
/>
{!hasMRN && <p className={styles.patientName}>{MRN_NULL_WARNING}</p>}
</>
);
};
Expand Down
19 changes: 3 additions & 16 deletions src/views/index-case-testing/tabs/ict-partner-information.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React, { useEffect, useState } from "react";
import React from "react";
import { EncounterList } from "@ohri/openmrs-esm-ohri-commons-lib";
import {
MRN_NULL_WARNING,
PARTNER_INDEX_CASE_INFORMATION_ENCOUNTER_TYPE,
PARTNER_INDEX_CASE_INFORMATION_ENCOUNTER_TYPE
} from "../../../constants";
import { getData } from "../../encounterUtils";
import { moduleName } from "../../../index";
import styles from "../../../root.scss";
import { fetchIdentifiers } from "../../../api/api";

const columns = [
{
Expand Down Expand Up @@ -77,15 +74,6 @@ const columns = [
const PartnerIndexCaseInformation: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const [hasMRN, setHasMRN] = useState(false);
useEffect(() => {
(async () => {
const identifiers = await fetchIdentifiers(patientUuid);
if (identifiers?.find((e) => e.identifierType.display === "MRN")) {
setHasMRN(true);
}
})();
});
return (
<>
<EncounterList
Expand All @@ -98,10 +86,9 @@ const PartnerIndexCaseInformation: React.FC<{ patientUuid: string }> = ({
launchOptions={{
displayText: "Add",
moduleName: moduleName,
hideFormLauncher: !hasMRN,
hideFormLauncher: true,
}}
/>
{!hasMRN && <p className={styles.patientName}>{MRN_NULL_WARNING}</p>}
</>
);
};
Expand Down
17 changes: 2 additions & 15 deletions src/views/index-case-testing/tabs/ict-screening.component.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React, { useEffect, useState } from "react";
import React from "react";
import { EncounterList } from "@ohri/openmrs-esm-ohri-commons-lib";
import {
MRN_NULL_WARNING,
ICT_SCREENING_ENCOUNTER_TYPE,
} from "../../../constants";
import { getData } from "../../encounterUtils";
import { moduleName } from "../../../index";
import styles from "../../../root.scss";
import { fetchIdentifiers } from "../../../api/api";

const columns = [
{
Expand Down Expand Up @@ -70,15 +67,6 @@ const columns = [
const ICTScreening: React.FC<{ patientUuid: string }> = ({
patientUuid,
}) => {
const [hasMRN, setHasMRN] = useState(false);
useEffect(() => {
(async () => {
const identifiers = await fetchIdentifiers(patientUuid);
if (identifiers?.find((e) => e.identifierType.display === "MRN")) {
setHasMRN(true);
}
})();
});
return (
<>
<EncounterList
Expand All @@ -91,10 +79,9 @@ const ICTScreening: React.FC<{ patientUuid: string }> = ({
launchOptions={{
displayText: "Add",
moduleName: moduleName,
hideFormLauncher: !hasMRN,
hideFormLauncher: true,
}}
/>
{!hasMRN && <p className={styles.patientName}>{MRN_NULL_WARNING}</p>}
</>
);
};
Expand Down

0 comments on commit 845dea0

Please sign in to comment.