@kenyaemr/esm-appointments-app 7.0.3-pre.89 → 8.0.0

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.
Files changed (112) hide show
  1. package/.turbo/turbo-build.log +23 -22
  2. package/dist/130.js +1 -1
  3. package/dist/130.js.map +1 -1
  4. package/dist/23.js +2 -0
  5. package/dist/23.js.map +1 -0
  6. package/dist/265.js +1 -1
  7. package/dist/271.js +1 -1
  8. package/dist/319.js +1 -1
  9. package/dist/460.js +1 -1
  10. package/dist/529.js +1 -1
  11. package/dist/574.js +1 -1
  12. package/dist/581.js +1 -0
  13. package/dist/581.js.map +1 -0
  14. package/dist/644.js +1 -1
  15. package/dist/646.js +2 -0
  16. package/dist/646.js.map +1 -0
  17. package/dist/757.js +1 -1
  18. package/dist/788.js +1 -1
  19. package/dist/807.js +1 -1
  20. package/dist/833.js +1 -1
  21. package/dist/85.js +1 -0
  22. package/dist/85.js.map +1 -0
  23. package/dist/89.js +1 -0
  24. package/dist/89.js.map +1 -0
  25. package/dist/kenyaemr-esm-appointments-app.js +1 -1
  26. package/dist/kenyaemr-esm-appointments-app.js.buildmanifest.json +167 -143
  27. package/dist/kenyaemr-esm-appointments-app.js.map +1 -1
  28. package/dist/main.js +1 -1
  29. package/dist/main.js.map +1 -1
  30. package/dist/routes.json +1 -1
  31. package/package.json +2 -3
  32. package/src/admin/appointment-services/appointment-services.scss +5 -5
  33. package/src/appointments/appointment-tabs.scss +6 -7
  34. package/src/appointments/appointment-tabs.test.tsx +4 -11
  35. package/src/appointments/common-components/appointments-actions.test.tsx +121 -74
  36. package/src/appointments/common-components/appointments-table.scss +6 -6
  37. package/src/appointments/common-components/appointments-table.test.tsx +30 -32
  38. package/src/appointments/common-components/end-appointment.test.tsx +20 -19
  39. package/src/appointments/details/appointment-details.component.tsx +1 -1
  40. package/src/appointments/details/appointment-details.scss +13 -13
  41. package/src/appointments/details/appointment-details.test.tsx +49 -48
  42. package/src/appointments/scheduled/scheduled-appointments.component.tsx +1 -1
  43. package/src/appointments/scheduled/scheduled-appointments.scss +3 -1
  44. package/src/appointments/unscheduled/unscheduled-appointments.test.tsx +35 -37
  45. package/src/appointments.component.tsx +0 -1
  46. package/src/calendar/appointments-calendar-view-view.scss +3 -4
  47. package/src/calendar/appointments-calendar-view.test.tsx +1 -5
  48. package/src/calendar/header/calendar-header.scss +4 -4
  49. package/src/calendar/monthly/days-of-week.scss +1 -1
  50. package/src/calendar/monthly/monthly-view-workload.scss +10 -10
  51. package/src/config-schema.ts +88 -90
  52. package/src/empty-state/empty-state.scss +4 -4
  53. package/src/form/appointments-form.component.tsx +58 -26
  54. package/src/form/appointments-form.resource.ts +2 -2
  55. package/src/form/appointments-form.scss +11 -11
  56. package/src/form/appointments-form.test.tsx +42 -43
  57. package/src/header/appointments-header.scss +12 -12
  58. package/src/home/home-appointments.scss +0 -1
  59. package/src/homepage-tile/appointments-tile.component.tsx +23 -0
  60. package/src/homepage-tile/appointments-tile.scss +39 -0
  61. package/src/homepage-tile/appointments.resource.ts +15 -0
  62. package/src/hooks/useClinicalMetrics.ts +1 -1
  63. package/src/hooks/useDefaultLocation.ts +1 -1
  64. package/src/hooks/usePatientAppointmentHistory.ts +1 -1
  65. package/src/hooks/useProviders.ts +1 -1
  66. package/src/index.ts +5 -0
  67. package/src/metrics/appointments-metrics.scss +0 -1
  68. package/src/metrics/appointments-metrics.test.tsx +25 -31
  69. package/src/metrics/metrics-card.component.tsx +6 -33
  70. package/src/metrics/metrics-card.scss +8 -8
  71. package/src/metrics/metrics-header.scss +1 -1
  72. package/src/past-visit/past-visit.component.tsx +1 -1
  73. package/src/past-visit/past-visit.resource.ts +1 -1
  74. package/src/past-visit/past-visit.scss +19 -14
  75. package/src/patient-appointments/patient-appointments-action-menu.scss +6 -0
  76. package/src/patient-appointments/patient-appointments-base.component.tsx +6 -6
  77. package/src/patient-appointments/patient-appointments-base.scss +24 -29
  78. package/src/patient-appointments/patient-appointments-base.test.tsx +13 -11
  79. package/src/patient-appointments/patient-appointments-header.scss +4 -5
  80. package/src/patient-appointments/patient-appointments-overview.component.tsx +2 -2
  81. package/src/patient-appointments/patient-appointments-overview.scss +0 -1
  82. package/src/patient-appointments/patient-appointments.resource.ts +1 -1
  83. package/src/patient-appointments/patient-upcoming-appointments-card.component.tsx +3 -3
  84. package/src/patient-appointments/patient-upcoming-appointments-card.scss +11 -10
  85. package/src/patient-search/patient-search.scss +15 -14
  86. package/src/routes.json +5 -0
  87. package/src/types/index.ts +4 -0
  88. package/src/workload/monthly-view-workload/monthly-workload.scss +21 -6
  89. package/src/workload/monthly-view-workload/monthlyWorkCard.tsx +2 -2
  90. package/src/workload/workload.scss +3 -3
  91. package/translations/am.json +2 -0
  92. package/translations/ar.json +2 -0
  93. package/translations/en.json +2 -0
  94. package/translations/es.json +2 -0
  95. package/translations/fr.json +30 -28
  96. package/translations/he.json +2 -0
  97. package/translations/km.json +2 -0
  98. package/translations/zh.json +2 -0
  99. package/translations/zh_CN.json +2 -0
  100. package/dist/224.js +0 -1
  101. package/dist/224.js.map +0 -1
  102. package/dist/445.js +0 -2
  103. package/dist/445.js.map +0 -1
  104. package/dist/857.js +0 -2
  105. package/dist/857.js.map +0 -1
  106. package/dist/904.js +0 -1
  107. package/dist/904.js.map +0 -1
  108. package/src/root.scss +0 -50
  109. /package/dist/{857.js.LICENSE.txt → 23.js.LICENSE.txt} +0 -0
  110. /package/dist/{445.js.LICENSE.txt → 646.js.LICENSE.txt} +0 -0
  111. /package/src/helpers/{time.tsx → time.ts} +0 -0
  112. /package/src/patient-appointments/{patient-appointments-table.tsx → patient-appointments-table.component.tsx} +0 -0
@@ -1,12 +1,12 @@
1
1
  @use '@carbon/colors';
2
- @use '@carbon/styles/scss/spacing';
3
- @use '@carbon/styles/scss/type';
4
- @import '~@openmrs/esm-styleguide/src/vars';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+ @use '@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .header {
7
7
  @include type.type-style('body-compact-02');
8
8
  color: $text-02;
9
- height: spacing.$spacing-12;
9
+ height: layout.$spacing-12;
10
10
  background-color: $ui-02;
11
11
  border-bottom: 1px solid $ui-03;
12
12
  display: flex;
@@ -22,7 +22,7 @@
22
22
  .right-justified-items {
23
23
  @include type.type-style('body-compact-02');
24
24
  color: $text-02;
25
- margin: 0.5rem;
25
+ margin: layout.$spacing-03;
26
26
  }
27
27
 
28
28
  .page-name {
@@ -30,10 +30,10 @@
30
30
  }
31
31
 
32
32
  .page-labels {
33
- margin: 1rem 0;
33
+ margin: layout.$spacing-05 0;
34
34
 
35
35
  p:first-of-type {
36
- margin-bottom: 0.25rem;
36
+ margin-bottom: layout.$spacing-02;
37
37
  }
38
38
  }
39
39
 
@@ -47,15 +47,15 @@
47
47
  display: flex;
48
48
  align-items: center;
49
49
  justify-content: flex-end;
50
- margin-top: 0.25rem;
50
+ margin-top: layout.$spacing-02;
51
51
  }
52
52
 
53
53
  .value {
54
- margin-left: 0.25rem;
54
+ margin-left: layout.$spacing-02;
55
55
  }
56
56
 
57
57
  .middot {
58
- margin: 0 0.5rem;
58
+ margin: 0 layout.$spacing-03;
59
59
  }
60
60
 
61
61
  .view {
@@ -64,7 +64,7 @@
64
64
 
65
65
  .datePicker {
66
66
  background-color: transparent;
67
- width: 10rem;
67
+ width: layout.$spacing-13;
68
68
  border: none;
69
69
  & > input {
70
70
  color: colors.$blue-10;
@@ -78,7 +78,7 @@
78
78
  }
79
79
 
80
80
  :global(.cds--dropdown--inline .cds--list-box__menu) {
81
- left: -4rem;
81
+ left: -(layout.$spacing-10);
82
82
  }
83
83
  }
84
84
 
@@ -1,4 +1,3 @@
1
- @use '@carbon/colors';
2
1
  @use '@carbon/layout';
3
2
 
4
3
  .container {
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { Tile } from '@carbon/react';
3
+ import styles from './appointments-tile.scss';
4
+ import { useTranslation } from 'react-i18next';
5
+ import useAppointmentsData from './appointments.resource';
6
+
7
+ const AppointmentsTile: React.FC = () => {
8
+ const { data: appointmentsData } = useAppointmentsData();
9
+
10
+ const { t } = useTranslation();
11
+
12
+ return (
13
+ <Tile className={styles.tileContainer}>
14
+ <header className={styles.tileHeader}>{t('scheduledForToday', 'Scheduled For Today')}</header>
15
+ <div className={styles.displayDetails}>
16
+ <div className={styles.countLabel}>{t('patients', 'Patients')}</div>
17
+ <div className={styles.displayData}>{appointmentsData?.length ?? 0}</div>
18
+ </div>
19
+ </Tile>
20
+ );
21
+ };
22
+
23
+ export default AppointmentsTile;
@@ -0,0 +1,39 @@
1
+ @use '@openmrs/esm-styleguide/src/vars' as *;
2
+ @use '@carbon/type';
3
+ @use '@carbon/colors';
4
+ @use '@carbon/layout';
5
+
6
+ .tileContainer {
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: space-between;
10
+ background-color: colors.$white;
11
+ border: 1px solid colors.$gray-20;
12
+ height: 7.875rem;
13
+ padding: layout.$spacing-05;
14
+ margin: layout.$spacing-03;
15
+ }
16
+
17
+ .tileHeader {
18
+ @include type.type-style('heading-01');
19
+ font-weight: 600;
20
+ line-height: 1.28572;
21
+ letter-spacing: 0.16px;
22
+ color: colors.$gray-70;
23
+ }
24
+
25
+ .displayDetails {
26
+ margin-top: layout.$spacing-06;
27
+ }
28
+
29
+ .displayData {
30
+ font-size: 1.75rem;
31
+ font-weight: 400;
32
+ line-height: 1.28572;
33
+ color: colors.$black;
34
+ }
35
+
36
+ .countLabel {
37
+ @include type.type-style('label-01');
38
+ color: $text-02;
39
+ }
@@ -0,0 +1,15 @@
1
+ import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
+ import useSWR from 'swr';
3
+ import dayjs from 'dayjs';
4
+
5
+ const useAppointmentsData = () => {
6
+ const appointmentDate = dayjs(new Date().setHours(0, 0, 0, 0)).toISOString();
7
+
8
+ const url = `${restBaseUrl}/appointment/all?forDate=${appointmentDate}`;
9
+
10
+ const { data, error, isLoading } = useSWR<{ data: Array<any> }>(url, openmrsFetch);
11
+
12
+ return { data: data?.data, error, isLoading };
13
+ };
14
+
15
+ export default useAppointmentsData;
@@ -53,7 +53,7 @@ export function useAllAppointmentsByDate() {
53
53
  return {
54
54
  totalProviders: providersCount ? providersCount : 0,
55
55
  isLoading,
56
- isError: error,
56
+ error,
57
57
  isValidating,
58
58
  mutate,
59
59
  };
@@ -9,6 +9,6 @@ export const useDefaultLoginLocation = () => {
9
9
  return {
10
10
  defaultFacility: data ? data?.data : null,
11
11
  isLoading: isLoading,
12
- isError: error,
12
+ error,
13
13
  };
14
14
  };
@@ -42,7 +42,7 @@ export function usePatientAppointmentHistory(patientUuid: string) {
42
42
 
43
43
  return {
44
44
  appointmentsCount: { missedAppointments, completedAppointments, cancelledAppointments, upcomingAppointments },
45
- isError: error,
45
+ error,
46
46
  isLoading,
47
47
  isValidating,
48
48
  };
@@ -12,7 +12,7 @@ export function useProviders() {
12
12
  return {
13
13
  providers: data ? data.data?.results : [],
14
14
  isLoading,
15
- isError: error,
15
+ error,
16
16
  isValidating,
17
17
  };
18
18
  }
package/src/index.ts CHANGED
@@ -109,3 +109,8 @@ export const endAppointmentModal = getAsyncLifecycle(
109
109
  () => import('./appointments/common-components/end-appointment.modal'),
110
110
  options,
111
111
  );
112
+
113
+ export const homeAppointmentsTile = getAsyncLifecycle(
114
+ () => import('./homepage-tile/appointments-tile.component'),
115
+ options,
116
+ );
@@ -1,6 +1,5 @@
1
1
  @use '@carbon/colors';
2
2
  @use '@carbon/layout';
3
- @use '@carbon/type';
4
3
 
5
4
  .cardContainer {
6
5
  background-color: colors.$white;
@@ -1,40 +1,38 @@
1
1
  import React from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
- import { openmrsFetch } from '@openmrs/esm-framework';
3
+ import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework';
4
4
  import { mockAppointmentMetrics, mockProvidersCount, mockStartTime } from '__mocks__';
5
5
  import AppointmentsMetrics from './appointments-metrics.component';
6
6
 
7
- const mockedOpenmrsFetch = openmrsFetch as jest.Mock;
7
+ const mockOpenmrsFetch = jest.mocked(openmrsFetch);
8
8
 
9
- jest.mock('../hooks/useClinicalMetrics', () => {
10
- const originalModule = jest.requireActual('../hooks/useClinicalMetrics');
11
-
12
- return {
13
- ...originalModule,
14
- useClinicalMetrics: jest.fn().mockImplementation(() => ({
15
- highestServiceLoad: mockAppointmentMetrics.highestServiceLoad,
16
- isLoading: mockAppointmentMetrics.isLoading,
17
- error: mockAppointmentMetrics.error,
18
- })),
19
- useAllAppointmentsByDate: jest.fn().mockImplementation(() => ({
20
- totalProviders: mockProvidersCount.totalProviders,
21
- isLoading: mockProvidersCount.isLoading,
22
- error: mockProvidersCount.error,
23
- })),
24
- useScheduledAppointment: jest.fn().mockImplementation(() => ({
25
- totalScheduledAppointments: mockAppointmentMetrics.totalAppointments,
26
- })),
27
- useAppointmentDate: jest.fn().mockImplementation(() => ({
28
- startDate: mockStartTime.startTime,
29
- })),
30
- };
31
- });
9
+ jest.mock('../hooks/useClinicalMetrics', () => ({
10
+ ...jest.requireActual('../hooks/useClinicalMetrics'),
11
+ useClinicalMetrics: jest.fn().mockReturnValue({
12
+ highestServiceLoad: mockAppointmentMetrics.highestServiceLoad,
13
+ isLoading: mockAppointmentMetrics.isLoading,
14
+ error: mockAppointmentMetrics.error,
15
+ }),
16
+ useAllAppointmentsByDate: jest.fn().mockReturnValue({
17
+ totalProviders: mockProvidersCount.totalProviders,
18
+ isLoading: mockProvidersCount.isLoading,
19
+ error: mockProvidersCount.error,
20
+ }),
21
+ useScheduledAppointment: jest.fn().mockReturnValue({
22
+ totalScheduledAppointments: mockAppointmentMetrics.totalAppointments,
23
+ }),
24
+ useAppointmentDate: jest.fn().mockReturnValue({
25
+ startDate: mockStartTime.startTime,
26
+ }),
27
+ }));
32
28
 
33
29
  describe('Appointment metrics', () => {
34
30
  it('renders metrics from the appointments list', async () => {
35
- mockedOpenmrsFetch.mockResolvedValue({ data: [] });
31
+ mockOpenmrsFetch.mockResolvedValueOnce({
32
+ data: [],
33
+ } as unknown as FetchResponse);
36
34
 
37
- renderAppointmentMetrics();
35
+ render(<AppointmentsMetrics appointmentServiceType="consultation-service-uuid" />);
38
36
 
39
37
  await screen.findByText(/appointment metrics/i);
40
38
  expect(screen.getByText(/scheduled appointments/i)).toBeInTheDocument();
@@ -43,7 +41,3 @@ describe('Appointment metrics', () => {
43
41
  expect(screen.getByText(/4/i)).toBeInTheDocument();
44
42
  });
45
43
  });
46
-
47
- function renderAppointmentMetrics() {
48
- render(<AppointmentsMetrics appointmentServiceType="consultation-service-uuid" />);
49
- }
@@ -1,41 +1,23 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { useContext, useMemo } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import dayjs from 'dayjs';
4
4
  import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
5
5
  dayjs.extend(isSameOrBefore);
6
6
  import isEmpty from 'lodash-es/isEmpty';
7
- import { ConfigurableLink } from '@openmrs/esm-framework';
8
- import { ArrowRight } from '@carbon/react/icons';
9
- import { basePath, spaHomePage } from '../constants';
10
7
  import styles from './metrics-card.scss';
8
+ import SelectedDateContext from '../hooks/selectedDateContext';
11
9
 
12
10
  interface MetricsCardProps {
13
11
  label: string;
14
12
  value: number;
15
13
  headerLabel: string;
16
- children?: React.ReactNode;
17
- view?: string;
18
14
  count?: { pendingAppointments: Array<any>; arrivedAppointments: Array<any> };
19
- appointmentDate?: string;
20
15
  }
21
16
 
22
- const MetricsCard: React.FC<MetricsCardProps> = ({
23
- label,
24
- value,
25
- headerLabel,
26
- children,
27
- view,
28
- count,
29
- appointmentDate,
30
- }) => {
17
+ const MetricsCard: React.FC<MetricsCardProps> = ({ label, value, headerLabel, count }) => {
31
18
  const { t } = useTranslation();
32
- const isDateInPast = useMemo(() => !dayjs(appointmentDate).isBefore(dayjs(), 'date'), [appointmentDate]);
33
-
34
- const metricsLink = {
35
- patients: 'appointments-list/scheduled',
36
- highVolume: 'appointments-list/high-volume-service',
37
- providers: 'appointments-list/providers-link',
38
- };
19
+ const { selectedDate } = useContext(SelectedDateContext);
20
+ const isSelectedDateInPast = useMemo(() => dayjs(selectedDate).isBefore(dayjs(), 'date'), [selectedDate]);
39
21
 
40
22
  return (
41
23
  <article className={styles.container}>
@@ -43,16 +25,7 @@ const MetricsCard: React.FC<MetricsCardProps> = ({
43
25
  <div className={styles.tileHeader}>
44
26
  <div className={styles.headerLabelContainer}>
45
27
  <label className={styles.headerLabel}>{headerLabel}</label>
46
- {children}
47
28
  </div>
48
- {view && (
49
- <div className={styles.link}>
50
- <ConfigurableLink className={styles.link} to={`${spaHomePage}${basePath}/${metricsLink[view]}`}>
51
- <span style={{ fontSize: '0.825rem', marginRight: '0.325rem' }}>{t('view', 'View')}</span>{' '}
52
- <ArrowRight size={16} className={styles.viewListBtn} />
53
- </ConfigurableLink>
54
- </div>
55
- )}
56
29
  </div>
57
30
  <div className={styles.metricsGrid}>
58
31
  <div>
@@ -62,7 +35,7 @@ const MetricsCard: React.FC<MetricsCardProps> = ({
62
35
  {!isEmpty(count) && (
63
36
  <div className={styles.countGrid}>
64
37
  <span>{t('checkedIn', 'Checked in')}</span>
65
- <span>{isDateInPast ? t('notArrived', 'Not arrived') : t('missed', 'Missed')}</span>
38
+ <span>{isSelectedDateInPast ? t('missed', 'Missed') : t('notArrived', 'Not arrived')}</span>
66
39
  <p style={{ color: '#319227' }}>{count.arrivedAppointments?.length}</p>
67
40
  <p style={{ color: '#da1e28' }}>{count.pendingAppointments?.length}</p>
68
41
  </div>
@@ -1,7 +1,7 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
1
  @use '@carbon/colors';
4
- @import '~@openmrs/esm-styleguide/src/vars';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+ @use '@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .container {
7
7
  flex-grow: 1;
@@ -10,7 +10,7 @@
10
10
  .tileContainer {
11
11
  border: 1px solid $ui-03;
12
12
  height: 7.875rem;
13
- padding: spacing.$spacing-05;
13
+ padding: layout.$spacing-05;
14
14
  display: flex;
15
15
  justify-content: space-between;
16
16
  flex-direction: column;
@@ -20,7 +20,7 @@
20
20
  display: flex;
21
21
  justify-content: space-between;
22
22
  align-items: baseline;
23
- margin-bottom: spacing.$spacing-03;
23
+ margin-bottom: layout.$spacing-03;
24
24
  }
25
25
 
26
26
  .headerLabel {
@@ -61,9 +61,9 @@
61
61
  display: grid;
62
62
  grid-template-columns: 1fr 1fr;
63
63
  justify-self: flex-end;
64
- column-gap: spacing.$spacing-03;
65
- row-gap: spacing.$spacing-03;
66
- margin: spacing.$spacing-03;
64
+ column-gap: layout.$spacing-03;
65
+ row-gap: layout.$spacing-03;
66
+ margin: layout.$spacing-03;
67
67
 
68
68
  & > span {
69
69
  font-size: 0.625rem !important;
@@ -1,6 +1,6 @@
1
1
  @use '@carbon/layout';
2
2
  @use '@carbon/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .metricsContainer {
6
6
  display: flex;
@@ -25,7 +25,7 @@ export interface FormattedEncounter {
25
25
 
26
26
  const PastVisit: React.FC<PastVisitProps> = ({ patientUuid }) => {
27
27
  const { t } = useTranslation();
28
- const { data: pastVisits, isError, isLoading } = usePastVisits(patientUuid);
28
+ const { data: pastVisits, error, isLoading } = usePastVisits(patientUuid);
29
29
  const [selectedTabIndex, setSelectedTabIndex] = useState(0);
30
30
  const isTablet = useLayoutType() === 'tablet';
31
31
 
@@ -18,7 +18,7 @@ export function usePastVisits(patientUuid: string) {
18
18
 
19
19
  return {
20
20
  data: data ? data.data.results : null,
21
- isError: error,
21
+ error,
22
22
  isLoading,
23
23
  isValidating,
24
24
  };
@@ -1,9 +1,9 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .wrapper {
6
- margin-top: 0.5rem;
6
+ margin-top: layout.$spacing-03;
7
7
  }
8
8
 
9
9
  .bodyShort02 {
@@ -17,7 +17,7 @@
17
17
  .date {
18
18
  @include type.type-style('label-01');
19
19
  color: $text-02;
20
- margin: 0.5rem 0rem 0.25rem;
20
+ margin: layout.$spacing-03 0 layout.$spacing-02;
21
21
  }
22
22
 
23
23
  .visitType {
@@ -27,19 +27,19 @@
27
27
  .container {
28
28
  background-color: $ui-background;
29
29
  border: 1px solid $grey-2;
30
- padding: spacing.$spacing-05;
31
- margin: spacing.$spacing-05 0rem spacing.$spacing-05;
30
+ padding: layout.$spacing-05;
31
+ margin: layout.$spacing-05 0 layout.$spacing-05;
32
32
  width: 100%;
33
33
  }
34
34
 
35
35
  .tabs > :global(.cds--tab-content) {
36
- padding: spacing.$spacing-05 0rem !important;
36
+ padding: layout.$spacing-05 0 !important;
37
37
  }
38
38
 
39
39
  .header::after {
40
40
  content: '';
41
41
  display: block;
42
- width: spacing.$spacing-07;
42
+ width: layout.$spacing-07;
43
43
  padding-top: 0.188rem;
44
44
  border-bottom: 0.375rem solid var(--brand-03);
45
45
  }
@@ -55,10 +55,10 @@
55
55
  }
56
56
 
57
57
  .verticalTabs {
58
- margin: spacing.$spacing-04 0;
58
+ margin: layout.$spacing-04 0;
59
59
 
60
60
  &:global(.cds--tabs--scrollable .cds--tabs--scrollable__nav-item + .cds--tabs--scrollable__nav-item) {
61
- margin-left: 0rem;
61
+ margin-left: 0;
62
62
  }
63
63
  }
64
64
 
@@ -68,13 +68,13 @@
68
68
 
69
69
  .desktopTabs {
70
70
  button {
71
- height: 32px;
71
+ height: layout.$spacing-07;
72
72
  }
73
73
  }
74
74
 
75
75
  .tabletTabs {
76
76
  button {
77
- height: 48px;
77
+ height: layout.$spacing-09;
78
78
  }
79
79
  }
80
80
 
@@ -98,9 +98,14 @@
98
98
 
99
99
  .tabContent {
100
100
  border-top: 1px solid $ui-03;
101
- padding: spacing.$spacing-05 0;
101
+ padding: layout.$spacing-05 0;
102
102
  width: 70%;
103
103
  }
104
+
104
105
  .textColor {
105
106
  color: $color-blue-60-2;
106
107
  }
108
+
109
+ .text02 {
110
+ color: $text-02;
111
+ }
@@ -1,3 +1,5 @@
1
+ @use '@openmrs/esm-styleguide/src/vars' as *;
2
+
1
3
  .layer {
2
4
  height: 100%;
3
5
  }
@@ -5,3 +7,7 @@
5
7
  .menuItem {
6
8
  max-width: none;
7
9
  }
10
+
11
+ .text02 {
12
+ color: $text-02;
13
+ }
@@ -1,12 +1,12 @@
1
1
  import React, { useContext, useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
2
  import dayjs from 'dayjs';
3
+ import { useTranslation } from 'react-i18next';
4
4
  import { Button, ContentSwitcher, DataTableSkeleton, InlineLoading, Layer, Switch, Tile } from '@carbon/react';
5
5
  import { Add } from '@carbon/react/icons';
6
6
  import { launchWorkspace, useLayoutType } from '@openmrs/esm-framework';
7
7
  import { CardHeader, EmptyDataIllustration, ErrorState, launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
8
8
  import { usePatientAppointments } from './patient-appointments.resource';
9
- import PatientAppointmentsTable from './patient-appointments-table';
9
+ import PatientAppointmentsTable from './patient-appointments-table.component';
10
10
  import styles from './patient-appointments-base.scss';
11
11
 
12
12
  import PatientAppointmentContext, { PatientAppointmentContextTypes } from '../hooks/patientAppointmentContext';
@@ -32,7 +32,7 @@ const PatientAppointmentsBase: React.FC<PatientAppointmentsBaseProps> = ({ patie
32
32
  const startDate = dayjs(new Date().toISOString()).subtract(6, 'month').toISOString();
33
33
  const {
34
34
  data: appointmentsData,
35
- isError,
35
+ error,
36
36
  isLoading,
37
37
  isValidating,
38
38
  } = usePatientAppointments(patientUuid, startDate, new AbortController());
@@ -49,10 +49,10 @@ const PatientAppointmentsBase: React.FC<PatientAppointmentsBaseProps> = ({ patie
49
49
  };
50
50
 
51
51
  if (isLoading) return <DataTableSkeleton role="progressbar" compact={!isTablet} zebra />;
52
- if (isError) {
53
- return <ErrorState headerTitle={headerTitle} error={isError} />;
52
+ if (error) {
53
+ return <ErrorState headerTitle={headerTitle} error={error} />;
54
54
  }
55
- if (Object.keys(appointmentsData)?.length) {
55
+ if (appointmentsData && Object.keys(appointmentsData)?.length) {
56
56
  return (
57
57
  <div className={styles.widgetCard}>
58
58
  <CardHeader title={headerTitle}>