@openmrs/esm-fast-data-entry-app 1.0.1-pre.99 → 1.1.0
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/__mocks__/react-i18next.js +9 -14
- package/dist/12.js +1 -0
- package/dist/12.js.map +1 -0
- package/dist/132.js +1 -0
- package/dist/151.js +2 -0
- package/dist/151.js.map +1 -0
- package/dist/195.js +1 -0
- package/dist/195.js.map +1 -0
- package/dist/197.js +1 -0
- package/dist/221.js +1 -0
- package/dist/221.js.map +1 -0
- package/dist/259.js +1 -0
- package/dist/259.js.map +1 -0
- package/dist/265.js +1 -0
- package/dist/265.js.map +1 -0
- package/dist/269.js +1 -0
- package/dist/269.js.map +1 -0
- package/dist/{574.js → 300.js} +1 -1
- package/dist/335.js +1 -0
- package/dist/367.js +1 -0
- package/dist/367.js.map +1 -0
- package/dist/384.js +1 -0
- package/dist/384.js.map +1 -0
- package/dist/{294.js → 540.js} +2 -2
- package/dist/{294.js.map → 540.js.map} +1 -1
- package/dist/55.js +1 -0
- package/dist/579.js +1 -0
- package/dist/579.js.map +1 -0
- package/dist/595.js +2 -0
- package/dist/{409.js.LICENSE.txt → 595.js.LICENSE.txt} +14 -6
- package/dist/595.js.map +1 -0
- package/dist/602.js +1 -0
- package/dist/602.js.map +1 -0
- package/dist/616.js +1 -0
- package/dist/616.js.map +1 -0
- package/dist/626.js +2 -0
- package/dist/626.js.map +1 -0
- package/dist/652.js +1 -0
- package/dist/77.js +1 -0
- package/dist/77.js.map +1 -0
- package/dist/773.js +2 -0
- package/dist/{897.js.LICENSE.txt → 773.js.LICENSE.txt} +13 -2
- package/dist/773.js.map +1 -0
- package/dist/88.js +1 -0
- package/dist/88.js.map +1 -0
- package/dist/930.js +1 -0
- package/dist/930.js.map +1 -0
- package/dist/961.js +2 -0
- package/dist/961.js.map +1 -0
- package/dist/983.js +1 -0
- package/dist/983.js.map +1 -0
- package/dist/99.js +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +386 -154
- package/dist/openmrs-esm-fast-data-entry-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/jest.config.json +2 -1
- package/package.json +39 -36
- package/prettier.config.js +8 -0
- package/src/CancelModal.tsx +9 -15
- package/src/CompleteModal.tsx +7 -18
- package/src/FormBootstrap.tsx +31 -18
- package/src/Root.tsx +7 -12
- package/src/add-group-modal/AddGroupModal.tsx +73 -112
- package/src/add-group-modal/styles.scss +7 -3
- package/src/config-schema.ts +63 -24
- package/src/constant.ts +1 -1
- package/src/context/FormWorkflowContext.tsx +26 -39
- package/src/context/FormWorkflowReducer.ts +50 -74
- package/src/context/GroupFormWorkflowContext.tsx +40 -59
- package/src/context/GroupFormWorkflowReducer.ts +84 -109
- package/src/declarations.d.ts +3 -0
- package/src/empty-state/EmptyDataIllustration.tsx +4 -16
- package/src/empty-state/EmptyState.tsx +8 -13
- package/src/empty-state/styles.scss +14 -14
- package/src/form-entry-workflow/FormEntryWorkflow.tsx +43 -55
- package/src/form-entry-workflow/form-review-card/FormReviewCard.tsx +7 -7
- package/src/form-entry-workflow/form-review-card/index.ts +1 -1
- package/src/form-entry-workflow/form-review-card/styles.scss +9 -11
- package/src/form-entry-workflow/index.ts +1 -1
- package/src/form-entry-workflow/patient-banner/PatientBanner.test.tsx +5 -5
- package/src/form-entry-workflow/patient-banner/PatientBanner.tsx +14 -27
- package/src/form-entry-workflow/patient-banner/index.ts +1 -1
- package/src/form-entry-workflow/patient-banner/styles.scss +11 -12
- package/src/form-entry-workflow/patient-search-header/PatientSearchHeader.tsx +19 -28
- package/src/form-entry-workflow/patient-search-header/index.ts +1 -1
- package/src/form-entry-workflow/patient-search-header/styles.scss +13 -10
- package/src/form-entry-workflow/styles.scss +11 -13
- package/src/form-entry-workflow/workflow-review/WorkflowReview.tsx +13 -11
- package/src/form-entry-workflow/workflow-review/index.ts +1 -1
- package/src/form-entry-workflow/workflow-review/styles.scss +0 -4
- package/src/forms-app-menu-link.tsx +4 -6
- package/src/forms-page/FormsPage.tsx +23 -51
- package/src/forms-page/forms-table/FormsTable.tsx +22 -42
- package/src/forms-page/forms-table/index.ts +1 -1
- package/src/forms-page/forms-table/styles.scss +4 -5
- package/src/forms-page/index.ts +1 -1
- package/src/forms-page/styles.scss +3 -5
- package/src/group-form-entry-workflow/GroupFormEntryWorkflow.tsx +9 -9
- package/src/group-form-entry-workflow/GroupSessionWorkspace.tsx +77 -117
- package/src/group-form-entry-workflow/SessionDetailsForm.tsx +73 -50
- package/src/group-form-entry-workflow/SessionMetaWorkspace.tsx +20 -28
- package/src/group-form-entry-workflow/attendance-table/AttendanceTable.tsx +15 -29
- package/src/group-form-entry-workflow/attendance-table/index.ts +1 -1
- package/src/group-form-entry-workflow/configurable-questions/ConfigurableQuestionsSection.tsx +45 -0
- package/src/group-form-entry-workflow/group-display-header/GroupDisplayHeader.test.tsx +5 -5
- package/src/group-form-entry-workflow/group-display-header/GroupDisplayHeader.tsx +13 -21
- package/src/group-form-entry-workflow/group-display-header/index.ts +1 -1
- package/src/group-form-entry-workflow/group-display-header/styles.scss +20 -20
- package/src/group-form-entry-workflow/group-search/CompactGroupResults.tsx +24 -35
- package/src/group-form-entry-workflow/group-search/CompactGroupSearch.tsx +13 -15
- package/src/group-form-entry-workflow/group-search/GroupSearch.tsx +22 -38
- package/src/group-form-entry-workflow/group-search/compact-group-result.scss +16 -17
- package/src/group-form-entry-workflow/group-search/compact-group-search.scss +7 -8
- package/src/group-form-entry-workflow/group-search/group-search.scss +20 -23
- package/src/group-form-entry-workflow/group-search-header/GroupSearchHeader.tsx +20 -21
- package/src/group-form-entry-workflow/group-search-header/index.ts +1 -1
- package/src/group-form-entry-workflow/group-search-header/styles.scss +8 -8
- package/src/group-form-entry-workflow/index.ts +1 -1
- package/src/group-form-entry-workflow/styles.scss +13 -16
- package/src/hooks/index.ts +7 -6
- package/src/hooks/useFormState.ts +3 -3
- package/src/hooks/useGetAllForms.ts +7 -15
- package/src/hooks/useGetEncounter.ts +3 -3
- package/src/hooks/useGetPatient.ts +2 -2
- package/src/hooks/useGetPatients.ts +4 -6
- package/src/hooks/useGetSystemSetting.ts +3 -5
- package/src/hooks/useKeyPress.ts +5 -5
- package/src/hooks/usePostEndpoint.ts +10 -10
- package/src/hooks/useSearchEndpoint.ts +23 -40
- package/src/hooks/useSpecificQuestions.ts +75 -0
- package/src/hooks/useStartVisit.ts +18 -28
- package/src/index.ts +8 -20
- package/src/patient-card/PatientCard.tsx +8 -20
- package/src/patient-card/index.ts +1 -1
- package/src/patient-card/styles.scss +2 -4
- package/src/routes.json +2 -2
- package/src/setup-tests.ts +1 -1
- package/src/types.ts +25 -0
- package/tools/i18next-parser.config.js +19 -19
- package/translations/am.json +75 -0
- package/translations/ar.json +75 -0
- package/translations/en.json +7 -1
- package/translations/es.json +75 -0
- package/translations/fr.json +33 -8
- package/translations/he.json +75 -0
- package/translations/km.json +75 -0
- package/tsconfig.json +2 -1
- package/turbo.json +18 -0
- package/webpack.config.js +1 -1
- package/dist/136.js +0 -1
- package/dist/136.js.map +0 -1
- package/dist/141.js +0 -2
- package/dist/141.js.map +0 -1
- package/dist/233.js +0 -2
- package/dist/233.js.map +0 -1
- package/dist/242.js +0 -1
- package/dist/242.js.map +0 -1
- package/dist/327.js +0 -1
- package/dist/327.js.map +0 -1
- package/dist/387.js +0 -1
- package/dist/387.js.map +0 -1
- package/dist/405.js +0 -1
- package/dist/405.js.map +0 -1
- package/dist/409.js +0 -2
- package/dist/409.js.map +0 -1
- package/dist/431.js +0 -1
- package/dist/431.js.map +0 -1
- package/dist/559.js +0 -1
- package/dist/559.js.map +0 -1
- package/dist/757.js +0 -1
- package/dist/820.js +0 -1
- package/dist/820.js.map +0 -1
- package/dist/846.js +0 -1
- package/dist/846.js.map +0 -1
- package/dist/885.js +0 -1
- package/dist/885.js.map +0 -1
- package/dist/897.js +0 -2
- package/dist/897.js.map +0 -1
- package/dist/92.js +0 -1
- package/dist/92.js.map +0 -1
- package/dist/935.js +0 -2
- package/dist/935.js.map +0 -1
- package/src/declarations.d.tsx +0 -2
- /package/dist/{141.js.LICENSE.txt → 151.js.LICENSE.txt} +0 -0
- /package/dist/{294.js.LICENSE.txt → 540.js.LICENSE.txt} +0 -0
- /package/dist/{233.js.LICENSE.txt → 626.js.LICENSE.txt} +0 -0
- /package/dist/{935.js.LICENSE.txt → 961.js.LICENSE.txt} +0 -0
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import { navigate } from
|
|
2
|
-
import { initialWorkflowState } from
|
|
1
|
+
import { navigate } from '@openmrs/esm-framework';
|
|
2
|
+
import { initialWorkflowState } from './FormWorkflowContext';
|
|
3
|
+
import { v4 as uuid } from 'uuid';
|
|
3
4
|
|
|
4
|
-
export const fdeGroupWorkflowStorageVersion =
|
|
5
|
-
export const fdeGroupWorkflowStorageName =
|
|
6
|
-
"openmrs:fastDataEntryGroupWorkflowState";
|
|
5
|
+
export const fdeGroupWorkflowStorageVersion = '1.0.5';
|
|
6
|
+
export const fdeGroupWorkflowStorageName = 'openmrs:fastDataEntryGroupWorkflowState';
|
|
7
7
|
const persistData = (data) => {
|
|
8
|
-
localStorage.setItem(
|
|
9
|
-
fdeGroupWorkflowStorageName + ":" + data.userUuid,
|
|
10
|
-
JSON.stringify(data)
|
|
11
|
-
);
|
|
8
|
+
localStorage.setItem(fdeGroupWorkflowStorageName + ':' + data.userUuid, JSON.stringify(data));
|
|
12
9
|
};
|
|
13
10
|
|
|
14
11
|
const initialFormState = {
|
|
15
|
-
workflowState:
|
|
12
|
+
workflowState: 'NEW_GROUP_SESSION',
|
|
16
13
|
groupUuid: null,
|
|
17
14
|
groupName: null,
|
|
18
15
|
groupMembers: [],
|
|
19
16
|
activePatientUuid: null,
|
|
20
17
|
activeEncounterUuid: null,
|
|
21
18
|
activeVisitUuid: null,
|
|
19
|
+
activeSessionUuid: null,
|
|
22
20
|
patientUuids: [],
|
|
23
21
|
encounters: {},
|
|
24
22
|
visits: {},
|
|
@@ -26,16 +24,11 @@ const initialFormState = {
|
|
|
26
24
|
|
|
27
25
|
const reducer = (state, action) => {
|
|
28
26
|
switch (action.type) {
|
|
29
|
-
case
|
|
30
|
-
const savedData = localStorage.getItem(
|
|
31
|
-
fdeGroupWorkflowStorageName + ":" + action.userUuid
|
|
32
|
-
);
|
|
27
|
+
case 'INITIALIZE_WORKFLOW_STATE': {
|
|
28
|
+
const savedData = localStorage.getItem(fdeGroupWorkflowStorageName + ':' + action.userUuid);
|
|
33
29
|
const savedDataObject = savedData ? JSON.parse(savedData) : {};
|
|
34
30
|
let newState: { [key: string]: unknown } = {};
|
|
35
|
-
if (
|
|
36
|
-
savedData &&
|
|
37
|
-
savedDataObject["_storageVersion"] === fdeGroupWorkflowStorageVersion
|
|
38
|
-
) {
|
|
31
|
+
if (savedData && savedDataObject['_storageVersion'] === fdeGroupWorkflowStorageVersion) {
|
|
39
32
|
// there is localStorage data and it is still valid
|
|
40
33
|
const thisSavedForm = savedDataObject.forms?.[action.activeFormUuid];
|
|
41
34
|
// set active patient to the last one we were on
|
|
@@ -45,6 +38,7 @@ const reducer = (state, action) => {
|
|
|
45
38
|
thisSavedForm?.patientUuids?.[0] ||
|
|
46
39
|
// something probably went wrong...
|
|
47
40
|
null;
|
|
41
|
+
const activeSessionUuid = thisSavedForm?.activeSessionUuid || uuid();
|
|
48
42
|
newState = {
|
|
49
43
|
...savedDataObject,
|
|
50
44
|
// set current form to this one
|
|
@@ -56,10 +50,9 @@ const reducer = (state, action) => {
|
|
|
56
50
|
...initialFormState,
|
|
57
51
|
...thisSavedForm,
|
|
58
52
|
activePatientUuid: activePatientUuid,
|
|
59
|
-
activeEncounterUuid:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
thisSavedForm?.visits?.[activePatientUuid] || null,
|
|
53
|
+
activeEncounterUuid: thisSavedForm?.encounters?.[activePatientUuid] || null,
|
|
54
|
+
activeVisitUuid: thisSavedForm?.visits?.[activePatientUuid] || null,
|
|
55
|
+
activeSessionUuid: activeSessionUuid,
|
|
63
56
|
},
|
|
64
57
|
},
|
|
65
58
|
};
|
|
@@ -79,7 +72,7 @@ const reducer = (state, action) => {
|
|
|
79
72
|
return newState;
|
|
80
73
|
}
|
|
81
74
|
|
|
82
|
-
case
|
|
75
|
+
case 'SET_GROUP': {
|
|
83
76
|
const newState = {
|
|
84
77
|
...state,
|
|
85
78
|
forms: {
|
|
@@ -92,23 +85,19 @@ const reducer = (state, action) => {
|
|
|
92
85
|
// this translation is not preferred
|
|
93
86
|
// the only reason we tollerate it here is beause it should be the only time
|
|
94
87
|
// we add cohort information to state
|
|
95
|
-
action.group.cohortMembers?.map(
|
|
96
|
-
|
|
97
|
-
) ?? [],
|
|
98
|
-
groupMembers:
|
|
99
|
-
action.group.cohortMembers?.map(
|
|
100
|
-
(member) => member?.patient?.uuid
|
|
101
|
-
) ?? [],
|
|
88
|
+
action.group.cohortMembers?.map((member) => member?.patient?.uuid) ?? [],
|
|
89
|
+
groupMembers: action.group.cohortMembers?.map((member) => member?.patient?.uuid) ?? [],
|
|
102
90
|
activePatientUuid: null,
|
|
103
91
|
activeEncounterUuid: null,
|
|
104
92
|
activeVisitUuid: null,
|
|
93
|
+
activeSessionUuid: null,
|
|
105
94
|
},
|
|
106
95
|
},
|
|
107
96
|
};
|
|
108
97
|
persistData(newState);
|
|
109
98
|
return newState;
|
|
110
99
|
}
|
|
111
|
-
case
|
|
100
|
+
case 'UNSET_GROUP': {
|
|
112
101
|
const newState = {
|
|
113
102
|
...state,
|
|
114
103
|
forms: {
|
|
@@ -122,13 +111,14 @@ const reducer = (state, action) => {
|
|
|
122
111
|
activePatientUuid: null,
|
|
123
112
|
activeEncounterUuid: null,
|
|
124
113
|
activeVisitUuid: null,
|
|
114
|
+
activeSessionUuid: null,
|
|
125
115
|
},
|
|
126
116
|
},
|
|
127
117
|
};
|
|
128
118
|
persistData(newState);
|
|
129
119
|
return newState;
|
|
130
120
|
}
|
|
131
|
-
case
|
|
121
|
+
case 'SET_SESSION_META': {
|
|
132
122
|
// requires that group is already entered and contains patientUuids
|
|
133
123
|
const newState = {
|
|
134
124
|
...state,
|
|
@@ -137,29 +127,21 @@ const reducer = (state, action) => {
|
|
|
137
127
|
[state.activeFormUuid]: {
|
|
138
128
|
...state.forms[state.activeFormUuid],
|
|
139
129
|
sessionMeta: action.meta,
|
|
140
|
-
activePatientUuid:
|
|
141
|
-
state.forms[state.activeFormUuid].patientUuids?.[0],
|
|
130
|
+
activePatientUuid: state.forms[state.activeFormUuid].patientUuids?.[0],
|
|
142
131
|
activeEncounterUuid:
|
|
143
|
-
state.forms[state.activeFormUuid].encounters[
|
|
144
|
-
state.forms[state.activeFormUuid].patientUuids?.[0]
|
|
145
|
-
] || null,
|
|
132
|
+
state.forms[state.activeFormUuid].encounters[state.forms[state.activeFormUuid].patientUuids?.[0]] || null,
|
|
146
133
|
activeVisitUuid:
|
|
147
|
-
state.forms[state.activeFormUuid].visits[
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
workflowState: "EDIT_FORM",
|
|
134
|
+
state.forms[state.activeFormUuid].visits[state.forms[state.activeFormUuid].patientUuids?.[0]] || null,
|
|
135
|
+
activeSessionUuid: uuid(),
|
|
136
|
+
workflowState: 'EDIT_FORM',
|
|
151
137
|
},
|
|
152
138
|
},
|
|
153
139
|
};
|
|
154
140
|
persistData(newState);
|
|
155
141
|
return newState;
|
|
156
142
|
}
|
|
157
|
-
case
|
|
158
|
-
if (
|
|
159
|
-
state.forms[state.activeFormUuid].patientUuids.includes(
|
|
160
|
-
action.patientUuid
|
|
161
|
-
)
|
|
162
|
-
) {
|
|
143
|
+
case 'ADD_PATIENT_UUID': {
|
|
144
|
+
if (state.forms[state.activeFormUuid].patientUuids.includes(action.patientUuid)) {
|
|
163
145
|
return state;
|
|
164
146
|
}
|
|
165
147
|
|
|
@@ -169,35 +151,30 @@ const reducer = (state, action) => {
|
|
|
169
151
|
...state.forms,
|
|
170
152
|
[state.activeFormUuid]: {
|
|
171
153
|
...state.forms[state.activeFormUuid],
|
|
172
|
-
patientUuids: [
|
|
173
|
-
...state.forms[state.activeFormUuid].patientUuids,
|
|
174
|
-
action.patientUuid,
|
|
175
|
-
],
|
|
154
|
+
patientUuids: [...state.forms[state.activeFormUuid].patientUuids, action.patientUuid],
|
|
176
155
|
},
|
|
177
156
|
},
|
|
178
157
|
};
|
|
179
158
|
persistData(newState);
|
|
180
159
|
return newState;
|
|
181
160
|
}
|
|
182
|
-
case
|
|
161
|
+
case 'REMOVE_PATIENT_UUID': {
|
|
183
162
|
const newState = {
|
|
184
163
|
...state,
|
|
185
164
|
forms: {
|
|
186
165
|
...state.forms,
|
|
187
166
|
[state.activeFormUuid]: {
|
|
188
167
|
...state.forms[state.activeFormUuid],
|
|
189
|
-
patientUuids: state.forms[
|
|
190
|
-
state.activeFormUuid
|
|
191
|
-
].patientUuids?.filter((uuid) => action.patientUuid !== uuid),
|
|
168
|
+
patientUuids: state.forms[state.activeFormUuid].patientUuids?.filter((uuid) => action.patientUuid !== uuid),
|
|
192
169
|
},
|
|
193
170
|
},
|
|
194
171
|
};
|
|
195
172
|
persistData(newState);
|
|
196
173
|
return newState;
|
|
197
174
|
}
|
|
198
|
-
case
|
|
175
|
+
case 'SAVE_ENCOUNTER': {
|
|
199
176
|
const thisForm = state.forms[state.activeFormUuid];
|
|
200
|
-
if (thisForm.workflowState ===
|
|
177
|
+
if (thisForm.workflowState === 'SUBMIT_FOR_COMPLETE') {
|
|
201
178
|
const { [state.activeFormUuid]: activeForm, ...formRest } = state.forms;
|
|
202
179
|
const newState = {
|
|
203
180
|
...state,
|
|
@@ -206,31 +183,30 @@ const reducer = (state, action) => {
|
|
|
206
183
|
};
|
|
207
184
|
persistData(newState);
|
|
208
185
|
// eslint-disable-next-line
|
|
209
|
-
navigate({ to:
|
|
186
|
+
navigate({ to: '${openmrsSpaBase}/forms' });
|
|
210
187
|
return newState;
|
|
211
|
-
} else if (thisForm.workflowState ===
|
|
188
|
+
} else if (thisForm.workflowState === 'SUBMIT_FOR_NEXT') {
|
|
212
189
|
const nextPatientUuid = state.nextPatientUuid
|
|
213
190
|
? state.nextPatientUuid
|
|
214
191
|
: thisForm.patientUuids[
|
|
215
|
-
Math.min(
|
|
216
|
-
thisForm.patientUuids.indexOf(thisForm.activePatientUuid) + 1,
|
|
217
|
-
thisForm.patientUuids.length - 1
|
|
218
|
-
)
|
|
192
|
+
Math.min(thisForm.patientUuids.indexOf(thisForm.activePatientUuid) + 1, thisForm.patientUuids.length - 1)
|
|
219
193
|
];
|
|
194
|
+
const encounters = {
|
|
195
|
+
...thisForm.encounters,
|
|
196
|
+
[thisForm.activePatientUuid]: action.encounterUuid,
|
|
197
|
+
};
|
|
220
198
|
const newState = {
|
|
221
199
|
...state,
|
|
222
200
|
forms: {
|
|
223
201
|
...state.forms,
|
|
224
202
|
[state.activeFormUuid]: {
|
|
225
203
|
...thisForm,
|
|
226
|
-
encounters
|
|
227
|
-
...thisForm.encounters,
|
|
228
|
-
[thisForm.activePatientUuid]: action.encounterUuid,
|
|
229
|
-
},
|
|
204
|
+
encounters,
|
|
230
205
|
activePatientUuid: nextPatientUuid,
|
|
231
|
-
activeEncounterUuid:
|
|
206
|
+
activeEncounterUuid: encounters[nextPatientUuid] || null,
|
|
232
207
|
activeVisitUuid: thisForm.visits[nextPatientUuid] || null,
|
|
233
|
-
|
|
208
|
+
activeSessionUuid: thisForm.activeSessionUuid,
|
|
209
|
+
workflowState: 'EDIT_FORM',
|
|
234
210
|
},
|
|
235
211
|
},
|
|
236
212
|
};
|
|
@@ -238,35 +214,34 @@ const reducer = (state, action) => {
|
|
|
238
214
|
return newState;
|
|
239
215
|
} else return state;
|
|
240
216
|
}
|
|
241
|
-
case
|
|
217
|
+
case 'EDIT_ENCOUNTER': {
|
|
242
218
|
const newState = {
|
|
243
219
|
...state,
|
|
244
220
|
forms: {
|
|
245
221
|
...state.forms,
|
|
246
222
|
[state.activeFormUuid]: {
|
|
247
223
|
...state.forms[state.activeFormUuid],
|
|
248
|
-
activeEncounterUuid:
|
|
249
|
-
|
|
250
|
-
activeVisitUuid:
|
|
251
|
-
state.forms[state.activeFormUuid].visits[action.patientUuid],
|
|
224
|
+
activeEncounterUuid: state.forms[state.activeFormUuid].encounters[action.patientUuid],
|
|
225
|
+
activeVisitUuid: state.forms[state.activeFormUuid].visits[action.patientUuid],
|
|
252
226
|
activePatientUuid: action.patientUuid,
|
|
253
|
-
|
|
227
|
+
activeSessionUuid: action.activeSessionUuid,
|
|
228
|
+
workflowState: 'EDIT_FORM',
|
|
254
229
|
},
|
|
255
230
|
},
|
|
256
231
|
};
|
|
257
232
|
persistData(newState);
|
|
258
233
|
return newState;
|
|
259
234
|
}
|
|
260
|
-
case
|
|
235
|
+
case 'VALIDATE_FOR_NEXT':
|
|
261
236
|
// this state should not be persisted
|
|
262
237
|
window.dispatchEvent(
|
|
263
|
-
new CustomEvent(
|
|
238
|
+
new CustomEvent('ampath-form-action', {
|
|
264
239
|
detail: {
|
|
265
240
|
formUuid: state.activeFormUuid,
|
|
266
241
|
patientUuid: state.forms[state.activeFormUuid].activePatientUuid,
|
|
267
|
-
action:
|
|
242
|
+
action: 'validateForm',
|
|
268
243
|
},
|
|
269
|
-
})
|
|
244
|
+
}),
|
|
270
245
|
);
|
|
271
246
|
return {
|
|
272
247
|
...state,
|
|
@@ -274,11 +249,11 @@ const reducer = (state, action) => {
|
|
|
274
249
|
...state.forms,
|
|
275
250
|
[state.activeFormUuid]: {
|
|
276
251
|
...state.forms[state.activeFormUuid],
|
|
277
|
-
workflowState:
|
|
252
|
+
workflowState: 'VALIDATE_FOR_NEXT',
|
|
278
253
|
},
|
|
279
254
|
},
|
|
280
255
|
};
|
|
281
|
-
case
|
|
256
|
+
case 'UPDATE_VISIT_UUID':
|
|
282
257
|
// this state should not be persisted
|
|
283
258
|
// we don't pers
|
|
284
259
|
return {
|
|
@@ -289,24 +264,23 @@ const reducer = (state, action) => {
|
|
|
289
264
|
...state.forms[state.activeFormUuid],
|
|
290
265
|
visits: {
|
|
291
266
|
...state.forms[state.activeFormUuid].visits,
|
|
292
|
-
[state.forms[state.activeFormUuid].activePatientUuid]:
|
|
293
|
-
action.visitUuid,
|
|
267
|
+
[state.forms[state.activeFormUuid].activePatientUuid]: action.visitUuid,
|
|
294
268
|
},
|
|
295
269
|
activeVisitUuid: action.visitUuid,
|
|
296
270
|
},
|
|
297
271
|
},
|
|
298
272
|
};
|
|
299
273
|
|
|
300
|
-
case
|
|
274
|
+
case 'SUBMIT_FOR_NEXT':
|
|
301
275
|
// this state should not be persisted
|
|
302
276
|
window.dispatchEvent(
|
|
303
|
-
new CustomEvent(
|
|
277
|
+
new CustomEvent('ampath-form-action', {
|
|
304
278
|
detail: {
|
|
305
279
|
formUuid: state.activeFormUuid,
|
|
306
280
|
patientUuid: state.forms[state.activeFormUuid].activePatientUuid,
|
|
307
|
-
action:
|
|
281
|
+
action: 'onSubmit',
|
|
308
282
|
},
|
|
309
|
-
})
|
|
283
|
+
}),
|
|
310
284
|
);
|
|
311
285
|
return {
|
|
312
286
|
...state,
|
|
@@ -314,21 +288,21 @@ const reducer = (state, action) => {
|
|
|
314
288
|
...state.forms,
|
|
315
289
|
[state.activeFormUuid]: {
|
|
316
290
|
...state.forms[state.activeFormUuid],
|
|
317
|
-
workflowState:
|
|
291
|
+
workflowState: 'SUBMIT_FOR_NEXT',
|
|
318
292
|
},
|
|
319
293
|
},
|
|
320
294
|
nextPatientUuid: action.nextPatientUuid,
|
|
321
295
|
};
|
|
322
|
-
case
|
|
296
|
+
case 'SUBMIT_FOR_REVIEW':
|
|
323
297
|
// this state should not be persisted
|
|
324
298
|
window.dispatchEvent(
|
|
325
|
-
new CustomEvent(
|
|
299
|
+
new CustomEvent('ampath-form-action', {
|
|
326
300
|
detail: {
|
|
327
301
|
formUuid: state.activeFormUuid,
|
|
328
302
|
patientUuid: state.forms[state.activeFormUuid].activePatientUuid,
|
|
329
|
-
action:
|
|
303
|
+
action: 'onSubmit',
|
|
330
304
|
},
|
|
331
|
-
})
|
|
305
|
+
}),
|
|
332
306
|
);
|
|
333
307
|
return {
|
|
334
308
|
...state,
|
|
@@ -336,21 +310,21 @@ const reducer = (state, action) => {
|
|
|
336
310
|
...state.forms,
|
|
337
311
|
[state.activeFormUuid]: {
|
|
338
312
|
...state.forms[state.activeFormUuid],
|
|
339
|
-
workflowState:
|
|
313
|
+
workflowState: 'SUBMIT_FOR_REVIEW',
|
|
340
314
|
},
|
|
341
315
|
},
|
|
342
316
|
};
|
|
343
317
|
|
|
344
|
-
case
|
|
318
|
+
case 'VALIDATE_FOR_COMPLETE':
|
|
345
319
|
// this state should not be persisted
|
|
346
320
|
window.dispatchEvent(
|
|
347
|
-
new CustomEvent(
|
|
321
|
+
new CustomEvent('ampath-form-action', {
|
|
348
322
|
detail: {
|
|
349
323
|
formUuid: state.activeFormUuid,
|
|
350
324
|
patientUuid: state.forms[state.activeFormUuid].activePatientUuid,
|
|
351
|
-
action:
|
|
325
|
+
action: 'validateForm',
|
|
352
326
|
},
|
|
353
|
-
})
|
|
327
|
+
}),
|
|
354
328
|
);
|
|
355
329
|
return {
|
|
356
330
|
...state,
|
|
@@ -358,20 +332,20 @@ const reducer = (state, action) => {
|
|
|
358
332
|
...state.forms,
|
|
359
333
|
[state.activeFormUuid]: {
|
|
360
334
|
...state.forms[state.activeFormUuid],
|
|
361
|
-
workflowState:
|
|
335
|
+
workflowState: 'VALIDATE_FOR_COMPLETE',
|
|
362
336
|
},
|
|
363
337
|
},
|
|
364
338
|
};
|
|
365
|
-
case
|
|
339
|
+
case 'SUBMIT_FOR_COMPLETE':
|
|
366
340
|
// this state should not be persisted
|
|
367
341
|
window.dispatchEvent(
|
|
368
|
-
new CustomEvent(
|
|
342
|
+
new CustomEvent('ampath-form-action', {
|
|
369
343
|
detail: {
|
|
370
344
|
formUuid: state.activeFormUuid,
|
|
371
345
|
patientUuid: state.forms[state.activeFormUuid].activePatientUuid,
|
|
372
|
-
action:
|
|
346
|
+
action: 'onSubmit',
|
|
373
347
|
},
|
|
374
|
-
})
|
|
348
|
+
}),
|
|
375
349
|
);
|
|
376
350
|
return {
|
|
377
351
|
...state,
|
|
@@ -379,11 +353,11 @@ const reducer = (state, action) => {
|
|
|
379
353
|
...state.forms,
|
|
380
354
|
[state.activeFormUuid]: {
|
|
381
355
|
...state.forms[state.activeFormUuid],
|
|
382
|
-
workflowState:
|
|
356
|
+
workflowState: 'SUBMIT_FOR_COMPLETE',
|
|
383
357
|
},
|
|
384
358
|
},
|
|
385
359
|
};
|
|
386
|
-
case
|
|
360
|
+
case 'GO_TO_REVIEW': {
|
|
387
361
|
const newState = {
|
|
388
362
|
...state,
|
|
389
363
|
forms: {
|
|
@@ -393,14 +367,15 @@ const reducer = (state, action) => {
|
|
|
393
367
|
activeEncounterUuid: null,
|
|
394
368
|
activVisitUuid: null,
|
|
395
369
|
activePatientUuid: null,
|
|
396
|
-
|
|
370
|
+
activeSessionUuid: null,
|
|
371
|
+
workflowState: 'REVIEW',
|
|
397
372
|
},
|
|
398
373
|
},
|
|
399
374
|
};
|
|
400
375
|
persistData(newState);
|
|
401
376
|
return newState;
|
|
402
377
|
}
|
|
403
|
-
case
|
|
378
|
+
case 'DESTROY_SESSION': {
|
|
404
379
|
const { [state.activeFormUuid]: activeForm, ...formRest } = state.forms;
|
|
405
380
|
const newState = {
|
|
406
381
|
...state,
|
|
@@ -409,17 +384,17 @@ const reducer = (state, action) => {
|
|
|
409
384
|
};
|
|
410
385
|
persistData(newState);
|
|
411
386
|
//eslint-disable-next-line
|
|
412
|
-
navigate({ to:
|
|
387
|
+
navigate({ to: '${openmrsSpaBase}/forms' });
|
|
413
388
|
return { ...newState, formDestroyed: true };
|
|
414
389
|
}
|
|
415
|
-
case
|
|
390
|
+
case 'CLOSE_SESSION': {
|
|
416
391
|
const newState = {
|
|
417
392
|
...state,
|
|
418
393
|
activeFormUuid: null,
|
|
419
394
|
};
|
|
420
395
|
persistData(newState);
|
|
421
396
|
//eslint-disable-next-line
|
|
422
|
-
navigate({ to:
|
|
397
|
+
navigate({ to: '${openmrsSpaBase}/forms' });
|
|
423
398
|
return newState;
|
|
424
399
|
}
|
|
425
400
|
default:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
-
export const EmptyDataIllustration = ({ width =
|
|
3
|
+
export const EmptyDataIllustration = ({ width = '64', height = '64' }) => {
|
|
4
4
|
return (
|
|
5
5
|
<svg width={width} height={height} viewBox="0 0 64 64">
|
|
6
6
|
<title>Empty data illustration</title>
|
|
@@ -18,13 +18,7 @@ export const EmptyDataIllustration = ({ width = "64", height = "64" }) => {
|
|
|
18
18
|
fill="#C6C6C6"
|
|
19
19
|
/>
|
|
20
20
|
<circle fill="#C6C6C6" cx={17.636} cy={2.314} r={1.855} />
|
|
21
|
-
<circle
|
|
22
|
-
fill="#FFF"
|
|
23
|
-
fillRule="nonzero"
|
|
24
|
-
cx={17.636}
|
|
25
|
-
cy={2.314}
|
|
26
|
-
r={1.175}
|
|
27
|
-
/>
|
|
21
|
+
<circle fill="#FFF" fillRule="nonzero" cx={17.636} cy={2.314} r={1.175} />
|
|
28
22
|
<path
|
|
29
23
|
d="M55.893 53.995H24.544a.79.79 0 01-.788-.789V15.644a.79.79 0 01.788-.788h31.349a.79.79 0 01.788.788v37.562a.79.79 0 01-.788.789z"
|
|
30
24
|
fill="#F4F4F4"
|
|
@@ -38,13 +32,7 @@ export const EmptyDataIllustration = ({ width = "64", height = "64" }) => {
|
|
|
38
32
|
fill="#C6C6C6"
|
|
39
33
|
/>
|
|
40
34
|
<circle fill="#C6C6C6" cx={40.218} cy={9.755} r={1.855} />
|
|
41
|
-
<circle
|
|
42
|
-
fill="#FFF"
|
|
43
|
-
fillRule="nonzero"
|
|
44
|
-
cx={40.218}
|
|
45
|
-
cy={9.755}
|
|
46
|
-
r={1.13}
|
|
47
|
-
/>
|
|
35
|
+
<circle fill="#FFF" fillRule="nonzero" cx={40.218} cy={9.755} r={1.13} />
|
|
48
36
|
</g>
|
|
49
37
|
</svg>
|
|
50
38
|
);
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Tile, Layer } from
|
|
3
|
-
import styles from
|
|
4
|
-
import { useLayoutType } from
|
|
5
|
-
import { EmptyDataIllustration } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tile, Layer } from '@carbon/react';
|
|
3
|
+
import styles from './styles.scss';
|
|
4
|
+
import { useLayoutType } from '@openmrs/esm-framework';
|
|
5
|
+
import { EmptyDataIllustration } from './EmptyDataIllustration';
|
|
6
6
|
|
|
7
7
|
export interface EmptyStateProps {
|
|
8
8
|
headerTitle: string;
|
|
9
9
|
displayText: string;
|
|
10
10
|
}
|
|
11
|
-
const EmptyState: React.FC<EmptyStateProps> = ({
|
|
12
|
-
|
|
13
|
-
displayText,
|
|
14
|
-
}) => {
|
|
15
|
-
const isTablet = useLayoutType() === "tablet";
|
|
11
|
+
const EmptyState: React.FC<EmptyStateProps> = ({ headerTitle, displayText }) => {
|
|
12
|
+
const isTablet = useLayoutType() === 'tablet';
|
|
16
13
|
|
|
17
14
|
return (
|
|
18
15
|
<Layer>
|
|
19
16
|
<Tile className={styles.tile}>
|
|
20
|
-
<div
|
|
21
|
-
className={isTablet ? styles.tabletHeading : styles.desktopHeading}
|
|
22
|
-
>
|
|
17
|
+
<div className={isTablet ? styles.tabletHeading : styles.desktopHeading}>
|
|
23
18
|
<h4>{headerTitle}</h4>
|
|
24
19
|
</div>
|
|
25
20
|
<EmptyDataIllustration />
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
3
|
-
@
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
4
4
|
|
|
5
5
|
.action {
|
|
6
|
-
margin-bottom:
|
|
6
|
+
margin-bottom: layout.$spacing-03;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.content {
|
|
10
|
-
@include
|
|
11
|
-
color:
|
|
12
|
-
margin-top:
|
|
13
|
-
margin-bottom:
|
|
10
|
+
@include type.type-style("heading-compact-01");
|
|
11
|
+
color: colors.$gray-70;
|
|
12
|
+
margin-top: layout.$spacing-05;
|
|
13
|
+
margin-bottom: layout.$spacing-03;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.desktopHeading {
|
|
17
17
|
h4 {
|
|
18
|
-
@include
|
|
19
|
-
color:
|
|
18
|
+
@include type.type-style('heading-compact-02');
|
|
19
|
+
color: colors.$gray-70;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.tabletHeading {
|
|
24
24
|
h4 {
|
|
25
|
-
@include
|
|
26
|
-
color:
|
|
25
|
+
@include type.type-style('heading-03');
|
|
26
|
+
color: colors.$gray-70;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.desktopHeading, .tabletHeading {
|
|
31
31
|
text-align: left;
|
|
32
32
|
text-transform: capitalize;
|
|
33
|
-
margin-bottom:
|
|
33
|
+
margin-bottom: layout.$spacing-05;
|
|
34
34
|
|
|
35
35
|
h4:after {
|
|
36
36
|
content: "";
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
|
|
52
52
|
.tile {
|
|
53
53
|
text-align: center;
|
|
54
|
-
border: 1px solid
|
|
54
|
+
border: 1px solid colors.$gray-20;
|
|
55
55
|
}
|