@kenyaemr/esm-service-queues-app 8.1.1-pre.116 → 8.1.1-pre.119
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.
- package/.turbo/turbo-build.log +8 -8
- package/dist/130.js +1 -1
- package/dist/130.js.map +1 -1
- package/dist/574.js +1 -1
- package/dist/748.js +1 -1
- package/dist/748.js.map +1 -1
- package/dist/kenyaemr-esm-service-queues-app.js +1 -1
- package/dist/kenyaemr-esm-service-queues-app.js.buildmanifest.json +13 -13
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/patient-queue-metrics/clinic-metrics.component.tsx +4 -4
- package/src/patient-queue-metrics/metrics-header.component.tsx +16 -15
- package/src/queue-screen/queue-screen.component.tsx +67 -11
- package/src/queue-screen/queue-screen.test.tsx +1 -1
- package/src/queue-screen/useActiveTickets.tsx +1 -1
- package/src/routes.json +32 -29
- package/translations/en.json +2 -0
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0","queue":"^2.4.0-0"},"extensions":[{"name":"outpatient-side-nav-ext","component":"outpatientSideNav","slot":"outpatient-sidebar-slot","online":true,"offline":true},{"name":"service-queues-dashboard-link","component":"serviceQueuesDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"service-queues","slot":"service-queues-dashboard-slot","title":"Service queues"},"online":true,"offline":true},{"name":"queue-table-by-status-menu-dashboard-link","component":"queueTableByStatusMenu","meta":{"name":"service-queues","slot":"service-queues-dashboard-slot","title":"Service queues"},"online":true,"offline":true},{"component":"root","name":"service-queues-dashboard","slot":"service-queues-dashboard-slot"},{"name":"
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0","queue":"^2.4.0-0"},"extensions":[{"name":"outpatient-side-nav-ext","component":"outpatientSideNav","slot":"outpatient-sidebar-slot","online":true,"offline":true},{"name":"service-queues-dashboard-link","component":"serviceQueuesDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"service-queues","slot":"service-queues-dashboard-slot","title":"Service queues"},"online":true,"offline":true},{"name":"queue-table-by-status-menu-dashboard-link","component":"queueTableByStatusMenu","meta":{"name":"service-queues","slot":"service-queues-dashboard-slot","title":"Service queues"},"online":true,"offline":true},{"component":"root","name":"service-queues-dashboard","slot":"service-queues-dashboard-slot"},{"name":"patient-info-banner-slot","component":"patientInfoBannerSlot"},{"name":"remove-queue-entry","component":"removeQueueEntry"},{"name":"clear-all-queue-entries","component":"clearAllQueueEntries"},{"name":"previous-visit-summary-widget","component":"pastVisitSummary","slot":"previous-visit-summary-slot"},{"name":"active-visits-row-actions","component":"activeVisitsRowActions","slot":"queue-table-serve-patient-slot"},{"name":"visit-form-queue-fields","component":"visitFormQueueFields","slot":"visit-form-queue-slot"}],"modals":[{"name":"add-visit-to-queue-modal","component":"addVisitToQueueModal"},{"name":"add-provider-to-room-modal","component":"addProviderToRoomModal"},{"name":"edit-queue-entry-modal","component":"editQueueEntryModal"},{"name":"edit-queue-entry-status-modal","component":"editQueueEntryStatusModal"},{"name":"end-queue-entry-modal","component":"endQueueEntryModal"},{"name":"transition-patient-to-latest-queue-modal","component":"transitionPatientToLatestQueue"},{"name":"transition-queue-entry-modal","component":"transitionQueueEntryModal"},{"name":"transition-queue-entry-status-modal","component":"transitionQueueEntryStatusModal"},{"name":"undo-transition-queue-entry-modal","component":"undoTransitionQueueEntryModal"},{"name":"void-queue-entry-modal","component":"voidQueueEntryModal"}],"workspaces":[{"name":"service-queues-service-form","title":"addNewQueueService","component":"addNewQueueServiceWorkspace","type":"service-queues"},{"name":"service-queues-room-form","title":"addNewQueueServiceRoom","component":"addNewQueueServiceRoomWorkspace","type":"service-queues"},{"name":"service-queues-linelist-filter","title":"filter","component":"queueLinelistFilterWorkspace","type":"service-queues"},{"name":"service-queues-patient-search","title":"searchPatient","component":"patientSearchWorkspace","type":"service-queues"}],"version":"8.1.1-pre.119"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Dropdown } from '@carbon/react';
|
|
4
|
-
import
|
|
5
|
-
import MetricsHeader from './metrics-header.component';
|
|
4
|
+
import { isDesktop, useLayoutType } from '@openmrs/esm-framework';
|
|
6
5
|
import { updateSelectedService, useSelectedService, useSelectedQueueLocationUuid } from '../helpers/helpers';
|
|
7
6
|
import { useActiveVisits, useAverageWaitTime } from './clinic-metrics.resource';
|
|
8
7
|
import { useServiceMetricsCount } from './queue-metrics.resource';
|
|
9
|
-
import
|
|
8
|
+
import MetricsCard from './metrics-card.component';
|
|
9
|
+
import MetricsHeader from './metrics-header.component';
|
|
10
10
|
import { useMutateQueueEntries, useQueueEntries } from '../hooks/useQueueEntries';
|
|
11
11
|
import useQueueServices from '../hooks/useQueueService';
|
|
12
|
-
import
|
|
12
|
+
import styles from './clinic-metrics.scss';
|
|
13
13
|
|
|
14
14
|
export interface Service {
|
|
15
15
|
uuid: string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
1
3
|
import { ComboButton, MenuItem } from '@carbon/react';
|
|
2
4
|
import {
|
|
3
5
|
UserHasAccess,
|
|
@@ -8,22 +10,29 @@ import {
|
|
|
8
10
|
useLayoutType,
|
|
9
11
|
useSession,
|
|
10
12
|
} from '@openmrs/esm-framework';
|
|
11
|
-
import React, { useState } from 'react';
|
|
12
|
-
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { spaBasePath } from '../constants';
|
|
14
14
|
import styles from './metrics-header.scss';
|
|
15
15
|
|
|
16
16
|
const MetricsHeader = () => {
|
|
17
17
|
const { t } = useTranslation();
|
|
18
|
+
const currentUserSession = useSession();
|
|
19
|
+
const layout = useLayoutType();
|
|
20
|
+
|
|
18
21
|
const metricsTitle = t('clinicMetrics', 'Clinic metrics');
|
|
19
22
|
const queueScreenText = t('queueScreen', 'Queue screen');
|
|
20
|
-
const currentUserSession = useSession();
|
|
21
23
|
const providerUuid = currentUserSession?.currentProvider?.uuid;
|
|
22
|
-
const layout = useLayoutType();
|
|
23
24
|
|
|
24
|
-
const
|
|
25
|
+
const launchAddProviderToRoomModal = useCallback(() => {
|
|
26
|
+
const dispose = showModal('add-provider-to-room-modal', {
|
|
27
|
+
closeModal: () => dispose(),
|
|
28
|
+
providerUuid,
|
|
29
|
+
});
|
|
30
|
+
}, [providerUuid]);
|
|
31
|
+
|
|
32
|
+
const navigateToQueueScreen = useCallback(() => {
|
|
25
33
|
navigate({ to: `${spaBasePath}/service-queues/screen` });
|
|
26
|
-
};
|
|
34
|
+
}, []);
|
|
35
|
+
|
|
27
36
|
return (
|
|
28
37
|
<div className={styles.metricsContainer}>
|
|
29
38
|
<span className={styles.metricsTitle}>{metricsTitle}</span>
|
|
@@ -44,15 +53,7 @@ const MetricsHeader = () => {
|
|
|
44
53
|
onClick={() => launchWorkspace('service-queues-room-form')}
|
|
45
54
|
/>
|
|
46
55
|
</UserHasAccess>
|
|
47
|
-
<MenuItem
|
|
48
|
-
label={t('addProviderQueueRoom', 'Add provider queue room')}
|
|
49
|
-
onClick={() => {
|
|
50
|
-
const dispose = showModal('add-provider-to-room-modal', {
|
|
51
|
-
closeModal: () => dispose(),
|
|
52
|
-
providerUuid,
|
|
53
|
-
});
|
|
54
|
-
}}
|
|
55
|
-
/>
|
|
56
|
+
<MenuItem label={t('addProviderQueueRoom', 'Add provider queue room')} onClick={launchAddProviderToRoomModal} />
|
|
56
57
|
</ComboButton>
|
|
57
58
|
</div>
|
|
58
59
|
);
|
|
@@ -1,31 +1,87 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { DataTableSkeleton } from '@carbon/react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useActiveTickets } from './useActiveTickets';
|
|
5
5
|
import PatientQueueHeader from '../patient-queue-header/patient-queue-header.component';
|
|
6
6
|
import styles from './queue-screen.scss';
|
|
7
|
+
import { useSelectedQueueLocationUuid } from '../helpers/helpers';
|
|
8
|
+
import { ErrorState } from '@openmrs/esm-framework';
|
|
7
9
|
|
|
8
10
|
interface QueueScreenProps {}
|
|
9
11
|
|
|
10
12
|
const QueueScreen: React.FC<QueueScreenProps> = () => {
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
const { activeTickets, isLoading, error } = useActiveTickets();
|
|
13
|
+
const { t, i18n } = useTranslation();
|
|
14
|
+
const { activeTickets, isLoading, error, mutate } = useActiveTickets();
|
|
15
|
+
const [isSpeaking, setIsSpeaking] = useState(false);
|
|
16
|
+
const selectedLocation = useSelectedQueueLocationUuid();
|
|
17
|
+
|
|
18
|
+
const rowData = useMemo(
|
|
19
|
+
() =>
|
|
20
|
+
activeTickets.map((ticket, index) => ({
|
|
21
|
+
id: `${index}`,
|
|
22
|
+
room: ticket.room,
|
|
23
|
+
ticketNumber: ticket.ticketNumber,
|
|
24
|
+
status: ticket.status,
|
|
25
|
+
})),
|
|
26
|
+
[activeTickets],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const readTicket = useCallback(
|
|
30
|
+
(queue) => {
|
|
31
|
+
if ('speechSynthesis' in window) {
|
|
32
|
+
window.speechSynthesis.cancel();
|
|
33
|
+
|
|
34
|
+
const message = new SpeechSynthesisUtterance();
|
|
35
|
+
const [prefix, suffix] = queue.ticketNumber.split('-');
|
|
36
|
+
const utterance = t(
|
|
37
|
+
'ticketAnnouncement',
|
|
38
|
+
'Ticket number: {{prefix}}, - {{suffix}}, please proceed to room {{room}}',
|
|
39
|
+
{
|
|
40
|
+
prefix: prefix.split(''),
|
|
41
|
+
suffix: suffix.split(''),
|
|
42
|
+
room: queue.room,
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
message.rate = 1;
|
|
46
|
+
message.pitch = 1;
|
|
47
|
+
message.text = utterance;
|
|
48
|
+
message.lang = i18n.language;
|
|
49
|
+
|
|
50
|
+
return new Promise<void>((resolve) => {
|
|
51
|
+
message.onend = () => resolve();
|
|
52
|
+
window.speechSynthesis.speak(message);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return Promise.resolve();
|
|
56
|
+
},
|
|
57
|
+
[i18n.language, t],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const ticketsToCallOut = activeTickets.filter((item) => item.status.toLowerCase() === 'calling');
|
|
62
|
+
|
|
63
|
+
if (ticketsToCallOut.length > 0 && !isSpeaking) {
|
|
64
|
+
setIsSpeaking(true);
|
|
65
|
+
const readTickets = async () => {
|
|
66
|
+
for (const ticket of ticketsToCallOut) {
|
|
67
|
+
await readTicket(ticket);
|
|
68
|
+
}
|
|
69
|
+
setIsSpeaking(false);
|
|
70
|
+
mutate?.();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
readTickets();
|
|
74
|
+
}
|
|
75
|
+
}, [activeTickets, isSpeaking, readTicket, mutate]);
|
|
13
76
|
|
|
14
77
|
if (isLoading) {
|
|
15
78
|
return <DataTableSkeleton row={5} className={styles.queueScreen} role="progressbar" />;
|
|
16
79
|
}
|
|
17
80
|
|
|
18
81
|
if (error) {
|
|
19
|
-
return <
|
|
82
|
+
return <ErrorState error={error} headerTitle={t('queueScreenError', 'Queue screen error')} />;
|
|
20
83
|
}
|
|
21
84
|
|
|
22
|
-
const rowData = activeTickets.map((ticket, index) => ({
|
|
23
|
-
id: `${index}}`,
|
|
24
|
-
room: ticket.room,
|
|
25
|
-
ticketNumber: ticket.ticketNumber,
|
|
26
|
-
status: ticket.status,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
85
|
return (
|
|
30
86
|
<div>
|
|
31
87
|
<PatientQueueHeader title={t('queueScreen', 'Queue screen')} showLocationDropdown />
|
|
@@ -26,7 +26,7 @@ describe('QueueScreen component', () => {
|
|
|
26
26
|
mutate: jest.fn(),
|
|
27
27
|
});
|
|
28
28
|
render(<QueueScreen />);
|
|
29
|
-
expect(screen.getByText(
|
|
29
|
+
expect(screen.getByText(/Error State/i)).toBeInTheDocument();
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
test('renders table with active tickets when data is loaded', () => {
|
|
@@ -5,7 +5,7 @@ export const useActiveTickets = () => {
|
|
|
5
5
|
const { data, isLoading, error, mutate } = useSWR<{ data: Record<string, { status: string; ticketNumber: string }> }>(
|
|
6
6
|
`${restBaseUrl}/queueutil/active-tickets`,
|
|
7
7
|
openmrsFetch,
|
|
8
|
-
{ refreshInterval:
|
|
8
|
+
{ refreshInterval: 30000 },
|
|
9
9
|
);
|
|
10
10
|
const activeTickets =
|
|
11
11
|
Array.from(Object.entries(data?.data ?? {}).map(([key, value]) => ({ room: key, ...value }))) ?? [];
|
package/src/routes.json
CHANGED
|
@@ -40,10 +40,6 @@
|
|
|
40
40
|
"name": "service-queues-dashboard",
|
|
41
41
|
"slot": "service-queues-dashboard-slot"
|
|
42
42
|
},
|
|
43
|
-
{
|
|
44
|
-
"name": "edit-queue-entry-status-modal",
|
|
45
|
-
"component": "editQueueEntryStatusModal"
|
|
46
|
-
},
|
|
47
43
|
{
|
|
48
44
|
"name": "patient-info-banner-slot",
|
|
49
45
|
"component": "patientInfoBannerSlot"
|
|
@@ -57,55 +53,62 @@
|
|
|
57
53
|
"component": "clearAllQueueEntries"
|
|
58
54
|
},
|
|
59
55
|
{
|
|
60
|
-
"name": "
|
|
61
|
-
"component": "
|
|
56
|
+
"name": "previous-visit-summary-widget",
|
|
57
|
+
"component": "pastVisitSummary",
|
|
58
|
+
"slot": "previous-visit-summary-slot"
|
|
62
59
|
},
|
|
60
|
+
|
|
63
61
|
{
|
|
64
|
-
"name": "
|
|
65
|
-
"component": "
|
|
62
|
+
"name": "active-visits-row-actions",
|
|
63
|
+
"component": "activeVisitsRowActions",
|
|
64
|
+
"slot": "queue-table-serve-patient-slot"
|
|
66
65
|
},
|
|
67
66
|
{
|
|
68
|
-
"name": "
|
|
69
|
-
"component": "
|
|
70
|
-
"slot":
|
|
67
|
+
"name": "visit-form-queue-fields",
|
|
68
|
+
"component": "visitFormQueueFields",
|
|
69
|
+
"slot":"visit-form-queue-slot"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"modals": [
|
|
73
|
+
{
|
|
74
|
+
"name": "add-visit-to-queue-modal",
|
|
75
|
+
"component": "addVisitToQueueModal"
|
|
71
76
|
},
|
|
72
77
|
{
|
|
73
78
|
"name": "add-provider-to-room-modal",
|
|
74
79
|
"component": "addProviderToRoomModal"
|
|
75
80
|
},
|
|
76
81
|
{
|
|
77
|
-
"name": "
|
|
78
|
-
"component": "
|
|
82
|
+
"name": "edit-queue-entry-modal",
|
|
83
|
+
"component": "editQueueEntryModal"
|
|
79
84
|
},
|
|
80
85
|
{
|
|
81
|
-
"name": "
|
|
82
|
-
"component": "
|
|
86
|
+
"name": "edit-queue-entry-status-modal",
|
|
87
|
+
"component": "editQueueEntryStatusModal"
|
|
83
88
|
},
|
|
84
89
|
{
|
|
85
|
-
"name": "
|
|
86
|
-
"component": "
|
|
90
|
+
"name": "end-queue-entry-modal",
|
|
91
|
+
"component": "endQueueEntryModal"
|
|
87
92
|
},
|
|
88
93
|
{
|
|
89
|
-
"name": "
|
|
90
|
-
"component": "
|
|
94
|
+
"name": "transition-patient-to-latest-queue-modal",
|
|
95
|
+
"component": "transitionPatientToLatestQueue"
|
|
91
96
|
},
|
|
92
97
|
{
|
|
93
|
-
"name": "
|
|
94
|
-
"component": "
|
|
98
|
+
"name": "transition-queue-entry-modal",
|
|
99
|
+
"component": "transitionQueueEntryModal"
|
|
95
100
|
},
|
|
96
101
|
{
|
|
97
|
-
"name": "
|
|
98
|
-
"component": "
|
|
102
|
+
"name": "transition-queue-entry-status-modal",
|
|
103
|
+
"component": "transitionQueueEntryStatusModal"
|
|
99
104
|
},
|
|
100
105
|
{
|
|
101
|
-
"name": "
|
|
102
|
-
"component": "
|
|
103
|
-
"slot": "queue-table-serve-patient-slot"
|
|
106
|
+
"name": "undo-transition-queue-entry-modal",
|
|
107
|
+
"component": "undoTransitionQueueEntryModal"
|
|
104
108
|
},
|
|
105
109
|
{
|
|
106
|
-
"name": "
|
|
107
|
-
"component": "
|
|
108
|
-
"slot":"visit-form-queue-slot"
|
|
110
|
+
"name": "void-queue-entry-modal",
|
|
111
|
+
"component": "voidQueueEntryModal"
|
|
109
112
|
}
|
|
110
113
|
],
|
|
111
114
|
"workspaces": [
|
package/translations/en.json
CHANGED
|
@@ -215,6 +215,7 @@
|
|
|
215
215
|
"queueRoomUpdatedSuccessfully": "Queue room updated successfully",
|
|
216
216
|
"queuesClearedSuccessfully": "Queues cleared successfully",
|
|
217
217
|
"queueScreen": "Queue screen",
|
|
218
|
+
"queueScreenError": "Queue screen error",
|
|
218
219
|
"queueService": "Queue service",
|
|
219
220
|
"queueStatus": "Queue status",
|
|
220
221
|
"recentScheduledVisits_one": "{{count}} visit scheduled for +/- 7 days",
|
|
@@ -272,6 +273,7 @@
|
|
|
272
273
|
"submitting": "Submitting...",
|
|
273
274
|
"success": "Success",
|
|
274
275
|
"temperature": "Temperature",
|
|
276
|
+
"ticketAnnouncement": "Ticket number: {{prefix}}, - {{suffix}}, please proceed to room {{room}}",
|
|
275
277
|
"ticketNumber": "Ticket Number",
|
|
276
278
|
"time": "Time",
|
|
277
279
|
"timeCannotBeInFuture": "Time cannot be in the future",
|