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

(refactor) Dashboard UI Workflows: Implement HCT and TP dashboard schema workflows. #1873

Merged
merged 1 commit into from
Jun 19, 2024
Merged
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
2 changes: 2 additions & 0 deletions packages/esm-commons-lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export * from './hooks/useLastEncounter';
export * from './utils/encounter-list-config-builder';
export * from './utils/summary-card-config-builder';
export * from './utils/encounter-tile-config-builder';
export * from './utils/cohort-list-config-builder';
export * from './utils/patient-list-tabs-config-builder';
// Workspace registration moved to the index.ts and routes.json
const options = {
featureName: 'ohri-forms-workspace-item',
Expand Down
15 changes: 15 additions & 0 deletions packages/esm-commons-lib/src/utils/cohort-list-config-builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { extractSchemaValues, replaceWithConfigDefaults } from './schema-manipulation';

export const getCohortListTabsData = (cohortTabsSchema, config) => {
const configDefaults = extractSchemaValues(config);
const transformedSchemaConfig = replaceWithConfigDefaults(cohortTabsSchema, configDefaults);

const tabs = transformedSchemaConfig.tabDefinitions?.map((tab) => {
return {
name: tab.tabName,
cohortListData: tab.cohortContent,
};
});

return tabs;
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const createOHRIDashboardLink = (meta) => {

if (meta.isFolder) {
return (
<SideNavMenu renderIcon={meta.config.icon} title={meta.title}>
<SideNavMenu renderIcon={meta.config?.icon} title={meta.title}>
<ExtensionSlot name={meta.slot} />
</SideNavMenu>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { getObsFromEncounter } from './encounter-list-utils';
import { extractSchemaValues, replaceWithConfigDefaults } from './schema-manipulation';

export const getPatientListTabsData = (patientListTabsSchema, config) => {
const configDefaults = extractSchemaValues(config);
const transformedSchemaConfig = replaceWithConfigDefaults(patientListTabsSchema, configDefaults);

const tabs = transformedSchemaConfig.tabDefinitions?.map((tab) => {
const otherColumnsData = tab.otherColumns.map((column) => {
return {
key: column.id,
header: column.title,
index: column.index || null,
getValue: (row) => {
if (column.type === 'patientId') {
return row.id;
}

if (column.type === 'lastDate') {
return '13/01/2021';
}

if (column.type === 'appointmentDate') {
return '03/03/2021';
}

const { encounter } = row;
return getObsFromEncounter(encounter, column.concept, column.isDate);
},
};
});
return {
...tab,
label: tab.tabName,
queryParams: tab.hasQueryParams ? [`value1=${new Date().toISOString().split('T')[0]}`] : null,
otherColumns: otherColumnsData,
};
});

return tabs;
};
10 changes: 5 additions & 5 deletions packages/esm-hiv-care-treatment-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { defineConfigSchema, getSyncLifecycle } from '@openmrs/esm-framework';
import ServiceSummaryOverviewList from './views/service-summary/encounter-list/service-summary-encounter-list.component';
import ProgramManagementSummary from './views/program-management/program-management-summary.component';
import VisitsSummary from './views/visits/visits-summary.component';
import GeneralCounsellingSummary from './views/general-counselling/general-counselling-summary.component';
import PartnerNotificationServices from './views/partner-notification-services/partner-notification-services.component';
import ServiceSummaryOverviewList from './views/patient-chart/service-summary/service-summary-encounter-list.component';
import ProgramManagementSummary from './views/patient-chart/program-management/program-management-summary.component';
import VisitsSummary from './views/patient-chart/visits/visits-summary.component';
import GeneralCounsellingSummary from './views/patient-chart/general-counselling/general-counselling-summary.component';
import PartnerNotificationServices from './views/patient-chart/partner-notification-services/partner-notification-services.component';
import {
createOHRIDashboardLink,
PatientStatusBannerTag,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading