@openmrs/esm-patient-notes-app 11.3.0 → 11.3.1-patch.9310
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 +22 -19
- package/dist/2499.js +2 -0
- package/dist/2499.js.map +1 -0
- package/dist/4400.js +1 -0
- package/dist/4400.js.map +1 -0
- package/dist/5670.js +1 -0
- package/dist/5670.js.map +1 -0
- package/dist/6336.js +1 -0
- package/dist/6336.js.map +1 -0
- package/dist/6554.js +2 -0
- package/dist/6554.js.map +1 -0
- package/dist/8051.js +1 -1
- package/dist/8051.js.map +1 -1
- package/dist/9444.js +1 -0
- package/dist/9444.js.map +1 -0
- package/dist/9538.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-notes-app.js +1 -1
- package/dist/openmrs-esm-patient-notes-app.js.buildmanifest.json +168 -168
- package/dist/openmrs-esm-patient-notes-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +5 -4
- package/src/dashboard.meta.ts +3 -1
- package/src/index.ts +0 -1
- package/src/notes/notes-overview.extension.tsx +57 -3
- package/src/notes/visit-notes-form.test.tsx +32 -13
- package/src/notes/visit-notes-form.workspace.tsx +238 -241
- package/src/routes.json +11 -11
- package/src/visit-note-action-button.extension.tsx +15 -9
- package/src/visit-note-action-button.test.tsx +13 -30
- package/translations/it.json +1 -1
- package/dist/1433.js +0 -1
- package/dist/1433.js.map +0 -1
- package/dist/2356.js +0 -1
- package/dist/2356.js.map +0 -1
- package/dist/3691.js +0 -2
- package/dist/3691.js.map +0 -1
- package/dist/521.js +0 -2
- package/dist/521.js.map +0 -1
- package/dist/5639.js +0 -1
- package/dist/5639.js.map +0 -1
- package/dist/717.js +0 -1
- package/dist/717.js.map +0 -1
- package/src/notes/notes-main.component.tsx +0 -62
- package/src/notes/notes-main.test.tsx +0 -101
- /package/dist/{521.js.LICENSE.txt → 2499.js.LICENSE.txt} +0 -0
- /package/dist/{3691.js.LICENSE.txt → 6554.js.LICENSE.txt} +0 -0
package/src/dashboard.meta.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type DashboardLinkConfig } from '@openmrs/esm-patient-common-lib';
|
|
2
|
+
|
|
3
|
+
export const dashboardMeta: DashboardLinkConfig & { slot: string } = {
|
|
2
4
|
slot: 'patient-chart-encounters-dashboard-slot',
|
|
3
5
|
title: 'Encounters',
|
|
4
6
|
path: 'Encounters',
|
package/src/index.ts
CHANGED
|
@@ -28,7 +28,6 @@ export function startupApp() {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const notesOverview = getSyncLifecycle(notesOverviewExtension, options);
|
|
31
|
-
|
|
32
31
|
export const visitNotesActionButton = getSyncLifecycle(visitNotesActionButtonExtension, options);
|
|
33
32
|
|
|
34
33
|
// t('visitNoteWorkspaceTitle', 'Visit Note')
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ComponentProps } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import
|
|
3
|
+
import { Button, DataTableSkeleton, InlineLoading } from '@carbon/react';
|
|
4
|
+
import { AddIcon, launchWorkspace, useLayoutType } from '@openmrs/esm-framework';
|
|
5
|
+
import {
|
|
6
|
+
CardHeader,
|
|
7
|
+
EmptyState,
|
|
8
|
+
ErrorState,
|
|
9
|
+
launchStartVisitPrompt,
|
|
10
|
+
usePatientChartStore,
|
|
11
|
+
} from '@openmrs/esm-patient-common-lib';
|
|
12
|
+
import { useVisitNotes } from './visit-notes.resource';
|
|
13
|
+
import PaginatedNotes from './paginated-notes.component';
|
|
14
|
+
import styles from './notes-overview.scss';
|
|
4
15
|
|
|
5
16
|
interface NotesOverviewProps {
|
|
6
17
|
patientUuid: string;
|
|
@@ -8,13 +19,56 @@ interface NotesOverviewProps {
|
|
|
8
19
|
basePath: string;
|
|
9
20
|
}
|
|
10
21
|
|
|
22
|
+
/**
|
|
23
|
+
* This extension uses the patient chart store and MUST only be mounted within the patient chart
|
|
24
|
+
*/
|
|
11
25
|
const NotesOverview: React.FC<NotesOverviewProps> = ({ patientUuid, patient, basePath }) => {
|
|
12
26
|
const pageSize = 5;
|
|
13
27
|
const { t } = useTranslation();
|
|
14
28
|
const pageUrl = `\${openmrsSpaBase}/patient/${patient.id}/chart/Forms & Notes`;
|
|
15
29
|
const urlLabel = t('seeAll', 'See all');
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
const { visitContext } = usePatientChartStore(patientUuid);
|
|
32
|
+
const displayText = t('visitNotes', 'Visit notes');
|
|
33
|
+
const headerTitle = t('visitNotes', 'Visit notes');
|
|
34
|
+
const { visitNotes, error, isLoading, isValidating } = useVisitNotes(patientUuid);
|
|
35
|
+
const layout = useLayoutType();
|
|
36
|
+
const isDesktop = layout === 'large-desktop' || layout === 'small-desktop';
|
|
37
|
+
|
|
38
|
+
const launchVisitNoteForm = React.useCallback(() => {
|
|
39
|
+
if (visitContext) {
|
|
40
|
+
launchWorkspace('visit-notes-form-workspace');
|
|
41
|
+
} else {
|
|
42
|
+
launchStartVisitPrompt();
|
|
43
|
+
}
|
|
44
|
+
}, [visitContext]);
|
|
45
|
+
|
|
46
|
+
if (isLoading) {
|
|
47
|
+
return <DataTableSkeleton role="progressbar" compact={isDesktop} zebra />;
|
|
48
|
+
}
|
|
49
|
+
if (error) {
|
|
50
|
+
return <ErrorState error={error} headerTitle={headerTitle} />;
|
|
51
|
+
}
|
|
52
|
+
if (!visitNotes?.length) {
|
|
53
|
+
return <EmptyState displayText={displayText} headerTitle={headerTitle} launchForm={launchVisitNoteForm} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className={styles.widgetCard}>
|
|
58
|
+
<CardHeader title={headerTitle}>
|
|
59
|
+
<span>{isValidating ? <InlineLoading /> : null}</span>
|
|
60
|
+
<Button
|
|
61
|
+
kind="ghost"
|
|
62
|
+
renderIcon={(props: ComponentProps<typeof AddIcon>) => <AddIcon size={16} {...props} />}
|
|
63
|
+
iconDescription="Add visit note"
|
|
64
|
+
onClick={launchVisitNoteForm}
|
|
65
|
+
>
|
|
66
|
+
{t('add', 'Add')}
|
|
67
|
+
</Button>
|
|
68
|
+
</CardHeader>
|
|
69
|
+
<PaginatedNotes notes={visitNotes} pageSize={pageSize} urlLabel={urlLabel} pageUrl={pageUrl} />
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
18
72
|
};
|
|
19
73
|
|
|
20
74
|
export default NotesOverview;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import { screen, render } from '@testing-library/react';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
type Encounter,
|
|
6
|
+
getDefaultsFromConfigSchema,
|
|
7
|
+
showSnackbar,
|
|
8
|
+
useConfig,
|
|
9
|
+
useSession,
|
|
10
|
+
} from '@openmrs/esm-framework';
|
|
11
|
+
import { type PatientWorkspace2DefinitionProps } from '@openmrs/esm-patient-common-lib';
|
|
5
12
|
import { fetchDiagnosisConceptsByName, saveVisitNote, updateVisitNote } from './visit-notes.resource';
|
|
6
13
|
import {
|
|
7
14
|
ConfigMock,
|
|
@@ -12,20 +19,32 @@ import {
|
|
|
12
19
|
} from '__mocks__';
|
|
13
20
|
import { configSchema, type ConfigObject } from '../config-schema';
|
|
14
21
|
import { mockPatient, getByTextWithMarkup } from 'tools';
|
|
15
|
-
import VisitNotesForm from './visit-notes-form.workspace';
|
|
22
|
+
import VisitNotesForm, { type VisitNotesFormProps } from './visit-notes-form.workspace';
|
|
16
23
|
|
|
17
|
-
const defaultProps = {
|
|
24
|
+
const defaultProps: PatientWorkspace2DefinitionProps<VisitNotesFormProps, {}> = {
|
|
18
25
|
closeWorkspace: jest.fn(),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
workspaceProps: {
|
|
27
|
+
formContext: 'creating' as const,
|
|
28
|
+
},
|
|
29
|
+
groupProps: {
|
|
30
|
+
patient: mockPatient,
|
|
31
|
+
patientUuid: mockPatient.id,
|
|
32
|
+
visitContext: null,
|
|
33
|
+
mutateVisitContext: null,
|
|
34
|
+
},
|
|
35
|
+
launchChildWorkspace: jest.fn(),
|
|
36
|
+
windowProps: {},
|
|
37
|
+
workspaceName: '',
|
|
38
|
+
windowName: '',
|
|
39
|
+
isRootWorkspace: false,
|
|
25
40
|
};
|
|
26
41
|
|
|
27
|
-
function renderVisitNotesForm(
|
|
28
|
-
|
|
42
|
+
function renderVisitNotesForm(workspaceProps: Partial<VisitNotesFormProps> = {}) {
|
|
43
|
+
const props = {
|
|
44
|
+
...defaultProps,
|
|
45
|
+
workspaceProps: { ...defaultProps.workspaceProps, ...workspaceProps },
|
|
46
|
+
};
|
|
47
|
+
render(<VisitNotesForm {...props} />);
|
|
29
48
|
}
|
|
30
49
|
|
|
31
50
|
const mockFetchDiagnosisConceptsByName = jest.mocked(fetchDiagnosisConceptsByName);
|
|
@@ -245,7 +264,7 @@ test('initializes form with existing encounter data when in edit mode', () => {
|
|
|
245
264
|
|
|
246
265
|
renderVisitNotesForm({
|
|
247
266
|
formContext: 'editing',
|
|
248
|
-
encounter: mockEncounter,
|
|
267
|
+
encounter: mockEncounter as any as Encounter, // TODO: fix
|
|
249
268
|
});
|
|
250
269
|
|
|
251
270
|
// Verify date is pre-filled
|
|
@@ -311,7 +330,7 @@ test('updates existing visit note when in edit mode', async () => {
|
|
|
311
330
|
|
|
312
331
|
renderVisitNotesForm({
|
|
313
332
|
formContext: 'editing',
|
|
314
|
-
encounter: mockEncounter,
|
|
333
|
+
encounter: mockEncounter as any as Encounter, // TODO: fix
|
|
315
334
|
});
|
|
316
335
|
|
|
317
336
|
// Update clinical note
|