From b757d08c2cbba5b42f81eeb286bd9f98bda9e668 Mon Sep 17 00:00:00 2001 From: Eudson Bambo Date: Wed, 13 Sep 2023 21:18:24 +0200 Subject: [PATCH] CT Adult and Child Pages --- package.json | 5 +- .../care-and-treatment.component.tsx | 36 ++++- .../tabs/ct-adult-allergy-form.tsx | 107 +++++++++++++++ .../tabs/ct-adult-hospitalization-form.tsx | 107 +++++++++++++++ .../tabs/ct-adult-imaging-form.tsx | 107 +++++++++++++++ .../tabs/ct-adult-lab-form.tsx | 105 +++++++++++++++ .../tabs/ct-adult-oi-form.tsx | 105 +++++++++++++++ .../tabs/ct-adult-problems-form.tsx | 107 +++++++++++++++ .../tabs/ct-adult-visit-form.component.tsx | 127 ++++++++++++++++++ .../child-care-and-treatment.component.tsx | 39 ++++++ .../tabs/tab-one.component.tsx | 2 +- .../tabs/tab-three.component.tsx | 17 +++ .../tabs/tab-two.component.tsx | 17 +++ src/index.ts | 32 ++++- src/routes.json | 29 +++- 15 files changed, 926 insertions(+), 16 deletions(-) create mode 100644 src/care-and-treatment/tabs/ct-adult-allergy-form.tsx create mode 100644 src/care-and-treatment/tabs/ct-adult-hospitalization-form.tsx create mode 100644 src/care-and-treatment/tabs/ct-adult-imaging-form.tsx create mode 100644 src/care-and-treatment/tabs/ct-adult-lab-form.tsx create mode 100644 src/care-and-treatment/tabs/ct-adult-oi-form.tsx create mode 100644 src/care-and-treatment/tabs/ct-adult-problems-form.tsx create mode 100644 src/care-and-treatment/tabs/ct-adult-visit-form.component.tsx create mode 100644 src/child-care-and-treatment/child-care-and-treatment.component.tsx rename src/{care-and-treatment => child-care-and-treatment}/tabs/tab-one.component.tsx (89%) create mode 100644 src/child-care-and-treatment/tabs/tab-three.component.tsx create mode 100644 src/child-care-and-treatment/tabs/tab-two.component.tsx diff --git a/package.json b/package.json index ab56334..8487293 100644 --- a/package.json +++ b/package.json @@ -44,11 +44,14 @@ "url": "https://github.com/UCSF-IGHS/openmrs-esm-rwanda/issues" }, "dependencies": { - "@carbon/react": "^1.33.1", + "@carbon/react": "1.37.0", "dayjs": "^1.11.9", "lodash-es": "^4.17.21", "react-image-annotate": "^1.8.0" }, + "resolutions": { + "@carbon/react": "1.17.0" + }, "peerDependencies": { "@openmrs/esm-framework": "5.x", "react": "18.x", diff --git a/src/care-and-treatment/care-and-treatment.component.tsx b/src/care-and-treatment/care-and-treatment.component.tsx index 1663ca2..2841ce0 100644 --- a/src/care-and-treatment/care-and-treatment.component.tsx +++ b/src/care-and-treatment/care-and-treatment.component.tsx @@ -2,9 +2,15 @@ import React from "react"; import { Tabs, Tab, TabList, TabPanels, TabPanel } from "@carbon/react"; import styles from "../common.scss"; import { useTranslation } from "react-i18next"; -import TabOne from "./tabs/tab-one.component"; import TabThree from "./tabs/tab-three.component"; import TabTwo from "./tabs/tab-two.component"; +import CtAdultVisitForm from "./tabs/ct-adult-visit-form.component"; +import CtAdultProblemsForm from "./tabs/ct-adult-problems-form"; +import CtAdultOiForm from "./tabs/ct-adult-oi-form"; +import CtAdultLabForm from "./tabs/ct-adult-lab-form"; +import CtAdultImagingForm from "./tabs/ct-adult-imaging-form"; +import CtAdultHospitalizationForm from "./tabs/ct-adult-hospitalization-form"; +import CtAdultAllergyForm from "./tabs/ct-adult-allergy-form"; interface OverviewListProps { patientUuid: string; @@ -16,19 +22,35 @@ const CareAndTreatment: React.FC = ({ patientUuid }) => {
- {t("tabOne", "Tab One")} - {t("tabTwo", "Tab Two")} - {t("tabThree", "Tab Three")} + {t("tabOne", "Visits")} + {t("tabTwo", "Problems (Wahala)")} + {t("tabThree", "OI Form")} + {t("tabOne", "Lab")} + {t("tabTwo", "Imaging")} + {t("tabThree", "Hospitalizations")} + {t("tabThree", "Allergies")} - + - + - + + + + + + + + + + + + + diff --git a/src/care-and-treatment/tabs/ct-adult-allergy-form.tsx b/src/care-and-treatment/tabs/ct-adult-allergy-form.tsx new file mode 100644 index 0000000..b2db576 --- /dev/null +++ b/src/care-and-treatment/tabs/ct-adult-allergy-form.tsx @@ -0,0 +1,107 @@ +import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + getObsFromEncounter, +} from "@ohri/openmrs-esm-ohri-commons-lib"; +import { moduleName } from "../../index"; + +const CtAdultAllergyForm: React.FC<{ patientUuid: string }> = ({ + patientUuid, +}) => { + const { t } = useTranslation(); + const formName = "A - HIV Visit - Allergy Form"; + const title = t("adultCtProblemsTab", "Allergies"); + const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0"; + + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: "adverseEventMedication", + header: t("adverseEventMedication", "Suspect drug"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3cd95ed6-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "adverseEventMedicationNonCoded", + header: t("adverseEventMedicationNonCoded", "Suspect drug (Other)"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "2c62cce0-8b88-4b9e-8b22-c99c7ccc3e27" + ); + }, + }, + { + key: "adverseEventEffect", + header: t("adverseEventEffect", "Effect"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3cd96052-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "adverseEventActionTaken", + header: t("adverseEventActionTaken", "Action taken"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3cdc7e2c-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "actions", + header: t("actions", "Actions"), + getValue: (encounter) => [ + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("viewDetails", "View Details"), + mode: "view", + }, + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("editForm", "Edit Form"), + mode: "edit", + }, + ], + }, + ], + [] + ); + + return ( + + ); +}; + +export default CtAdultAllergyForm; diff --git a/src/care-and-treatment/tabs/ct-adult-hospitalization-form.tsx b/src/care-and-treatment/tabs/ct-adult-hospitalization-form.tsx new file mode 100644 index 0000000..cbf538e --- /dev/null +++ b/src/care-and-treatment/tabs/ct-adult-hospitalization-form.tsx @@ -0,0 +1,107 @@ +import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + getObsFromEncounter, +} from "@ohri/openmrs-esm-ohri-commons-lib"; +import { moduleName } from "../../index"; + +const CtAdultHospitalizationForm: React.FC<{ patientUuid: string }> = ({ + patientUuid, +}) => { + const { t } = useTranslation(); + const formName = "A - HIV Visit - Problem Form"; + const title = t("adultCtProblemsTab", "Problems"); + const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0"; + + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: "chronicCareDiagnosis", + header: t("chronicCareDiagnosis", "Chronic care diagnosis"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "bb7e04d8-3355-4fe8-9c87-98642eafab93" + ); + }, + }, + { + key: "chronicCareDiagnosisNonCoded", + header: t("chronicCareDiagnosisNonCoded", "Care diagnosis non coded"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "0814d34f-a6ab-408c-848b-c69c96b42f70" + ); + }, + }, + { + key: "ctAdultComment", + header: t("ctAdultComment", "Comments"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ce888c0-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "emrMatchesPaper", + header: t("emrMatchesPaper", "EMR matches paper"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "c8f6b4ae-600e-496c-b6b9-d6b395e13a1f" + ); + }, + }, + { + key: "actions", + header: t("actions", "Actions"), + getValue: (encounter) => [ + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("viewDetails", "View Details"), + mode: "view", + }, + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("editForm", "Edit Form"), + mode: "edit", + }, + ], + }, + ], + [] + ); + + return ( + + ); +}; + +export default CtAdultHospitalizationForm; diff --git a/src/care-and-treatment/tabs/ct-adult-imaging-form.tsx b/src/care-and-treatment/tabs/ct-adult-imaging-form.tsx new file mode 100644 index 0000000..d2e7f13 --- /dev/null +++ b/src/care-and-treatment/tabs/ct-adult-imaging-form.tsx @@ -0,0 +1,107 @@ +import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + getObsFromEncounter, +} from "@ohri/openmrs-esm-ohri-commons-lib"; +import { moduleName } from "../../index"; + +const CtAdultImagingForm: React.FC<{ patientUuid: string }> = ({ + patientUuid, +}) => { + const { t } = useTranslation(); + const formName = "A - HIV Visit - Problem Form"; + const title = t("adultCtProblemsTab", "Problems"); + const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0"; + + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: "chronicCareDiagnosis", + header: t("chronicCareDiagnosis", "Chronic care diagnosis"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "bb7e04d8-3355-4fe8-9c87-98642eafab93" + ); + }, + }, + { + key: "chronicCareDiagnosisNonCoded", + header: t("chronicCareDiagnosisNonCoded", "Care diagnosis non coded"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "0814d34f-a6ab-408c-848b-c69c96b42f70" + ); + }, + }, + { + key: "ctAdultComment", + header: t("ctAdultComment", "Comments"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ce888c0-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "emrMatchesPaper", + header: t("emrMatchesPaper", "EMR matches paper"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "c8f6b4ae-600e-496c-b6b9-d6b395e13a1f" + ); + }, + }, + { + key: "actions", + header: t("actions", "Actions"), + getValue: (encounter) => [ + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("viewDetails", "View Details"), + mode: "view", + }, + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("editForm", "Edit Form"), + mode: "edit", + }, + ], + }, + ], + [] + ); + + return ( + + ); +}; + +export default CtAdultImagingForm; diff --git a/src/care-and-treatment/tabs/ct-adult-lab-form.tsx b/src/care-and-treatment/tabs/ct-adult-lab-form.tsx new file mode 100644 index 0000000..c87f218 --- /dev/null +++ b/src/care-and-treatment/tabs/ct-adult-lab-form.tsx @@ -0,0 +1,105 @@ +import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + getObsFromEncounter, +} from "@ohri/openmrs-esm-ohri-commons-lib"; +import { moduleName } from "../../index"; + +const CtAdultLabForm: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { + const { t } = useTranslation(); + const formName = "A - HIV Visit - Problem Form"; + const title = t("adultCtProblemsTab", "Problems"); + const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0"; + + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: "chronicCareDiagnosis", + header: t("chronicCareDiagnosis", "Chronic care diagnosis"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "bb7e04d8-3355-4fe8-9c87-98642eafab93" + ); + }, + }, + { + key: "chronicCareDiagnosisNonCoded", + header: t("chronicCareDiagnosisNonCoded", "Care diagnosis non coded"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "0814d34f-a6ab-408c-848b-c69c96b42f70" + ); + }, + }, + { + key: "ctAdultComment", + header: t("ctAdultComment", "Comments"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ce888c0-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "emrMatchesPaper", + header: t("emrMatchesPaper", "EMR matches paper"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "c8f6b4ae-600e-496c-b6b9-d6b395e13a1f" + ); + }, + }, + { + key: "actions", + header: t("actions", "Actions"), + getValue: (encounter) => [ + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("viewDetails", "View Details"), + mode: "view", + }, + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("editForm", "Edit Form"), + mode: "edit", + }, + ], + }, + ], + [] + ); + + return ( + + ); +}; + +export default CtAdultLabForm; diff --git a/src/care-and-treatment/tabs/ct-adult-oi-form.tsx b/src/care-and-treatment/tabs/ct-adult-oi-form.tsx new file mode 100644 index 0000000..1863489 --- /dev/null +++ b/src/care-and-treatment/tabs/ct-adult-oi-form.tsx @@ -0,0 +1,105 @@ +import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + getObsFromEncounter, +} from "@ohri/openmrs-esm-ohri-commons-lib"; +import { moduleName } from "../../index"; + +const CtAdultOiForm: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { + const { t } = useTranslation(); + const formName = "A - HIV Visit - Problem Form"; + const title = t("adultCtProblemsTab", "Problems"); + const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0"; + + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: "chronicCareDiagnosis", + header: t("chronicCareDiagnosis", "Chronic care diagnosis"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "bb7e04d8-3355-4fe8-9c87-98642eafab93" + ); + }, + }, + { + key: "chronicCareDiagnosisNonCoded", + header: t("chronicCareDiagnosisNonCoded", "Care diagnosis non coded"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "0814d34f-a6ab-408c-848b-c69c96b42f70" + ); + }, + }, + { + key: "ctAdultComment", + header: t("ctAdultComment", "Comments"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ce888c0-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "emrMatchesPaper", + header: t("emrMatchesPaper", "EMR matches paper"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "c8f6b4ae-600e-496c-b6b9-d6b395e13a1f" + ); + }, + }, + { + key: "actions", + header: t("actions", "Actions"), + getValue: (encounter) => [ + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("viewDetails", "View Details"), + mode: "view", + }, + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("editForm", "Edit Form"), + mode: "edit", + }, + ], + }, + ], + [] + ); + + return ( + + ); +}; + +export default CtAdultOiForm; diff --git a/src/care-and-treatment/tabs/ct-adult-problems-form.tsx b/src/care-and-treatment/tabs/ct-adult-problems-form.tsx new file mode 100644 index 0000000..d5c7804 --- /dev/null +++ b/src/care-and-treatment/tabs/ct-adult-problems-form.tsx @@ -0,0 +1,107 @@ +import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + getObsFromEncounter, +} from "@ohri/openmrs-esm-ohri-commons-lib"; +import { moduleName } from "../../index"; + +const CtAdultProblemsForm: React.FC<{ patientUuid: string }> = ({ + patientUuid, +}) => { + const { t } = useTranslation(); + const formName = "A - HIV Visit - Problem Form"; + const title = t("adultCtProblemsTab", "Problems"); + const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0"; + + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: "chronicCareDiagnosis", + header: t("chronicCareDiagnosis", "Chronic care diagnosis"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "bb7e04d8-3355-4fe8-9c87-98642eafab93" + ); + }, + }, + { + key: "chronicCareDiagnosisNonCoded", + header: t("chronicCareDiagnosisNonCoded", "Care diagnosis non coded"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "0814d34f-a6ab-408c-848b-c69c96b42f70" + ); + }, + }, + { + key: "ctAdultComment", + header: t("ctAdultComment", "Comments"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ce888c0-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "emrMatchesPaper", + header: t("emrMatchesPaper", "EMR matches paper"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "c8f6b4ae-600e-496c-b6b9-d6b395e13a1f" + ); + }, + }, + { + key: "actions", + header: t("actions", "Actions"), + getValue: (encounter) => [ + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("viewDetails", "View Details"), + mode: "view", + }, + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("editForm", "Edit Form"), + mode: "edit", + }, + ], + }, + ], + [] + ); + + return ( + + ); +}; + +export default CtAdultProblemsForm; diff --git a/src/care-and-treatment/tabs/ct-adult-visit-form.component.tsx b/src/care-and-treatment/tabs/ct-adult-visit-form.component.tsx new file mode 100644 index 0000000..91c6ca1 --- /dev/null +++ b/src/care-and-treatment/tabs/ct-adult-visit-form.component.tsx @@ -0,0 +1,127 @@ +import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + getObsFromEncounter, +} from "@ohri/openmrs-esm-ohri-commons-lib"; +import { moduleName } from "../../index"; + +const CtAdultVisitForm: React.FC<{ patientUuid: string }> = ({ + patientUuid, +}) => { + const { t } = useTranslation(); + const formName = "A - HIV Visit - Visit Form"; + const title = t("adultCtVisitFormTab", "Visits"); + const encounterTypeUUID = "2dc31190-cf0e-4ab0-a5a1-6ad601d6ecc0"; + + const columns: EncounterListColumn[] = useMemo( + () => [ + { + key: "stageOfPatient", + header: t("stageOfPatient", "Stage of patient"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3cdc979a-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "currentSTI", + header: t("currentSTI", "Current STI"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3cd9e9b4-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "stiDiagnosisDescription", + header: t("stiDiagnosisDescription", "Sti diagnosis"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "56218090-7172-4b34-9c62-c9787e1545a8" + ); + }, + }, + { + key: "tbScreeningResult", + header: t("tbScreeningResult", "TB screening result"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ce14c2c-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "contraception", + header: t("econtraceptiondd", "Contraception"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ccfbd0e-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "nextVisitDate", + header: t("nextVisitDate", "Next visit date"), + getValue: (encounter) => { + return getObsFromEncounter( + encounter, + "3ce94df0-26fe-102b-80cb-0017a47871b2" + ); + }, + }, + { + key: "actions", + header: t("actions", "Actions"), + getValue: (encounter) => [ + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("viewDetails", "View Details"), + mode: "view", + }, + { + form: { name: formName, package: "maternal_health" }, + encounterUuid: encounter.uuid, + intent: "*", + label: t("editForm", "Edit Form"), + mode: "edit", + }, + ], + }, + ], + [] + ); + + return ( + + ); +}; + +export default CtAdultVisitForm; diff --git a/src/child-care-and-treatment/child-care-and-treatment.component.tsx b/src/child-care-and-treatment/child-care-and-treatment.component.tsx new file mode 100644 index 0000000..aeba002 --- /dev/null +++ b/src/child-care-and-treatment/child-care-and-treatment.component.tsx @@ -0,0 +1,39 @@ +import React from "react"; +import { Tabs, Tab, TabList, TabPanels, TabPanel } from "@carbon/react"; +import styles from "../common.scss"; +import { useTranslation } from "react-i18next"; +import TabOne from "./tabs/tab-one.component"; +import TabThree from "./tabs/tab-three.component"; +import TabTwo from "./tabs/tab-two.component"; + +interface OverviewListProps { + patientUuid: string; +} + +const CareAndTreatment: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + return ( +
+ + + {t("tabOne", "Child Tab One")} + {t("tabTwo", "Tab Two")} + {t("tabThree", "Tab Three")} + + + + + + + + + + + + + +
+ ); +}; + +export default CareAndTreatment; diff --git a/src/care-and-treatment/tabs/tab-one.component.tsx b/src/child-care-and-treatment/tabs/tab-one.component.tsx similarity index 89% rename from src/care-and-treatment/tabs/tab-one.component.tsx rename to src/child-care-and-treatment/tabs/tab-one.component.tsx index 38c46ec..b90976e 100644 --- a/src/care-and-treatment/tabs/tab-one.component.tsx +++ b/src/child-care-and-treatment/tabs/tab-one.component.tsx @@ -5,7 +5,7 @@ import { EmptyStateComingSoon } from "@ohri/openmrs-esm-ohri-commons-lib"; const TabOne: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { const { t } = useTranslation(); - const title = t("tabOne", "Tab One"); + const title = t("tabOne", "Child Tab One"); return ( <> diff --git a/src/child-care-and-treatment/tabs/tab-three.component.tsx b/src/child-care-and-treatment/tabs/tab-three.component.tsx new file mode 100644 index 0000000..3431ef0 --- /dev/null +++ b/src/child-care-and-treatment/tabs/tab-three.component.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import { EmptyStateComingSoon } from "@ohri/openmrs-esm-ohri-commons-lib"; +import { useTranslation } from "react-i18next"; + +const TabThree: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { + const { t } = useTranslation(); + + const title = t("tabThree", "Tab Three"); + + return ( + <> + + + ); +}; + +export default TabThree; diff --git a/src/child-care-and-treatment/tabs/tab-two.component.tsx b/src/child-care-and-treatment/tabs/tab-two.component.tsx new file mode 100644 index 0000000..5d0f4d2 --- /dev/null +++ b/src/child-care-and-treatment/tabs/tab-two.component.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import { EmptyStateComingSoon } from "@ohri/openmrs-esm-ohri-commons-lib"; +import { useTranslation } from "react-i18next"; + +const TabTwo: React.FC<{ patientUuid: string }> = ({ patientUuid }) => { + const { t } = useTranslation(); + + const title = t("tabTwo", "Tab Two"); + + return ( + <> + + + ); +}; + +export default TabTwo; diff --git a/src/index.ts b/src/index.ts index 1eb5f24..bfb1a20 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,12 +5,13 @@ import { } from "@openmrs/esm-framework"; import { configSchema } from "./config-schema"; import { + createConditionalDashboardLink, createOHRIPatientChartSideNavLink, patientChartDivider_dashboardMeta, } from "@ohri/openmrs-esm-ohri-commons-lib"; import { createDashboardLink } from "@openmrs/esm-patient-common-lib"; -const moduleName = "@ohri/openmrs-esm-rwanda"; +export const moduleName = "@ohri/openmrs-esm-rwanda"; const options = { featureName: "esm-rwanda", @@ -42,6 +43,27 @@ export const careAndTreatmentDashboardLink = getSyncLifecycle( }), options ); + +export const childCareAndTreatmentDashboardLink = getSyncLifecycle( + createConditionalDashboardLink({ + path: "child-care-and-treatment", + title: "Child Care And Treatment", + patientExpression: "calculateAge(patient.birthDate) < 18", + moduleName, + }), + options +); + +export const adultCareAndTreatmentDashboardLink = getSyncLifecycle( + createConditionalDashboardLink({ + path: "adult-care-and-treatment", + title: "Adult Care And Treatment", + patientExpression: "calculateAge(patient.birthDate) >= 18", + moduleName, + }), + options +); + export const careAndTreatmentDashboard = getAsyncLifecycle( () => import("./care-and-treatment/care-and-treatment.component"), { @@ -49,3 +71,11 @@ export const careAndTreatmentDashboard = getAsyncLifecycle( moduleName, } ); + +export const childCareAndTreatmentDashboard = getAsyncLifecycle( + () => import("./child-care-and-treatment/child-care-and-treatment.component"), + { + featureName: "child-care-and-treatment", + moduleName, + } +); diff --git a/src/routes.json b/src/routes.json index 29df4e4..93509ca 100644 --- a/src/routes.json +++ b/src/routes.json @@ -14,21 +14,38 @@ "order": 15 }, { - "name": "care-and-treatment-link", + "name": "adult-care-and-treatment-link", "slot": "patient-chart-dashboard-slot", - "component": "careAndTreatmentDashboardLink", - "order": 16, + "component": "adultCareAndTreatmentDashboardLink", + "order": 17, "meta": { - "slot": "care-and-treatment-slot", + "slot": "adult-care-and-treatment-slot", "columns": 1, - "path": "care-and-treatment", + "path": "adult-care-and-treatment", + "layoutMode": "anchored" + } + }, + { + "name": "child-care-and-treatment-link", + "slot": "patient-chart-dashboard-slot", + "component": "childCareAndTreatmentDashboardLink", + "order": 18, + "meta": { + "slot": "child-care-and-treatment-slot", + "columns": 1, + "path": "child-care-and-treatment", "layoutMode": "anchored" } }, { "name": "care-and-treatment-ext", - "slot": "care-and-treatment-slot", + "slot": "adult-care-and-treatment-slot", "component": "careAndTreatmentDashboard" + }, + { + "name": "child-care-and-treatment-ext", + "slot": "child-care-and-treatment-slot", + "component": "childCareAndTreatmentDashboard" } ] }