@openmrs/esm-appointments-app 5.2.2-pre.2391 → 5.2.2-pre.2397

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.
@@ -80,10 +80,10 @@
80
80
  "initial": true,
81
81
  "entry": true,
82
82
  "recorded": false,
83
- "size": 4551848,
83
+ "size": 4552544,
84
84
  "sizes": {
85
85
  "consume-shared": 252,
86
- "javascript": 4530926,
86
+ "javascript": 4531622,
87
87
  "share-init": 252,
88
88
  "runtime": 20418
89
89
  },
@@ -100,7 +100,7 @@
100
100
  "auxiliaryFiles": [
101
101
  "main.js.map"
102
102
  ],
103
- "hash": "2dcc694bd98844c6",
103
+ "hash": "1c2d5a027511cd78",
104
104
  "childrenByOrder": {}
105
105
  },
106
106
  {
@@ -395,9 +395,9 @@
395
395
  "initial": false,
396
396
  "entry": false,
397
397
  "recorded": false,
398
- "size": 493401,
398
+ "size": 494097,
399
399
  "sizes": {
400
- "javascript": 493233,
400
+ "javascript": 493929,
401
401
  "consume-shared": 168
402
402
  },
403
403
  "names": [],
@@ -411,7 +411,7 @@
411
411
  "auxiliaryFiles": [
412
412
  "690.js.map"
413
413
  ],
414
- "hash": "511dd7ecdb92ac31",
414
+ "hash": "ec0c95ee2d6e6c0e",
415
415
  "childrenByOrder": {}
416
416
  },
417
417
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2391"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0"},"extensions":[{"name":"home-appointments","slot":"homepage-widgets-slot","component":"homeAppointments","order":1},{"name":"clinical-appointments-dashboard-link","slot":"homepage-dashboard-slot","component":"appointmentsDashboardLink","meta":{"name":"appointments","slot":"clinical-appointments-dashboard-slot","title":"Appointments"}},{"component":"root","name":"clinical-appointments-dashboard","slot":"clinical-appointments-dashboard-slot"},{"name":"appointments-calendar-dashboard-link","slot":"calendar-dashboard-slot","component":"appointmentsCalendarDashboardLink"},{"name":"check-in-appointment-modal","slot":"todays-appointment-slot","component":"checkInModal"},{"name":"todays-appointments-dashboard","slot":"todays-appointment-slot","component":"homeAppointments"},{"name":"expected-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"checked-in-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"completed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"missed-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"cancelled-appointments-panel","slot":"scheduled-appointments-panels-slot","component":"appointmentsByStatus"},{"name":"early-appointments-panel","component":"earlyAppointments"}],"version":"5.2.2-pre.2397"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-appointments-app",
3
- "version": "5.2.2-pre.2391",
3
+ "version": "5.2.2-pre.2397",
4
4
  "description": "Appointments front-end module for the OpenMRS SPA",
5
5
  "browser": "dist/openmrs-esm-appointments-app.js",
6
6
  "main": "src/index.ts",
@@ -19,7 +19,7 @@ import {
19
19
  TableToolbarSearch,
20
20
  Button,
21
21
  } from '@carbon/react';
22
- import { ConfigurableLink, formatDatetime, usePagination, formatDate } from '@openmrs/esm-framework';
22
+ import { ConfigurableLink, formatDatetime, usePagination, formatDate, useConfig } from '@openmrs/esm-framework';
23
23
  import startCase from 'lodash-es/startCase';
24
24
  import { Download } from '@carbon/react/icons';
25
25
  import AppointmentDetails from '../details/appointment-details.component';
@@ -31,6 +31,7 @@ import { MappedAppointment } from '../../types';
31
31
  import { getPageSizes, useSearchResults } from '../utils';
32
32
  import AppointmentActions from './appointments-actions.component';
33
33
  import styles from './appointments-table.scss';
34
+ import { ConfigObject } from '../../config-schema';
34
35
 
35
36
  interface AppointmentsTableProps {
36
37
  appointments: Array<MappedAppointment>;
@@ -53,6 +54,7 @@ const AppointmentsTable: React.FC<AppointmentsTableProps> = ({
53
54
  const [searchString, setSearchString] = useState('');
54
55
  const searchResults = useSearchResults(appointments, searchString);
55
56
  const { results, goTo, currentPage } = usePagination(searchResults, pageSize);
57
+ const { customPatientChartUrl } = useConfig<ConfigObject>();
56
58
 
57
59
  const headerData = [
58
60
  {
@@ -79,7 +81,8 @@ const AppointmentsTable: React.FC<AppointmentsTableProps> = ({
79
81
  patientName: (
80
82
  <ConfigurableLink
81
83
  style={{ textDecoration: 'none', maxWidth: '50%' }}
82
- to={`\${openmrsSpaBase}/patient/${appointment.patientUuid}/chart`}>
84
+ to={customPatientChartUrl}
85
+ templateParams={{ patientUuid: appointment.patientUuid }}>
83
86
  {appointment.name}
84
87
  </ConfigurableLink>
85
88
  ),
@@ -44,6 +44,9 @@ jest.mock('@openmrs/esm-framework', () => {
44
44
  return {
45
45
  ...originalModule,
46
46
  openmrsFetch: jest.fn(),
47
+ useConfig: jest.fn(() => ({
48
+ customPatientChartUrl: 'someUrl',
49
+ })),
47
50
  };
48
51
  });
49
52
 
@@ -80,12 +83,14 @@ describe('AppointmentsBaseTable', () => {
80
83
  });
81
84
 
82
85
  render(<AppointmentsTable {...props} appointments={appointments} />);
83
- waitFor(() => {
86
+ await waitFor(() => {
84
87
  expect(screen.getByText('Patient name')).toBeInTheDocument();
85
88
  expect(screen.getByText('Identifier')).toBeInTheDocument();
86
89
  expect(screen.getByText('Service Type')).toBeInTheDocument();
87
90
  expect(screen.getByText('Actions')).toBeInTheDocument();
88
- expect(screen.getByText('John Smith')).toBeInTheDocument();
91
+ const patient = screen.getByText('John Smith');
92
+ expect(patient).toBeInTheDocument();
93
+ expect(patient).toHaveAttribute('href', 'someUrl');
89
94
  expect(screen.getByText('12345')).toBeInTheDocument();
90
95
  expect(screen.getByText('Service')).toBeInTheDocument();
91
96
  });
@@ -1,6 +1,5 @@
1
1
  import React, { useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import isEmpty from 'lodash-es/isEmpty';
4
3
  import {
5
4
  DataTable,
6
5
  TableContainer,
@@ -18,11 +17,12 @@ import {
18
17
  Button,
19
18
  } from '@carbon/react';
20
19
  import { Download } from '@carbon/react/icons';
21
- import { ConfigurableLink, usePagination } from '@openmrs/esm-framework';
20
+ import { ConfigurableLink, useConfig, usePagination } from '@openmrs/esm-framework';
22
21
  import { useUnscheduledAppointments } from '../../hooks/useUnscheduledAppointments';
23
22
  import { downloadUnscheduledAppointments } from '../../helpers/excel';
24
23
  import { EmptyState } from '../../empty-state/empty-state.component';
25
24
  import { getPageSizes, useSearchResults } from '../utils';
25
+ import { ConfigObject } from '../../config-schema';
26
26
 
27
27
  const UnscheduledAppointments: React.FC = () => {
28
28
  const { t } = useTranslation();
@@ -31,6 +31,8 @@ const UnscheduledAppointments: React.FC = () => {
31
31
  const [searchString, setSearchString] = useState('');
32
32
  const { data: unscheduledAppointments, isLoading, error } = useUnscheduledAppointments();
33
33
  const searchResults = useSearchResults(unscheduledAppointments, searchString);
34
+ const { customPatientChartUrl } = useConfig<ConfigObject>();
35
+
34
36
  const headerData = [
35
37
  {
36
38
  header: 'Patient Name',
@@ -55,7 +57,10 @@ const UnscheduledAppointments: React.FC = () => {
55
57
  const rowData = results?.map((visit) => ({
56
58
  id: `${visit.uuid}`,
57
59
  name: (
58
- <ConfigurableLink style={{ textDecoration: 'none' }} to={`\${openmrsSpaBase}/patient/${visit.uuid}/chart`}>
60
+ <ConfigurableLink
61
+ style={{ textDecoration: 'none' }}
62
+ to={customPatientChartUrl}
63
+ templateParams={{ patientUuid: visit.uuid }}>
59
64
  {visit.name}
60
65
  </ConfigurableLink>
61
66
  ),
@@ -19,6 +19,9 @@ jest.mock('@openmrs/esm-framework', () => {
19
19
  return {
20
20
  ...originalModule,
21
21
  openmrsFetch: jest.fn(),
22
+ useConfig: jest.fn(() => ({
23
+ customPatientChartUrl: 'someUrl',
24
+ })),
22
25
  };
23
26
  });
24
27
 
@@ -62,6 +65,7 @@ describe('UnscheduledAppointments component', () => {
62
65
 
63
66
  const patientName = await screen.findByText('Test Patient');
64
67
  expect(patientName).toBeInTheDocument();
68
+ expect(patientName).toHaveAttribute('href', 'someUrl');
65
69
 
66
70
  const identifier = screen.getByText('1234-56-78');
67
71
  expect(identifier).toBeInTheDocument();
@@ -66,6 +66,12 @@ export const configSchema = {
66
66
  _default: '/ws/rest/v1/kenyaemr/default-facility',
67
67
  _description: 'Custom URL to load default facility if it is not in the session',
68
68
  },
69
+ customPatientChartUrl: {
70
+ _type: Type.String,
71
+ _description:
72
+ 'Template URL that will be used when clicking on the patient name in the appointment list. Available argument: patientUuid',
73
+ _default: '${openmrsSpaBase}/patient/${patientUuid}/chart',
74
+ },
69
75
  patientIdentifierType: {
70
76
  _type: Type.String,
71
77
  _description: 'The name of the patient identifier type to be used for the patient identifier field',
@@ -87,5 +93,6 @@ export interface ConfigObject {
87
93
  hiddenFormFields: Array<string>;
88
94
  showServiceQueueFields: boolean;
89
95
  defaultFacilityUrl: string;
96
+ customPatientChartUrl: string;
90
97
  patientIdentifierType: string;
91
98
  }
@@ -34,6 +34,7 @@ import { SeeAllAppointmentsLink, AddAppointmentLink, ViewCalendarLink } from './
34
34
  import { Appointment, MappedHomeAppointment } from '../types';
35
35
  import { useTodaysAppointments } from './appointments-table.resource';
36
36
  import styles from './appointments-list.scss';
37
+ import { ConfigObject } from '../config-schema';
37
38
 
38
39
  interface PaginationData {
39
40
  goTo: (page: number) => void;
@@ -103,6 +104,7 @@ const AppointmentsBaseTable = () => {
103
104
  const { appointments, isLoading, mutate } = useTodaysAppointments();
104
105
 
105
106
  const fullView = userHasAccess(fullViewPrivilege, user) || !useFullViewPrivilege;
107
+ const { customPatientChartUrl } = useConfig<ConfigObject>();
106
108
 
107
109
  const filteredAppointments = !fullView
108
110
  ? appointments.filter((appointment) => appointment.status === 'Scheduled')
@@ -173,7 +175,7 @@ const AppointmentsBaseTable = () => {
173
175
  name: {
174
176
  content: (
175
177
  <div className={styles.nameContainer}>
176
- <ConfigurableLink to={`\${openmrsSpaBase}/patient/${appointment.patientUuid}/chart`}>
178
+ <ConfigurableLink to={customPatientChartUrl} templateParams={{ patientUuid: appointment.patientUuid }}>
177
179
  {appointment.name}
178
180
  </ConfigurableLink>
179
181
  </div>
@@ -17,6 +17,7 @@ jest.mock('@openmrs/esm-framework', () => ({
17
17
  useBahmniAppointmentsUI: false,
18
18
  useFullViewPrivilege: false,
19
19
  fullViewPrivilege: 'somePrivilege',
20
+ customPatientChartUrl: 'someUrl',
20
21
  })),
21
22
  userHasAccess: jest.fn(() => true),
22
23
  }));
@@ -58,6 +59,7 @@ describe('AppointmentsBaseTable', () => {
58
59
  serviceColor: 'blue',
59
60
  serviceType: 'Checkup',
60
61
  status: 'Scheduled',
62
+ patientUuid: 'some-uuid',
61
63
  },
62
64
  ],
63
65
  isLoading: false,
@@ -76,6 +78,7 @@ describe('AppointmentsBaseTable', () => {
76
78
  serviceColor: 'blue',
77
79
  serviceType: 'Checkup',
78
80
  status: 'Scheduled',
81
+ patientUuid: 'some-uuid',
79
82
  },
80
83
  ],
81
84
  }));
@@ -83,7 +86,9 @@ describe('AppointmentsBaseTable', () => {
83
86
 
84
87
  // Assert that appointment data is displayed
85
88
  expect(screen.getByText('2023-08-18 10:00 AM')).toBeInTheDocument();
86
- expect(screen.getByText('John Doe')).toBeInTheDocument();
89
+ const patient = screen.getByText('John Doe');
90
+ expect(patient).toBeInTheDocument();
91
+ expect(patient).toHaveAttribute('href', 'someUrl');
87
92
  expect(screen.getByText('JD123')).toBeInTheDocument();
88
93
  expect(screen.getByText('Clinic A')).toBeInTheDocument();
89
94
  expect(screen.getByText('Checkup')).toBeInTheDocument();