@openmrs/esm-appointments-app 9.2.1-pre.7356 → 9.2.1-pre.7362

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@ const PatientAppointmentsTable: React.FC<AppointmentTableProps> = ({
46
46
  }
47
47
  }, [switchedView, goTo, currentPage]);
48
48
 
49
- const tableHeaders: Array<typeof DataTableHeader> = useMemo(
49
+ const tableHeaders: Array<DataTableHeader> = useMemo(
50
50
  () => [
51
51
  { key: 'date', header: t('date', 'Date') },
52
52
  { key: 'location', header: t('location', 'Location') },
@@ -87,9 +87,8 @@ const PatientAppointmentsTable: React.FC<AppointmentTableProps> = ({
87
87
  className={classNames(styles.productiveHeading01, styles.text02)}
88
88
  {...getHeaderProps({
89
89
  header,
90
- isSortable: header.isSortable,
91
90
  })}>
92
- {header.header?.content ?? header.header}
91
+ {header.header}
93
92
  </TableHeader>
94
93
  ))}
95
94
  <TableHeader />
@@ -58,7 +58,6 @@
58
58
  "countMore_other": "{{count}} more",
59
59
  "createNewAppointment": "Create new appointment",
60
60
  "date": "Date",
61
- "date&Time": "Date & time",
62
61
  "dateAppointmentIssued": "Date appointment issued",
63
62
  "dateAppointmentIssuedCannotBeAfterAppointmentDate": "Date appointment issued cannot be after the appointment date",
64
63
  "dateAppointmentScheduled": "Date appointment scheduled",
@@ -74,8 +73,6 @@
74
73
  "edit": "Edit",
75
74
  "editAppointment": "Edit appointment",
76
75
  "emptyStateText": "There are no <1>{{displayText}}</1> to display",
77
- "encounters": "Encounters",
78
- "encounterType": "Encounter type",
79
76
  "endAppointmentAndVisitConfirmationMessage": "Checking the patient out will mark the appointment as complete, and close out the active visit for this patient.",
80
77
  "endAppointmentConfirmation": "Are you sure you want to check the patient out for this appointment?",
81
78
  "endAppointmentConfirmationMessage": "Checking the patient out will mark the appointment as complete.",
@@ -94,7 +91,6 @@
94
91
  "itemsPerPage": "Items per page",
95
92
  "loading": "Loading",
96
93
  "location": "Location",
97
- "medications": "Medications",
98
94
  "metricLoadErrorMessage": "Please contact your system administrator if the problem persists.",
99
95
  "missed": "Missed",
100
96
  "MON": "MON",
@@ -105,10 +101,8 @@
105
101
  "noAppointmentsToDisplay": "No appointments to display",
106
102
  "noContent": "No Content",
107
103
  "noCurrentAppointments": "There are no appointments scheduled for today to display for this patient",
108
- "noEncountersFound": "No encounters found",
109
104
  "noMatchingAppointments": "No matching appointments found",
110
105
  "noPastAppointments": "There are no past appointments to display for this patient",
111
- "noPreviousVisitFound": "No previous visit found",
112
106
  "notArrived": "Not arrived",
113
107
  "note": "Note",
114
108
  "notes": "Notes",
@@ -160,7 +154,6 @@
160
154
  "upcoming": "Upcoming",
161
155
  "upcomingAppointments": "Upcoming appointments",
162
156
  "updateError": "Error updating upcoming appointment",
163
- "vitals": "Vitals",
164
157
  "WED": "WED",
165
158
  "week": "Week",
166
159
  "yes": "Yes"
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import classNames from 'classnames';
3
- import {
4
- StructuredListHead,
5
- StructuredListCell,
6
- StructuredListRow,
7
- StructuredListBody,
8
- StructuredListWrapper,
9
- } from '@carbon/react';
10
- import { useTranslation } from 'react-i18next';
11
- import { formatDatetime, parseDate } from '@openmrs/esm-framework';
12
- import { type FormattedEncounter } from './past-visit.component';
13
- import styles from './past-visit.scss';
14
-
15
- interface EncounterListProps {
16
- encounters: Array<FormattedEncounter>;
17
- }
18
-
19
- const EncounterList: React.FC<EncounterListProps> = ({ encounters }) => {
20
- const { t } = useTranslation();
21
-
22
- const structuredListBodyRowGenerator = () => {
23
- return encounters.map((encounter, i) => (
24
- <StructuredListRow label key={`row-${i}`}>
25
- <StructuredListCell>{formatDatetime(parseDate(encounter.datetime), { mode: 'wide' })}</StructuredListCell>
26
- <StructuredListCell className={styles.textColor}>{encounter.encounterType}</StructuredListCell>
27
- <StructuredListCell>{encounter.provider}</StructuredListCell>
28
- </StructuredListRow>
29
- ));
30
- };
31
-
32
- if (encounters?.length) {
33
- return (
34
- <div className={styles.encounterListContainer}>
35
- <StructuredListWrapper>
36
- <StructuredListHead>
37
- <StructuredListRow head>
38
- <StructuredListCell head>{t('date&Time', 'Date & time')}</StructuredListCell>
39
- <StructuredListCell head>{t('encounterType', 'Encounter type')}</StructuredListCell>
40
- <StructuredListCell head>{t('provider', 'Provider')}</StructuredListCell>
41
- </StructuredListRow>
42
- </StructuredListHead>
43
- <StructuredListBody>{structuredListBodyRowGenerator()}</StructuredListBody>
44
- </StructuredListWrapper>
45
- </div>
46
- );
47
- }
48
-
49
- return (
50
- <p className={classNames(styles.bodyLong01, styles.text02)}>{t('noEncountersFound', 'No encounters found')}</p>
51
- );
52
- };
53
-
54
- export default EncounterList;
@@ -1,106 +0,0 @@
1
- import React, { useState } from 'react';
2
- import classNames from 'classnames';
3
- import { useTranslation } from 'react-i18next';
4
- import { StructuredListSkeleton, Tab, Tabs } from '@carbon/react';
5
- import { formatDate, type OpenmrsResource, parseDate, useLayoutType } from '@openmrs/esm-framework';
6
- import { type Observation } from '../types';
7
- import { usePastVisits } from './past-visit.resource';
8
- import EncounterList from './encounter-list.component';
9
- import styles from './past-visit.scss';
10
-
11
- interface PastVisitProps {
12
- patientUuid: string;
13
- }
14
-
15
- export interface FormattedEncounter {
16
- id: string;
17
- datetime: string;
18
- encounterType: string;
19
- form: OpenmrsResource;
20
- obs: Array<Observation>;
21
- provider: string;
22
- visitType: string;
23
- visitUuid: string;
24
- }
25
-
26
- const PastVisit: React.FC<PastVisitProps> = ({ patientUuid }) => {
27
- const { t } = useTranslation();
28
- const { data: pastVisits, error, isLoading } = usePastVisits(patientUuid);
29
- const [selectedTabIndex, setSelectedTabIndex] = useState(0);
30
- const isTablet = useLayoutType() === 'tablet';
31
-
32
- if (isLoading) {
33
- return <StructuredListSkeleton role="progressbar" />;
34
- }
35
-
36
- if (pastVisits?.length) {
37
- const encounters = mapEncounters(pastVisits[0]);
38
-
39
- const tabsClasses = classNames(styles.verticalTabs, {
40
- [styles.tabletTabs]: isTablet,
41
- [styles.desktopTabs]: !isTablet,
42
- });
43
-
44
- const tabClass = (index) =>
45
- classNames(styles.tab, styles.bodyLong01, {
46
- [styles.selectedTab]: selectedTabIndex === index,
47
- });
48
-
49
- return (
50
- <div className={styles.wrapper}>
51
- <div className={styles.visitType}>
52
- <span> {pastVisits?.length ? pastVisits[0]?.visitType.display : '--'}</span>
53
- <p className={styles.date}>
54
- {pastVisits?.length ? formatDate(parseDate(pastVisits[0]?.startDatetime)) : '--'}
55
- </p>
56
- </div>
57
- <div className={styles.visitContainer}>
58
- <Tabs className={tabsClasses}>
59
- <Tab
60
- className={tabClass[0]}
61
- id="vitals-tab"
62
- onClick={() => setSelectedTabIndex(0)}
63
- label={t('vitals', 'Vitals')}></Tab>
64
-
65
- <Tab
66
- className={tabClass[1]}
67
- id="notes-tab"
68
- onClick={() => setSelectedTabIndex(1)}
69
- label={t('notes', 'Notes')}></Tab>
70
-
71
- <Tab
72
- className={tabClass[2]}
73
- id="medications-tab"
74
- onClick={() => setSelectedTabIndex(2)}
75
- label={t('medications', 'Medications')}></Tab>
76
-
77
- <Tab
78
- className={tabClass[3]}
79
- id="encounters-tab"
80
- onClick={() => setSelectedTabIndex(3)}
81
- label={t('encounters', 'Encounters')}>
82
- <EncounterList encounters={encounters} />
83
- </Tab>
84
- </Tabs>
85
- </div>
86
- </div>
87
- );
88
- }
89
- return <p className={styles.bodyLong01}>{t('noPreviousVisitFound', 'No previous visit found')}</p>;
90
- };
91
-
92
- export function mapEncounters(visit) {
93
- return visit?.encounters?.map((encounter) => ({
94
- id: encounter?.uuid,
95
- datetime: encounter?.encounterDatetime,
96
- encounterType: encounter?.encounterType?.display,
97
- form: encounter?.form,
98
- obs: encounter?.obs,
99
- provider:
100
- encounter?.encounterProviders?.length > 0 ? encounter.encounterProviders[0].provider?.person?.display : '--',
101
- visitUuid: visit?.visitType.uuid,
102
- visitType: visit?.visitType?.name,
103
- }));
104
- }
105
-
106
- export default PastVisit;
@@ -1,25 +0,0 @@
1
- import useSWR from 'swr';
2
- import { openmrsFetch, restBaseUrl, type Visit } from '@openmrs/esm-framework';
3
-
4
- export function usePastVisits(patientUuid: string) {
5
- const customRepresentation =
6
- 'custom:(uuid,encounters:(uuid,encounterDatetime,' +
7
- 'form:(uuid,name),location:ref,' +
8
- 'encounterType:ref,encounterProviders:(uuid,display,' +
9
- 'provider:(uuid,display))),patient:(uuid,uuid),' +
10
- 'visitType:(uuid,name,display),attributes:(uuid,display,value),location:(uuid,name,display),startDatetime,' +
11
- 'stopDatetime)';
12
-
13
- const apiUrl = `${restBaseUrl}/visit?patient=${patientUuid}&v=${customRepresentation}`;
14
- const { data, error, isLoading, isValidating } = useSWR<{ data: { results: Array<Visit> } }, Error>(
15
- patientUuid ? apiUrl : null,
16
- openmrsFetch,
17
- );
18
-
19
- return {
20
- data: data ? data.data.results : null,
21
- error,
22
- isLoading,
23
- isValidating,
24
- };
25
- }
@@ -1,111 +0,0 @@
1
- @use '@carbon/layout';
2
- @use '@carbon/type';
3
- @use '@openmrs/esm-styleguide/src/vars' as *;
4
-
5
- .wrapper {
6
- margin-top: layout.$spacing-03;
7
- }
8
-
9
- .bodyShort02 {
10
- @include type.type-style('body-compact-02');
11
- }
12
-
13
- .bodyLong01 {
14
- @include type.type-style('body-01');
15
- }
16
-
17
- .date {
18
- @include type.type-style('label-01');
19
- color: $text-02;
20
- margin: layout.$spacing-03 0 layout.$spacing-02;
21
- }
22
-
23
- .visitType {
24
- @include type.type-style('heading-compact-02');
25
- }
26
-
27
- .container {
28
- background-color: $ui-background;
29
- border: 1px solid $grey-2;
30
- padding: layout.$spacing-05;
31
- margin: layout.$spacing-05 0 layout.$spacing-05;
32
- width: 100%;
33
- }
34
-
35
- .tabs > :global(.cds--tab-content) {
36
- padding: layout.$spacing-05 0 !important;
37
- }
38
-
39
- .header::after {
40
- content: '';
41
- display: block;
42
- width: layout.$spacing-07;
43
- padding-top: 0.188rem;
44
- border-bottom: 0.375rem solid var(--brand-03);
45
- }
46
-
47
- .visitContainer {
48
- background-color: $ui-background;
49
- display: grid;
50
- grid-template-columns: max-content auto;
51
- }
52
-
53
- .flexSections {
54
- display: flex;
55
- }
56
-
57
- .verticalTabs {
58
- margin: layout.$spacing-04 0;
59
-
60
- &:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-item + .cds--tabs--scrollable__nav-item) {
61
- margin-left: 0;
62
- }
63
- }
64
-
65
- .verticalTabs > ul {
66
- flex-direction: column !important;
67
- }
68
-
69
- .desktopTabs {
70
- button {
71
- height: layout.$spacing-07;
72
- }
73
- }
74
-
75
- .tabletTabs {
76
- button {
77
- height: layout.$spacing-09;
78
- }
79
- }
80
-
81
- .tab > button {
82
- border-bottom: 0 !important;
83
- border-left: 3px solid $ui-03 !important;
84
- }
85
-
86
- .tab > button,
87
- .tab > button:focus,
88
- .tab > button:active {
89
- outline: 0 !important;
90
- outline-offset: 0 !important;
91
- }
92
-
93
- .selectedTab > button {
94
- border-left: 3px solid var(--brand-03) !important;
95
- border-bottom: 0 !important;
96
- font-weight: 600 !important;
97
- }
98
-
99
- .tabContent {
100
- border-top: 1px solid $ui-03;
101
- padding: layout.$spacing-05 0;
102
- width: 70%;
103
- }
104
-
105
- .textColor {
106
- color: $color-blue-60-2;
107
- }
108
-
109
- .text02 {
110
- color: $text-02;
111
- }