diff --git a/packages/esm-tb-app/src/dashboard.meta.tsx b/packages/esm-tb-app/src/dashboard.meta.tsx index 61b225d2a..0be3c3498 100644 --- a/packages/esm-tb-app/src/dashboard.meta.tsx +++ b/packages/esm-tb-app/src/dashboard.meta.tsx @@ -1,3 +1,5 @@ +import { PillsAdd } from '@carbon/react/icons'; + export const tbPatientChartMeta = { title: 'TB Program', slotName: 'ohri-tb-slot', @@ -35,3 +37,18 @@ export const tbContactListingDashboardMeta = { path: 'tb-contact-listing', layoutMode: 'anchored', }; +// Clinical Dashboards +export const tbClinicalViewDashboardMeta = { + slot: 'tb-clinical-dashboard-slot', + config: { columns: 1, type: 'grid', icon: PillsAdd }, + isFolder: true, + title: 'Tuberculosis', +}; + +export const tbCasesDashboardMeta = { + name: 'tb-cases', + slot: 'tb-cases-dashboard-slot', + config: { columns: 1, type: 'grid', programme: 'tb', dashboardTitle: 'TB Treatment', icon: PillsAdd }, + title: 'TB Treatment', + dashboardIcon: PillsAdd, +}; \ No newline at end of file diff --git a/packages/esm-tb-app/src/index.ts b/packages/esm-tb-app/src/index.ts index 96ebd3e3b..57eceecc7 100644 --- a/packages/esm-tb-app/src/index.ts +++ b/packages/esm-tb-app/src/index.ts @@ -1,4 +1,5 @@ import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework'; +import { createOHRIDashboardLink, OHRIHome, OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; import { createDashboardGroup, createDashboardLink } from '@openmrs/esm-patient-common-lib'; import { tbPatientChartMeta, @@ -6,6 +7,8 @@ import { tbPatientSummaryDashboardMeta, tbProgramManagementDashboardMeta, tbTreatmentFollowUpDashboardMeta, + tbClinicalViewDashboardMeta, + tbCasesDashboardMeta, } from './dashboard.meta'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -72,3 +75,33 @@ export const tbContactListingDashboard = getAsyncLifecycle( moduleName, }, ); +export const tbDashboardHeader = getSyncLifecycle(OHRIWelcomeSection, { + featureName: 'tb-home-header', + moduleName, +}); + +export const tbDashboardTiles = getAsyncLifecycle( + () => import('./views/dashboard/summary-tiles/tb-summary-tiles.component'), + { + featureName: 'tb-home-tiles', + moduleName, + }, +); +export const tbDashboardTabs = getAsyncLifecycle( + () => import('./views/dashboard/patient-list-tabs/tb-patient-list-tabs.component'), + { + featureName: 'tb-home-tabs', + moduleName, + }, +); + +// OHRI HOME +export const tbClinicalViewDashboardLink = getSyncLifecycle( + createOHRIDashboardLink(tbClinicalViewDashboardMeta), + options, +); +export const tbCasesDashboardLink = getSyncLifecycle(createOHRIDashboardLink(tbCasesDashboardMeta), options); +export const tbCasesDashboard = getSyncLifecycle(OHRIHome, { + featureName: 'tb cases dashboard', + moduleName, +}); \ No newline at end of file diff --git a/packages/esm-tb-app/src/routes.json b/packages/esm-tb-app/src/routes.json index 41996d887..2fd34a6b9 100644 --- a/packages/esm-tb-app/src/routes.json +++ b/packages/esm-tb-app/src/routes.json @@ -89,6 +89,62 @@ "name": "tb-contact-listing-summary-ext", "slot": "tb-contact-listing-summary-slot", "component": "tbContactListingDashboard" - } + }, + { + "name": "tb-dashboard-link", + "slot": "tb-dashboard-slot", + "component": "tbClinicalViewDashboardLink", + "meta": { + "slot": "tb-clinical-dashboard-slot", + "isFolder": true, + "title": "Tuberculosis" + } + }, + { + "name": "tb-cases-dashboard-ext", + "slot": "tb-clinical-dashboard-slot", + "component": "tbCasesDashboardLink", + "meta": { + "name": "tb-cases", + "slot": "tb-cases-dashboard-slot", + "config": { + "columns": 1, + "type": "grid", + "programme": "tb", + "dashboardTitle": "TB Treatment" + }, + "title": "TB Treatment" + } + }, + { + "name": "tb-cases-dashboard", + "slot": "tb-cases-dashboard-slot", + "component": "tbCasesDashboard", + "meta": { + "name": "tb-cases", + "slot": "tb-cases-dashboard-slot", + "config": { + "columns": 1, + "programme": "tb", + "dashboardTitle": "TB Treatment" + }, + "title": "TB Treatment" + } + }, + { + "name": "tb-home-header-ext", + "slot": "tb-home-header-slot", + "component": "tbDashboardHeader" + }, + { + "name": "tb-home-tiles-ext", + "slot": "tb-home-tiles-slot", + "component": "tbDashboardTiles" + }, + { + "name": "tb-home-tabs-ext", + "slot": "tb-home-tabs-slot", + "component": "tbDashboardTabs" + } ] } diff --git a/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tb-patient-list-tabs.component.tsx b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tb-patient-list-tabs.component.tsx new file mode 100644 index 000000000..21e13de10 --- /dev/null +++ b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tb-patient-list-tabs.component.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { Tabs, Tab, TabPanels, TabPanel, TabList } from '@carbon/react'; +import { useTranslation } from 'react-i18next'; + +interface OverviewListProps { + patientUuid: string; +} + +const TbHomePatientTabs: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + return ( + + + {t('allTbClients', 'All TB Clients')} + + + + + + + ); +}; + +export default TbHomePatientTabs; diff --git a/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx new file mode 100644 index 000000000..d35ef08ef --- /dev/null +++ b/packages/esm-tb-app/src/views/dashboard/summary-tiles/tb-summary-tiles.component.tsx @@ -0,0 +1,29 @@ +import { OHRIProgrammeSummaryTiles } from '@ohri/openmrs-esm-ohri-commons-lib'; +import React, { useEffect, useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; + +function TbSummaryTiles({ launchWorkSpace }) { + const { t } = useTranslation(); + const [activeDSClientsCount, setActiveDSClientsCount] = useState(35); + const [activeDRClientsCount, setActiveDRClientsCount] = useState(5); + const tiles = useMemo( + () => [ + { + title: t('activeDsCases', 'Active DS Cases'), + linkAddress: '#', + subTitle: t('drugSensitive', 'Cases with drug sesnsitive TB'), + value: activeDSClientsCount, + }, + { + title: t('activeDrCases', 'Active DR Cases'), + linkAddress: '#', + subTitle: t('drugResistant', 'Cases with drug resistant TB'), + value: activeDRClientsCount, + } + ], + [], + ); + return ; +} + +export default TbSummaryTiles; \ No newline at end of file diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index 222afe9dc..01f1e53b5 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -6,5 +6,11 @@ "TbContactListing": "TB Contact Listing", "recentTuberculosis": "Recent Tuberculosis", "previousCases": "Previous Cases", - "visits": "Visits" + "visits": "Visits", + "allTbClients": "All TB Clients", + "activeDrCases": "Active DR Cases", + "activeDsCases": "Active DS Cases", + "drugResistant": "Cases with drug resistant TB", + "drugSensitive": "Cases with drug sesnsitive TB" + } diff --git a/yarn.lock b/yarn.lock index ffe7e52fd..c5d976a8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4108,8 +4108,8 @@ __metadata: linkType: hard "@openmrs/openmrs-form-engine-lib@npm:next": - version: 1.0.0-pre.463 - resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.463" + version: 1.0.0-pre.465 + resolution: "@openmrs/openmrs-form-engine-lib@npm:1.0.0-pre.465" dependencies: ace-builds: ^1.4.12 enzyme: ^3.11.0 @@ -4132,7 +4132,7 @@ __metadata: react: 18.x react-i18next: 11.x rxjs: 6.x - checksum: ce4a7fc4c846e73ab9c280abd286c5c49790ff150445d419cbe9418cb8dede9e119c262725b99939429b4add72555e1e7e4ba6d7b92bf67a4e8088eb48519d80 + checksum: 22c349ed661c228c1adb779706c84056e771b560f43cccd2ea230009a90bd391b1d54813d9da92130fe51db517ce207298aa2d8c20bb6ff9559bf743477da6b3 languageName: node linkType: hard