@kenyaemr/esm-patient-registration-app 8.1.2-pre.220 → 8.1.2-pre.236

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 (140) hide show
  1. package/.turbo/turbo-build.log +13 -39
  2. package/dist/116.js +1 -0
  3. package/dist/127.js +1 -0
  4. package/dist/177.js +1 -0
  5. package/dist/196.js +1 -0
  6. package/dist/196.js.map +1 -0
  7. package/dist/226.js +1 -0
  8. package/dist/226.js.map +1 -0
  9. package/dist/254.js +1 -0
  10. package/dist/273.js +1 -0
  11. package/dist/298.js +1 -0
  12. package/dist/298.js.map +1 -0
  13. package/dist/329.js +1 -0
  14. package/dist/329.js.map +1 -0
  15. package/dist/339.js +1 -0
  16. package/dist/381.js +1 -0
  17. package/dist/40.js +1 -0
  18. package/dist/436.js +1 -0
  19. package/dist/436.js.map +1 -0
  20. package/dist/465.js +1 -0
  21. package/dist/466.js +1 -0
  22. package/dist/466.js.map +1 -0
  23. package/dist/472.js +1 -0
  24. package/dist/472.js.map +1 -0
  25. package/dist/474.js +1 -0
  26. package/dist/535.js +1 -0
  27. package/dist/535.js.map +1 -0
  28. package/dist/547.js +6 -0
  29. package/dist/547.js.map +1 -0
  30. package/dist/549.js +1 -0
  31. package/dist/553.js +1 -0
  32. package/dist/553.js.map +1 -0
  33. package/dist/566.js +1 -1
  34. package/dist/602.js +1 -0
  35. package/dist/602.js.map +1 -0
  36. package/dist/603.js +1 -0
  37. package/dist/631.js +1 -0
  38. package/dist/689.js +1 -0
  39. package/dist/689.js.map +1 -0
  40. package/dist/697.js +1 -0
  41. package/dist/697.js.map +1 -0
  42. package/dist/720.js +1 -0
  43. package/dist/751.js +1 -0
  44. package/dist/754.js +1 -0
  45. package/dist/799.js +1 -0
  46. package/dist/802.js +1 -0
  47. package/dist/827.js +1 -0
  48. package/dist/847.js +1 -0
  49. package/dist/847.js.map +1 -0
  50. package/dist/85.js +1 -0
  51. package/dist/85.js.map +1 -0
  52. package/dist/868.js +1 -0
  53. package/dist/882.js +1 -0
  54. package/dist/91.js +1 -0
  55. package/dist/91.js.map +1 -0
  56. package/dist/914.js +1 -0
  57. package/dist/914.js.map +1 -0
  58. package/dist/916.js +1 -0
  59. package/dist/925.js +1 -0
  60. package/dist/954.js +43 -0
  61. package/dist/954.js.map +1 -0
  62. package/dist/970.js +1 -0
  63. package/dist/998.js +1 -0
  64. package/dist/998.js.map +1 -0
  65. package/dist/kenyaemr-esm-patient-registration-app.js +6 -1
  66. package/dist/kenyaemr-esm-patient-registration-app.js.buildmanifest.json +416 -312
  67. package/dist/kenyaemr-esm-patient-registration-app.js.map +1 -1
  68. package/dist/main.js +11 -2
  69. package/dist/main.js.map +1 -1
  70. package/dist/routes.json +1 -1
  71. package/package.json +6 -9
  72. package/rspack.config.js +1 -0
  73. package/src/patient-registration/patient-registration.component.tsx +162 -90
  74. package/src/root.component.tsx +4 -2
  75. package/src/util/index.tsx +12 -0
  76. package/translations/am.json +1 -8
  77. package/translations/en.json +1 -8
  78. package/dist/100.js +0 -2
  79. package/dist/100.js.LICENSE.txt +0 -59
  80. package/dist/100.js.map +0 -1
  81. package/dist/108.js +0 -1
  82. package/dist/108.js.map +0 -1
  83. package/dist/130.js +0 -2
  84. package/dist/130.js.LICENSE.txt +0 -5
  85. package/dist/130.js.map +0 -1
  86. package/dist/169.js +0 -1
  87. package/dist/169.js.map +0 -1
  88. package/dist/2.js +0 -2
  89. package/dist/2.js.LICENSE.txt +0 -9
  90. package/dist/2.js.map +0 -1
  91. package/dist/236.js +0 -1
  92. package/dist/240.js +0 -1
  93. package/dist/261.js +0 -1
  94. package/dist/271.js +0 -1
  95. package/dist/272.js +0 -1
  96. package/dist/319.js +0 -1
  97. package/dist/325.js +0 -1
  98. package/dist/325.js.map +0 -1
  99. package/dist/336.js +0 -1
  100. package/dist/371.js +0 -1
  101. package/dist/371.js.map +0 -1
  102. package/dist/372.js +0 -1
  103. package/dist/372.js.map +0 -1
  104. package/dist/378.js +0 -1
  105. package/dist/460.js +0 -1
  106. package/dist/501.js +0 -1
  107. package/dist/501.js.map +0 -1
  108. package/dist/539.js +0 -1
  109. package/dist/574.js +0 -1
  110. package/dist/587.js +0 -1
  111. package/dist/587.js.map +0 -1
  112. package/dist/591.js +0 -2
  113. package/dist/591.js.LICENSE.txt +0 -32
  114. package/dist/591.js.map +0 -1
  115. package/dist/623.js +0 -1
  116. package/dist/623.js.map +0 -1
  117. package/dist/644.js +0 -1
  118. package/dist/652.js +0 -1
  119. package/dist/657.js +0 -1
  120. package/dist/657.js.map +0 -1
  121. package/dist/673.js +0 -1
  122. package/dist/705.js +0 -1
  123. package/dist/711.js +0 -1
  124. package/dist/727.js +0 -1
  125. package/dist/737.js +0 -1
  126. package/dist/744.js +0 -1
  127. package/dist/757.js +0 -1
  128. package/dist/76.js +0 -1
  129. package/dist/76.js.map +0 -1
  130. package/dist/784.js +0 -2
  131. package/dist/784.js.LICENSE.txt +0 -9
  132. package/dist/784.js.map +0 -1
  133. package/dist/788.js +0 -1
  134. package/dist/807.js +0 -1
  135. package/dist/833.js +0 -1
  136. package/dist/879.js +0 -1
  137. package/dist/879.js.map +0 -1
  138. package/dist/899.js +0 -1
  139. package/dist/main.js.LICENSE.txt +0 -59
  140. package/webpack.config.js +0 -1
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true}],"modals":[{"name":"cancel-patient-edit-modal","component":"cancelPatientEditModal"},{"name":"delete-identifier-confirmation-modal","component":"deleteIdentifierConfirmationModal"},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal"},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal"},{"component":"hieConfirmationModal","name":"hie-confirmation-modal"}],"version":"8.1.2-pre.220"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true}],"modals":[{"name":"cancel-patient-edit-modal","component":"cancelPatientEditModal"},{"name":"delete-identifier-confirmation-modal","component":"deleteIdentifierConfirmationModal"},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal"},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal"},{"component":"hieConfirmationModal","name":"hie-confirmation-modal"}],"version":"8.1.2-pre.236"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-patient-registration-app",
3
- "version": "8.1.2-pre.220",
3
+ "version": "8.1.2-pre.236",
4
4
  "description": "Patient registration microfrontend for the OpenMRS SPA",
5
5
  "browser": "dist/kenyaemr-esm-patient-registration-app.js",
6
6
  "main": "src/index.ts",
@@ -9,16 +9,16 @@
9
9
  "homepage": "https://github.com/openmrs/openmrs-esm-patient-management#readme",
10
10
  "scripts": {
11
11
  "start": "openmrs develop",
12
- "serve": "webpack serve --mode=development",
13
12
  "debug": "npm run serve",
14
- "build": "webpack --mode production",
15
- "analyze": "webpack --mode=production --env.analyze=true",
16
- "lint": "cross-env eslint src --ext ts,tsx",
13
+ "build": "rspack --mode=production",
14
+ "analyze": "rspack --mode=production --env analyze=true",
15
+ "lint": "eslint src --ext ts,tsx",
16
+ "serve": "rspack serve --mode=development",
17
17
  "test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests --color",
18
18
  "test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js --color",
19
19
  "coverage": "yarn test --coverage",
20
20
  "typescript": "tsc",
21
- "extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.extension.tsx' 'src/**/*modal.tsx' 'src/**/*.workspace.tsx' 'src/index.ts' 'src/patient-registration/validation/patient-registration-validation.ts' --config ../../tools/i18next-parser.config.js"
21
+ "extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.resource.tsx' 'src/**/*.extension.tsx' 'src/**/*modal.tsx' 'src/**/*.workspace.tsx' 'src/index.ts' --config ../../tools/i18next-parser.config.js"
22
22
  },
23
23
  "browserslist": [
24
24
  "extends browserslist-config-openmrs"
@@ -51,8 +51,5 @@
51
51
  "react-router-dom": "6.x",
52
52
  "swr": "2.x"
53
53
  },
54
- "devDependencies": {
55
- "webpack": "^5.74.0"
56
- },
57
54
  "stableVersion": "8.0.2"
58
55
  }
@@ -0,0 +1 @@
1
+ module.exports = require('openmrs/default-rspack-config');
@@ -13,6 +13,9 @@ import {
13
13
  usePatient,
14
14
  usePatientPhoto,
15
15
  useFeatureFlag,
16
+ launchWorkspace,
17
+ closeWorkspace,
18
+ navigate,
16
19
  } from '@openmrs/esm-framework';
17
20
  import { getValidationSchema } from './validation/patient-registration-validation';
18
21
  import { type CapturePhotoProps, type FormValues } from './patient-registration.types';
@@ -65,6 +68,7 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
65
68
  const [enableClientRegistry, setEnableClientRegistry] = useState(
66
69
  inEditMode ? initialFormValues.identifiers['nationalUniquePatientIdentifier']?.identifierValue : false,
67
70
  );
71
+ const [formSavedSuccessfully, setFormSavedSuccessfully] = useState(false);
68
72
 
69
73
  useEffect(() => {
70
74
  if (initialMPIFormValues) {
@@ -107,6 +111,43 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
107
111
  abortController,
108
112
  );
109
113
 
114
+ helpers.resetForm({ values });
115
+
116
+ setFormSavedSuccessfully((prev) => {
117
+ setTimeout(() => {
118
+ const patientUuid = values.patientUuid;
119
+ const patientChartUrl = config.links?.submitButton
120
+ ? interpolateUrl(config.links.submitButton, { patientUuid })
121
+ : `\${openmrsSpaBase}/patient/${patientUuid}/chart`;
122
+
123
+ if (inEditMode) {
124
+ navigate({ to: patientChartUrl });
125
+ } else {
126
+ launchWorkspace('start-visit-workspace-form', {
127
+ patientUuid: patientUuid,
128
+ workspaceTitle: t('checkInPatientWorkspaceTitle', 'Check in patient'),
129
+ closeWorkspace: () => {
130
+ closeWorkspace('start-visit-workspace-form', {
131
+ onWorkspaceClose: () => {
132
+ navigate({ to: patientChartUrl });
133
+ },
134
+ ignoreChanges: true,
135
+ });
136
+ },
137
+ closeWorkspaceWithSavedChanges: () => {
138
+ closeWorkspace('start-visit-workspace-form', {
139
+ onWorkspaceClose: () => {
140
+ navigate({ to: patientChartUrl });
141
+ },
142
+ ignoreChanges: true,
143
+ });
144
+ },
145
+ });
146
+ }
147
+ }, 100);
148
+ return true;
149
+ });
150
+
110
151
  showSnackbar({
111
152
  subtitle: inEditMode
112
153
  ? t('updatePatientSuccessSnackbarSubtitle', "The patient's information has been successfully updated")
@@ -120,17 +161,49 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
120
161
  kind: 'success',
121
162
  isLowContrast: true,
122
163
  });
123
-
124
- const afterUrl = new URLSearchParams(search).get('afterUrl');
125
- const redirectUrl = interpolateUrl(afterUrl || config.links.submitButton, { patientUuid: values.patientUuid });
126
-
127
- setTarget(redirectUrl);
128
164
  } catch (error) {
129
165
  const fieldErrors = Object.entries(error.responseBody?.error?.fieldErrors || {}) as Array<
130
166
  [string, Array<{ code: string; message: string }>]
131
167
  >;
132
168
 
133
169
  if (savePatientTransactionManager.current.patientSaved) {
170
+ helpers.resetForm({ values });
171
+ setFormSavedSuccessfully((prev) => {
172
+ setTimeout(() => {
173
+ const patientUuid = values.patientUuid;
174
+ const patientChartUrl = config.links?.submitButton
175
+ ? interpolateUrl(config.links.submitButton, { patientUuid })
176
+ : `\${openmrsSpaBase}/patient/${patientUuid}/chart`;
177
+
178
+ if (inEditMode) {
179
+ navigate({ to: patientChartUrl });
180
+ } else {
181
+ launchWorkspace('start-visit-workspace-form', {
182
+ patientUuid: patientUuid,
183
+ workspaceTitle: t('checkInPatientWorkspaceTitle', 'Check in patient'),
184
+ closeWorkspace: () => {
185
+ closeWorkspace('start-visit-workspace-form', {
186
+ onWorkspaceClose: () => {
187
+ navigate({ to: patientChartUrl });
188
+ },
189
+ ignoreChanges: true,
190
+ });
191
+ },
192
+ closeWorkspaceWithSavedChanges: () => {
193
+ closeWorkspace('start-visit-workspace-form', {
194
+ onWorkspaceClose: () => {
195
+ navigate({ to: patientChartUrl });
196
+ },
197
+ ignoreChanges: true,
198
+ });
199
+ },
200
+ });
201
+ }
202
+ }, 100);
203
+
204
+ return true;
205
+ });
206
+
134
207
  fieldErrors.forEach(([field, error]) => {
135
208
  const errorMessage = error.map((e) => e.message).join(', ');
136
209
  showSnackbar({
@@ -140,10 +213,6 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
140
213
  timeoutInMs: 8000,
141
214
  });
142
215
  });
143
- const afterUrl = new URLSearchParams(search).get('afterUrl');
144
- const redirectUrl = interpolateUrl(afterUrl || config.links.submitButton, { patientUuid: values.patientUuid });
145
-
146
- setTarget(redirectUrl);
147
216
  }
148
217
 
149
218
  if (error.responseBody?.error?.globalErrors) {
@@ -182,6 +251,7 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
182
251
  </ul>
183
252
  );
184
253
  };
254
+
185
255
  const enableRegistryButton = healthInformationExchangeFlag ? false : !enableClientRegistry;
186
256
 
187
257
  const displayErrors = (errors) => {
@@ -201,92 +271,94 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
201
271
  initialValues={initialFormValues}
202
272
  validationSchema={validationSchema}
203
273
  onSubmit={onFormSubmit}>
204
- {(props) => (
205
- <Form className={styles.form}>
206
- <BeforeSavePrompt when={Object.keys(props.touched).length > 0} redirect={target} />
207
- <div className={styles.formContainer}>
208
- <div>
209
- <div className={styles.stickyColumn}>
210
- <h4>
211
- {inEditMode
212
- ? t('editPatientDetails', 'Edit patient details')
213
- : t('createNewPatient', 'Create new patient')}
214
- </h4>
215
- {showDummyData && <DummyDataInput setValues={props.setValues} />}
216
- <p className={styles.label01}>{t('jumpTo', 'Jump to')}</p>
217
- {sections.map((section) => (
218
- <div className={classNames(styles.space05, styles.touchTarget)} key={section.name}>
219
- <Link className={styles.linkName} onClick={() => scrollIntoView(section.id)}>
220
- <XAxis size={16} /> {t(`${section.id}Section`, section.name)}
221
- </Link>
222
- </div>
223
- ))}
224
- {!healthInformationExchangeFlag && (
274
+ {(props) => {
275
+ const touchedKeys = Object.keys(props.touched);
276
+ const whenCondition = touchedKeys.length > 0 && !formSavedSuccessfully;
277
+
278
+ return (
279
+ <Form className={styles.form}>
280
+ <BeforeSavePrompt when={whenCondition} redirect={target} />
281
+ <div className={styles.formContainer}>
282
+ <div>
283
+ <div className={styles.stickyColumn}>
284
+ <h4>
285
+ {inEditMode
286
+ ? t('editPatientDetails', 'Edit patient details')
287
+ : t('createNewPatient', 'Create new patient')}
288
+ </h4>
289
+ {showDummyData && <DummyDataInput setValues={props.setValues} />}
290
+ <p className={styles.label01}>{t('jumpTo', 'Jump to')}</p>
291
+ {sections.map((section) => (
292
+ <div className={classNames(styles.space05, styles.touchTarget)} key={section.name}>
293
+ <Link className={styles.linkName} onClick={() => scrollIntoView(section.id)}>
294
+ <XAxis size={16} /> {t(`${section.id}Section`, section.name)}
295
+ </Link>
296
+ </div>
297
+ ))}
298
+ {!healthInformationExchangeFlag && (
299
+ <Button
300
+ renderIcon={ShareKnowledge}
301
+ disabled={!currentSession || !identifierTypes}
302
+ onClick={() => {
303
+ setEnableClientRegistry(true);
304
+ props.isValid
305
+ ? handleSavePatientToClientRegistry(props.values, props.setValues, inEditMode)
306
+ : props.validateForm().then((errors) => displayErrors(errors));
307
+ }}
308
+ className={styles.submitButton}>
309
+ {t('postToRegistry', 'Post to registry')}
310
+ </Button>
311
+ )}
225
312
  <Button
226
- renderIcon={ShareKnowledge}
227
- disabled={!currentSession || !identifierTypes}
228
- onClick={() => {
229
- setEnableClientRegistry(true);
230
- props.isValid
231
- ? handleSavePatientToClientRegistry(props.values, props.setValues, inEditMode)
232
- : props.validateForm().then((errors) => displayErrors(errors));
233
- }}
234
- className={styles.submitButton}>
235
- {t('postToRegistry', 'Post to registry')}
313
+ className={styles.submitButton}
314
+ type="submit"
315
+ onClick={() => props.validateForm().then((errors) => displayErrors(errors))}
316
+ disabled={!currentSession || !identifierTypes || props.isSubmitting || enableRegistryButton}>
317
+ {props.isSubmitting ? (
318
+ <InlineLoading
319
+ className={styles.spinner}
320
+ description={`${t('submitting', 'Submitting')} ...`}
321
+ iconDescription="submitting"
322
+ />
323
+ ) : inEditMode ? (
324
+ t('updatePatient', 'Update patient')
325
+ ) : (
326
+ t('registerPatient', 'Register patient')
327
+ )}
236
328
  </Button>
237
- )}
238
- <Button
239
- className={styles.submitButton}
240
- type="submit"
241
- onClick={() => props.validateForm().then((errors) => displayErrors(errors))}
242
- // Current session and identifiers are required for patient registration.
243
- // If currentSession or identifierTypes are not available, then the
244
- // user should be blocked to register the patient.
245
- disabled={!currentSession || !identifierTypes || props.isSubmitting || enableRegistryButton}>
246
- {props.isSubmitting ? (
247
- <InlineLoading
248
- className={styles.spinner}
249
- description={`${t('submitting', 'Submitting')} ...`}
250
- iconDescription="submitting"
329
+ <Button className={styles.cancelButton} kind="tertiary" onClick={cancelRegistration}>
330
+ {t('cancel', 'Cancel')}
331
+ </Button>
332
+ </div>
333
+ </div>
334
+ <div className={styles.infoGrid}>
335
+ <PatientRegistrationContext.Provider
336
+ value={{
337
+ identifierTypes: identifierTypes,
338
+ validationSchema,
339
+ values: props.values,
340
+ inEditMode,
341
+ setFieldValue: props.setFieldValue,
342
+ setFieldTouched: props.setFieldTouched,
343
+ setCapturePhotoProps,
344
+ currentPhoto: photo?.imageSrc,
345
+ isOffline,
346
+ initialFormValues: props.initialValues,
347
+ setInitialFormValues,
348
+ }}>
349
+ {sections.map((section, index) => (
350
+ <SectionWrapper
351
+ key={`registration-section-${section.id}`}
352
+ sectionDefinition={section}
353
+ index={index}
251
354
  />
252
- ) : inEditMode ? (
253
- t('updatePatient', 'Update patient')
254
- ) : (
255
- t('registerPatient', 'Register patient')
256
- )}
257
- </Button>
258
- <Button className={styles.cancelButton} kind="tertiary" onClick={cancelRegistration}>
259
- {t('cancel', 'Cancel')}
260
- </Button>
355
+ ))}
356
+ </PatientRegistrationContext.Provider>
261
357
  </div>
262
358
  </div>
263
- <div className={styles.infoGrid}>
264
- <PatientRegistrationContext.Provider
265
- value={{
266
- identifierTypes: identifierTypes,
267
- validationSchema,
268
- values: props.values,
269
- inEditMode,
270
- setFieldValue: props.setFieldValue,
271
- setFieldTouched: props.setFieldTouched,
272
- setCapturePhotoProps,
273
- currentPhoto: photo?.imageSrc,
274
- isOffline,
275
- initialFormValues: props.initialValues,
276
- setInitialFormValues,
277
- }}>
278
- {sections.map((section, index) => (
279
- <SectionWrapper
280
- key={`registration-section-${section.id}`}
281
- sectionDefinition={section}
282
- index={index}
283
- />
284
- ))}
285
- </PatientRegistrationContext.Provider>
286
- </div>
287
- </div>
288
- </Form>
289
- )}
359
+ </Form>
360
+ );
361
+ }}
290
362
  </Formik>
291
363
  );
292
364
  };
@@ -1,9 +1,9 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import useSWRImmutable from 'swr/immutable';
4
- import { BrowserRouter, Route, Routes } from 'react-router-dom';
4
+ import { BrowserRouter, Route, Routes, useLocation } from 'react-router-dom';
5
5
  import { Grid, Row } from '@carbon/react';
6
- import { ExtensionSlot, useConnectivity, useSession } from '@openmrs/esm-framework';
6
+ import { ExtensionSlot, useConnectivity, useSession, WorkspaceContainer } from '@openmrs/esm-framework';
7
7
  import {
8
8
  ResourcesContext,
9
9
  fetchAddressTemplate,
@@ -13,6 +13,7 @@ import {
13
13
  import { FormManager } from './patient-registration/form-manager';
14
14
  import { PatientRegistration } from './patient-registration/patient-registration.component';
15
15
  import styles from './root.scss';
16
+ import { WorkspaceWrapper } from './util';
16
17
 
17
18
  export default function Root() {
18
19
  const isOnline = useConnectivity();
@@ -55,6 +56,7 @@ export default function Root() {
55
56
  element={<PatientRegistration savePatientForm={savePatientForm} isOffline={!isOnline} />}
56
57
  />
57
58
  </Routes>
59
+ <WorkspaceWrapper />
58
60
  </BrowserRouter>
59
61
  </ResourcesContext.Provider>
60
62
  </Grid>
@@ -0,0 +1,12 @@
1
+ import React, { useMemo } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import { WorkspaceContainer } from '@openmrs/esm-framework';
4
+
5
+ export const WorkspaceWrapper = () => {
6
+ const location = useLocation();
7
+ const contextKey = useMemo(() => {
8
+ const path = location.pathname.replace(/^\/|\/$/g, '');
9
+ return path || 'patient-registration';
10
+ }, [location.pathname]);
11
+ return <WorkspaceContainer key={contextKey} contextKey={contextKey} overlay />;
12
+ };
@@ -6,11 +6,11 @@
6
6
  "autoGeneratedPlaceholderText": "በራስ-ሰር የመነጨ",
7
7
  "birthCertificate": "የትውልድ የምስክር ወረቀት",
8
8
  "birthdayNotInTheFuture": "የልደት ቀን ወደፊት ሊሆን አይችልም",
9
- "birthdayNotOver140YearsAgo": "የልደት ቀን ከ140 ዓመታት በፊት ሊሆን አይችልም",
10
9
  "birthdayRequired": "የልደት ቀን ያስፈልጋል",
11
10
  "birthFieldLabelText": "የትውልድ",
12
11
  "cancel": "ይቅር",
13
12
  "causeOfDeathInputLabel": "የሞት መንስኤ",
13
+ "checkInPatientWorkspaceTitle": "Check in patient",
14
14
  "clientRegistryEmpty": "ታካሚ ፍጠር እና አስገባ",
15
15
  "clientRegistryEmptys": "ታካሚ ፍጠር",
16
16
  "clientRegistryError": "የደንበኛ መዝገብን በሚያገኙበት ጊዜ ስህተት ተከስቷል",
@@ -33,17 +33,11 @@
33
33
  "dateOfBirth": "የትውልድ ቀን",
34
34
  "dateOfBirthLabelText": "የትውልድ ቀን",
35
35
  "deathCauseRequired": "የሞት መንስኤ ያስፈልጋል",
36
- "deathDateInFuture": "የሞት ቀን ወደፊት ሊሆን አይችልም",
37
36
  "deathDateInputLabel": "የሞት ቀን",
38
- "deathDateRequired": "የሞት ቀን ያስፈልጋል",
39
37
  "deathdayInvalidDate": "የሞት ቀን እና ሰዓት ከልደት ቀን በፊት ሊሆን አይችልም",
40
38
  "deathdayIsRequired": "ታካሚው እንደሞተ ምልክት ከተደረገበት የሞት ቀን ያስፈልጋል",
41
39
  "deathdayNotInTheFuture": "የሞት ቀን ወደፊት ሊሆን አይችልም",
42
40
  "deathSection": "የሞት መረጃ",
43
- "deathTimeFormatInvalid": "የሰዓት ቅርጸት ትክክል አይደለም",
44
- "deathTimeFormatRequired": "የሰዓት ቅርጸት ያስፈልጋል",
45
- "deathTimeInvalid": "ሰዓት ከቅርጸት 'hh:mm' ጋር አይዛመድም",
46
- "deathTimeRequired": "የሞት ሰዓት ያስፈልጋል",
47
41
  "deleteIdentifierModalHeading": "መለያ አስወግድ?",
48
42
  "deleteIdentifierModalText": " እሴቱ ነው ",
49
43
  "deleteIdentifierTooltip": "ሰርዝ",
@@ -100,7 +94,6 @@
100
94
  "no": "አይ",
101
95
  "nonCodedCauseOfDeath": "ያልተመዘገበ የሞት መንስኤ",
102
96
  "nonCodedCauseOfDeathRequired": "የሞት መንስኤ ያስፈልጋል",
103
- "nonsensicalYears": "የተገመቱ ዓመታት ከ140 በላይ ሊሆኑ አይችሉም",
104
97
  "numberInNameDubious": "በስም ውስጥ ያለው ቁጥር አጠራጣሪ ነው",
105
98
  "nupi": "NUPI",
106
99
  "obsFieldUnknownDatatype": "ለኦቢኤስ መስክ '{{fieldDefinitionId}}' ጽንሰ-ሀሳብ ያልታወቀ የውሂብ አይነት '{{datatypeName}}' አለው",
@@ -6,11 +6,11 @@
6
6
  "autoGeneratedPlaceholderText": "Auto-generated",
7
7
  "birthCertificate": "Birth Certificate",
8
8
  "birthdayNotInTheFuture": "Birthday cannot be in future",
9
- "birthdayNotOver140YearsAgo": "Birthday cannot be more than 140 years ago",
10
9
  "birthdayRequired": "Birthday is required",
11
10
  "birthFieldLabelText": "Birth",
12
11
  "cancel": "Cancel",
13
12
  "causeOfDeathInputLabel": "Cause of death",
13
+ "checkInPatientWorkspaceTitle": "Check in patient",
14
14
  "clientRegistryEmpty": "Create & Post Patient",
15
15
  "clientRegistryEmptys": "Create Patient",
16
16
  "clientRegistryError": "Error occurred while reaching the client registry",
@@ -33,17 +33,11 @@
33
33
  "dateOfBirth": "Date of birth",
34
34
  "dateOfBirthLabelText": "Date of birth",
35
35
  "deathCauseRequired": "Cause of death is required",
36
- "deathDateInFuture": "Death date cannot be in future",
37
36
  "deathDateInputLabel": "Date of death",
38
- "deathDateRequired": "Death date is required",
39
37
  "deathdayInvalidDate": "Death date and time cannot be before the birthday",
40
38
  "deathdayIsRequired": "Death date is required when the patient is marked as deceased.",
41
39
  "deathdayNotInTheFuture": "",
42
40
  "deathSection": "Death Info",
43
- "deathTimeFormatInvalid": "Time format is invalid",
44
- "deathTimeFormatRequired": "Time format is required",
45
- "deathTimeInvalid": "Time doesn't match the format 'hh:mm'",
46
- "deathTimeRequired": "Death time is required",
47
41
  "deleteIdentifierModalHeading": "Remove identifier?",
48
42
  "deleteIdentifierModalText": " has a value of ",
49
43
  "deleteIdentifierTooltip": "Delete",
@@ -100,7 +94,6 @@
100
94
  "no": "No",
101
95
  "nonCodedCauseOfDeath": "Non-coded cause of death",
102
96
  "nonCodedCauseOfDeathRequired": "Cause of death is required",
103
- "nonsensicalYears": "Estimated years cannot be more than 140",
104
97
  "numberInNameDubious": "Number in name is dubious",
105
98
  "nupi": "NUPI",
106
99
  "obsFieldUnknownDatatype": "Concept for obs field '{{fieldDefinitionId}}' has unknown datatype '{{datatypeName}}'",