@openmrs/esm-service-queues-app 9.2.1-pre.7366 → 9.2.1-pre.7380
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 +1 -1
- package/dist/1151.js +1 -1
- package/dist/1151.js.map +1 -1
- package/dist/1638.js +1 -1
- package/dist/1638.js.map +1 -1
- package/dist/3386.js +1 -1
- package/dist/3386.js.map +1 -1
- package/dist/3683.js +1 -1
- package/dist/3683.js.map +1 -1
- package/dist/370.js +1 -1
- package/dist/370.js.map +1 -1
- package/dist/4890.js +1 -1
- package/dist/4890.js.map +1 -1
- package/dist/5228.js +1 -1
- package/dist/5228.js.map +1 -1
- package/dist/5578.js +1 -1
- package/dist/5578.js.map +1 -1
- package/dist/6381.js +1 -1
- package/dist/6381.js.map +1 -1
- package/dist/7067.js +1 -1
- package/dist/7067.js.map +1 -1
- package/dist/714.js.map +1 -1
- package/dist/8233.js +1 -1
- package/dist/8233.js.map +1 -1
- package/dist/8370.js +1 -1
- package/dist/8370.js.map +1 -1
- package/dist/8561.js +1 -1
- package/dist/8561.js.map +1 -1
- package/dist/9707.js +1 -1
- package/dist/9707.js.map +1 -1
- package/dist/openmrs-esm-service-queues-app.js.buildmanifest.json +43 -43
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/admin/queue-rooms/queue-room-form.test.tsx +9 -10
- package/src/admin/queue-rooms/queue-room-form.workspace.tsx +1 -1
- package/src/admin/queue-services/queue-service-form.test.tsx +12 -6
- package/src/admin/queue-services/queue-service-form.workspace.tsx +1 -1
- package/src/create-queue-entry/create-queue-entry.workspace.tsx +1 -1
- package/src/create-queue-entry/queue-fields/queue-fields.component.tsx +1 -1
- package/src/declarations.d.ts +0 -4
- package/src/home.test.tsx +8 -0
- package/src/metrics/metrics-cards/waiting-patients.extension.tsx +1 -0
- package/src/modals/queue-entry-actions-modal.component.tsx +18 -10
- package/src/modals/queue-entry-actions.test.tsx +37 -27
- package/src/modals/queue-entry-confirm-action.modal.tsx +2 -2
- package/src/past-visit/past-visit-details/past-visit-summary.component.tsx +36 -30
- package/src/past-visit/past-visit.component.tsx +1 -1
- package/src/patient-queue-header/patient-queue-header.component.tsx +11 -10
- package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +2 -3
- package/src/queue-screen/queue-screen.component.tsx +1 -1
- package/src/queue-screen/queue-screen.test.tsx +10 -3
- package/src/queue-table/default-queue-table.component.tsx +8 -1
- package/src/queue-table/queue-table.component.tsx +1 -1
- package/src/types/index.ts +0 -2
|
@@ -371,7 +371,7 @@ const QueueFields = React.memo(({ setOnSubmit, defaultInitialServiceQueue }: Que
|
|
|
371
371
|
control={control}
|
|
372
372
|
render={({ field }) =>
|
|
373
373
|
isLoadingQueues ? (
|
|
374
|
-
<RadioButtonGroup>
|
|
374
|
+
<RadioButtonGroup name="priority">
|
|
375
375
|
<RadioButtonSkeleton />
|
|
376
376
|
<RadioButtonSkeleton />
|
|
377
377
|
<RadioButtonSkeleton />
|
package/src/declarations.d.ts
CHANGED
package/src/home.test.tsx
CHANGED
|
@@ -7,6 +7,14 @@ import Home from './home.component';
|
|
|
7
7
|
|
|
8
8
|
const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
|
|
9
9
|
|
|
10
|
+
jest.mock('./hooks/useQueues', () => ({
|
|
11
|
+
useQueues: jest.fn(() => ({ queues: [] })),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
jest.mock('./create-queue-entry/hooks/useQueueLocations', () => ({
|
|
15
|
+
useQueueLocations: jest.fn(() => ({ queueLocations: [], isLoading: false, error: undefined })),
|
|
16
|
+
}));
|
|
17
|
+
|
|
10
18
|
mockUseConfig.mockReturnValue({
|
|
11
19
|
...getDefaultsFromConfigSchema(configSchema),
|
|
12
20
|
visitQueueNumberAttributeUuid: 'c61ce16f-272a-41e7-9924-4c555d0932c5',
|
|
@@ -62,6 +62,7 @@ export default function WaitingPatientsExtension() {
|
|
|
62
62
|
item ? `${item.display} ${item.location?.display ? `- ${item.location.display}` : ''}` : ''
|
|
63
63
|
}
|
|
64
64
|
label=""
|
|
65
|
+
titleText=""
|
|
65
66
|
onChange={handleServiceChange}
|
|
66
67
|
size={isDesktop(layout) ? 'sm' : 'lg'}
|
|
67
68
|
type="inline"
|
|
@@ -16,16 +16,17 @@ import {
|
|
|
16
16
|
TextArea,
|
|
17
17
|
TimePicker,
|
|
18
18
|
TimePickerSelect,
|
|
19
|
+
type OnChangeData,
|
|
19
20
|
} from '@carbon/react';
|
|
20
21
|
import { useTranslation } from 'react-i18next';
|
|
21
22
|
import { OpenmrsDatePicker, showSnackbar, type FetchResponse, useConfig } from '@openmrs/esm-framework';
|
|
22
23
|
import { useMutateQueueEntries } from '../hooks/useQueueEntries';
|
|
23
24
|
import { useQueues } from '../hooks/useQueues';
|
|
24
25
|
import { DUPLICATE_QUEUE_ENTRY_ERROR_CODE, time12HourFormatRegexPattern } from '../constants';
|
|
26
|
+
import { convertTime12to24, type amPm } from './time-helpers';
|
|
25
27
|
import { type ConfigObject } from '../config-schema';
|
|
26
|
-
import { type QueueEntry } from '../types';
|
|
28
|
+
import { type Queue, type QueueEntry } from '../types';
|
|
27
29
|
import QueuePriority from '../queue-table/components/queue-priority.component';
|
|
28
|
-
import { convertTime12to24, type amPm } from './time-helpers';
|
|
29
30
|
import styles from './queue-entry-actions.scss';
|
|
30
31
|
|
|
31
32
|
interface QueueEntryActionModalProps {
|
|
@@ -255,10 +256,11 @@ export const QueueEntryActionModal: React.FC<QueueEntryActionModalProps> = ({
|
|
|
255
256
|
<RadioButtonGroup
|
|
256
257
|
className={styles.radioButtonGroup}
|
|
257
258
|
id="queue"
|
|
259
|
+
name="queue"
|
|
258
260
|
invalidText="Required"
|
|
259
261
|
valueSelected={formState.selectedQueue}
|
|
260
262
|
orientation="vertical"
|
|
261
|
-
onChange={(uuid) => setSelectedQueueUuid(uuid)}>
|
|
263
|
+
onChange={(uuid) => setSelectedQueueUuid(String(uuid))}>
|
|
262
264
|
{queues?.map(({ uuid, display, location }) => (
|
|
263
265
|
<RadioButton
|
|
264
266
|
key={uuid}
|
|
@@ -274,20 +276,25 @@ export const QueueEntryActionModal: React.FC<QueueEntryActionModalProps> = ({
|
|
|
274
276
|
))}
|
|
275
277
|
</RadioButtonGroup>
|
|
276
278
|
) : (
|
|
277
|
-
<Dropdown
|
|
279
|
+
<Dropdown<Queue>
|
|
278
280
|
id="queue"
|
|
279
281
|
label={selectedQueue.display}
|
|
280
282
|
initialSelectedItem={selectedQueue}
|
|
281
|
-
value={formState.selectedQueue}
|
|
282
283
|
items={queues}
|
|
283
|
-
itemToString={(item) =>
|
|
284
|
+
itemToString={(item: Queue) =>
|
|
284
285
|
item.uuid === queueEntry.queue.uuid
|
|
285
286
|
? t('currentValueFormatted', '{{value}} (Current)', {
|
|
286
287
|
value: `${item.display} - ${item.location?.display}`,
|
|
287
288
|
})
|
|
288
289
|
: `${item.display} - ${item.location?.display}`
|
|
289
290
|
}
|
|
290
|
-
onChange={(
|
|
291
|
+
onChange={(data: OnChangeData<Queue>) => {
|
|
292
|
+
const queue = data.selectedItem;
|
|
293
|
+
if (queue) {
|
|
294
|
+
setSelectedQueueUuid(queue.uuid);
|
|
295
|
+
}
|
|
296
|
+
}}
|
|
297
|
+
titleText=""
|
|
291
298
|
/>
|
|
292
299
|
)}
|
|
293
300
|
</section>
|
|
@@ -310,7 +317,7 @@ export const QueueEntryActionModal: React.FC<QueueEntryActionModalProps> = ({
|
|
|
310
317
|
name="status"
|
|
311
318
|
valueSelected={formState.selectedStatus}
|
|
312
319
|
onChange={(uuid) => {
|
|
313
|
-
setSelectedStatusUuid(uuid);
|
|
320
|
+
setSelectedStatusUuid(String(uuid));
|
|
314
321
|
}}>
|
|
315
322
|
{statuses?.map(({ uuid, display }) => (
|
|
316
323
|
<RadioButton
|
|
@@ -344,9 +351,10 @@ export const QueueEntryActionModal: React.FC<QueueEntryActionModalProps> = ({
|
|
|
344
351
|
) : (
|
|
345
352
|
<RadioButtonGroup
|
|
346
353
|
className={styles.radioButtonGroup}
|
|
354
|
+
name="priority"
|
|
347
355
|
valueSelected={formState.selectedPriority}
|
|
348
356
|
onChange={(uuid) => {
|
|
349
|
-
setSelectedPriorityUuid(uuid);
|
|
357
|
+
setSelectedPriorityUuid(String(uuid));
|
|
350
358
|
}}>
|
|
351
359
|
{priorities?.map(({ uuid, display }) => (
|
|
352
360
|
<RadioButton
|
|
@@ -394,6 +402,7 @@ export const QueueEntryActionModal: React.FC<QueueEntryActionModalProps> = ({
|
|
|
394
402
|
/>
|
|
395
403
|
|
|
396
404
|
<TimePicker
|
|
405
|
+
id="transitionTime"
|
|
397
406
|
labelText={t('time', 'Time')}
|
|
398
407
|
onChange={(event) => setTransitionTime(event.target.value)}
|
|
399
408
|
pattern={time12HourFormatRegexPattern}
|
|
@@ -404,7 +413,6 @@ export const QueueEntryActionModal: React.FC<QueueEntryActionModalProps> = ({
|
|
|
404
413
|
id="visitStartTimeSelect"
|
|
405
414
|
onChange={(event) => setTransitionTimeFormat(event.target.value as amPm)}
|
|
406
415
|
value={formState.transitionTimeFormat}
|
|
407
|
-
labelText={t('time', 'Time')}
|
|
408
416
|
aria-label={t('time', 'Time')}>
|
|
409
417
|
<SelectItem value="AM" text="AM" />
|
|
410
418
|
<SelectItem value="PM" text="PM" />
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type FetchResponse,
|
|
5
|
+
getDefaultsFromConfigSchema,
|
|
6
|
+
openmrsFetch,
|
|
7
|
+
showSnackbar,
|
|
8
|
+
useConfig,
|
|
9
|
+
} from '@openmrs/esm-framework';
|
|
4
10
|
import { screen } from '@testing-library/react';
|
|
5
11
|
import { mockQueues, mockQueueEntryAlice } from '__mocks__';
|
|
6
12
|
import { renderWithSwr } from 'tools';
|
|
13
|
+
import { type ConfigObject, configSchema } from '../config-schema';
|
|
7
14
|
import DeleteQueueEntryModal from './delete-queue-entry.modal';
|
|
8
15
|
import QueueEntryActionModal from './queue-entry-actions-modal.component';
|
|
9
16
|
import UndoTransitionQueueEntryModal from './undo-transition-queue-entry.modal';
|
|
10
17
|
|
|
11
18
|
const mockOpenmrsFetch = jest.mocked(openmrsFetch);
|
|
19
|
+
const mockUseConfig = jest.mocked(useConfig<ConfigObject>);
|
|
12
20
|
|
|
13
21
|
jest.mock('../hooks/useQueues', () => {
|
|
14
22
|
return {
|
|
@@ -18,6 +26,10 @@ jest.mock('../hooks/useQueues', () => {
|
|
|
18
26
|
};
|
|
19
27
|
});
|
|
20
28
|
|
|
29
|
+
jest.mock('../create-queue-entry/hooks/useQueueLocations', () => ({
|
|
30
|
+
useQueueLocations: jest.fn(() => ({ queueLocations: [], isLoading: false, error: undefined })),
|
|
31
|
+
}));
|
|
32
|
+
|
|
21
33
|
jest.mock('../hooks/useQueueEntries', () => {
|
|
22
34
|
return {
|
|
23
35
|
useMutateQueueEntries: jest.fn().mockReturnValue({
|
|
@@ -26,33 +38,31 @@ jest.mock('../hooks/useQueueEntries', () => {
|
|
|
26
38
|
};
|
|
27
39
|
});
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
style: null,
|
|
41
|
-
color: 'green',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
conceptUuid: 'dc3492ef-24a5-4fd9-b58d-4fd2acf7071f',
|
|
45
|
-
style: null,
|
|
46
|
-
color: 'orange',
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
concepts: {
|
|
50
|
-
defaultPriorityConceptUuid: 'f4620bfa-3625-4883-bd3f-84c2cce14470',
|
|
51
|
-
defaultStatusConceptUuid: '51ae5e4d-b72b-4912-bf31-a17efb690aeb',
|
|
52
|
-
defaultTransitionStatus: 'ca7494ae-437f-4fd0-8aae-b88b9a2ba47d',
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
mockUseConfig.mockReturnValue({
|
|
43
|
+
...getDefaultsFromConfigSchema(configSchema),
|
|
44
|
+
showQueueNumber: true,
|
|
45
|
+
showPriorityComment: true,
|
|
46
|
+
showTransitionDateTime: true,
|
|
47
|
+
priorityConfigs: [
|
|
48
|
+
{
|
|
49
|
+
conceptUuid: 'f4620bfa-3625-4883-bd3f-84c2cce14470',
|
|
50
|
+
style: null,
|
|
51
|
+
color: 'green',
|
|
53
52
|
},
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
{
|
|
54
|
+
conceptUuid: 'dc3492ef-24a5-4fd9-b58d-4fd2acf7071f',
|
|
55
|
+
style: null,
|
|
56
|
+
color: 'orange',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
concepts: {
|
|
60
|
+
...getDefaultsFromConfigSchema(configSchema).concepts,
|
|
61
|
+
defaultPriorityConceptUuid: 'f4620bfa-3625-4883-bd3f-84c2cce14470',
|
|
62
|
+
defaultStatusConceptUuid: '51ae5e4d-b72b-4912-bf31-a17efb690aeb',
|
|
63
|
+
defaultTransitionStatus: 'ca7494ae-437f-4fd0-8aae-b88b9a2ba47d',
|
|
64
|
+
},
|
|
65
|
+
} as ConfigObject);
|
|
56
66
|
});
|
|
57
67
|
|
|
58
68
|
describe('UndoTransitionQueueEntryModal', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { type ReactNode, useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { type QueueEntry } from '../types';
|
|
4
3
|
import { Button, ModalHeader, ModalBody, ModalFooter, Stack } from '@carbon/react';
|
|
5
4
|
import { type FetchResponse, showSnackbar } from '@openmrs/esm-framework';
|
|
5
|
+
import { type QueueEntry } from '../types';
|
|
6
6
|
import { useMutateQueueEntries } from '../hooks/useQueueEntries';
|
|
7
7
|
|
|
8
8
|
interface QueueEntryUndoActionsModalProps {
|
|
@@ -85,7 +85,7 @@ export const QueueEntryConfirmActionModal: React.FC<QueueEntryUndoActionsModalPr
|
|
|
85
85
|
<span>{modalInstruction}</span>
|
|
86
86
|
</Stack>
|
|
87
87
|
) : (
|
|
88
|
-
<
|
|
88
|
+
<div>{modalInstruction}</div>
|
|
89
89
|
)}
|
|
90
90
|
</ModalBody>
|
|
91
91
|
<ModalFooter>
|
|
@@ -141,36 +141,42 @@ const PastVisitSummary: React.FC<PastVisitSummaryProps> = ({ encounters, patient
|
|
|
141
141
|
|
|
142
142
|
return (
|
|
143
143
|
<div className={styles.wrapper}>
|
|
144
|
-
<
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
144
|
+
<div className={tabsClasses}>
|
|
145
|
+
<Tabs>
|
|
146
|
+
<TabList className={styles.verticalTabList} aria-label="Past visits tabs">
|
|
147
|
+
<Tab className={tabClasses(0)} id="vitals-tab" onClick={() => setSelectedTabIndex(0)}>
|
|
148
|
+
{t('vitals', 'Vitals')}
|
|
149
|
+
</Tab>
|
|
150
|
+
<Tab className={tabClasses(1)} id="notes-tab" onClick={() => setSelectedTabIndex(1)}>
|
|
151
|
+
{t('notes', 'Notes')}
|
|
152
|
+
</Tab>
|
|
153
|
+
<Tab className={tabClasses(2)} id="medications-tab" onClick={() => setSelectedTabIndex(2)}>
|
|
154
|
+
{t('medications', 'Medications')}
|
|
155
|
+
</Tab>
|
|
156
|
+
<Tab className={tabClasses(3)} id="encounters-tab" onClick={() => setSelectedTabIndex(3)}>
|
|
157
|
+
{t('encounters', 'Encounters')}
|
|
158
|
+
</Tab>
|
|
159
|
+
</TabList>
|
|
160
|
+
<TabPanels>
|
|
161
|
+
<TabPanel>
|
|
162
|
+
<Vitals
|
|
163
|
+
vitals={useVitalsFromObs(vitalsToRetrieve)}
|
|
164
|
+
patientUuid={patientUuid}
|
|
165
|
+
visitType={visitTypes.PAST}
|
|
166
|
+
/>
|
|
167
|
+
</TabPanel>
|
|
168
|
+
<TabPanel>
|
|
169
|
+
<Notes notes={notes} diagnoses={diagnoses} />
|
|
170
|
+
</TabPanel>
|
|
171
|
+
<TabPanel>
|
|
172
|
+
<Medications medications={medications} />
|
|
173
|
+
</TabPanel>
|
|
174
|
+
<TabPanel>
|
|
175
|
+
<EncounterList encounters={encountersToDisplay} />
|
|
176
|
+
</TabPanel>
|
|
177
|
+
</TabPanels>
|
|
178
|
+
</Tabs>
|
|
179
|
+
</div>
|
|
174
180
|
</div>
|
|
175
181
|
);
|
|
176
182
|
};
|
|
@@ -15,7 +15,7 @@ const PastVisit: React.FC<PastVisitProps> = ({ patientUuid }) => {
|
|
|
15
15
|
const { visits, isLoading } = usePastVisits(patientUuid);
|
|
16
16
|
|
|
17
17
|
if (isLoading) {
|
|
18
|
-
return <StructuredListSkeleton
|
|
18
|
+
return <StructuredListSkeleton />;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if (visits) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Dropdown, DropdownSkeleton, InlineNotification } from '@carbon/react';
|
|
3
|
+
import { Dropdown, DropdownSkeleton, InlineNotification, type OnChangeData } from '@carbon/react';
|
|
4
4
|
import { useConfig, useSession, PageHeader, PageHeaderContent, ServiceQueuesPictogram } from '@openmrs/esm-framework';
|
|
5
5
|
import { useQueueLocations } from '../create-queue-entry/hooks/useQueueLocations';
|
|
6
6
|
import {
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
updateSelectedService,
|
|
10
10
|
useServiceQueuesStore,
|
|
11
11
|
} from '../store/store';
|
|
12
|
+
import { useQueues } from '../hooks/useQueues';
|
|
12
13
|
import type { ConfigObject } from '../config-schema';
|
|
13
14
|
import styles from './patient-queue-header.scss';
|
|
14
|
-
import { useQueues } from '../hooks/useQueues';
|
|
15
15
|
|
|
16
16
|
interface PatientQueueHeaderProps {
|
|
17
17
|
title?: string | JSX.Element;
|
|
@@ -24,8 +24,7 @@ const PatientQueueHeader: React.FC<PatientQueueHeaderProps> = ({ title, showFilt
|
|
|
24
24
|
const { queueLocations, isLoading, error } = useQueueLocations();
|
|
25
25
|
const { dashboardTitle } = useConfig<ConfigObject>();
|
|
26
26
|
const userSession = useSession();
|
|
27
|
-
const { selectedQueueLocationName, selectedQueueLocationUuid, selectedServiceDisplay
|
|
28
|
-
useServiceQueuesStore();
|
|
27
|
+
const { selectedQueueLocationName, selectedQueueLocationUuid, selectedServiceDisplay } = useServiceQueuesStore();
|
|
29
28
|
const { queues } = useQueues();
|
|
30
29
|
const showLocationDropdown = showFilters && queueLocations.length > 1;
|
|
31
30
|
const showServiceDropdown = showFilters && queues.length > 1;
|
|
@@ -57,11 +56,14 @@ const PatientQueueHeader: React.FC<PatientQueueHeaderProps> = ({ title, showFilt
|
|
|
57
56
|
);
|
|
58
57
|
|
|
59
58
|
const handleServiceChange = useCallback(
|
|
60
|
-
({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
(data: OnChangeData<{ id: string; name: string }>) => {
|
|
60
|
+
const selectedItem = data.selectedItem;
|
|
61
|
+
if (selectedItem) {
|
|
62
|
+
if (selectedItem.id === 'all') {
|
|
63
|
+
updateSelectedService(null, t('all', 'All'));
|
|
64
|
+
} else {
|
|
65
|
+
updateSelectedService(selectedItem.id, selectedItem.name);
|
|
66
|
+
}
|
|
65
67
|
}
|
|
66
68
|
},
|
|
67
69
|
[t],
|
|
@@ -142,7 +144,6 @@ const PatientQueueHeader: React.FC<PatientQueueHeaderProps> = ({ title, showFilt
|
|
|
142
144
|
titleText={t('service', 'Service')}
|
|
143
145
|
type="inline"
|
|
144
146
|
onChange={handleServiceChange}
|
|
145
|
-
value={selectedServiceUuid}
|
|
146
147
|
/>
|
|
147
148
|
)}
|
|
148
149
|
{actions}
|
|
@@ -4,8 +4,9 @@ import { type TFunction } from 'i18next';
|
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
6
6
|
DataTable,
|
|
7
|
-
|
|
7
|
+
DataTableSkeleton,
|
|
8
8
|
Layer,
|
|
9
|
+
Pagination,
|
|
9
10
|
Table,
|
|
10
11
|
TableBody,
|
|
11
12
|
TableCell,
|
|
@@ -18,8 +19,6 @@ import {
|
|
|
18
19
|
TableToolbarSearch,
|
|
19
20
|
Tag,
|
|
20
21
|
Tile,
|
|
21
|
-
DataTableSkeleton,
|
|
22
|
-
Pagination,
|
|
23
22
|
} from '@carbon/react';
|
|
24
23
|
import { OverflowMenuVertical } from '@carbon/react/icons';
|
|
25
24
|
import { ConfigurableLink, ExtensionSlot, formatDatetime, parseDate, usePagination } from '@openmrs/esm-framework';
|
|
@@ -12,7 +12,7 @@ const QueueScreen: React.FC<QueueScreenProps> = () => {
|
|
|
12
12
|
const { activeTickets, isLoading, error } = useActiveTickets();
|
|
13
13
|
|
|
14
14
|
if (isLoading) {
|
|
15
|
-
return <DataTableSkeleton
|
|
15
|
+
return <DataTableSkeleton rowCount={5} className={styles.queueScreen} data-testid="queue-screen-skeleton" />;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
if (error) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { useActiveTickets } from './useActiveTickets';
|
|
4
|
-
import QueueScreen from './queue-screen.component';
|
|
5
4
|
import { updateSelectedQueueLocationName, updateSelectedQueueLocationUuid } from '../store/store';
|
|
5
|
+
import QueueScreen from './queue-screen.component';
|
|
6
6
|
|
|
7
7
|
const mockUseActiveTickets = jest.mocked(useActiveTickets);
|
|
8
8
|
|
|
@@ -10,8 +10,15 @@ jest.mock('./useActiveTickets', () => ({
|
|
|
10
10
|
useActiveTickets: jest.fn(),
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
jest.mock('../hooks/useQueues', () => ({
|
|
14
|
+
useQueues: jest.fn(() => ({ queues: [] })),
|
|
15
|
+
}));
|
|
14
16
|
|
|
17
|
+
jest.mock('../create-queue-entry/hooks/useQueueLocations', () => ({
|
|
18
|
+
useQueueLocations: jest.fn(() => ({ queueLocations: [], isLoading: false, error: undefined })),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
describe('QueueScreen component', () => {
|
|
15
22
|
beforeEach(() => {
|
|
16
23
|
updateSelectedQueueLocationName('Room A');
|
|
17
24
|
updateSelectedQueueLocationUuid('123');
|
|
@@ -22,7 +29,7 @@ describe('QueueScreen component', () => {
|
|
|
22
29
|
|
|
23
30
|
render(<QueueScreen />);
|
|
24
31
|
|
|
25
|
-
expect(screen.
|
|
32
|
+
expect(screen.getByTestId('queue-screen-skeleton')).toBeInTheDocument();
|
|
26
33
|
});
|
|
27
34
|
|
|
28
35
|
test('renders error message when there is an error fetching data', () => {
|
|
@@ -103,7 +103,14 @@ function QueueTableSection() {
|
|
|
103
103
|
<StatusDropdownFilter />
|
|
104
104
|
<TableToolbarSearch
|
|
105
105
|
className={styles.search}
|
|
106
|
-
onChange={(e) =>
|
|
106
|
+
onChange={(e) => {
|
|
107
|
+
if (typeof e === 'string') {
|
|
108
|
+
setSearchTerm(e);
|
|
109
|
+
} else if (e && 'target' in e) {
|
|
110
|
+
const target = e.target as HTMLInputElement;
|
|
111
|
+
setSearchTerm(target.value);
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
107
114
|
placeholder={t('searchThisList', 'Search this list')}
|
|
108
115
|
size={isDesktop(layout) ? 'sm' : 'lg'}
|
|
109
116
|
persistent
|
|
@@ -78,7 +78,7 @@ function QueueTable({
|
|
|
78
78
|
|
|
79
79
|
const rows =
|
|
80
80
|
paginatedQueueEntries?.map((queueEntry) => {
|
|
81
|
-
const row:
|
|
81
|
+
const row: { id: string; [key: string]: JSX.Element | string } = { id: queueEntry.uuid };
|
|
82
82
|
columns.forEach(({ key, CellComponent }) => {
|
|
83
83
|
row[key] = <CellComponent key={key} queueEntry={queueEntry} />;
|
|
84
84
|
});
|