@pih/esm-referrals-queue-app 2.0.0-pre.17 → 2.1.1-pre.2
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/144.js +2 -0
- package/dist/144.js.LICENSE.txt +19 -0
- package/dist/144.js.map +1 -0
- package/dist/173.js +1 -0
- package/dist/173.js.map +1 -0
- package/dist/300.js +1 -0
- package/dist/{294.js → 41.js} +2 -2
- package/dist/41.js.map +1 -0
- package/dist/534.js +2 -0
- package/dist/{468.js.LICENSE.txt → 534.js.LICENSE.txt} +7 -24
- package/dist/534.js.map +1 -0
- package/dist/{757.js → 55.js} +1 -1
- package/dist/60.js +1 -0
- package/dist/60.js.map +1 -0
- package/dist/726.js +1 -0
- package/dist/726.js.map +1 -0
- package/dist/746.js +2 -0
- package/dist/{512.js.LICENSE.txt → 746.js.LICENSE.txt} +22 -0
- package/dist/746.js.map +1 -0
- package/dist/831.js +2 -0
- package/dist/{800.js.LICENSE.txt → 831.js.LICENSE.txt} +0 -2
- package/dist/831.js.map +1 -0
- package/dist/{319.js → 99.js} +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/pih-esm-referrals-queue-app.js +1 -1
- package/dist/pih-esm-referrals-queue-app.js.buildmanifest.json +197 -176
- package/dist/pih-esm-referrals-queue-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/jest.config.js +3 -0
- package/package.json +23 -42
- package/src/config-schema.ts +8 -16
- package/src/declarations.d.tsx +3 -7
- package/src/index.ts +7 -19
- package/src/referrals-queue/referrals-queue.component.tsx +36 -70
- package/src/referrals-queue/referrals-queue.resource.tsx +6 -9
- package/src/referrals-queue/referrals-queue.scss +1 -2
- package/src/referrals-queue/referrals-queue.test.tsx +124 -122
- package/src/root.component.test.tsx +3 -3
- package/src/root.component.tsx +5 -5
- package/src/setup-tests.ts +8 -8
- package/src/table/referrals-table.component.tsx +12 -31
- package/src/util.ts +5 -9
- 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-push +0 -7
- package/.prettierignore +0 -14
- package/LICENSE +0 -401
- package/dist/153.js +0 -1
- package/dist/153.js.map +0 -1
- package/dist/294.js.map +0 -1
- package/dist/468.js +0 -2
- package/dist/468.js.map +0 -1
- package/dist/512.js +0 -2
- package/dist/512.js.map +0 -1
- package/dist/559.js +0 -1
- package/dist/559.js.map +0 -1
- package/dist/574.js +0 -1
- package/dist/783.js +0 -1
- package/dist/783.js.map +0 -1
- package/dist/800.js +0 -2
- package/dist/800.js.map +0 -1
- package/dist/897.js +0 -2
- package/dist/897.js.LICENSE.txt +0 -21
- package/dist/897.js.map +0 -1
- package/jest.config.json +0 -19
- /package/dist/{294.js.LICENSE.txt → 41.js.LICENSE.txt} +0 -0
|
@@ -1,68 +1,62 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { of } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "@testing-library/react";
|
|
10
|
-
import MockDate from "mockdate";
|
|
11
|
-
import ReferralsQueue from "./referrals-queue.component";
|
|
12
|
-
import { getReferrals } from "./referrals-queue.resource";
|
|
13
|
-
|
|
14
|
-
jest.mock("./referrals-queue.resource");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { of } from 'rxjs';
|
|
3
|
+
import { render, fireEvent, screen, within, waitFor } from '@testing-library/react';
|
|
4
|
+
import MockDate from 'mockdate';
|
|
5
|
+
import ReferralsQueue from './referrals-queue.component';
|
|
6
|
+
import { getReferrals } from './referrals-queue.resource';
|
|
7
|
+
|
|
8
|
+
jest.mock('./referrals-queue.resource');
|
|
15
9
|
const mockedGetReferrals = getReferrals as jest.Mock;
|
|
16
10
|
|
|
17
11
|
const referrals = [
|
|
18
12
|
{
|
|
19
|
-
patient_uuid:
|
|
20
|
-
zl_emr_id:
|
|
21
|
-
patient_name:
|
|
22
|
-
referral_date:
|
|
13
|
+
patient_uuid: 'ptaaaaaa-2869-41a4-86af-811fa2ee65b8',
|
|
14
|
+
zl_emr_id: 'PTID1',
|
|
15
|
+
patient_name: 'Patient Commcare',
|
|
16
|
+
referral_date: '2020-03-25T00:00:00.000-0400',
|
|
23
17
|
details: null,
|
|
24
|
-
visit_uuid:
|
|
18
|
+
visit_uuid: 'visitaaa-091a-46fd-a442-2a9778d91a52',
|
|
25
19
|
encounter_id: 12,
|
|
26
|
-
referral_type:
|
|
27
|
-
encounter_uuid:
|
|
20
|
+
referral_type: 'Test Referral Type',
|
|
21
|
+
encounter_uuid: 'encounter-0fe1-4318-95a4-641d31745e09',
|
|
28
22
|
fulfillment_status: null,
|
|
29
23
|
},
|
|
30
24
|
{
|
|
31
|
-
patient_uuid:
|
|
32
|
-
zl_emr_id:
|
|
33
|
-
patient_name:
|
|
34
|
-
referral_date:
|
|
35
|
-
details:
|
|
36
|
-
visit_uuid:
|
|
25
|
+
patient_uuid: 'ptbbbbbb-de0e-489f-b4c7-fe4579e07aa9',
|
|
26
|
+
zl_emr_id: 'PTID2',
|
|
27
|
+
patient_name: 'Davina Mother',
|
|
28
|
+
referral_date: '2020-03-23T00:00:00.000-0400',
|
|
29
|
+
details: 'Suspected depression',
|
|
30
|
+
visit_uuid: 'visitbbb-64ca-4d53-9024-574a9214f76e',
|
|
37
31
|
encounter_id: 13,
|
|
38
|
-
referral_type:
|
|
39
|
-
encounter_uuid:
|
|
40
|
-
fulfillment_status:
|
|
32
|
+
referral_type: 'Mental Health',
|
|
33
|
+
encounter_uuid: 'encounter-d5cb-4f7e-a1aa-bd6741a96381',
|
|
34
|
+
fulfillment_status: 'Pending status',
|
|
41
35
|
},
|
|
42
36
|
{
|
|
43
|
-
person_uuid:
|
|
44
|
-
zl_emr_id:
|
|
45
|
-
patient_name:
|
|
46
|
-
referral_date:
|
|
47
|
-
details:
|
|
48
|
-
visit_uuid:
|
|
37
|
+
person_uuid: 'ptcccccc-de0e-489f-b4c7-fe4579e07aa9',
|
|
38
|
+
zl_emr_id: 'PTID3',
|
|
39
|
+
patient_name: 'Patient Prenatal',
|
|
40
|
+
referral_date: '2020-03-28T00:00:00.000-0400',
|
|
41
|
+
details: 'Urgent',
|
|
42
|
+
visit_uuid: 'visitccc-64ca-4d53-9024-574a9214f76e',
|
|
49
43
|
encounter_id: 14,
|
|
50
|
-
referral_type:
|
|
51
|
-
encounter_uuid:
|
|
52
|
-
fulfillment_status:
|
|
44
|
+
referral_type: 'Family Member',
|
|
45
|
+
encounter_uuid: 'encounter-67bc-435d-9929-670a98cefe4e',
|
|
46
|
+
fulfillment_status: 'Test Complete',
|
|
53
47
|
},
|
|
54
48
|
];
|
|
55
49
|
|
|
56
|
-
(window as any).openmrsBase =
|
|
50
|
+
(window as any).openmrsBase = '/openmrs';
|
|
57
51
|
// hack around js-dom to make navigation testable
|
|
58
52
|
delete window.location;
|
|
59
53
|
//@ts-ignore
|
|
60
|
-
window.location = { href:
|
|
54
|
+
window.location = { href: '/referrals-queue' };
|
|
61
55
|
|
|
62
|
-
describe(
|
|
63
|
-
const todayString =
|
|
56
|
+
describe('referrals queue', () => {
|
|
57
|
+
const todayString = '2020-10-31';
|
|
64
58
|
beforeEach(() => {
|
|
65
|
-
MockDate.set(todayString +
|
|
59
|
+
MockDate.set(todayString + 'T10:00:00.000-0400');
|
|
66
60
|
mockedGetReferrals.mockReset();
|
|
67
61
|
mockedGetReferrals.mockReturnValue(of(referrals));
|
|
68
62
|
render(<ReferralsQueue />);
|
|
@@ -72,15 +66,15 @@ describe("referrals queue", () => {
|
|
|
72
66
|
MockDate.reset();
|
|
73
67
|
});
|
|
74
68
|
|
|
75
|
-
it(
|
|
69
|
+
it('renders without failing', () => {
|
|
76
70
|
// in beforeEach
|
|
77
71
|
});
|
|
78
72
|
|
|
79
|
-
it(
|
|
73
|
+
it('renders the expected fields', () => {
|
|
80
74
|
for (let referral of referrals) {
|
|
81
|
-
const row = screen.getByText(referral.zl_emr_id).closest(
|
|
75
|
+
const row = screen.getByText(referral.zl_emr_id).closest('tr');
|
|
82
76
|
within(row).getByText(referral.patient_name);
|
|
83
|
-
within(row).getByText(referral.referral_type, { selector:
|
|
77
|
+
within(row).getByText(referral.referral_type, { selector: 'td' });
|
|
84
78
|
if (referral.details) {
|
|
85
79
|
within(row).getByText(referral.details);
|
|
86
80
|
}
|
|
@@ -88,122 +82,130 @@ describe("referrals queue", () => {
|
|
|
88
82
|
within(row).getByText(referral.fulfillment_status);
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
|
-
screen.getByText(
|
|
92
|
-
screen.getByText(
|
|
93
|
-
screen.getByText(
|
|
85
|
+
screen.getByText('25 Mar');
|
|
86
|
+
screen.getByText('23 Mar');
|
|
87
|
+
screen.getByText('28 Mar');
|
|
94
88
|
});
|
|
95
89
|
|
|
96
90
|
// TODO figure out how to test links
|
|
97
|
-
it.skip(
|
|
98
|
-
const table = screen.getByRole(
|
|
91
|
+
it.skip('navigates to the links', async () => {
|
|
92
|
+
const table = screen.getByRole('table');
|
|
99
93
|
const pt0DashLink = within(table).getByText(referrals[0].zl_emr_id);
|
|
100
94
|
fireEvent.click(pt0DashLink);
|
|
101
95
|
await waitFor(() => {
|
|
102
|
-
expect(window.location.href).toBe(
|
|
103
|
-
"/openmrs/pt-dash/" + referrals[0].patient_uuid
|
|
104
|
-
);
|
|
96
|
+
expect(window.location.href).toBe('/openmrs/pt-dash/' + referrals[0].patient_uuid);
|
|
105
97
|
});
|
|
106
|
-
const pt1VisitLink = within(table).getByText(
|
|
98
|
+
const pt1VisitLink = within(table).getByText('23 Mar');
|
|
107
99
|
fireEvent.click(pt1VisitLink);
|
|
108
100
|
await waitFor(() => {
|
|
109
|
-
expect(window.location.href).toBe(
|
|
110
|
-
`/openmrs/visit/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}`
|
|
111
|
-
);
|
|
101
|
+
expect(window.location.href).toBe(`/openmrs/visit/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}`);
|
|
112
102
|
});
|
|
113
|
-
const pendingStatusLink = within(table).getByText(
|
|
103
|
+
const pendingStatusLink = within(table).getByText('Pending status');
|
|
114
104
|
fireEvent.click(pendingStatusLink);
|
|
115
105
|
await waitFor(() => {
|
|
116
106
|
expect(window.location.href).toBe(
|
|
117
|
-
`/openmrs/home-visit-form/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}/${referrals[1].encounter_uuid}
|
|
107
|
+
`/openmrs/home-visit-form/${referrals[1].patient_uuid}/${referrals[1].visit_uuid}/${referrals[1].encounter_uuid}`,
|
|
118
108
|
);
|
|
119
109
|
});
|
|
120
110
|
});
|
|
121
111
|
|
|
122
112
|
it("doesn't make non-pending statuses into links", () => {
|
|
123
|
-
const table = screen.getByRole(
|
|
124
|
-
expect(within(table).getByText(
|
|
125
|
-
expect(within(table).getByText(
|
|
113
|
+
const table = screen.getByRole('table');
|
|
114
|
+
expect(within(table).getByText('Pending status').tagName).toBe('A'); // sanity check
|
|
115
|
+
expect(within(table).getByText('Test Complete').tagName).not.toBe('A'); // the actual test
|
|
126
116
|
});
|
|
127
117
|
|
|
128
|
-
it(
|
|
129
|
-
fireEvent.click(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
118
|
+
it('filters by referral type', () => {
|
|
119
|
+
fireEvent.click(
|
|
120
|
+
screen.getByLabelText('Referral Type', {
|
|
121
|
+
selector: 'button',
|
|
122
|
+
}),
|
|
123
|
+
);
|
|
124
|
+
fireEvent.click(
|
|
125
|
+
screen.getByText('Mental Health', {
|
|
126
|
+
selector: 'div',
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
130
|
+
expect(screen.queryByText('PTID2')).not.toBeNull();
|
|
131
|
+
expect(screen.queryByText('PTID3')).toBeNull();
|
|
138
132
|
});
|
|
139
133
|
|
|
140
|
-
it(
|
|
141
|
-
expect(screen.queryByText(
|
|
142
|
-
fireEvent.click(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
134
|
+
it('infers list of referral types from data', () => {
|
|
135
|
+
expect(screen.queryByText('Test Referral Type', { selector: 'span' })).toBeNull(); // sanity check
|
|
136
|
+
fireEvent.click(
|
|
137
|
+
screen.getByLabelText('Referral Type', {
|
|
138
|
+
selector: 'button',
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
141
|
+
fireEvent.click(
|
|
142
|
+
screen.getByText('Test Referral Type', {
|
|
143
|
+
selector: 'div',
|
|
144
|
+
}),
|
|
145
|
+
);
|
|
146
|
+
expect(screen.queryByText('Test Referral Type', { selector: 'span' })).not.toBeNull();
|
|
149
147
|
});
|
|
150
148
|
|
|
151
|
-
it(
|
|
152
|
-
fireEvent.click(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
149
|
+
it('filters by statuses, with dropdown inferred from data', () => {
|
|
150
|
+
fireEvent.click(
|
|
151
|
+
screen.getByLabelText('Status', {
|
|
152
|
+
selector: 'button',
|
|
153
|
+
}),
|
|
154
|
+
);
|
|
155
|
+
fireEvent.click(
|
|
156
|
+
screen.getByText('Test Complete', {
|
|
157
|
+
selector: 'div',
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
161
|
+
expect(screen.queryByText('PTID2')).toBeNull();
|
|
162
|
+
expect(screen.queryByText('PTID3')).not.toBeNull();
|
|
161
163
|
});
|
|
162
164
|
|
|
163
165
|
// TODO figure out how to interact with Carbon datepicker
|
|
164
|
-
it.skip(
|
|
165
|
-
const monthAgoString =
|
|
166
|
+
it.skip('calls getReferrals with the correct date arguments', () => {
|
|
167
|
+
const monthAgoString = '2020-09-30';
|
|
166
168
|
expect(mockedGetReferrals).lastCalledWith({
|
|
167
169
|
fromDate: monthAgoString,
|
|
168
170
|
toDate: todayString,
|
|
169
|
-
locale:
|
|
171
|
+
locale: 'en',
|
|
170
172
|
});
|
|
171
|
-
const fromDateInput = screen.getByLabelText(
|
|
172
|
-
fireEvent.change(fromDateInput, { target: { value:
|
|
173
|
+
const fromDateInput = screen.getByLabelText('From');
|
|
174
|
+
fireEvent.change(fromDateInput, { target: { value: '2020-01-01' } });
|
|
173
175
|
expect(mockedGetReferrals).lastCalledWith({
|
|
174
|
-
fromDate:
|
|
176
|
+
fromDate: '2020-01-01',
|
|
175
177
|
toDate: todayString,
|
|
176
|
-
locale:
|
|
178
|
+
locale: 'en',
|
|
177
179
|
});
|
|
178
|
-
const toDateInput = screen.getByLabelText(
|
|
179
|
-
fireEvent.change(toDateInput, { target: { value:
|
|
180
|
+
const toDateInput = screen.getByLabelText('To');
|
|
181
|
+
fireEvent.change(toDateInput, { target: { value: '2020-03-01' } });
|
|
180
182
|
expect(mockedGetReferrals).lastCalledWith({
|
|
181
|
-
fromDate:
|
|
182
|
-
toDate:
|
|
183
|
-
locale:
|
|
183
|
+
fromDate: '2020-01-01',
|
|
184
|
+
toDate: '2020-03-01',
|
|
185
|
+
locale: 'en',
|
|
184
186
|
});
|
|
185
187
|
});
|
|
186
188
|
|
|
187
|
-
it(
|
|
188
|
-
const queryBox = screen.getByLabelText(
|
|
189
|
-
fireEvent.change(queryBox, { target: { value:
|
|
190
|
-
expect(screen.queryByText(
|
|
191
|
-
expect(screen.queryByText(
|
|
189
|
+
it('filters the list of results by patient name query', () => {
|
|
190
|
+
const queryBox = screen.getByLabelText('Filter by patient');
|
|
191
|
+
fireEvent.change(queryBox, { target: { value: 'Mother' } });
|
|
192
|
+
expect(screen.queryByText('PTID2')).not.toBeNull();
|
|
193
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
192
194
|
});
|
|
193
195
|
|
|
194
|
-
it(
|
|
195
|
-
const queryBox = screen.getByLabelText(
|
|
196
|
-
fireEvent.change(queryBox, { target: { value:
|
|
197
|
-
expect(screen.queryByText(
|
|
198
|
-
expect(screen.queryByText(
|
|
196
|
+
it('filters the list of results by patient name partial token matches', () => {
|
|
197
|
+
const queryBox = screen.getByLabelText('Filter by patient');
|
|
198
|
+
fireEvent.change(queryBox, { target: { value: 'dav mo' } });
|
|
199
|
+
expect(screen.queryByText('PTID2')).not.toBeNull();
|
|
200
|
+
expect(screen.queryByText('PTID1')).toBeNull();
|
|
199
201
|
});
|
|
200
202
|
|
|
201
|
-
it(
|
|
202
|
-
const queryBox = screen.getByLabelText(
|
|
203
|
-
fireEvent.change(queryBox, { target: { value:
|
|
204
|
-
expect(screen.queryByText(
|
|
205
|
-
expect(screen.queryByText(
|
|
203
|
+
it('filters the list of results by patient id', () => {
|
|
204
|
+
const queryBox = screen.getByLabelText('Filter by patient');
|
|
205
|
+
fireEvent.change(queryBox, { target: { value: 'ptid1' } });
|
|
206
|
+
expect(screen.queryByText('PTID1')).not.toBeNull();
|
|
207
|
+
expect(screen.queryByText('PTID2')).toBeNull();
|
|
206
208
|
});
|
|
207
209
|
|
|
208
|
-
test.todo(
|
|
210
|
+
test.todo('makes the API call with the locale from the user session');
|
|
209
211
|
});
|
|
@@ -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,8 +1,8 @@
|
|
|
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 (
|
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';
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
TableRow,
|
|
7
|
-
TableBody,
|
|
8
|
-
TableCell,
|
|
9
|
-
} from "@carbon/react";
|
|
10
|
-
import {
|
|
11
|
-
ConfigurableLink,
|
|
12
|
-
interpolateString,
|
|
13
|
-
useConfig,
|
|
14
|
-
} from "@openmrs/esm-framework";
|
|
15
|
-
import { Trans } from "react-i18next";
|
|
16
|
-
import { formatDate } from "../util";
|
|
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';
|
|
17
6
|
|
|
18
7
|
export interface ReferralsTableProps {
|
|
19
8
|
referrals: Referral[];
|
|
@@ -54,10 +43,8 @@ export default function ReferrablesTable(props: ReferralsTableProps) {
|
|
|
54
43
|
<TableCell>
|
|
55
44
|
<ConfigurableLink
|
|
56
45
|
to={interpolateString(config.links.patientDash, {
|
|
57
|
-
patientUuid:
|
|
58
|
-
|
|
59
|
-
})}
|
|
60
|
-
>
|
|
46
|
+
patientUuid: referral.patient_uuid || referral.person_uuid,
|
|
47
|
+
})}>
|
|
61
48
|
{referral.zl_emr_id}
|
|
62
49
|
</ConfigurableLink>
|
|
63
50
|
</TableCell>
|
|
@@ -65,28 +52,22 @@ export default function ReferrablesTable(props: ReferralsTableProps) {
|
|
|
65
52
|
<TableCell>
|
|
66
53
|
<ConfigurableLink
|
|
67
54
|
to={interpolateString(config.links.visitPage, {
|
|
68
|
-
patientUuid:
|
|
69
|
-
referral.patient_uuid || referral.person_uuid,
|
|
55
|
+
patientUuid: referral.patient_uuid || referral.person_uuid,
|
|
70
56
|
visitUuid: referral.visit_uuid,
|
|
71
|
-
})}
|
|
72
|
-
>
|
|
57
|
+
})}>
|
|
73
58
|
{formatDate(referral.referral_date)}
|
|
74
59
|
</ConfigurableLink>
|
|
75
60
|
</TableCell>
|
|
76
61
|
<TableCell>{referral.referral_type}</TableCell>
|
|
77
62
|
<TableCell>{referral.details}</TableCell>
|
|
78
63
|
<TableCell>
|
|
79
|
-
{config.pendingStatuses.includes(
|
|
80
|
-
referral.fulfillment_status
|
|
81
|
-
) ? (
|
|
64
|
+
{config.pendingStatuses.includes(referral.fulfillment_status) ? (
|
|
82
65
|
<ConfigurableLink
|
|
83
66
|
to={interpolateString(config.links.homeVisitForm, {
|
|
84
|
-
patientUuid:
|
|
85
|
-
referral.patient_uuid || referral.person_uuid,
|
|
67
|
+
patientUuid: referral.patient_uuid || referral.person_uuid,
|
|
86
68
|
visitUuid: referral.visit_uuid,
|
|
87
69
|
encounterUuid: referral.encounter_uuid,
|
|
88
|
-
})}
|
|
89
|
-
>
|
|
70
|
+
})}>
|
|
90
71
|
{referral.fulfillment_status}
|
|
91
72
|
</ConfigurableLink>
|
|
92
73
|
) : (
|
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/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
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
name: Node.js CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
release:
|
|
9
|
-
types:
|
|
10
|
-
- created
|
|
11
|
-
|
|
12
|
-
env:
|
|
13
|
-
ESM_NAME: "@pih/esm-referrals-queue-app"
|
|
14
|
-
JS_NAME: "esm-referrals-queue-app.js"
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
build:
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v2
|
|
22
|
-
- name: Use Node.js
|
|
23
|
-
uses: actions/setup-node@v1
|
|
24
|
-
with:
|
|
25
|
-
node-version: "16.x"
|
|
26
|
-
- run: yarn
|
|
27
|
-
- run: yarn lint
|
|
28
|
-
- run: yarn coverage
|
|
29
|
-
- run: yarn typescript
|
|
30
|
-
- run: yarn build
|
|
31
|
-
- name: Upload Artifacts
|
|
32
|
-
uses: actions/upload-artifact@v2
|
|
33
|
-
with:
|
|
34
|
-
name: dist
|
|
35
|
-
path: |
|
|
36
|
-
dist
|
|
37
|
-
|
|
38
|
-
pre_release:
|
|
39
|
-
runs-on: ubuntu-latest
|
|
40
|
-
|
|
41
|
-
needs: build
|
|
42
|
-
|
|
43
|
-
if: ${{ github.event_name == 'push' }}
|
|
44
|
-
|
|
45
|
-
steps:
|
|
46
|
-
- uses: actions/checkout@v2
|
|
47
|
-
- name: Download Artifacts
|
|
48
|
-
uses: actions/download-artifact@v2
|
|
49
|
-
- name: Use Node.js
|
|
50
|
-
uses: actions/setup-node@v1
|
|
51
|
-
with:
|
|
52
|
-
node-version: "16.x"
|
|
53
|
-
registry-url: "https://registry.npmjs.org"
|
|
54
|
-
- run: yarn install
|
|
55
|
-
- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
|
|
56
|
-
- run: yarn publish --access public --tag next
|
|
57
|
-
env:
|
|
58
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
59
|
-
|
|
60
|
-
release:
|
|
61
|
-
runs-on: ubuntu-latest
|
|
62
|
-
|
|
63
|
-
needs: build
|
|
64
|
-
|
|
65
|
-
if: ${{ github.event_name == 'release' }}
|
|
66
|
-
|
|
67
|
-
steps:
|
|
68
|
-
- uses: actions/checkout@v2
|
|
69
|
-
- name: Download Artifacts
|
|
70
|
-
uses: actions/download-artifact@v2
|
|
71
|
-
- name: Use Node.js
|
|
72
|
-
uses: actions/setup-node@v1
|
|
73
|
-
with:
|
|
74
|
-
node-version: "16.x"
|
|
75
|
-
registry-url: 'https://registry.npmjs.org'
|
|
76
|
-
- run: yarn
|
|
77
|
-
- run: yarn publish --access public
|
|
78
|
-
env:
|
|
79
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
package/.husky/pre-push
DELETED