@openmrs/esm-service-queues-app 9.2.1-pre.7118 → 9.2.1-pre.7126
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 +9 -9
- package/dist/2799.js +1 -1
- package/dist/2799.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/4300.js +1 -1
- package/dist/5228.js +1 -1
- package/dist/5228.js.map +1 -1
- package/dist/5278.js +2 -0
- package/dist/5278.js.map +1 -0
- package/dist/5578.js +1 -1
- package/dist/5578.js.map +1 -1
- package/dist/5680.js +1 -1
- package/dist/5680.js.map +1 -1
- package/dist/714.js +1 -1
- package/dist/714.js.map +1 -1
- package/dist/8233.js +1 -0
- package/dist/8233.js.map +1 -0
- package/dist/8844.js +1 -1
- package/dist/8844.js.map +1 -1
- package/dist/9384.js +1 -1
- package/dist/9384.js.map +1 -1
- package/dist/9707.js +1 -1
- package/dist/9707.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-service-queues-app.js +1 -1
- package/dist/openmrs-esm-service-queues-app.js.buildmanifest.json +85 -85
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/admin/admin-page/admin-page.component.tsx +3 -3
- package/src/admin/queue-rooms/queue-room-form.workspace.tsx +88 -85
- package/src/admin/queue-services/queue-service-form.workspace.tsx +85 -83
- package/src/create-queue-entry/create-queue-entry.workspace.tsx +72 -61
- package/src/create-queue-entry/existing-visit-form/existing-visit-form.component.tsx +8 -14
- package/src/index.ts +0 -2
- package/src/patient-banner-extension/patient-banner-queue-entry-status.extension.tsx +2 -3
- package/src/patient-banner-extension/patient-banner-queue-entry-status.scss +2 -1
- package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +3 -21
- package/src/queue-patient-linelists/queue-services-table.component.tsx +1 -1
- package/src/queue-table/components/add-patient-to-queue-button.component.tsx +45 -0
- package/src/queue-table/components/queue-priority.component.tsx +2 -2
- package/src/queue-table/components/queue-priority.scss +2 -2
- package/src/queue-table/default-queue-table.component.tsx +4 -52
- package/src/routes.json +33 -15
- package/src/views/queue-tables-for-all-statuses.component.tsx +3 -20
- package/translations/en.json +1 -12
- package/dist/3050.js +0 -1
- package/dist/3050.js.map +0 -1
- package/dist/7706.js +0 -2
- package/dist/7706.js.map +0 -1
- package/src/hooks/usePatientSearchVisibility.tsx +0 -26
- package/src/queue-patient-linelists/queue-linelist-filter.scss +0 -53
- package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +0 -83
- package/src/queue-patient-linelists/queue-linelist-filter.workspace.tsx +0 -180
- /package/dist/{7706.js.LICENSE.txt → 5278.js.LICENSE.txt} +0 -0
|
@@ -19,11 +19,12 @@ import {
|
|
|
19
19
|
TextInput,
|
|
20
20
|
} from '@carbon/react';
|
|
21
21
|
import {
|
|
22
|
-
type DefaultWorkspaceProps,
|
|
23
22
|
getCoreTranslation,
|
|
24
23
|
restBaseUrl,
|
|
25
24
|
showSnackbar,
|
|
26
25
|
useLayoutType,
|
|
26
|
+
Workspace2,
|
|
27
|
+
type Workspace2DefinitionProps,
|
|
27
28
|
} from '@openmrs/esm-framework';
|
|
28
29
|
import { saveQueueRoom } from './queue-room.resource';
|
|
29
30
|
import { useQueueLocations } from '../../create-queue-entry/hooks/useQueueLocations';
|
|
@@ -54,7 +55,7 @@ const createQueueRoomSchema = (t: TFunction) =>
|
|
|
54
55
|
|
|
55
56
|
type QueueRoomFormData = z.infer<ReturnType<typeof createQueueRoomSchema>>;
|
|
56
57
|
|
|
57
|
-
const QueueRoomForm: React.FC<
|
|
58
|
+
const QueueRoomForm: React.FC<Workspace2DefinitionProps> = ({ closeWorkspace }) => {
|
|
58
59
|
const { t } = useTranslation();
|
|
59
60
|
const isTablet = useLayoutType() === 'tablet';
|
|
60
61
|
const {
|
|
@@ -99,91 +100,93 @@ const QueueRoomForm: React.FC<DefaultWorkspaceProps> = ({ closeWorkspace }) => {
|
|
|
99
100
|
};
|
|
100
101
|
|
|
101
102
|
return (
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
103
|
+
<Workspace2 title={t('addNewQueueServiceRoom', 'Add new queue service room')}>
|
|
104
|
+
<Form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
|
|
105
|
+
<Stack gap={4} className={styles.grid}>
|
|
106
|
+
<Column>
|
|
107
|
+
<Layer className={styles.input}>
|
|
108
|
+
<Controller
|
|
109
|
+
control={control}
|
|
110
|
+
name="queueRoomName"
|
|
111
|
+
render={({ field }) => (
|
|
112
|
+
<TextInput
|
|
113
|
+
{...field}
|
|
114
|
+
id="queueRoomName"
|
|
115
|
+
invalid={!!errors.queueRoomName}
|
|
116
|
+
invalidText={errors.queueRoomName?.message}
|
|
117
|
+
labelText={t('queueRoomName', 'Queue room name')}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
/>
|
|
121
|
+
</Layer>
|
|
122
|
+
</Column>
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
124
|
+
<Column>
|
|
125
|
+
<Layer className={styles.input}>
|
|
126
|
+
<Controller
|
|
127
|
+
name="queueLocation"
|
|
128
|
+
control={control}
|
|
129
|
+
render={({ field: { onChange, value, ...field } }) => (
|
|
130
|
+
<Select
|
|
131
|
+
{...field}
|
|
132
|
+
id="queueRoomLocation"
|
|
133
|
+
invalid={!!errors.queueLocation}
|
|
134
|
+
invalidText={errors.queueLocation?.message}
|
|
135
|
+
labelText={t('queueLocation', 'Queue location')}
|
|
136
|
+
onChange={(e) => onChange(e.target.value)}
|
|
137
|
+
value={value || ''}>
|
|
138
|
+
<SelectItem text={t('selectQueueRoomLocation', 'Select a queue room location')} value="" />
|
|
139
|
+
{queueLocations?.map((location) => (
|
|
140
|
+
<SelectItem key={location.id} text={location.name} value={location.id}>
|
|
141
|
+
{location.name}
|
|
142
|
+
</SelectItem>
|
|
143
|
+
))}
|
|
144
|
+
</Select>
|
|
145
|
+
)}
|
|
146
|
+
/>
|
|
147
|
+
</Layer>
|
|
148
|
+
</Column>
|
|
147
149
|
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
150
|
+
<Column>
|
|
151
|
+
<Layer className={styles.input}>
|
|
152
|
+
<Controller
|
|
153
|
+
name="queueRoomService"
|
|
154
|
+
control={control}
|
|
155
|
+
render={({ field: { onChange, value, ...field } }) => (
|
|
156
|
+
<Select
|
|
157
|
+
{...field}
|
|
158
|
+
id="queueRoomService"
|
|
159
|
+
invalid={!!errors.queueRoomService}
|
|
160
|
+
invalidText={errors.queueRoomService?.message}
|
|
161
|
+
labelText={t('queueRoomService', 'Queue room service')}
|
|
162
|
+
onChange={(e) => onChange(e.target.value)}
|
|
163
|
+
value={value || ''}>
|
|
164
|
+
<SelectItem text={t('selectQueueRoomService', 'Select a queue room service')} value="" />
|
|
165
|
+
{queues?.map((service) => (
|
|
166
|
+
<SelectItem key={service.uuid} text={service.display} value={service.uuid}>
|
|
167
|
+
{service.display}
|
|
168
|
+
</SelectItem>
|
|
169
|
+
))}
|
|
170
|
+
</Select>
|
|
171
|
+
)}
|
|
172
|
+
/>
|
|
173
|
+
</Layer>
|
|
174
|
+
</Column>
|
|
175
|
+
</Stack>
|
|
176
|
+
<ButtonSet className={classNames(isTablet ? styles.tablet : styles.desktop)}>
|
|
177
|
+
<Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
|
|
178
|
+
{getCoreTranslation('cancel', 'Cancel')}
|
|
179
|
+
</Button>
|
|
180
|
+
<Button className={styles.button} disabled={isSubmitting} kind="primary" type="submit">
|
|
181
|
+
{isSubmitting ? (
|
|
182
|
+
<InlineLoading description={t('saving', 'Saving') + '...'} />
|
|
183
|
+
) : (
|
|
184
|
+
<span>{getCoreTranslation('save', 'Save')}</span>
|
|
185
|
+
)}{' '}
|
|
186
|
+
</Button>
|
|
187
|
+
</ButtonSet>
|
|
188
|
+
</Form>
|
|
189
|
+
</Workspace2>
|
|
187
190
|
);
|
|
188
191
|
};
|
|
189
192
|
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
TextInput,
|
|
18
18
|
} from '@carbon/react';
|
|
19
19
|
import { mutate } from 'swr';
|
|
20
|
-
import {
|
|
20
|
+
import { restBaseUrl, showSnackbar, Workspace2, type Workspace2DefinitionProps } from '@openmrs/esm-framework';
|
|
21
21
|
import { saveQueue, useServiceConcepts } from './queue-service.resource';
|
|
22
22
|
import { useQueueLocations } from '../../create-queue-entry/hooks/useQueueLocations';
|
|
23
23
|
import styles from './queue-service-form.scss';
|
|
@@ -46,7 +46,7 @@ const createQueueServiceSchema = (t: TFunction) =>
|
|
|
46
46
|
|
|
47
47
|
type QueueServiceFormData = z.infer<ReturnType<typeof createQueueServiceSchema>>;
|
|
48
48
|
|
|
49
|
-
const QueueServiceForm: React.FC<
|
|
49
|
+
const QueueServiceForm: React.FC<Workspace2DefinitionProps> = ({ closeWorkspace }) => {
|
|
50
50
|
const { t } = useTranslation();
|
|
51
51
|
const { queueConcepts } = useServiceConcepts();
|
|
52
52
|
const { queueLocations } = useQueueLocations();
|
|
@@ -92,87 +92,89 @@ const QueueServiceForm: React.FC<DefaultWorkspaceProps> = ({ closeWorkspace }) =
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
queueConcepts
|
|
129
|
-
|
|
130
|
-
{concept.display}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
queueLocations
|
|
153
|
-
|
|
154
|
-
{location.name}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<
|
|
165
|
-
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{isSubmitting
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
95
|
+
<Workspace2 title={t('addNewQueueService', 'Add New Queue Service')}>
|
|
96
|
+
<Form onSubmit={handleSubmit(createQueue)} className={styles.form}>
|
|
97
|
+
<Stack gap={5} className={styles.grid}>
|
|
98
|
+
<Column>
|
|
99
|
+
<Layer className={styles.input}>
|
|
100
|
+
<Controller
|
|
101
|
+
name="queueName"
|
|
102
|
+
control={control}
|
|
103
|
+
render={({ field }) => (
|
|
104
|
+
<TextInput
|
|
105
|
+
{...field}
|
|
106
|
+
id="queueName"
|
|
107
|
+
invalidText={errors.queueName?.message}
|
|
108
|
+
invalid={!!errors.queueName}
|
|
109
|
+
labelText={t('queueName', 'Queue name')}
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
/>
|
|
113
|
+
</Layer>
|
|
114
|
+
</Column>
|
|
115
|
+
<Column>
|
|
116
|
+
<Layer className={styles.input}>
|
|
117
|
+
<Controller
|
|
118
|
+
name="queueServiceType"
|
|
119
|
+
control={control}
|
|
120
|
+
render={({ field }) => (
|
|
121
|
+
<Select
|
|
122
|
+
{...field}
|
|
123
|
+
labelText={t('selectServiceType', 'Select a service type')}
|
|
124
|
+
id="queueServiceType"
|
|
125
|
+
invalid={!!errors?.queueServiceType}
|
|
126
|
+
invalidText={errors?.queueServiceType?.message}>
|
|
127
|
+
<SelectItem text={t('selectServiceType', 'Select a service type')} value="" />
|
|
128
|
+
{queueConcepts?.length > 0 &&
|
|
129
|
+
queueConcepts.map((concept) => (
|
|
130
|
+
<SelectItem key={concept.uuid} text={concept.display} value={concept.uuid}>
|
|
131
|
+
{concept.display}
|
|
132
|
+
</SelectItem>
|
|
133
|
+
))}
|
|
134
|
+
</Select>
|
|
135
|
+
)}
|
|
136
|
+
/>
|
|
137
|
+
</Layer>
|
|
138
|
+
</Column>
|
|
139
|
+
<Column>
|
|
140
|
+
<Layer className={styles.input}>
|
|
141
|
+
<Controller
|
|
142
|
+
name="userLocation"
|
|
143
|
+
control={control}
|
|
144
|
+
render={({ field }) => (
|
|
145
|
+
<Select
|
|
146
|
+
{...field}
|
|
147
|
+
id="location"
|
|
148
|
+
invalid={!!errors?.userLocation}
|
|
149
|
+
invalidText={errors?.userLocation?.message}
|
|
150
|
+
labelText={t('selectALocation', 'Select a location')}>
|
|
151
|
+
<SelectItem text={t('selectALocation', 'Select a location')} value="" />
|
|
152
|
+
{queueLocations?.length > 0 &&
|
|
153
|
+
queueLocations.map((location) => (
|
|
154
|
+
<SelectItem key={location.id} text={location.name} value={location.id}>
|
|
155
|
+
{location.name}
|
|
156
|
+
</SelectItem>
|
|
157
|
+
))}
|
|
158
|
+
</Select>
|
|
159
|
+
)}
|
|
160
|
+
/>
|
|
161
|
+
</Layer>
|
|
162
|
+
</Column>
|
|
163
|
+
</Stack>
|
|
164
|
+
<ButtonSet className={styles.buttonSet}>
|
|
165
|
+
<Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
|
|
166
|
+
{t('cancel', 'Cancel')}
|
|
167
|
+
</Button>
|
|
168
|
+
<Button className={styles.button} disabled={isSubmitting} kind="primary" type="submit">
|
|
169
|
+
{isSubmitting ? (
|
|
170
|
+
<InlineLoading description={t('saving', 'Saving') + '...'} />
|
|
171
|
+
) : (
|
|
172
|
+
<span>{t('save', 'Save')}</span>
|
|
173
|
+
)}
|
|
174
|
+
</Button>
|
|
175
|
+
</ButtonSet>
|
|
176
|
+
</Form>
|
|
177
|
+
</Workspace2>
|
|
176
178
|
);
|
|
177
179
|
};
|
|
178
180
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Button, DataTableSkeleton } from '@carbon/react';
|
|
3
|
+
import { Button, DataTableSkeleton, Stack } from '@carbon/react';
|
|
4
4
|
import {
|
|
5
5
|
ArrowLeftIcon,
|
|
6
6
|
ErrorState,
|
|
@@ -12,28 +12,35 @@ import {
|
|
|
12
12
|
PatientPhoto,
|
|
13
13
|
usePatient,
|
|
14
14
|
useVisit,
|
|
15
|
-
|
|
15
|
+
Workspace2,
|
|
16
|
+
type Workspace2DefinitionProps,
|
|
16
17
|
} from '@openmrs/esm-framework';
|
|
17
18
|
import { AddPatientToQueueContextProvider } from './add-patient-to-queue-context';
|
|
18
19
|
import ExistingVisitFormComponent from './existing-visit-form/existing-visit-form.component';
|
|
19
20
|
import styles from './create-queue-entry.scss';
|
|
20
21
|
|
|
21
|
-
interface
|
|
22
|
+
interface CreateQueueEntryWorkspaceProps {
|
|
22
23
|
selectedPatientUuid: string;
|
|
23
24
|
currentServiceQueueUuid?: string;
|
|
24
|
-
handleReturnToSearchList?: () => void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
*
|
|
29
29
|
* This is the component that appears when clicking on a search result in the "Add patient to queue" workspace,
|
|
30
30
|
*/
|
|
31
|
-
const CreateQueueEntryWorkspace: React.FC<
|
|
31
|
+
const CreateQueueEntryWorkspace: React.FC<
|
|
32
|
+
Workspace2DefinitionProps<
|
|
33
|
+
CreateQueueEntryWorkspaceProps,
|
|
34
|
+
{
|
|
35
|
+
startVisitWorkspaceName: string;
|
|
36
|
+
},
|
|
37
|
+
{}
|
|
38
|
+
>
|
|
39
|
+
> = ({
|
|
32
40
|
closeWorkspace,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
handleReturnToSearchList,
|
|
41
|
+
workspaceProps: { selectedPatientUuid, currentServiceQueueUuid },
|
|
42
|
+
windowProps: { startVisitWorkspaceName },
|
|
43
|
+
launchChildWorkspace,
|
|
37
44
|
}) => {
|
|
38
45
|
const { t } = useTranslation();
|
|
39
46
|
const { patient } = usePatient(selectedPatientUuid);
|
|
@@ -47,60 +54,64 @@ const CreateQueueEntryWorkspace: React.FC<PatientSearchProps> = ({
|
|
|
47
54
|
|
|
48
55
|
const patientName = patient && getPatientName(patient);
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
if (!patient) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Workspace2 title={t('addPatientToQueue', 'Add patient to queue')}>
|
|
63
|
+
<div className={styles.patientSearchContainer}>
|
|
64
|
+
<AddPatientToQueueContextProvider value={{ currentServiceQueueUuid }}>
|
|
65
|
+
<div className={styles.patientBannerContainer}>
|
|
66
|
+
<div className={styles.patientBanner}>
|
|
67
|
+
<div className={styles.patientPhoto} role="img">
|
|
68
|
+
<PatientPhoto patientUuid={patient.id} patientName={patientName} />
|
|
69
|
+
</div>
|
|
70
|
+
<PatientBannerPatientInfo patient={patient} />
|
|
71
|
+
<PatientBannerToggleContactDetailsButton
|
|
72
|
+
className={styles.toggleContactDetailsButton}
|
|
73
|
+
showContactDetails={showContactDetails}
|
|
74
|
+
toggleContactDetails={handleToggleContactDetails}
|
|
75
|
+
/>
|
|
57
76
|
</div>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
{showContactDetails ? (
|
|
78
|
+
<PatientBannerContactDetails deceased={patient.deceasedBoolean} patientId={patient.id} />
|
|
79
|
+
) : null}
|
|
80
|
+
</div>
|
|
81
|
+
<div className={styles.backButton}>
|
|
82
|
+
<Button
|
|
83
|
+
className={styles.backButton}
|
|
84
|
+
kind="ghost"
|
|
85
|
+
renderIcon={(props) => <ArrowLeftIcon size={24} {...props} />}
|
|
86
|
+
iconDescription={t('backToSearchResults', 'Back to search results')}
|
|
87
|
+
size="sm"
|
|
88
|
+
onClick={closeWorkspace}>
|
|
89
|
+
<span>{t('backToSearchResults', 'Back to search results')}</span>
|
|
90
|
+
</Button>
|
|
64
91
|
</div>
|
|
65
|
-
{
|
|
66
|
-
<
|
|
67
|
-
) :
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
visit={activeVisit}
|
|
89
|
-
/>
|
|
90
|
-
) : (
|
|
91
|
-
<ExtensionSlot
|
|
92
|
-
name="start-visit-workspace-form-slot"
|
|
93
|
-
state={{
|
|
94
|
-
patientUuid: selectedPatientUuid,
|
|
95
|
-
closeWorkspace,
|
|
96
|
-
promptBeforeClosing,
|
|
97
|
-
openedFrom: 'service-queues-add-patient',
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
)}
|
|
101
|
-
</AddPatientToQueueContextProvider>
|
|
102
|
-
</div>
|
|
103
|
-
) : null;
|
|
92
|
+
{isLoading ? (
|
|
93
|
+
<DataTableSkeleton role="progressbar" />
|
|
94
|
+
) : error ? (
|
|
95
|
+
<ErrorState headerTitle={t('errorFetchingVisit', 'Error fetching patient visit')} error={error} />
|
|
96
|
+
) : activeVisit ? (
|
|
97
|
+
<ExistingVisitFormComponent closeWorkspace={closeWorkspace} visit={activeVisit} />
|
|
98
|
+
) : (
|
|
99
|
+
<Stack gap={4}>
|
|
100
|
+
<div>{t('visitRequiredToCreateQueueEntry', 'A visit is required to add patient to queue')}</div>
|
|
101
|
+
<ExtensionSlot
|
|
102
|
+
name="start-visit-button-slot2"
|
|
103
|
+
state={{
|
|
104
|
+
patientUuid: patient.id,
|
|
105
|
+
launchChildWorkspace,
|
|
106
|
+
startVisitWorkspaceName,
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
</Stack>
|
|
110
|
+
)}
|
|
111
|
+
</AddPatientToQueueContextProvider>
|
|
112
|
+
</div>
|
|
113
|
+
</Workspace2>
|
|
114
|
+
);
|
|
104
115
|
};
|
|
105
116
|
|
|
106
117
|
export default CreateQueueEntryWorkspace;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Button, ButtonSet, Form, Row } from '@carbon/react';
|
|
4
|
-
import { ExtensionSlot, useLayoutType, type Visit } from '@openmrs/esm-framework';
|
|
4
|
+
import { ExtensionSlot, useLayoutType, type Workspace2DefinitionProps, type Visit } from '@openmrs/esm-framework';
|
|
5
5
|
import { useMutateQueueEntries } from '../../hooks/useQueueEntries';
|
|
6
6
|
import QueueFields from '../queue-fields/queue-fields.component';
|
|
7
7
|
import styles from './existing-visit-form.scss';
|
|
8
8
|
|
|
9
9
|
interface ExistingVisitFormProps {
|
|
10
|
-
closeWorkspace:
|
|
11
|
-
handleReturnToSearchList?: () => void;
|
|
10
|
+
closeWorkspace: Workspace2DefinitionProps['closeWorkspace'];
|
|
12
11
|
visit: Visit;
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -16,7 +15,7 @@ interface ExistingVisitFormProps {
|
|
|
16
15
|
* This is the form that appears when clicking on a search result in the "Add patient to queue" workspace,
|
|
17
16
|
* when the patient already has an active visit.
|
|
18
17
|
*/
|
|
19
|
-
const ExistingVisitForm: React.FC<ExistingVisitFormProps> = ({ visit, closeWorkspace
|
|
18
|
+
const ExistingVisitForm: React.FC<ExistingVisitFormProps> = ({ visit, closeWorkspace }) => {
|
|
20
19
|
const { t } = useTranslation();
|
|
21
20
|
const isTablet = useLayoutType() === 'tablet';
|
|
22
21
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
@@ -26,14 +25,6 @@ const ExistingVisitForm: React.FC<ExistingVisitFormProps> = ({ visit, closeWorks
|
|
|
26
25
|
submitQueueEntry: (visit: Visit) => Promise<unknown>;
|
|
27
26
|
} | null>(null);
|
|
28
27
|
|
|
29
|
-
const handleCloseWorkspace = useCallback(() => {
|
|
30
|
-
if (handleReturnToSearchList) {
|
|
31
|
-
handleReturnToSearchList();
|
|
32
|
-
} else {
|
|
33
|
-
closeWorkspace();
|
|
34
|
-
}
|
|
35
|
-
}, [closeWorkspace, handleReturnToSearchList]);
|
|
36
|
-
|
|
37
28
|
const handleSubmit = useCallback(
|
|
38
29
|
(event: React.FormEvent) => {
|
|
39
30
|
event.preventDefault();
|
|
@@ -47,7 +38,7 @@ const ExistingVisitForm: React.FC<ExistingVisitFormProps> = ({ visit, closeWorks
|
|
|
47
38
|
callback
|
|
48
39
|
.submitQueueEntry(visit)
|
|
49
40
|
.then(() => {
|
|
50
|
-
closeWorkspace();
|
|
41
|
+
closeWorkspace({ closeWindow: true, discardUnsavedChanges: true });
|
|
51
42
|
mutateQueueEntries();
|
|
52
43
|
})
|
|
53
44
|
.finally(() => {
|
|
@@ -81,7 +72,10 @@ const ExistingVisitForm: React.FC<ExistingVisitFormProps> = ({ visit, closeWorks
|
|
|
81
72
|
<QueueFields setOnSubmit={handleSetOnSubmit} />
|
|
82
73
|
</div>
|
|
83
74
|
<ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
|
|
84
|
-
<Button
|
|
75
|
+
<Button
|
|
76
|
+
className={styles.button}
|
|
77
|
+
kind="secondary"
|
|
78
|
+
onClick={() => closeWorkspace({ discardUnsavedChanges: false })}>
|
|
85
79
|
{t('discard', 'Discard')}
|
|
86
80
|
</Button>
|
|
87
81
|
<Button className={styles.button} disabled={isSubmitting || !callback} kind="primary" type="submit">
|
package/src/index.ts
CHANGED
|
@@ -121,7 +121,6 @@ export const transitionOverflowMenuItem = getAsyncLifecycle(
|
|
|
121
121
|
},
|
|
122
122
|
);
|
|
123
123
|
|
|
124
|
-
// t('addNewQueueService', 'Add New Queue Service')
|
|
125
124
|
export const addNewQueueServiceWorkspace = getAsyncLifecycle(
|
|
126
125
|
() => import('./admin/queue-services/queue-service-form.workspace'),
|
|
127
126
|
{
|
|
@@ -130,7 +129,6 @@ export const addNewQueueServiceWorkspace = getAsyncLifecycle(
|
|
|
130
129
|
},
|
|
131
130
|
);
|
|
132
131
|
|
|
133
|
-
// t('addNewQueueServiceRoom', 'Add new queue service room')
|
|
134
132
|
export const addNewQueueServiceRoomWorkspace = getAsyncLifecycle(
|
|
135
133
|
() => import('./admin/queue-rooms/queue-room-form.workspace'),
|
|
136
134
|
{
|