From 414a77bdc8596a81e764d3d5e993a0e9ca0b6d29 Mon Sep 17 00:00:00 2001 From: Jovan Ssebaggala Date: Sat, 18 Jan 2025 01:19:13 +0300 Subject: [PATCH] (feat) O3-3773 Support for Patient Program Summary in Patient Chart (#1969) * Introduce summary card * add logic * clean up * code review * code review * Introduce summary card * add logic * clean up * code review * code review * Restructure directories and fix conflicts * code review * code review * code review * Update encounter-list.component.tsx --------- Co-authored-by: CynthiaKamau Co-authored-by: Ian <52504170+ibacher@users.noreply.github.com> --- .../encounter-list-tabs.component.tsx | 0 .../encounter-list}/encounter-list-tabs.scss | 0 .../encounter-list.component.tsx | 16 +- .../encounter-list}/encounter-list.scss | 0 .../encounter-list}/table.component.tsx | 0 .../encounter-list}/table.scss | 0 .../encounter-list}/tag.component.tsx | 2 +- .../clinical-views-summary.component.tsx | 40 ++++ .../encounter-tile.component.tsx | 84 +++++++ .../clinical-views/encounter-tile/tile.scss | 87 ++++++++ .../hooks/index.ts | 1 + .../hooks/useEncounterRows.ts | 0 .../hooks/useFormsJson.ts | 0 .../clinical-views/hooks/useLastEncounter.ts | 29 +++ .../types.ts | 100 ++++++++- .../utils/encounter-list-config-builder.ts | 57 +++-- .../utils}/encounter-list.resource.ts | 0 .../src/clinical-views/utils/helpers.ts | 211 ++++++++++++++++++ .../src/clinical-views/utils/index.ts | 86 +++++++ .../src/encounter-list/utils/helpers.ts | 182 --------------- packages/esm-patient-chart-app/src/index.ts | 9 +- .../esm-patient-chart-app/src/routes.json | 6 + .../esm-patient-common-lib/src/types/index.ts | 12 + 23 files changed, 696 insertions(+), 226 deletions(-) rename packages/esm-patient-chart-app/src/{encounter-list/components => clinical-views/encounter-list}/encounter-list-tabs.component.tsx (100%) rename packages/esm-patient-chart-app/src/{encounter-list/components => clinical-views/encounter-list}/encounter-list-tabs.scss (100%) rename packages/esm-patient-chart-app/src/{encounter-list/components => clinical-views/encounter-list}/encounter-list.component.tsx (95%) rename packages/esm-patient-chart-app/src/{encounter-list/components => clinical-views/encounter-list}/encounter-list.scss (100%) rename packages/esm-patient-chart-app/src/{encounter-list/components => clinical-views/encounter-list}/table.component.tsx (100%) rename packages/esm-patient-chart-app/src/{encounter-list/components => clinical-views/encounter-list}/table.scss (100%) rename packages/esm-patient-chart-app/src/{encounter-list/components => clinical-views/encounter-list}/tag.component.tsx (87%) create mode 100644 packages/esm-patient-chart-app/src/clinical-views/encounter-tile/clinical-views-summary.component.tsx create mode 100644 packages/esm-patient-chart-app/src/clinical-views/encounter-tile/encounter-tile.component.tsx create mode 100644 packages/esm-patient-chart-app/src/clinical-views/encounter-tile/tile.scss rename packages/esm-patient-chart-app/src/{encounter-list => clinical-views}/hooks/index.ts (65%) rename packages/esm-patient-chart-app/src/{encounter-list => clinical-views}/hooks/useEncounterRows.ts (100%) rename packages/esm-patient-chart-app/src/{encounter-list => clinical-views}/hooks/useFormsJson.ts (100%) create mode 100644 packages/esm-patient-chart-app/src/clinical-views/hooks/useLastEncounter.ts rename packages/esm-patient-chart-app/src/{encounter-list => clinical-views}/types.ts (66%) rename packages/esm-patient-chart-app/src/{encounter-list => clinical-views}/utils/encounter-list-config-builder.ts (82%) rename packages/esm-patient-chart-app/src/{encounter-list => clinical-views/utils}/encounter-list.resource.ts (100%) create mode 100644 packages/esm-patient-chart-app/src/clinical-views/utils/helpers.ts create mode 100644 packages/esm-patient-chart-app/src/clinical-views/utils/index.ts delete mode 100644 packages/esm-patient-chart-app/src/encounter-list/utils/helpers.ts diff --git a/packages/esm-patient-chart-app/src/encounter-list/components/encounter-list-tabs.component.tsx b/packages/esm-patient-chart-app/src/clinical-views/encounter-list/encounter-list-tabs.component.tsx similarity index 100% rename from packages/esm-patient-chart-app/src/encounter-list/components/encounter-list-tabs.component.tsx rename to packages/esm-patient-chart-app/src/clinical-views/encounter-list/encounter-list-tabs.component.tsx diff --git a/packages/esm-patient-chart-app/src/encounter-list/components/encounter-list-tabs.scss b/packages/esm-patient-chart-app/src/clinical-views/encounter-list/encounter-list-tabs.scss similarity index 100% rename from packages/esm-patient-chart-app/src/encounter-list/components/encounter-list-tabs.scss rename to packages/esm-patient-chart-app/src/clinical-views/encounter-list/encounter-list-tabs.scss diff --git a/packages/esm-patient-chart-app/src/encounter-list/components/encounter-list.component.tsx b/packages/esm-patient-chart-app/src/clinical-views/encounter-list/encounter-list.component.tsx similarity index 95% rename from packages/esm-patient-chart-app/src/encounter-list/components/encounter-list.component.tsx rename to packages/esm-patient-chart-app/src/clinical-views/encounter-list/encounter-list.component.tsx index 127d1cbb11..77d955e000 100644 --- a/packages/esm-patient-chart-app/src/encounter-list/components/encounter-list.component.tsx +++ b/packages/esm-patient-chart-app/src/clinical-views/encounter-list/encounter-list.component.tsx @@ -1,17 +1,15 @@ import React, { useCallback, useMemo, useState } from 'react'; -import { navigate, showModal, showSnackbar, type Visit } from '@openmrs/esm-framework'; -import { EmptyState } from '@openmrs/esm-patient-common-lib'; import { useTranslation } from 'react-i18next'; -import { EncounterListDataTable } from './table.component'; import { Button, Link, OverflowMenu, OverflowMenuItem, DataTableSkeleton, Pagination } from '@carbon/react'; -import { Add } from '@carbon/react/icons'; +import { AddIcon, navigate, showModal, showSnackbar, type Visit } from '@openmrs/esm-framework'; +import { EmptyState } from '@openmrs/esm-patient-common-lib'; +import { EncounterListDataTable } from './table.component'; import { launchEncounterForm } from '../utils/helpers'; -import { deleteEncounter } from '../encounter-list.resource'; +import { deleteEncounter } from '../utils/encounter-list.resource'; import { useEncounterRows, useFormsJson } from '../hooks'; - +import type { TableRow, Encounter, Mode, ColumnValue, FormattedColumn } from '../types'; import styles from './encounter-list.scss'; -import { type TableRow, type Encounter, type Mode, type ColumnValue } from '../types'; -import { type FormattedColumn } from '../utils/encounter-list-config-builder'; + export interface EncounterListColumn { key: string; @@ -243,7 +241,7 @@ export const EncounterList: React.FC = ({ return (