@openmrs/esm-patient-chart-app 11.3.1-patch.9310 → 11.3.1-patch.9508
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 +18 -21
- package/dist/1119.js +1 -1
- package/dist/1197.js +1 -1
- package/dist/2146.js +1 -1
- package/dist/2540.js +1 -0
- package/dist/2540.js.map +1 -0
- package/dist/2690.js +1 -1
- package/dist/276.js +1 -0
- package/dist/276.js.map +1 -0
- package/dist/2761.js.map +1 -1
- package/dist/3099.js +1 -1
- package/dist/{8278.js → 3119.js} +1 -1
- package/dist/{8278.js.map → 3119.js.map} +1 -1
- package/dist/3584.js +1 -1
- package/dist/3905.js +1 -0
- package/dist/3905.js.map +1 -0
- package/dist/4055.js +1 -1
- package/dist/4132.js +1 -1
- package/dist/4300.js +1 -1
- package/dist/4335.js +1 -1
- package/dist/439.js +1 -0
- package/dist/4618.js +1 -1
- package/dist/4652.js +1 -1
- package/dist/4944.js +1 -1
- package/dist/5048.js +1 -0
- package/dist/5048.js.map +1 -0
- package/dist/506.js +2 -0
- package/dist/506.js.map +1 -0
- package/dist/5173.js +1 -1
- package/dist/5241.js +1 -1
- package/dist/5442.js +1 -1
- package/dist/5661.js +1 -1
- package/dist/5670.js +1 -1
- package/dist/6022.js +1 -1
- package/dist/6411.js +1 -1
- package/dist/6411.js.map +1 -1
- package/dist/6468.js +1 -1
- package/dist/6568.js +1 -1
- package/dist/6568.js.map +1 -1
- package/dist/6589.js +1 -0
- package/dist/6679.js +1 -1
- package/dist/6840.js +1 -1
- package/dist/6859.js +1 -1
- package/dist/6924.js +1 -1
- package/dist/6924.js.map +1 -1
- package/dist/{9294.js → 6997.js} +1 -1
- package/dist/6997.js.map +1 -0
- package/dist/7097.js +1 -1
- package/dist/7159.js +1 -1
- package/dist/723.js +1 -1
- package/dist/7617.js +1 -1
- package/dist/7810.js +1 -0
- package/dist/7810.js.map +1 -0
- package/dist/7822.js +1 -1
- package/dist/7822.js.map +1 -1
- package/dist/795.js +1 -1
- package/dist/8163.js +1 -1
- package/dist/8260.js +1 -1
- package/dist/8260.js.map +1 -1
- package/dist/8349.js +1 -1
- package/dist/8371.js +1 -0
- package/dist/8454.js +1 -1
- package/dist/8454.js.map +1 -1
- package/dist/8618.js +1 -1
- package/dist/8709.js +1 -1
- package/dist/8709.js.map +1 -1
- package/dist/890.js +1 -1
- package/dist/9214.js +1 -1
- package/dist/9538.js +1 -1
- package/dist/9569.js +1 -1
- package/dist/986.js +1 -1
- package/dist/9879.js +1 -1
- package/dist/9895.js +1 -1
- package/dist/9900.js +1 -1
- package/dist/9913.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-chart-app.js +1 -1
- package/dist/openmrs-esm-patient-chart-app.js.buildmanifest.json +375 -285
- package/dist/openmrs-esm-patient-chart-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/actions-buttons/mark-patient-deceased.component.tsx +2 -2
- package/src/actions-buttons/start-visit.component.tsx +5 -10
- package/src/actions-buttons/start-visit.test.tsx +5 -9
- package/src/clinical-views/encounter-list/encounter-list-tabs.extension.tsx +2 -2
- package/src/clinical-views/utils/encounter-list-config-builder.ts +19 -6
- package/src/clinical-views/utils/helpers.ts +5 -4
- package/src/index.ts +18 -12
- package/src/mark-patient-deceased/mark-patient-deceased-form.test.tsx +9 -15
- package/src/mark-patient-deceased/mark-patient-deceased-form.workspace.tsx +138 -147
- package/src/patient-banner-tags/visit-attribute-tags.extension.tsx +21 -13
- package/src/patient-banner-tags/visit-attribute-tags.scss +8 -0
- package/src/patient-chart/chart-review/dashboard-view.component.tsx +2 -2
- package/src/patient-chart/chart-review/dashboard-view.scss +5 -0
- package/src/patient-chart/patient-chart.component.tsx +41 -50
- package/src/patient-chart/patient-chart.resources.ts +10 -52
- package/src/routes.json +7 -18
- package/src/visit/hooks/useDeleteVisit.tsx +1 -1
- package/src/visit/start-visit-button.component.tsx +2 -2
- package/src/visit/start-visit-button.test.tsx +2 -2
- package/src/visit/visit-action-items/edit-visit-details.component.tsx +8 -29
- package/src/visit/visit-form/base-visit-type.component.tsx +30 -21
- package/src/visit/visit-form/exported-visit-form.workspace.tsx +3 -0
- package/src/visit/visit-form/visit-form.test.tsx +18 -27
- package/src/visit/visit-form/visit-form.workspace.tsx +653 -35
- package/src/visit/visit-history-table/visit-actions-cell.component.tsx +2 -3
- package/src/visit/visit-history-table/visit-date-cell.component.tsx +0 -1
- package/src/visit/visit-history-table/visit-diagnoses-cell.component.tsx +0 -1
- package/src/visit/visit-history-table/visit-history-table.component.tsx +2 -3
- package/src/visit/visit-history-table/visit-type-cell.component.tsx +0 -1
- package/src/visit/visit-prompt/delete-visit-dialog.test.tsx +1 -1
- package/src/visit/visit-prompt/{end-visit-dialog.modal.tsx → end-visit-dialog.component.tsx} +1 -1
- package/src/visit/visit-prompt/end-visit-dialog.test.tsx +1 -1
- package/src/visit/visit-prompt/{start-visit-dialog.modal.tsx → start-visit-dialog.component.tsx} +4 -10
- package/src/visit/visit-prompt/start-visit-dialog.test.tsx +3 -3
- package/src/visit/visits-widget/current-visit-summary.extension.tsx +3 -3
- package/src/visit/visits-widget/past-visits-components/encounters-table/encounters-table.component.tsx +35 -12
- package/src/visit/visits-widget/visit-context/retrospective-data-date-time-picker/retrospective-date-time-picker.component.tsx +0 -1
- package/src/visit/visits-widget/visit-context/visit-context-switcher.modal.tsx +2 -2
- package/src/visit/visits-widget/visit-context/visit-context-switcher.test.tsx +20 -22
- package/src/visit/visits-widget/visit-detail-overview.component.tsx +2 -3
- package/src/visit/visits-widget/visit-detail-overview.test.tsx +4 -4
- package/translations/am.json +1 -2
- package/translations/ar.json +2 -3
- package/translations/ar_SY.json +1 -2
- package/translations/bn.json +1 -2
- package/translations/cs.json +196 -0
- package/translations/de.json +1 -2
- package/translations/en.json +1 -1
- package/translations/en_US.json +1 -2
- package/translations/es.json +2 -3
- package/translations/es_MX.json +1 -2
- package/translations/fr.json +7 -8
- package/translations/he.json +2 -3
- package/translations/hi.json +1 -2
- package/translations/hi_IN.json +1 -2
- package/translations/id.json +2 -3
- package/translations/it.json +2 -3
- package/translations/ka.json +2 -3
- package/translations/km.json +2 -3
- package/translations/ku.json +1 -2
- package/translations/ky.json +1 -2
- package/translations/lg.json +1 -2
- package/translations/ne.json +1 -2
- package/translations/pl.json +1 -2
- package/translations/pt.json +2 -3
- package/translations/pt_BR.json +2 -3
- package/translations/qu.json +1 -2
- package/translations/ro_RO.json +2 -3
- package/translations/ru_RU.json +1 -2
- package/translations/si.json +1 -2
- package/translations/sq.json +196 -0
- package/translations/sw.json +1 -2
- package/translations/sw_KE.json +1 -2
- package/translations/tr.json +1 -2
- package/translations/tr_TR.json +1 -2
- package/translations/uk.json +1 -2
- package/translations/uz.json +1 -2
- package/translations/uz@Latn.json +1 -2
- package/translations/uz_UZ.json +1 -2
- package/translations/vi.json +2 -3
- package/translations/zh.json +2 -3
- package/translations/zh_CN.json +2 -3
- package/translations/zh_TW.json +196 -0
- package/dist/1815.js +0 -2
- package/dist/1815.js.map +0 -1
- package/dist/3697.js +0 -1
- package/dist/3697.js.map +0 -1
- package/dist/5827.js +0 -1
- package/dist/5827.js.map +0 -1
- package/dist/7818.js +0 -1
- package/dist/7818.js.map +0 -1
- package/dist/9294.js.map +0 -1
- package/dist/9329.js +0 -1
- package/dist/9329.js.map +0 -1
- /package/dist/{1815.js.LICENSE.txt → 506.js.LICENSE.txt} +0 -0
- /package/src/visit/visit-prompt/{delete-visit-dialog.modal.tsx → delete-visit-dialog.component.tsx} +0 -0
package/src/routes.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.openmrs.org/routes.schema.json",
|
|
3
3
|
"optionalBackendDependencies": {
|
|
4
4
|
"emrapi": {
|
|
5
|
-
"version": "
|
|
5
|
+
"version": ">=2.0.0 <4.0.0",
|
|
6
6
|
"feature": {
|
|
7
7
|
"flagName": "emrapi-module",
|
|
8
8
|
"label": "EMR API Module",
|
|
@@ -225,29 +225,18 @@
|
|
|
225
225
|
"offline": true
|
|
226
226
|
}
|
|
227
227
|
],
|
|
228
|
-
"
|
|
228
|
+
"workspaces": [
|
|
229
229
|
{
|
|
230
230
|
"name": "mark-patient-deceased-workspace-form",
|
|
231
231
|
"component": "markPatientDeceasedForm",
|
|
232
|
-
"
|
|
232
|
+
"title": "Mark patient deceased",
|
|
233
|
+
"type": "form"
|
|
233
234
|
},
|
|
234
235
|
{
|
|
235
236
|
"name": "start-visit-workspace-form",
|
|
236
237
|
"component": "startVisitWorkspace",
|
|
237
|
-
"
|
|
238
|
+
"title": "startVisitWorkspaceTitle",
|
|
239
|
+
"type": "start-visit"
|
|
238
240
|
}
|
|
239
|
-
]
|
|
240
|
-
"workspaceWindows2": [
|
|
241
|
-
{
|
|
242
|
-
"name": "start-visit",
|
|
243
|
-
"group": "patient-chart"
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"name": "mark-patient-deceased",
|
|
247
|
-
"group": "patient-chart"
|
|
248
|
-
}
|
|
249
|
-
],
|
|
250
|
-
"workspaceGroups2": [{
|
|
251
|
-
"name":"patient-chart"
|
|
252
|
-
}]
|
|
241
|
+
]
|
|
253
242
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Button } from '@carbon/react';
|
|
4
|
-
import {
|
|
4
|
+
import { launchWorkspace, showSnackbar } from '@openmrs/esm-framework';
|
|
5
5
|
|
|
6
6
|
interface StartVisitButtonProps {
|
|
7
7
|
patientUuid: string;
|
|
@@ -20,7 +20,7 @@ const StartVisitButton = ({ patientUuid, handleReturnToSearchList, hidePatientSe
|
|
|
20
20
|
hidePatientSearch?.();
|
|
21
21
|
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
launchWorkspace(startVisitWorkspaceForm, {
|
|
24
24
|
patientUuid,
|
|
25
25
|
openedFrom: 'patient-chart-start-visit',
|
|
26
26
|
handleReturnToSearchList,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
|
-
import {
|
|
4
|
+
import { launchWorkspace } from '@openmrs/esm-framework';
|
|
5
5
|
import { mockPatient } from 'tools';
|
|
6
6
|
import StartVisitButton from './start-visit-button.component';
|
|
7
7
|
|
|
8
|
-
const mockLaunchWorkspace = jest.mocked(
|
|
8
|
+
const mockLaunchWorkspace = jest.mocked(launchWorkspace);
|
|
9
9
|
|
|
10
10
|
describe('StartVisitButton', () => {
|
|
11
11
|
it('renders the start visit button', () => {
|
|
@@ -6,20 +6,13 @@ import {
|
|
|
6
6
|
UserHasAccess,
|
|
7
7
|
type Visit,
|
|
8
8
|
getCoreTranslation,
|
|
9
|
-
|
|
9
|
+
launchWorkspace,
|
|
10
10
|
useLayoutType,
|
|
11
11
|
} from '@openmrs/esm-framework';
|
|
12
|
-
import { type VisitFormProps } from '../visit-form/visit-form.workspace';
|
|
13
|
-
import {
|
|
14
|
-
invalidateVisitAndEncounterData,
|
|
15
|
-
invalidateVisitByUuid,
|
|
16
|
-
type PatientWorkspaceGroupProps,
|
|
17
|
-
} from '@openmrs/esm-patient-common-lib';
|
|
18
|
-
import { useSWRConfig } from 'swr';
|
|
19
12
|
|
|
20
13
|
interface EditVisitDetailsActionItemProps {
|
|
14
|
+
patientUuid: string;
|
|
21
15
|
visit: Visit;
|
|
22
|
-
patient: fhir.Patient;
|
|
23
16
|
|
|
24
17
|
/**
|
|
25
18
|
* If true, renders as IconButton instead
|
|
@@ -27,32 +20,18 @@ interface EditVisitDetailsActionItemProps {
|
|
|
27
20
|
compact?: boolean;
|
|
28
21
|
}
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
* This component
|
|
32
|
-
*/
|
|
33
|
-
const EditVisitDetailsActionItem: React.FC<EditVisitDetailsActionItemProps> = ({ visit, patient, compact }) => {
|
|
23
|
+
const EditVisitDetailsActionItem: React.FC<EditVisitDetailsActionItemProps> = ({ visit, compact }) => {
|
|
34
24
|
const { t } = useTranslation();
|
|
35
|
-
const { mutate: globalMutate } = useSWRConfig();
|
|
36
25
|
|
|
37
26
|
const isTablet = useLayoutType() === 'tablet';
|
|
38
27
|
const responsiveSize = isTablet ? 'lg' : 'sm';
|
|
39
|
-
const patientUuid = patient.id;
|
|
40
28
|
|
|
41
29
|
const editVisitDetails = () => {
|
|
42
|
-
|
|
43
|
-
'
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
patient,
|
|
48
|
-
patientUuid: patientUuid,
|
|
49
|
-
visitContext: visit,
|
|
50
|
-
mutateVisitContext: () => {
|
|
51
|
-
invalidateVisitByUuid(globalMutate, visit.uuid);
|
|
52
|
-
invalidateVisitAndEncounterData(globalMutate, patientUuid);
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
);
|
|
30
|
+
launchWorkspace('start-visit-workspace-form', {
|
|
31
|
+
workspaceTitle: t('editVisitDetails', 'Edit visit details'),
|
|
32
|
+
visitToEdit: visit,
|
|
33
|
+
openedFrom: 'patient-chart-edit-visit',
|
|
34
|
+
});
|
|
56
35
|
};
|
|
57
36
|
|
|
58
37
|
return (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { useState, useMemo, useCallback, type ChangeEvent } from 'react';
|
|
1
|
+
import React, { useState, useMemo, useCallback, useEffect, useRef, type ChangeEvent } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
+
import { Layer, RadioButton, RadioButtonGroup, Search, StructuredListSkeleton, Tile } from '@carbon/react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
5
|
-
import { Layer, RadioButton, RadioButtonGroup, Search, StructuredListSkeleton, Tile } from '@carbon/react';
|
|
6
6
|
import { PatientChartPagination } from '@openmrs/esm-patient-common-lib';
|
|
7
7
|
import { useDebounce, useLayoutType, usePagination, type VisitType } from '@openmrs/esm-framework';
|
|
8
8
|
import { type VisitFormData } from './visit-form.resource';
|
|
@@ -14,7 +14,7 @@ interface BaseVisitTypeProps {
|
|
|
14
14
|
|
|
15
15
|
const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ visitTypes }) => {
|
|
16
16
|
const { t } = useTranslation();
|
|
17
|
-
const { control } = useFormContext<VisitFormData>();
|
|
17
|
+
const { control, setValue } = useFormContext<VisitFormData>();
|
|
18
18
|
const isTablet = useLayoutType() === 'tablet';
|
|
19
19
|
const [searchTerm, setSearchTerm] = useState<string>('');
|
|
20
20
|
const debouncedSearchTerm = useDebounce(searchTerm, 300);
|
|
@@ -29,30 +29,40 @@ const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ visitTypes }) => {
|
|
|
29
29
|
|
|
30
30
|
const { results, currentPage, goTo } = usePagination(searchResults, 5);
|
|
31
31
|
const hasNoMatchingSearchResults = debouncedSearchTerm.trim() !== '' && searchResults.length === 0;
|
|
32
|
+
const prevSearchTermRef = useRef(debouncedSearchTerm);
|
|
32
33
|
|
|
33
34
|
const handleSearchTermChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {
|
|
34
35
|
setSearchTerm(e.target.value);
|
|
35
36
|
}, []);
|
|
36
37
|
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (searchResults?.length === 1) {
|
|
40
|
+
setValue('visitType', searchResults[0].uuid);
|
|
41
|
+
}
|
|
42
|
+
}, [searchResults, setValue]);
|
|
43
|
+
|
|
44
|
+
// Reset pagination to page 1 when search term changes
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (prevSearchTermRef.current !== debouncedSearchTerm && currentPage !== 1) {
|
|
47
|
+
goTo(1);
|
|
48
|
+
}
|
|
49
|
+
prevSearchTermRef.current = debouncedSearchTerm;
|
|
50
|
+
}, [debouncedSearchTerm, currentPage, goTo]);
|
|
51
|
+
|
|
52
|
+
const searchComponent = (
|
|
53
|
+
<Search
|
|
54
|
+
labelText={t('searchForAVisitType', 'Search for a visit type')}
|
|
55
|
+
onChange={handleSearchTermChange}
|
|
56
|
+
placeholder={t('searchForAVisitType', 'Search for a visit type')}
|
|
57
|
+
value={searchTerm}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
|
|
37
61
|
return (
|
|
38
62
|
<div className={classNames(styles.visitTypeOverviewWrapper, isTablet ? styles.tablet : styles.desktop)}>
|
|
39
63
|
{visitTypes.length ? (
|
|
40
64
|
<>
|
|
41
|
-
{isTablet ?
|
|
42
|
-
<Layer>
|
|
43
|
-
<Search
|
|
44
|
-
labelText={t('searchForAVisitType', 'Search for a visit type')}
|
|
45
|
-
onChange={handleSearchTermChange}
|
|
46
|
-
placeholder={t('searchForAVisitType', 'Search for a visit type')}
|
|
47
|
-
/>
|
|
48
|
-
</Layer>
|
|
49
|
-
) : (
|
|
50
|
-
<Search
|
|
51
|
-
labelText={t('searchForAVisitType', 'Search for a visit type')}
|
|
52
|
-
onChange={handleSearchTermChange}
|
|
53
|
-
placeholder={t('searchForAVisitType', 'Search for a visit type')}
|
|
54
|
-
/>
|
|
55
|
-
)}
|
|
65
|
+
{isTablet ? <Layer>{searchComponent}</Layer> : searchComponent}
|
|
56
66
|
|
|
57
67
|
{hasNoMatchingSearchResults ? (
|
|
58
68
|
<div className={styles.tileContainer}>
|
|
@@ -67,7 +77,6 @@ const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ visitTypes }) => {
|
|
|
67
77
|
<Controller
|
|
68
78
|
name="visitType"
|
|
69
79
|
control={control}
|
|
70
|
-
defaultValue={results?.length === 1 ? results[0].uuid : null}
|
|
71
80
|
render={({ field: { onChange, value } }) => (
|
|
72
81
|
<RadioButtonGroup
|
|
73
82
|
className={styles.radioButtonGroup}
|
|
@@ -76,7 +85,7 @@ const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ visitTypes }) => {
|
|
|
76
85
|
orientation="vertical"
|
|
77
86
|
valueSelected={value}
|
|
78
87
|
>
|
|
79
|
-
{results.map(({
|
|
88
|
+
{results.map(({ display, uuid }) => (
|
|
80
89
|
<RadioButton
|
|
81
90
|
className={styles.radioButton}
|
|
82
91
|
id={`visit-type-${uuid}`}
|
|
@@ -97,7 +106,7 @@ const BaseVisitType: React.FC<BaseVisitTypeProps> = ({ visitTypes }) => {
|
|
|
97
106
|
onPageNumberChange={({ page }) => goTo(page)}
|
|
98
107
|
pageNumber={currentPage}
|
|
99
108
|
pageSize={5}
|
|
100
|
-
totalItems={
|
|
109
|
+
totalItems={searchResults.length}
|
|
101
110
|
/>
|
|
102
111
|
</div>
|
|
103
112
|
)}
|
|
@@ -21,6 +21,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|
|
21
21
|
import {
|
|
22
22
|
Extension,
|
|
23
23
|
ExtensionSlot,
|
|
24
|
+
launchWorkspaceGroup2,
|
|
24
25
|
OpenmrsFetchError,
|
|
25
26
|
saveVisit,
|
|
26
27
|
showSnackbar,
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
useConnectivity,
|
|
30
31
|
useEmrConfiguration,
|
|
31
32
|
useLayoutType,
|
|
33
|
+
useVisit,
|
|
32
34
|
type Visit,
|
|
33
35
|
Workspace2,
|
|
34
36
|
type Workspace2DefinitionProps,
|
|
@@ -37,6 +39,7 @@ import {
|
|
|
37
39
|
} from '@openmrs/esm-framework';
|
|
38
40
|
import {
|
|
39
41
|
createOfflineVisitForPatient,
|
|
42
|
+
invalidateVisitByUuid,
|
|
40
43
|
invalidateVisitAndEncounterData,
|
|
41
44
|
useActivePatientEnrollment,
|
|
42
45
|
} from '@openmrs/esm-patient-common-lib';
|
|
@@ -26,8 +26,10 @@ import {
|
|
|
26
26
|
useVisitFormCallbacks,
|
|
27
27
|
useVisitFormSchemaAndDefaultValues,
|
|
28
28
|
} from './visit-form.resource';
|
|
29
|
-
import VisitForm
|
|
30
|
-
|
|
29
|
+
import VisitForm from './visit-form.workspace';
|
|
30
|
+
|
|
31
|
+
// Fixed reference time used in time-dependent tests
|
|
32
|
+
const FIXED_NOW = new Date('2023-01-01T08:00:00.000Z');
|
|
31
33
|
|
|
32
34
|
const visitUuid = 'test_visit_uuid';
|
|
33
35
|
const visitAttributes = {
|
|
@@ -54,23 +56,20 @@ const visitAttributes = {
|
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
const mockCloseWorkspace = jest.fn();
|
|
59
|
+
const mockPromptBeforeClosing = jest.fn();
|
|
60
|
+
const mockSetTitle = jest.fn();
|
|
57
61
|
const mockMutateVisitContext = jest.fn();
|
|
58
|
-
|
|
62
|
+
|
|
63
|
+
const testProps = {
|
|
64
|
+
openedFrom: 'test',
|
|
65
|
+
patientUuid: mockPatient.id,
|
|
66
|
+
patient: mockPatient,
|
|
59
67
|
closeWorkspace: mockCloseWorkspace,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
patientUuid: mockPatient.id,
|
|
66
|
-
patient: mockPatient,
|
|
67
|
-
visitContext: null,
|
|
68
|
-
mutateVisitContext: mockMutateVisitContext,
|
|
69
|
-
},
|
|
70
|
-
workspaceName: '',
|
|
71
|
-
launchChildWorkspace: jest.fn(),
|
|
72
|
-
windowName: '',
|
|
73
|
-
isRootWorkspace: false,
|
|
68
|
+
closeWorkspaceWithSavedChanges: mockCloseWorkspace,
|
|
69
|
+
promptBeforeClosing: mockPromptBeforeClosing,
|
|
70
|
+
setTitle: mockSetTitle,
|
|
71
|
+
visitContext: null,
|
|
72
|
+
mutateVisitContext: mockMutateVisitContext,
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
const mockSaveVisit = jest.mocked(saveVisit);
|
|
@@ -156,10 +155,9 @@ jest.mock('../hooks/useDefaultFacilityLocation', () => {
|
|
|
156
155
|
|
|
157
156
|
return {
|
|
158
157
|
...requireActual,
|
|
159
|
-
|
|
158
|
+
useDefaultLoginLocation: jest.fn(() => ({
|
|
160
159
|
defaultFacility: null,
|
|
161
160
|
isLoading: false,
|
|
162
|
-
error: null,
|
|
163
161
|
})),
|
|
164
162
|
};
|
|
165
163
|
});
|
|
@@ -869,12 +867,5 @@ describe('useVisitFormSchemaAndDefaultValues', () => {
|
|
|
869
867
|
});
|
|
870
868
|
|
|
871
869
|
function renderVisitForm(visitToEdit?: Visit) {
|
|
872
|
-
|
|
873
|
-
...defaultProps,
|
|
874
|
-
groupProps: {
|
|
875
|
-
...defaultProps.groupProps,
|
|
876
|
-
visitContext: visitToEdit ?? null,
|
|
877
|
-
},
|
|
878
|
-
};
|
|
879
|
-
return render(<VisitForm {...props} />);
|
|
870
|
+
return render(<VisitForm {...{ ...testProps, visitToEdit }} />);
|
|
880
871
|
}
|