@pih/esm-referrals-queue-app 2.0.0-pre.9 → 2.1.1-pre.3
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 +39 -0
- package/dist/023bd53d342b7463.woff +0 -0
- package/dist/02acc4469a2fe2e4.woff2 +0 -0
- package/dist/033e03f8663ab9b1.woff +0 -0
- package/dist/052607e67da262ec.woff +0 -0
- package/dist/081587ca0db8e63f.woff2 +0 -0
- package/dist/08cf53c4e5e71cf1.woff2 +0 -0
- package/dist/090b2bc014d24ea4.woff2 +0 -0
- package/dist/0a28cd0b47497b71.woff +0 -0
- package/dist/0a9765a89ff0437d.woff +0 -0
- package/dist/0ae92bcea615e948.woff2 +0 -0
- package/dist/0be8520d8945b3b7.woff2 +0 -0
- package/dist/0bf6b66a8b86b014.woff +0 -0
- package/dist/0e7dd073cd8bb0ad.woff2 +0 -0
- package/dist/144.js +2 -0
- package/dist/144.js.LICENSE.txt +19 -0
- package/dist/144.js.map +1 -0
- package/dist/14869ac5d1830304.woff2 +0 -0
- package/dist/14aaceff85fc8b28.woff2 +0 -0
- package/dist/1590052e1cf8f28d.woff +0 -0
- package/dist/16f443eed01776ca.woff2 +0 -0
- package/dist/173.js +1 -0
- package/dist/173.js.map +1 -0
- package/dist/183bae0e53a22182.woff2 +0 -0
- package/dist/19b239a0bb74b27e.woff +0 -0
- package/dist/19c8f94ccd6289f5.woff2 +0 -0
- package/dist/1ae86565eab7451c.woff2 +0 -0
- package/dist/1c7bf8797e0a9be6.woff2 +0 -0
- package/dist/1d9aff9a93a3bb66.woff +0 -0
- package/dist/1f266d3619b30f16.woff2 +0 -0
- package/dist/1f8c5a4087a524fd.woff2 +0 -0
- package/dist/20ba2b23c5c0cd0b.woff2 +0 -0
- package/dist/2269d45733c5cf8f.woff +0 -0
- package/dist/258ecbd235953099.woff +0 -0
- package/dist/295dd01a1fbfee6d.woff2 +0 -0
- package/dist/2d7f835ab7c7c764.woff +0 -0
- package/dist/2f66cca99eeead63.woff +0 -0
- package/dist/2f686985e26e7107.woff2 +0 -0
- package/dist/300.js +1 -0
- package/dist/315eff729e4ccbd9.woff2 +0 -0
- package/dist/32f1e5aadf845e08.woff +0 -0
- package/dist/338484e1c850669c.woff +0 -0
- package/dist/33b7a82f1e295190.woff +0 -0
- package/dist/3674d98ec4a9173d.woff +0 -0
- package/dist/368d16e3259bf207.woff2 +0 -0
- package/dist/36c49aa341a7079a.woff2 +0 -0
- package/dist/36e1e0430475edee.woff2 +0 -0
- package/dist/3bc19662b8630ee9.woff2 +0 -0
- package/dist/3f645f473b3f8fba.woff2 +0 -0
- package/dist/4095df88acae9e98.woff +0 -0
- package/dist/41.js +2 -0
- package/dist/41.js.map +1 -0
- package/dist/4218ac9901b9d36d.woff2 +0 -0
- package/dist/4680ba68412e4da9.woff2 +0 -0
- package/dist/47d7a8698d562a0e.woff +0 -0
- package/dist/47ec6c9dffe776a0.woff +0 -0
- package/dist/48e37bd7ebf85a1f.woff2 +0 -0
- package/dist/48edfdf51dfb3160.woff +0 -0
- package/dist/4a35a2746c8ad7a5.woff +0 -0
- package/dist/4e11b8a7c445255f.woff2 +0 -0
- package/dist/4ea1f5c3baf89fe3.woff +0 -0
- package/dist/4ea99f41c896bf9d.woff +0 -0
- package/dist/5005db1d1caf70c7.woff +0 -0
- package/dist/528a8e7c1c141a31.woff +0 -0
- package/dist/52ca12f5b516d4ea.woff +0 -0
- package/dist/534.js +2 -0
- package/dist/534.js.LICENSE.txt +30 -0
- package/dist/534.js.map +1 -0
- package/dist/537ddd61c5c1fce2.woff2 +0 -0
- package/dist/5432f7541ec25c34.woff +0 -0
- package/dist/54a95d73a9454ba3.woff +0 -0
- package/dist/55.js +1 -0
- package/dist/56c4118c0907f151.woff2 +0 -0
- package/dist/5938bc2ae7ec60c0.woff2 +0 -0
- package/dist/594306657c4e44e8.woff +0 -0
- package/dist/5a538aa477a66067.woff +0 -0
- package/dist/5c6586155f0d278a.woff2 +0 -0
- package/dist/60.js +1 -0
- package/dist/60.js.map +1 -0
- package/dist/60ec587649ba812a.woff2 +0 -0
- package/dist/616567cd947eb9dd.woff +0 -0
- package/dist/65168b59f44caab4.woff +0 -0
- package/dist/65c0982f98374864.woff +0 -0
- package/dist/65e6511e035870e1.woff2 +0 -0
- package/dist/661425f6798cd16a.woff2 +0 -0
- package/dist/66b864fe213caf46.woff2 +0 -0
- package/dist/6775fee945132ef9.woff +0 -0
- package/dist/68bbd362c8e4983b.woff +0 -0
- package/dist/68d6deec87b6b604.woff +0 -0
- package/dist/69a7e6d31d390296.woff +0 -0
- package/dist/69d087d970ee9455.woff2 +0 -0
- package/dist/69fa3fc7363bbc04.woff +0 -0
- package/dist/6a1f0178b45b2e9e.woff +0 -0
- package/dist/6c6c45e66ff54281.woff2 +0 -0
- package/dist/6ffb9ed97b21fdc0.woff +0 -0
- package/dist/7073a7323e92bd11.woff2 +0 -0
- package/dist/718c6cc31274ab1a.woff2 +0 -0
- package/dist/726.js +1 -0
- package/dist/726.js.map +1 -0
- package/dist/72cdbedfe04be9f9.woff2 +0 -0
- package/dist/746.js +2 -0
- package/dist/{147.js.LICENSE.txt → 746.js.LICENSE.txt} +9 -16
- package/dist/746.js.map +1 -0
- package/dist/7509c9f56fe9e532.woff2 +0 -0
- package/dist/75dc5c5b04adc8bf.woff2 +0 -0
- package/dist/76a7c256fc8b3490.woff +0 -0
- package/dist/77b48bc05299ecca.woff2 +0 -0
- package/dist/787f56efa306ddbc.woff +0 -0
- package/dist/7a0a0215c248c73d.woff2 +0 -0
- package/dist/7c4463d9c84f263a.woff +0 -0
- package/dist/7d112a556b7670d2.woff +0 -0
- package/dist/7d52d6014b5f2bbc.woff +0 -0
- package/dist/7f00bebb24e40167.woff2 +0 -0
- package/dist/7f2c6ea3e740417e.woff +0 -0
- package/dist/802c6176541eeed7.woff2 +0 -0
- package/dist/8080081b3379c637.woff2 +0 -0
- package/dist/8274cc1afc7619f1.woff +0 -0
- package/dist/831.js +2 -0
- package/dist/831.js.LICENSE.txt +3 -0
- package/dist/831.js.map +1 -0
- package/dist/8605507b7a8487c4.woff2 +0 -0
- package/dist/8a83d654702f6534.woff2 +0 -0
- package/dist/8ccee65f6cf254ee.woff +0 -0
- package/dist/8d82a082a4aba439.woff +0 -0
- package/dist/8de04ae985937b56.woff +0 -0
- package/dist/8fe71173a13fe571.woff2 +0 -0
- package/dist/90edccb224a51cee.woff +0 -0
- package/dist/94b292fe87831a8b.woff +0 -0
- package/dist/95dc66c1b88745f8.woff +0 -0
- package/dist/95fb698be77c85ef.woff +0 -0
- package/dist/9624cec0f9bdd81e.woff2 +0 -0
- package/dist/9662331fa31e3f20.woff +0 -0
- package/dist/98a3af55a1698171.woff2 +0 -0
- package/dist/99.js +1 -0
- package/dist/9ba85996af74c5ce.woff2 +0 -0
- package/dist/9bc133b1df25cb74.woff +0 -0
- package/dist/9ddb22faa35006e7.woff2 +0 -0
- package/dist/9e97352380611b95.woff +0 -0
- package/dist/a167fb2799dd741b.woff2 +0 -0
- package/dist/a2045a5cc4fdf94f.woff2 +0 -0
- package/dist/a246c73905a31c93.woff2 +0 -0
- package/dist/a401aa7939cb6e6f.woff2 +0 -0
- package/dist/a41a71258c38684d.woff +0 -0
- package/dist/a60d94a72d615a8e.woff +0 -0
- package/dist/a66764dd0c1fa213.woff +0 -0
- package/dist/a6ed036f17a1ea29.woff2 +0 -0
- package/dist/a8f635129d660202.woff +0 -0
- package/dist/a9f25ca430709a1a.woff2 +0 -0
- package/dist/ae14d98ad8a1212c.woff +0 -0
- package/dist/aeec4f78084adf7f.woff +0 -0
- package/dist/af11e94b0644eba5.woff +0 -0
- package/dist/afa9121a49e95351.woff2 +0 -0
- package/dist/afcda12d9f805543.woff2 +0 -0
- package/dist/b09ded85a7da77f1.woff2 +0 -0
- package/dist/b2f4e9d1e821b71c.woff2 +0 -0
- package/dist/b30b06698dc369b2.woff +0 -0
- package/dist/b4a074bf828bb757.woff2 +0 -0
- package/dist/b7f447da43f6e596.woff2 +0 -0
- package/dist/b7f633b871b84820.woff +0 -0
- package/dist/bcca84a524572d10.woff2 +0 -0
- package/dist/be4d1f97b11d087c.woff2 +0 -0
- package/dist/be91def2232f6776.woff +0 -0
- package/dist/bec14780d81164de.woff2 +0 -0
- package/dist/c285f4b15d11f172.woff +0 -0
- package/dist/c4673617b80801f3.woff +0 -0
- package/dist/c553f7e0199c5084.woff2 +0 -0
- package/dist/c8470ed2c145ace7.woff +0 -0
- package/dist/c9d9ce9f465df4fe.woff2 +0 -0
- package/dist/ccb2870475da9fe8.woff +0 -0
- package/dist/d04134fa33c2606d.woff +0 -0
- package/dist/d11f9c5cd7d9ea16.woff +0 -0
- package/dist/d188f7f036ac5779.woff2 +0 -0
- package/dist/d265d81c58525ae4.woff2 +0 -0
- package/dist/d5942cd81663e136.woff2 +0 -0
- package/dist/d6097a5c452acf6d.woff +0 -0
- package/dist/d66b8ff73d95cabb.woff2 +0 -0
- package/dist/d77f5bf95de8edaa.woff +0 -0
- package/dist/d8829a685af4f372.woff +0 -0
- package/dist/d88899ef0fd16719.woff2 +0 -0
- package/dist/d9a5d958e69e058d.woff2 +0 -0
- package/dist/da65d9a514c628c8.woff +0 -0
- package/dist/dac90d495be353a0.woff2 +0 -0
- package/dist/dd7071bc6306585c.woff +0 -0
- package/dist/dd8ce598529c3fab.woff2 +0 -0
- package/dist/ddef6f2dd566c2b9.woff +0 -0
- package/dist/de013f1be25103fa.woff2 +0 -0
- package/dist/dee2ff599db31e5b.woff +0 -0
- package/dist/dee7c6b5dd954d9b.woff +0 -0
- package/dist/df222fceeffca849.woff2 +0 -0
- package/dist/e0d2e5b12f028b5d.woff +0 -0
- package/dist/e33e3db8e4f7559f.woff +0 -0
- package/dist/e62b00b9199c1ac9.woff2 +0 -0
- package/dist/e696cef1407b2610.woff2 +0 -0
- package/dist/e89ca83b24959664.woff +0 -0
- package/dist/eb8c0ae77ad55249.woff +0 -0
- package/dist/ed0997bd7d221b8e.woff +0 -0
- package/dist/eed48feba743e21c.woff2 +0 -0
- package/dist/f280bda8a6e535a6.woff +0 -0
- package/dist/f543c88feb236d11.woff2 +0 -0
- package/dist/f591b0079faa93fe.woff2 +0 -0
- package/dist/f6ed27923769ad1d.woff2 +0 -0
- package/dist/f8803bebe640d99a.woff +0 -0
- package/dist/fbebeb4336e67012.woff2 +0 -0
- package/dist/fd522cd7a5c646fe.woff +0 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -0
- package/dist/pih-esm-referrals-queue-app.js +1 -1
- package/dist/pih-esm-referrals-queue-app.js.buildmanifest.json +364 -73
- package/dist/pih-esm-referrals-queue-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +3 -0
- package/package.json +28 -46
- package/src/config-schema.ts +8 -16
- package/src/declarations.d.tsx +4 -4
- package/src/index.ts +11 -65
- package/src/referrals-queue/referrals-queue.component.tsx +71 -120
- package/src/referrals-queue/referrals-queue.resource.tsx +6 -9
- package/src/referrals-queue/referrals-queue.scss +26 -0
- package/src/referrals-queue/referrals-queue.test.tsx +132 -115
- package/src/root.component.test.tsx +3 -3
- package/src/root.component.tsx +6 -6
- package/src/routes.json +9 -0
- package/src/setup-tests.ts +8 -8
- package/src/table/referrals-table.component.tsx +83 -0
- package/src/util.ts +5 -9
- package/translations/en.json +13 -2
- package/translations/es.json +15 -0
- package/translations/fr.json +15 -0
- package/tsconfig.json +4 -22
- package/.editorconfig +0 -12
- package/.eslintignore +0 -2
- package/.eslintrc +0 -4
- package/.github/workflows/node.js.yml +0 -79
- package/.husky/pre-commit +0 -6
- package/.husky/pre-push +0 -6
- package/.prettierignore +0 -14
- package/LICENSE +0 -401
- package/dist/132.js +0 -1
- package/dist/147.js +0 -2
- package/dist/281.js +0 -1
- package/dist/294.js +0 -2
- package/dist/574.js +0 -1
- package/dist/595.js +0 -2
- package/dist/595.js.LICENSE.txt +0 -1
- package/dist/879.js +0 -2
- package/dist/879.js.LICENSE.txt +0 -21
- package/dist/90.js +0 -1
- package/dist/pih-esm-referrals-queue-app.old +0 -1
- package/jest.config.json +0 -19
- package/src/referrals-queue/react-dates-overrides.css +0 -39
- package/src/referrals-queue/referrals-queue.css +0 -63
- package/src/table/table.component.tsx +0 -95
- package/src/table/table.css +0 -16
- /package/dist/{294.js.LICENSE.txt → 41.js.LICENSE.txt} +0 -0
|
@@ -1,68 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import ReferralsQueue from "./referrals-queue.component";
|
|
12
|
-
import { getReferrals } from "./referrals-queue.resource";
|
|
13
|
-
|
|
14
|
-
jest.mock("./referrals-queue.resource");
|
|
1
|
+
import { defineConfigSchema } from '@openmrs/esm-framework';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { of } from 'rxjs';
|
|
4
|
+
import { render, fireEvent, screen, within, waitFor } from '@testing-library/react';
|
|
5
|
+
import MockDate from 'mockdate';
|
|
6
|
+
import ReferralsQueue from './referrals-queue.component';
|
|
7
|
+
import { getReferrals } from './referrals-queue.resource';
|
|
8
|
+
import { configSchema } from '../config-schema';
|
|
9
|
+
|
|
10
|
+
jest.mock('./referrals-queue.resource');
|
|
15
11
|
const mockedGetReferrals = getReferrals as jest.Mock;
|
|
16
12
|
|
|
17
13
|
const referrals = [
|
|
18
14
|
{
|
|
19
|
-
patient_uuid:
|
|
20
|
-
zl_emr_id:
|
|
21
|
-
patient_name:
|
|
22
|
-
referral_date:
|
|
15
|
+
patient_uuid: 'ptaaaaaa-2869-41a4-86af-811fa2ee65b8',
|
|
16
|
+
zl_emr_id: 'PTID1',
|
|
17
|
+
patient_name: 'Patient Commcare',
|
|
18
|
+
referral_date: '2020-03-25T00:00:00.000-0400',
|
|
23
19
|
details: null,
|
|
24
|
-
visit_uuid:
|
|
20
|
+
visit_uuid: 'visitaaa-091a-46fd-a442-2a9778d91a52',
|
|
25
21
|
encounter_id: 12,
|
|
26
|
-
referral_type:
|
|
27
|
-
encounter_uuid:
|
|
22
|
+
referral_type: 'Test Referral Type',
|
|
23
|
+
encounter_uuid: 'encounter-0fe1-4318-95a4-641d31745e09',
|
|
28
24
|
fulfillment_status: null,
|
|
29
25
|
},
|
|
30
26
|
{
|
|
31
|
-
patient_uuid:
|
|
32
|
-
zl_emr_id:
|
|
33
|
-
patient_name:
|
|
34
|
-
referral_date:
|
|
35
|
-
details:
|
|
36
|
-
visit_uuid:
|
|
27
|
+
patient_uuid: 'ptbbbbbb-de0e-489f-b4c7-fe4579e07aa9',
|
|
28
|
+
zl_emr_id: 'PTID2',
|
|
29
|
+
patient_name: 'Davina Mother',
|
|
30
|
+
referral_date: '2020-03-23T00:00:00.000-0400',
|
|
31
|
+
details: 'Suspected depression',
|
|
32
|
+
visit_uuid: 'visitbbb-64ca-4d53-9024-574a9214f76e',
|
|
37
33
|
encounter_id: 13,
|
|
38
|
-
referral_type:
|
|
39
|
-
encounter_uuid:
|
|
40
|
-
fulfillment_status:
|
|
34
|
+
referral_type: 'Mental Health',
|
|
35
|
+
encounter_uuid: 'encounter-d5cb-4f7e-a1aa-bd6741a96381',
|
|
36
|
+
fulfillment_status: 'Pending status',
|
|
41
37
|
},
|
|
42
38
|
{
|
|
43
|
-
person_uuid:
|
|
44
|
-
zl_emr_id:
|
|
45
|
-
patient_name:
|
|
46
|
-
referral_date:
|
|
47
|
-
details:
|
|
48
|
-
visit_uuid:
|
|
39
|
+
person_uuid: 'ptcccccc-de0e-489f-b4c7-fe4579e07aa9',
|
|
40
|
+
zl_emr_id: 'PTID3',
|
|
41
|
+
patient_name: 'Patient Prenatal',
|
|
42
|
+
referral_date: '2020-03-28T00:00:00.000-0400',
|
|
43
|
+
details: 'Urgent',
|
|
44
|
+
visit_uuid: 'visitccc-64ca-4d53-9024-574a9214f76e',
|
|
49
45
|
encounter_id: 14,
|
|
50
|
-
referral_type:
|
|
51
|
-
encounter_uuid:
|
|
52
|
-
fulfillment_status:
|
|
46
|
+
referral_type: 'Family Member',
|
|
47
|
+
encounter_uuid: 'encounter-67bc-435d-9929-670a98cefe4e',
|
|
48
|
+
fulfillment_status: 'Test Complete',
|
|
53
49
|
},
|
|
54
50
|
];
|
|
55
51
|
|
|
56
|
-
(window as any).openmrsBase =
|
|
52
|
+
(window as any).openmrsBase = '/openmrs';
|
|
57
53
|
// hack around js-dom to make navigation testable
|
|
58
54
|
delete window.location;
|
|
59
55
|
//@ts-ignore
|
|
60
|
-
window.location = { href:
|
|
56
|
+
window.location = { href: '/referrals-queue' };
|
|
61
57
|
|
|
62
|
-
describe(
|
|
63
|
-
const todayString =
|
|
58
|
+
describe('referrals queue', () => {
|
|
59
|
+
const todayString = '2020-10-31';
|
|
60
|
+
beforeAll(() => {
|
|
61
|
+
defineConfigSchema('@pih/esm-referral-queues-app', configSchema);
|
|
62
|
+
});
|
|
64
63
|
beforeEach(() => {
|
|
65
|
-
MockDate.set(todayString +
|
|
64
|
+
MockDate.set(todayString + 'T10:00:00.000-0400');
|
|
66
65
|
mockedGetReferrals.mockReset();
|
|
67
66
|
mockedGetReferrals.mockReturnValue(of(referrals));
|
|
68
67
|
render(<ReferralsQueue />);
|
|
@@ -72,15 +71,15 @@ describe("referrals queue", () => {
|
|
|
72
71
|
MockDate.reset();
|
|
73
72
|
});
|
|
74
73
|
|
|
75
|
-
it(
|
|
74
|
+
it('renders without failing', () => {
|
|
76
75
|
// in beforeEach
|
|
77
76
|
});
|
|
78
77
|
|
|
79
|
-
it(
|
|
78
|
+
it('renders the expected fields', () => {
|
|
80
79
|
for (let referral of referrals) {
|
|
81
|
-
const row = screen.getByText(referral.zl_emr_id).closest(
|
|
80
|
+
const row = screen.getByText(referral.zl_emr_id).closest('tr');
|
|
82
81
|
within(row).getByText(referral.patient_name);
|
|
83
|
-
within(row).getByText(referral.referral_type, { selector:
|
|
82
|
+
within(row).getByText(referral.referral_type, { selector: 'td' });
|
|
84
83
|
if (referral.details) {
|
|
85
84
|
within(row).getByText(referral.details);
|
|
86
85
|
}
|
|
@@ -88,112 +87,130 @@ describe("referrals queue", () => {
|
|
|
88
87
|
within(row).getByText(referral.fulfillment_status);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
screen.getByText(
|
|
92
|
-
screen.getByText(
|
|
93
|
-
screen.getByText(
|
|
90
|
+
screen.getByText('25 Mar');
|
|
91
|
+
screen.getByText('23 Mar');
|
|
92
|
+
screen.getByText('28 Mar');
|
|
94
93
|
});
|
|
95
94
|
|
|
96
|
-
// TODO
|
|
97
|
-
|
|
98
|
-
const table = screen.getByRole(
|
|
95
|
+
// TODO figure out how to test links
|
|
96
|
+
it.skip('navigates to the links', async () => {
|
|
97
|
+
const table = screen.getByRole('table');
|
|
99
98
|
const pt0DashLink = within(table).getByText(referrals[0].zl_emr_id);
|
|
100
99
|
fireEvent.click(pt0DashLink);
|
|
101
100
|
await waitFor(() => {
|
|
102
|
-
expect(window.location.href).toBe(
|
|
103
|
-
"/openmrs/pt-dash/" + referrals[0].patient_uuid
|
|
104
|
-
);
|
|
101
|
+
expect(window.location.href).toBe('/openmrs/pt-dash/' + referrals[0].patient_uuid);
|
|
105
102
|
});
|
|
106
|
-
const pt1VisitLink = within(table).getByText(
|
|
103
|
+
const pt1VisitLink = within(table).getByText('23 Mar');
|
|
107
104
|
fireEvent.click(pt1VisitLink);
|
|
108
105
|
await waitFor(() => {
|
|
109
|
-
expect(window.location.href).toBe(
|
|
110
|
-
`/openmrs/visit/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}`
|
|
111
|
-
);
|
|
106
|
+
expect(window.location.href).toBe(`/openmrs/visit/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}`);
|
|
112
107
|
});
|
|
113
|
-
const pendingStatusLink = within(table).getByText(
|
|
108
|
+
const pendingStatusLink = within(table).getByText('Pending status');
|
|
114
109
|
fireEvent.click(pendingStatusLink);
|
|
115
110
|
await waitFor(() => {
|
|
116
111
|
expect(window.location.href).toBe(
|
|
117
|
-
`/openmrs/home-visit-form/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}/${referrals[1].encounter_uuid}
|
|
112
|
+
`/openmrs/home-visit-form/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}/${referrals[1].encounter_uuid}`,
|
|
118
113
|
);
|
|
119
114
|
});
|
|
120
|
-
})
|
|
115
|
+
});
|
|
121
116
|
|
|
122
117
|
it("doesn't make non-pending statuses into links", () => {
|
|
123
|
-
const table = screen.getByRole(
|
|
124
|
-
expect(within(table).getByText(
|
|
125
|
-
expect(within(table).getByText(
|
|
118
|
+
const table = screen.getByRole('table');
|
|
119
|
+
expect(within(table).getByText('Pending status').tagName).toBe('A'); // sanity check
|
|
120
|
+
expect(within(table).getByText('Test Complete').tagName).not.toBe('A'); // the actual test
|
|
126
121
|
});
|
|
127
122
|
|
|
128
|
-
it(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
123
|
+
it('filters by referral type', () => {
|
|
124
|
+
fireEvent.click(
|
|
125
|
+
screen.getByLabelText('Referral Type', {
|
|
126
|
+
selector: 'button',
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
fireEvent.click(
|
|
130
|
+
screen.getByText('Mental Health', {
|
|
131
|
+
selector: 'div',
|
|
132
|
+
}),
|
|
133
|
+
);
|
|
134
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
135
|
+
expect(screen.queryByText('PTID2')).not.toBeNull();
|
|
136
|
+
expect(screen.queryByText('PTID3')).toBeNull();
|
|
136
137
|
});
|
|
137
138
|
|
|
138
|
-
it(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
it('infers list of referral types from data', () => {
|
|
140
|
+
expect(screen.queryByText('Test Referral Type', { selector: 'span' })).toBeNull(); // sanity check
|
|
141
|
+
fireEvent.click(
|
|
142
|
+
screen.getByLabelText('Referral Type', {
|
|
143
|
+
selector: 'button',
|
|
144
|
+
}),
|
|
145
|
+
);
|
|
146
|
+
fireEvent.click(
|
|
147
|
+
screen.getByText('Test Referral Type', {
|
|
148
|
+
selector: 'div',
|
|
149
|
+
}),
|
|
150
|
+
);
|
|
151
|
+
expect(screen.queryByText('Test Referral Type', { selector: 'span' })).not.toBeNull();
|
|
144
152
|
});
|
|
145
153
|
|
|
146
|
-
it(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
154
|
+
it('filters by statuses, with dropdown inferred from data', () => {
|
|
155
|
+
fireEvent.click(
|
|
156
|
+
screen.getByLabelText('Status', {
|
|
157
|
+
selector: 'button',
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
fireEvent.click(
|
|
161
|
+
screen.getByText('Test Complete', {
|
|
162
|
+
selector: 'div',
|
|
163
|
+
}),
|
|
164
|
+
);
|
|
165
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
166
|
+
expect(screen.queryByText('PTID2')).toBeNull();
|
|
167
|
+
expect(screen.queryByText('PTID3')).not.toBeNull();
|
|
152
168
|
});
|
|
153
169
|
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
// TODO figure out how to interact with Carbon datepicker
|
|
171
|
+
it.skip('calls getReferrals with the correct date arguments', () => {
|
|
172
|
+
const monthAgoString = '2020-09-30';
|
|
156
173
|
expect(mockedGetReferrals).lastCalledWith({
|
|
157
174
|
fromDate: monthAgoString,
|
|
158
175
|
toDate: todayString,
|
|
159
|
-
locale:
|
|
176
|
+
locale: 'en',
|
|
160
177
|
});
|
|
161
|
-
const fromDateInput = screen.getByLabelText(
|
|
162
|
-
fireEvent.change(fromDateInput, { target: { value:
|
|
178
|
+
const fromDateInput = screen.getByLabelText('From');
|
|
179
|
+
fireEvent.change(fromDateInput, { target: { value: '2020-01-01' } });
|
|
163
180
|
expect(mockedGetReferrals).lastCalledWith({
|
|
164
|
-
fromDate:
|
|
181
|
+
fromDate: '2020-01-01',
|
|
165
182
|
toDate: todayString,
|
|
166
|
-
locale:
|
|
183
|
+
locale: 'en',
|
|
167
184
|
});
|
|
168
|
-
const toDateInput = screen.getByLabelText(
|
|
169
|
-
fireEvent.change(toDateInput, { target: { value:
|
|
185
|
+
const toDateInput = screen.getByLabelText('To');
|
|
186
|
+
fireEvent.change(toDateInput, { target: { value: '2020-03-01' } });
|
|
170
187
|
expect(mockedGetReferrals).lastCalledWith({
|
|
171
|
-
fromDate:
|
|
172
|
-
toDate:
|
|
173
|
-
locale:
|
|
188
|
+
fromDate: '2020-01-01',
|
|
189
|
+
toDate: '2020-03-01',
|
|
190
|
+
locale: 'en',
|
|
174
191
|
});
|
|
175
192
|
});
|
|
176
193
|
|
|
177
|
-
it(
|
|
178
|
-
const queryBox = screen.getByLabelText(
|
|
179
|
-
fireEvent.change(queryBox, { target: { value:
|
|
180
|
-
expect(screen.queryByText(
|
|
181
|
-
expect(screen.queryByText(
|
|
194
|
+
it('filters the list of results by patient name query', () => {
|
|
195
|
+
const queryBox = screen.getByLabelText('Filter by patient');
|
|
196
|
+
fireEvent.change(queryBox, { target: { value: 'Mother' } });
|
|
197
|
+
expect(screen.queryByText('PTID2')).not.toBeNull();
|
|
198
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
182
199
|
});
|
|
183
200
|
|
|
184
|
-
it(
|
|
185
|
-
const queryBox = screen.getByLabelText(
|
|
186
|
-
fireEvent.change(queryBox, { target: { value:
|
|
187
|
-
expect(screen.queryByText(
|
|
188
|
-
expect(screen.queryByText(
|
|
201
|
+
it('filters the list of results by patient name partial token matches', () => {
|
|
202
|
+
const queryBox = screen.getByLabelText('Filter by patient');
|
|
203
|
+
fireEvent.change(queryBox, { target: { value: 'dav mo' } });
|
|
204
|
+
expect(screen.queryByText('PTID2')).not.toBeNull();
|
|
205
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
189
206
|
});
|
|
190
207
|
|
|
191
|
-
it(
|
|
192
|
-
const queryBox = screen.getByLabelText(
|
|
193
|
-
fireEvent.change(queryBox, { target: { value:
|
|
194
|
-
expect(screen.queryByText(
|
|
195
|
-
expect(screen.queryByText(
|
|
208
|
+
it('filters the list of results by patient id', () => {
|
|
209
|
+
const queryBox = screen.getByLabelText('Filter by patient');
|
|
210
|
+
fireEvent.change(queryBox, { target: { value: 'ptid1' } });
|
|
211
|
+
expect(screen.queryByText('PTID1')).not.toBeNull();
|
|
212
|
+
expect(screen.queryByText('PTID2')).toBeNull();
|
|
196
213
|
});
|
|
197
214
|
|
|
198
|
-
test.todo(
|
|
215
|
+
test.todo('makes the API call with the locale from the user session');
|
|
199
216
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import Root from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import Root from './root.component';
|
|
4
4
|
|
|
5
5
|
describe(`<Root />`, () => {
|
|
6
6
|
it(`renders without dying`, async () => {
|
package/src/root.component.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { BrowserRouter, Routes, Route } from
|
|
3
|
-
import ReferralsQueue from
|
|
4
|
-
import styles from
|
|
5
|
-
import { appPath } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
3
|
+
import ReferralsQueue from './referrals-queue/referrals-queue.component';
|
|
4
|
+
import styles from './root.css';
|
|
5
|
+
import { appPath } from './constants';
|
|
6
6
|
|
|
7
7
|
export default function Root() {
|
|
8
8
|
return (
|
|
9
|
-
<div className={
|
|
9
|
+
<div className={`${styles.ovconstantserflowAuto}`}>
|
|
10
10
|
<BrowserRouter basename={appPath}>
|
|
11
11
|
<Routes>
|
|
12
12
|
<Route path="/" element={<ReferralsQueue />} />
|
package/src/routes.json
ADDED
package/src/setup-tests.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
2
2
|
|
|
3
|
-
jest.mock(
|
|
4
|
-
const originalModule = jest.requireActual(
|
|
3
|
+
jest.mock('@openmrs/esm-framework', () => {
|
|
4
|
+
const originalModule = jest.requireActual('@openmrs/esm-framework');
|
|
5
5
|
|
|
6
6
|
return {
|
|
7
7
|
...originalModule,
|
|
@@ -9,16 +9,16 @@ jest.mock("@openmrs/esm-framework", () => {
|
|
|
9
9
|
return {
|
|
10
10
|
links: {
|
|
11
11
|
patientDash:
|
|
12
|
-
|
|
12
|
+
'${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard',
|
|
13
13
|
visitPage:
|
|
14
|
-
|
|
14
|
+
'${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview',
|
|
15
15
|
homeVisitForm:
|
|
16
|
-
|
|
16
|
+
'${openmrsBase}/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId=${patientUuid}&visitId=${visitUuid}&encounterId=${encounterUuid}&definitionUiResource=file:configuration/pih/htmlforms/section-mch-referral.xml&returnUrl=/mirebalais/spa/referrals-queue',
|
|
17
17
|
},
|
|
18
|
-
pendingStatuses: [
|
|
18
|
+
pendingStatuses: ['Pending status', 'Referral unmet'],
|
|
19
19
|
};
|
|
20
20
|
}),
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
window.getOpenmrsSpaBase = () =>
|
|
24
|
+
window.getOpenmrsSpaBase = () => 'openmrs/spa';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Table, TableHead, TableHeader, TableRow, TableBody, TableCell } from '@carbon/react';
|
|
3
|
+
import { ConfigurableLink, interpolateString, useConfig } from '@openmrs/esm-framework';
|
|
4
|
+
import { Trans } from 'react-i18next';
|
|
5
|
+
import { formatDate } from '../util';
|
|
6
|
+
|
|
7
|
+
export interface ReferralsTableProps {
|
|
8
|
+
referrals: Referral[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function ReferrablesTable(props: ReferralsTableProps) {
|
|
12
|
+
const config = useConfig();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Table>
|
|
16
|
+
<TableHead>
|
|
17
|
+
<TableRow>
|
|
18
|
+
<TableHeader>
|
|
19
|
+
<Trans i18nKey="emr-id">EMR ID</Trans>
|
|
20
|
+
</TableHeader>
|
|
21
|
+
<TableHeader>
|
|
22
|
+
<Trans i18nKey="name">Name</Trans>
|
|
23
|
+
</TableHeader>
|
|
24
|
+
<TableHeader>
|
|
25
|
+
<Trans i18nKey="referral-date">Referral Date</Trans>
|
|
26
|
+
</TableHeader>
|
|
27
|
+
<TableHeader>
|
|
28
|
+
<Trans i18nKey="referral-type">Referral Type</Trans>
|
|
29
|
+
</TableHeader>
|
|
30
|
+
<TableHeader>
|
|
31
|
+
<Trans i18nKey="details">Details</Trans>
|
|
32
|
+
</TableHeader>
|
|
33
|
+
<TableHeader>
|
|
34
|
+
<Trans i18nKey="status">Status</Trans>
|
|
35
|
+
</TableHeader>
|
|
36
|
+
</TableRow>
|
|
37
|
+
</TableHead>
|
|
38
|
+
<TableBody>
|
|
39
|
+
{props.referrals &&
|
|
40
|
+
props.referrals.map((referral, index) => (
|
|
41
|
+
<React.Fragment key={index}>
|
|
42
|
+
<TableRow>
|
|
43
|
+
<TableCell>
|
|
44
|
+
<ConfigurableLink
|
|
45
|
+
to={interpolateString(config.links.patientDash, {
|
|
46
|
+
patientUuid: referral.patient_uuid || referral.person_uuid,
|
|
47
|
+
})}>
|
|
48
|
+
{referral.zl_emr_id}
|
|
49
|
+
</ConfigurableLink>
|
|
50
|
+
</TableCell>
|
|
51
|
+
<TableCell>{referral.patient_name}</TableCell>
|
|
52
|
+
<TableCell>
|
|
53
|
+
<ConfigurableLink
|
|
54
|
+
to={interpolateString(config.links.visitPage, {
|
|
55
|
+
patientUuid: referral.patient_uuid || referral.person_uuid,
|
|
56
|
+
visitUuid: referral.visit_uuid,
|
|
57
|
+
})}>
|
|
58
|
+
{formatDate(referral.referral_date)}
|
|
59
|
+
</ConfigurableLink>
|
|
60
|
+
</TableCell>
|
|
61
|
+
<TableCell>{referral.referral_type}</TableCell>
|
|
62
|
+
<TableCell>{referral.details}</TableCell>
|
|
63
|
+
<TableCell>
|
|
64
|
+
{config.pendingStatuses.includes(referral.fulfillment_status) ? (
|
|
65
|
+
<ConfigurableLink
|
|
66
|
+
to={interpolateString(config.links.homeVisitForm, {
|
|
67
|
+
patientUuid: referral.patient_uuid || referral.person_uuid,
|
|
68
|
+
visitUuid: referral.visit_uuid,
|
|
69
|
+
encounterUuid: referral.encounter_uuid,
|
|
70
|
+
})}>
|
|
71
|
+
{referral.fulfillment_status}
|
|
72
|
+
</ConfigurableLink>
|
|
73
|
+
) : (
|
|
74
|
+
referral.fulfillment_status
|
|
75
|
+
)}
|
|
76
|
+
</TableCell>
|
|
77
|
+
</TableRow>
|
|
78
|
+
</React.Fragment>
|
|
79
|
+
))}
|
|
80
|
+
</TableBody>
|
|
81
|
+
</Table>
|
|
82
|
+
);
|
|
83
|
+
}
|
package/src/util.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import moment from
|
|
1
|
+
import moment from 'moment';
|
|
2
2
|
|
|
3
3
|
// We use UTC for the present TZ because the dates in the data
|
|
4
4
|
// are all midnight Eastern Time, which lines up with UTC
|
|
@@ -6,15 +6,11 @@ import moment from "moment";
|
|
|
6
6
|
export function formatDate(strDate: string) {
|
|
7
7
|
const date = moment.utc(strDate);
|
|
8
8
|
const today = moment.utc(new Date());
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
date.month() === today.month() &&
|
|
12
|
-
date.year() === today.year()
|
|
13
|
-
) {
|
|
14
|
-
return moment().calendar().split(" ")[0]; // locale-specific 'Today'
|
|
9
|
+
if (date.date() === today.date() && date.month() === today.month() && date.year() === today.year()) {
|
|
10
|
+
return moment().calendar().split(' ')[0]; // locale-specific 'Today'
|
|
15
11
|
} else if (date.year() === today.year()) {
|
|
16
|
-
return date.format(
|
|
12
|
+
return date.format('DD MMM');
|
|
17
13
|
} else {
|
|
18
|
-
return date.format(
|
|
14
|
+
return date.format('DD MMM YYYY');
|
|
19
15
|
}
|
|
20
16
|
}
|
package/translations/en.json
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"any": "Any",
|
|
3
|
+
"details": "Details",
|
|
4
|
+
"emr-id": "EMR ID",
|
|
5
|
+
"filter-by-patient": "Filter by patient",
|
|
6
|
+
"from": "From",
|
|
7
|
+
"name": "Name",
|
|
8
|
+
"referral-date": "Referral Date",
|
|
9
|
+
"referral-type": "Referral Type",
|
|
10
|
+
"referrals-queue": "Referrals Queue",
|
|
11
|
+
"select-referral-type": "Select Referral Type",
|
|
12
|
+
"select-status": "Select Status",
|
|
13
|
+
"status": "Status",
|
|
14
|
+
"to": "To"
|
|
4
15
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"any": "Any",
|
|
3
|
+
"details": "Detalles",
|
|
4
|
+
"emr-id": "EMR ID",
|
|
5
|
+
"filter-by-patient": "Filtrar por paciente",
|
|
6
|
+
"from": "Desde",
|
|
7
|
+
"name": "Nombre",
|
|
8
|
+
"referral-date": "Fecha de referencia",
|
|
9
|
+
"referral-type": "Tipo de referencia",
|
|
10
|
+
"referrals-queue": "Cola de referencias",
|
|
11
|
+
"select-referral-type": "Seleccionar tipo de referencia",
|
|
12
|
+
"select-status": "Seleccionar estado",
|
|
13
|
+
"status": "Estado",
|
|
14
|
+
"to": "Hasta"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"any": "Tout",
|
|
3
|
+
"details": "Détails",
|
|
4
|
+
"emr-id": "EMR ID",
|
|
5
|
+
"filter-by-patient": "Filtrer avec patient",
|
|
6
|
+
"from": "de",
|
|
7
|
+
"name": "Nom",
|
|
8
|
+
"referral-date": "Date de Référé",
|
|
9
|
+
"referral-type": "Type Référé",
|
|
10
|
+
"referrals-queue": "List de Référé",
|
|
11
|
+
"select-referral-type": "Sélectionnez le type de référé",
|
|
12
|
+
"select-status": "Sélectionnez le état",
|
|
13
|
+
"status": "État",
|
|
14
|
+
"to": "à"
|
|
15
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"jsx": "react",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"lib": [
|
|
10
|
-
"dom",
|
|
11
|
-
"es5",
|
|
12
|
-
"scripthost",
|
|
13
|
-
"es2015",
|
|
14
|
-
"es2015.promise",
|
|
15
|
-
"es2016.array.include",
|
|
16
|
-
"es2018",
|
|
17
|
-
"es2020"
|
|
18
|
-
],
|
|
19
|
-
"resolveJsonModule": true,
|
|
20
|
-
"noEmit": true,
|
|
21
|
-
"target": "esnext"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"include": ["src/**/*"],
|
|
4
|
+
"exclude": ["src/**/*.test.tsx"]
|
|
5
|
+
}
|
package/.editorconfig
DELETED
package/.eslintignore
DELETED
package/.eslintrc
DELETED