@openmrs/esm-service-queues-app 9.2.1-pre.7115 → 9.2.1-pre.7125

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 (49) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/dist/3386.js +1 -1
  3. package/dist/3386.js.map +1 -1
  4. package/dist/3683.js +1 -1
  5. package/dist/3683.js.map +1 -1
  6. package/dist/4300.js +1 -1
  7. package/dist/5228.js +1 -1
  8. package/dist/5228.js.map +1 -1
  9. package/dist/5278.js +2 -0
  10. package/dist/5278.js.map +1 -0
  11. package/dist/5680.js +1 -1
  12. package/dist/5680.js.map +1 -1
  13. package/dist/714.js +1 -1
  14. package/dist/714.js.map +1 -1
  15. package/dist/8233.js +1 -0
  16. package/dist/8233.js.map +1 -0
  17. package/dist/8844.js +1 -1
  18. package/dist/8844.js.map +1 -1
  19. package/dist/9384.js +1 -1
  20. package/dist/9384.js.map +1 -1
  21. package/dist/9707.js +1 -1
  22. package/dist/9707.js.map +1 -1
  23. package/dist/main.js +1 -1
  24. package/dist/main.js.map +1 -1
  25. package/dist/openmrs-esm-service-queues-app.js +1 -1
  26. package/dist/openmrs-esm-service-queues-app.js.buildmanifest.json +81 -81
  27. package/dist/routes.json +1 -1
  28. package/package.json +1 -1
  29. package/src/admin/admin-page/admin-page.component.tsx +3 -3
  30. package/src/admin/queue-rooms/queue-room-form.workspace.tsx +88 -85
  31. package/src/admin/queue-services/queue-service-form.workspace.tsx +85 -83
  32. package/src/create-queue-entry/create-queue-entry.workspace.tsx +72 -61
  33. package/src/create-queue-entry/existing-visit-form/existing-visit-form.component.tsx +8 -14
  34. package/src/index.ts +0 -2
  35. package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +3 -21
  36. package/src/queue-table/components/add-patient-to-queue-button.component.tsx +45 -0
  37. package/src/queue-table/default-queue-table.component.tsx +4 -52
  38. package/src/routes.json +33 -15
  39. package/src/views/queue-tables-for-all-statuses.component.tsx +3 -20
  40. package/translations/en.json +1 -12
  41. package/dist/3050.js +0 -1
  42. package/dist/3050.js.map +0 -1
  43. package/dist/7706.js +0 -2
  44. package/dist/7706.js.map +0 -1
  45. package/src/hooks/usePatientSearchVisibility.tsx +0 -26
  46. package/src/queue-patient-linelists/queue-linelist-filter.scss +0 -53
  47. package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +0 -83
  48. package/src/queue-patient-linelists/queue-linelist-filter.workspace.tsx +0 -180
  49. /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<DefaultWorkspaceProps> = ({ closeWorkspace }) => {
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
- <Form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
103
- <Stack gap={4} className={styles.grid}>
104
- <Column>
105
- <Layer className={styles.input}>
106
- <Controller
107
- control={control}
108
- name="queueRoomName"
109
- render={({ field }) => (
110
- <TextInput
111
- {...field}
112
- id="queueRoomName"
113
- invalid={!!errors.queueRoomName}
114
- invalidText={errors.queueRoomName?.message}
115
- labelText={t('queueRoomName', 'Queue room name')}
116
- />
117
- )}
118
- />
119
- </Layer>
120
- </Column>
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
- <Column>
123
- <Layer className={styles.input}>
124
- <Controller
125
- name="queueLocation"
126
- control={control}
127
- render={({ field: { onChange, value, ...field } }) => (
128
- <Select
129
- {...field}
130
- id="queueRoomLocation"
131
- invalid={!!errors.queueLocation}
132
- invalidText={errors.queueLocation?.message}
133
- labelText={t('queueLocation', 'Queue location')}
134
- onChange={(e) => onChange(e.target.value)}
135
- value={value || ''}>
136
- <SelectItem text={t('selectQueueRoomLocation', 'Select a queue room location')} value="" />
137
- {queueLocations?.map((location) => (
138
- <SelectItem key={location.id} text={location.name} value={location.id}>
139
- {location.name}
140
- </SelectItem>
141
- ))}
142
- </Select>
143
- )}
144
- />
145
- </Layer>
146
- </Column>
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
- <Column>
149
- <Layer className={styles.input}>
150
- <Controller
151
- name="queueRoomService"
152
- control={control}
153
- render={({ field: { onChange, value, ...field } }) => (
154
- <Select
155
- {...field}
156
- id="queueRoomService"
157
- invalid={!!errors.queueRoomService}
158
- invalidText={errors.queueRoomService?.message}
159
- labelText={t('queueRoomService', 'Queue room service')}
160
- onChange={(e) => onChange(e.target.value)}
161
- value={value || ''}>
162
- <SelectItem text={t('selectQueueRoomService', 'Select a queue room service')} value="" />
163
- {queues?.map((service) => (
164
- <SelectItem key={service.uuid} text={service.display} value={service.uuid}>
165
- {service.display}
166
- </SelectItem>
167
- ))}
168
- </Select>
169
- )}
170
- />
171
- </Layer>
172
- </Column>
173
- </Stack>
174
- <ButtonSet className={classNames(isTablet ? styles.tablet : styles.desktop)}>
175
- <Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
176
- {getCoreTranslation('cancel', 'Cancel')}
177
- </Button>
178
- <Button className={styles.button} disabled={isSubmitting} kind="primary" type="submit">
179
- {isSubmitting ? (
180
- <InlineLoading description={t('saving', 'Saving') + '...'} />
181
- ) : (
182
- <span>{getCoreTranslation('save', 'Save')}</span>
183
- )}{' '}
184
- </Button>
185
- </ButtonSet>
186
- </Form>
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 { type DefaultWorkspaceProps, restBaseUrl, showSnackbar } from '@openmrs/esm-framework';
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<DefaultWorkspaceProps> = ({ closeWorkspace }) => {
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
- <Form onSubmit={handleSubmit(createQueue)} className={styles.form}>
96
- <Stack gap={5} className={styles.grid}>
97
- <Column>
98
- <Layer className={styles.input}>
99
- <Controller
100
- name="queueName"
101
- control={control}
102
- render={({ field }) => (
103
- <TextInput
104
- {...field}
105
- id="queueName"
106
- invalidText={errors.queueName?.message}
107
- invalid={!!errors.queueName}
108
- labelText={t('queueName', 'Queue name')}
109
- />
110
- )}
111
- />
112
- </Layer>
113
- </Column>
114
- <Column>
115
- <Layer className={styles.input}>
116
- <Controller
117
- name="queueServiceType"
118
- control={control}
119
- render={({ field }) => (
120
- <Select
121
- {...field}
122
- labelText={t('selectServiceType', 'Select a service type')}
123
- id="queueServiceType"
124
- invalid={!!errors?.queueServiceType}
125
- invalidText={errors?.queueServiceType?.message}>
126
- <SelectItem text={t('selectServiceType', 'Select a service type')} value="" />
127
- {queueConcepts?.length > 0 &&
128
- queueConcepts.map((concept) => (
129
- <SelectItem key={concept.uuid} text={concept.display} value={concept.uuid}>
130
- {concept.display}
131
- </SelectItem>
132
- ))}
133
- </Select>
134
- )}
135
- />
136
- </Layer>
137
- </Column>
138
- <Column>
139
- <Layer className={styles.input}>
140
- <Controller
141
- name="userLocation"
142
- control={control}
143
- render={({ field }) => (
144
- <Select
145
- {...field}
146
- id="location"
147
- invalid={!!errors?.userLocation}
148
- invalidText={errors?.userLocation?.message}
149
- labelText={t('selectALocation', 'Select a location')}>
150
- <SelectItem text={t('selectALocation', 'Select a location')} value="" />
151
- {queueLocations?.length > 0 &&
152
- queueLocations.map((location) => (
153
- <SelectItem key={location.id} text={location.name} value={location.id}>
154
- {location.name}
155
- </SelectItem>
156
- ))}
157
- </Select>
158
- )}
159
- />
160
- </Layer>
161
- </Column>
162
- </Stack>
163
- <ButtonSet className={styles.buttonSet}>
164
- <Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
165
- {t('cancel', 'Cancel')}
166
- </Button>
167
- <Button className={styles.button} disabled={isSubmitting} kind="primary" type="submit">
168
- {isSubmitting ? (
169
- <InlineLoading description={t('saving', 'Saving') + '...'} />
170
- ) : (
171
- <span>{t('save', 'Save')}</span>
172
- )}
173
- </Button>
174
- </ButtonSet>
175
- </Form>
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
- type DefaultWorkspaceProps,
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 PatientSearchProps extends DefaultWorkspaceProps {
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<PatientSearchProps> = ({
31
+ const CreateQueueEntryWorkspace: React.FC<
32
+ Workspace2DefinitionProps<
33
+ CreateQueueEntryWorkspaceProps,
34
+ {
35
+ startVisitWorkspaceName: string;
36
+ },
37
+ {}
38
+ >
39
+ > = ({
32
40
  closeWorkspace,
33
- promptBeforeClosing,
34
- selectedPatientUuid,
35
- currentServiceQueueUuid,
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
- return patient ? (
51
- <div className={styles.patientSearchContainer}>
52
- <AddPatientToQueueContextProvider value={{ currentServiceQueueUuid }}>
53
- <div className={styles.patientBannerContainer}>
54
- <div className={styles.patientBanner}>
55
- <div className={styles.patientPhoto} role="img">
56
- <PatientPhoto patientUuid={patient.id} patientName={patientName} />
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
- <PatientBannerPatientInfo patient={patient} />
59
- <PatientBannerToggleContactDetailsButton
60
- className={styles.toggleContactDetailsButton}
61
- showContactDetails={showContactDetails}
62
- toggleContactDetails={handleToggleContactDetails}
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
- {showContactDetails ? (
66
- <PatientBannerContactDetails deceased={patient.deceasedBoolean} patientId={patient.id} />
67
- ) : null}
68
- </div>
69
- <div className={styles.backButton}>
70
- <Button
71
- className={styles.backButton}
72
- kind="ghost"
73
- renderIcon={(props) => <ArrowLeftIcon size={24} {...props} />}
74
- iconDescription={t('backToSearchResults', 'Back to search results')}
75
- size="sm"
76
- onClick={() => handleReturnToSearchList?.()}>
77
- <span>{t('backToSearchResults', 'Back to search results')}</span>
78
- </Button>
79
- </div>
80
- {isLoading ? (
81
- <DataTableSkeleton role="progressbar" />
82
- ) : error ? (
83
- <ErrorState headerTitle={t('errorFetchingVisit', 'Error fetching patient visit')} error={error} />
84
- ) : activeVisit ? (
85
- <ExistingVisitFormComponent
86
- closeWorkspace={closeWorkspace}
87
- handleReturnToSearchList={handleReturnToSearchList}
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: () => void;
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, handleReturnToSearchList }) => {
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 className={styles.button} kind="secondary" onClick={handleCloseWorkspace}>
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
  {