@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,19 +1,19 @@
|
|
|
1
|
-
import React, { useEffect, useReducer, useRef } from
|
|
2
|
-
import { SkeletonIcon, SkeletonText } from
|
|
3
|
-
import { Events } from
|
|
4
|
-
import styles from
|
|
5
|
-
import { useTranslation } from
|
|
6
|
-
import useKeyPress from
|
|
1
|
+
import React, { useEffect, useReducer, useRef } from 'react';
|
|
2
|
+
import { SkeletonIcon, SkeletonText } from '@carbon/react';
|
|
3
|
+
import { Events } from '@carbon/react/icons';
|
|
4
|
+
import styles from './compact-group-result.scss';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import useKeyPress from '../../hooks/useKeyPress';
|
|
7
7
|
|
|
8
8
|
const reducer = (state, action) => {
|
|
9
9
|
switch (action.type) {
|
|
10
|
-
case
|
|
10
|
+
case 'arrowUp':
|
|
11
11
|
return { selectedIndex: Math.max(state.selectedIndex - 1, 0) };
|
|
12
|
-
case
|
|
12
|
+
case 'arrowDown':
|
|
13
13
|
return {
|
|
14
14
|
selectedIndex: Math.min(state.selectedIndex + 1, action.listLength - 1),
|
|
15
15
|
};
|
|
16
|
-
case
|
|
16
|
+
case 'select':
|
|
17
17
|
return { selectedIndex: action.payload };
|
|
18
18
|
default:
|
|
19
19
|
return state;
|
|
@@ -21,19 +21,11 @@ const reducer = (state, action) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const scrollingOptions = {
|
|
24
|
-
behavior:
|
|
25
|
-
block:
|
|
24
|
+
behavior: 'smooth',
|
|
25
|
+
block: 'nearest',
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const ResultItem = ({
|
|
29
|
-
index,
|
|
30
|
-
selectGroupAction,
|
|
31
|
-
group,
|
|
32
|
-
dispatch,
|
|
33
|
-
state,
|
|
34
|
-
totalGroups,
|
|
35
|
-
lastRef,
|
|
36
|
-
}) => {
|
|
28
|
+
const ResultItem = ({ index, selectGroupAction, group, dispatch, state, totalGroups, lastRef }) => {
|
|
37
29
|
const ref = useRef(null);
|
|
38
30
|
const { t } = useTranslation();
|
|
39
31
|
|
|
@@ -48,12 +40,10 @@ const ResultItem = ({
|
|
|
48
40
|
return (
|
|
49
41
|
<div
|
|
50
42
|
onClick={() => {
|
|
51
|
-
dispatch({ type:
|
|
43
|
+
dispatch({ type: 'select', payload: index });
|
|
52
44
|
selectGroupAction(group);
|
|
53
45
|
}}
|
|
54
|
-
className={`${styles.patientSearchResult} ${
|
|
55
|
-
index === state.selectedIndex && styles.patientSearchResultSelected
|
|
56
|
-
}`}
|
|
46
|
+
className={`${styles.patientSearchResult} ${index === state.selectedIndex && styles.patientSearchResultSelected}`}
|
|
57
47
|
role="button"
|
|
58
48
|
aria-pressed={index === state.selectedIndex}
|
|
59
49
|
tabIndex={0}
|
|
@@ -65,7 +55,7 @@ const ResultItem = ({
|
|
|
65
55
|
<div>
|
|
66
56
|
<h2 className={styles.patientName}>{group.name}</h2>
|
|
67
57
|
<p className={styles.demographics}>
|
|
68
|
-
{group.cohortMembers?.length ?? 0} {t(
|
|
58
|
+
{group.cohortMembers?.length ?? 0} {t('members', 'members')}
|
|
69
59
|
<span className={styles.middot}>·</span> {group.description}
|
|
70
60
|
</p>
|
|
71
61
|
</div>
|
|
@@ -74,21 +64,21 @@ const ResultItem = ({
|
|
|
74
64
|
};
|
|
75
65
|
|
|
76
66
|
const CompactGroupResults = ({ groups, selectGroupAction, lastRef }) => {
|
|
77
|
-
const arrowUpPressed = useKeyPress(
|
|
78
|
-
const arrowDownPressed = useKeyPress(
|
|
79
|
-
const enterPressed = useKeyPress(
|
|
67
|
+
const arrowUpPressed = useKeyPress('ArrowUp');
|
|
68
|
+
const arrowDownPressed = useKeyPress('ArrowDown');
|
|
69
|
+
const enterPressed = useKeyPress('Enter');
|
|
80
70
|
|
|
81
71
|
const [state, dispatch] = useReducer(reducer, { selectedIndex: 0 });
|
|
82
72
|
|
|
83
73
|
useEffect(() => {
|
|
84
74
|
if (arrowUpPressed) {
|
|
85
|
-
dispatch({ type:
|
|
75
|
+
dispatch({ type: 'arrowUp' });
|
|
86
76
|
}
|
|
87
77
|
}, [arrowUpPressed]);
|
|
88
78
|
|
|
89
79
|
useEffect(() => {
|
|
90
80
|
if (arrowDownPressed) {
|
|
91
|
-
dispatch({ type:
|
|
81
|
+
dispatch({ type: 'arrowDown', listLength: groups.length });
|
|
92
82
|
}
|
|
93
83
|
}, [arrowDownPressed, groups.length]);
|
|
94
84
|
|
|
@@ -117,8 +107,8 @@ export const SearchResultSkeleton = () => {
|
|
|
117
107
|
<div className={styles.patientAvatar} role="img">
|
|
118
108
|
<SkeletonIcon
|
|
119
109
|
style={{
|
|
120
|
-
height:
|
|
121
|
-
width:
|
|
110
|
+
height: '3rem',
|
|
111
|
+
width: '3rem',
|
|
122
112
|
}}
|
|
123
113
|
/>
|
|
124
114
|
</div>
|
|
@@ -127,9 +117,8 @@ export const SearchResultSkeleton = () => {
|
|
|
127
117
|
<SkeletonText />
|
|
128
118
|
</h2>
|
|
129
119
|
<span className={styles.demographics}>
|
|
130
|
-
<SkeletonIcon /> <span className={styles.middot}>·</span>{
|
|
131
|
-
<
|
|
132
|
-
<SkeletonIcon />
|
|
120
|
+
<SkeletonIcon /> <span className={styles.middot}>·</span> <SkeletonIcon />{' '}
|
|
121
|
+
<span className={styles.middot}>·</span> <SkeletonIcon />
|
|
133
122
|
</span>
|
|
134
123
|
</div>
|
|
135
124
|
</div>
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { GroupType } from
|
|
3
|
-
import styles from
|
|
4
|
-
import GroupSearch from
|
|
5
|
-
import { Button, Search } from
|
|
6
|
-
import { useTranslation } from
|
|
7
|
-
import debounce from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { type GroupType } from '../../context/GroupFormWorkflowContext';
|
|
3
|
+
import styles from './compact-group-search.scss';
|
|
4
|
+
import GroupSearch from './GroupSearch';
|
|
5
|
+
import { Button, Search } from '@carbon/react';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import debounce from 'lodash-es/debounce';
|
|
8
8
|
|
|
9
9
|
interface CompactGroupSearchProps {
|
|
10
10
|
selectGroupAction?: (group: GroupType) => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const CompactGroupSearch: React.FC<CompactGroupSearchProps> = ({
|
|
14
|
-
selectGroupAction,
|
|
15
|
-
}) => {
|
|
13
|
+
const CompactGroupSearch: React.FC<CompactGroupSearchProps> = ({ selectGroupAction }) => {
|
|
16
14
|
const { t } = useTranslation();
|
|
17
|
-
const [query, setQuery] = useState(
|
|
15
|
+
const [query, setQuery] = useState('');
|
|
18
16
|
const [dropdownShown, setDropdownShown] = useState(false);
|
|
19
17
|
|
|
20
18
|
const onGroupSelect = (group) => {
|
|
21
19
|
selectGroupAction(group);
|
|
22
20
|
setDropdownShown(false);
|
|
23
|
-
setQuery(
|
|
21
|
+
setQuery('');
|
|
24
22
|
};
|
|
25
23
|
|
|
26
24
|
const handleSearchChange = (e) => {
|
|
@@ -42,18 +40,18 @@ const CompactGroupSearch: React.FC<CompactGroupSearchProps> = ({
|
|
|
42
40
|
<Search
|
|
43
41
|
autoFocus
|
|
44
42
|
className={styles.patientSearchInput}
|
|
45
|
-
closeButtonLabelText={t(
|
|
43
|
+
closeButtonLabelText={t('clearSearch', 'Clear')}
|
|
46
44
|
labelText=""
|
|
47
45
|
onChange={(event) => {
|
|
48
46
|
handleSearchChange(event.target.value);
|
|
49
47
|
}}
|
|
50
48
|
onClear={() => undefined}
|
|
51
|
-
placeholder={t(
|
|
49
|
+
placeholder={t('searchForGroup', 'Search for a group by name')}
|
|
52
50
|
size="sm"
|
|
53
51
|
value={query}
|
|
54
52
|
/>
|
|
55
53
|
<Button kind="secondary" size="sm">
|
|
56
|
-
{t(
|
|
54
|
+
{t('search', 'Search')}
|
|
57
55
|
</Button>
|
|
58
56
|
</div>
|
|
59
57
|
{dropdownShown && (
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import React, { useCallback, useRef } from
|
|
2
|
-
import { useTranslation } from
|
|
3
|
-
import { Layer, Tile, Loading } from
|
|
4
|
-
import styles from
|
|
5
|
-
import { EmptyDataIllustration } from
|
|
6
|
-
import CompactGroupResults, {
|
|
7
|
-
|
|
8
|
-
} from
|
|
9
|
-
import { GroupType } from "../../context/GroupFormWorkflowContext";
|
|
10
|
-
import { useSearchCohortInfinite } from "../../hooks/useSearchEndpoint";
|
|
1
|
+
import React, { useCallback, useRef } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Layer, Tile, Loading } from '@carbon/react';
|
|
4
|
+
import styles from './group-search.scss';
|
|
5
|
+
import { EmptyDataIllustration } from '../../empty-state/EmptyDataIllustration';
|
|
6
|
+
import CompactGroupResults, { SearchResultSkeleton } from './CompactGroupResults';
|
|
7
|
+
import { type GroupType } from '../../context/GroupFormWorkflowContext';
|
|
8
|
+
import { useSearchCohortInfinite } from '../../hooks/useSearchEndpoint';
|
|
11
9
|
|
|
12
10
|
interface GroupSearchProps {
|
|
13
11
|
query: string;
|
|
14
12
|
selectGroupAction?: (group: GroupType) => void;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
const GroupSearch: React.FC<GroupSearchProps> = ({
|
|
18
|
-
query = "",
|
|
19
|
-
selectGroupAction,
|
|
20
|
-
}) => {
|
|
15
|
+
const GroupSearch: React.FC<GroupSearchProps> = ({ query = '', selectGroupAction }) => {
|
|
21
16
|
const { t } = useTranslation();
|
|
22
17
|
const {
|
|
23
18
|
isLoading,
|
|
@@ -31,7 +26,7 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
|
|
|
31
26
|
searchTerm: query,
|
|
32
27
|
searching: !!query,
|
|
33
28
|
parameters: {
|
|
34
|
-
v:
|
|
29
|
+
v: 'full',
|
|
35
30
|
},
|
|
36
31
|
});
|
|
37
32
|
|
|
@@ -53,13 +48,13 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
|
|
|
53
48
|
},
|
|
54
49
|
{
|
|
55
50
|
threshold: 0.75,
|
|
56
|
-
}
|
|
51
|
+
},
|
|
57
52
|
);
|
|
58
53
|
if (node) {
|
|
59
54
|
observer.current.observe(node);
|
|
60
55
|
}
|
|
61
56
|
},
|
|
62
|
-
[loadingNewData, hasMore, setPage]
|
|
57
|
+
[loadingNewData, hasMore, setPage],
|
|
63
58
|
);
|
|
64
59
|
|
|
65
60
|
if (error) {
|
|
@@ -69,11 +64,11 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
|
|
|
69
64
|
<Tile className={styles.emptySearchResultsTile}>
|
|
70
65
|
<EmptyDataIllustration />
|
|
71
66
|
<div>
|
|
72
|
-
<p className={styles.errorMessage}>{t(
|
|
67
|
+
<p className={styles.errorMessage}>{t('error', 'Error')}</p>
|
|
73
68
|
<p className={styles.errorCopy}>
|
|
74
69
|
{t(
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
'errorCopy',
|
|
71
|
+
'Sorry, there was an error. You can try to reload this page, or contact the site administrator and quote the error code above.',
|
|
77
72
|
)}
|
|
78
73
|
</p>
|
|
79
74
|
</div>
|
|
@@ -101,18 +96,11 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
|
|
|
101
96
|
<Layer>
|
|
102
97
|
<Tile className={styles.emptySearchResultsTile}>
|
|
103
98
|
<EmptyDataIllustration />
|
|
104
|
-
<p className={styles.emptyResultText}>
|
|
105
|
-
{t("noGroupsFoundMessage", "Sorry, no groups have been found")}
|
|
106
|
-
</p>
|
|
99
|
+
<p className={styles.emptyResultText}>{t('noGroupsFoundMessage', 'Sorry, no groups have been found')}</p>
|
|
107
100
|
<p className={styles.actionText}>
|
|
108
|
-
<span>
|
|
109
|
-
{t(
|
|
110
|
-
"trySearchWithPatientUniqueID",
|
|
111
|
-
"Try searching with the cohort's description"
|
|
112
|
-
)}
|
|
113
|
-
</span>
|
|
101
|
+
<span>{t('trySearchWithPatientUniqueID', "Try searching with the cohort's description")}</span>
|
|
114
102
|
<br />
|
|
115
|
-
<span>{t(
|
|
103
|
+
<span>{t('orLabelName', 'OR label name')}</span>
|
|
116
104
|
</p>
|
|
117
105
|
</Tile>
|
|
118
106
|
</Layer>
|
|
@@ -125,21 +113,17 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
|
|
|
125
113
|
<div
|
|
126
114
|
className={styles.searchResults}
|
|
127
115
|
style={{
|
|
128
|
-
maxHeight:
|
|
116
|
+
maxHeight: '22rem',
|
|
129
117
|
}}
|
|
130
118
|
>
|
|
131
119
|
<p className={styles.resultsText}>
|
|
132
|
-
{totalResults} {t(
|
|
120
|
+
{totalResults} {t('searchResultsText', 'search result(s)')}
|
|
133
121
|
</p>
|
|
134
|
-
<CompactGroupResults
|
|
135
|
-
groups={results}
|
|
136
|
-
selectGroupAction={selectGroupAction}
|
|
137
|
-
lastRef={lastItem}
|
|
138
|
-
/>
|
|
122
|
+
<CompactGroupResults groups={results} selectGroupAction={selectGroupAction} lastRef={lastItem} />
|
|
139
123
|
<div ref={lastItem}>
|
|
140
124
|
<div className={styles.lastItem} ref={loadingRef}>
|
|
141
125
|
{hasMore && <Loading withOverlay={false} small />}
|
|
142
|
-
{!hasMore && <p>{t(
|
|
126
|
+
{!hasMore && <p>{t('noMoreResults', 'End of search results')}</p>}
|
|
143
127
|
</div>
|
|
144
128
|
</div>
|
|
145
129
|
</div>
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
@use '@carbon/
|
|
2
|
-
@use '@carbon/
|
|
3
|
-
@use '@carbon/
|
|
4
|
-
@import '~@openmrs/esm-styleguide/src/vars';
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
5
4
|
|
|
6
5
|
.patientSearchResult {
|
|
7
6
|
text-decoration: none;
|
|
8
7
|
display: flex;
|
|
9
8
|
align-items: center;
|
|
10
|
-
border-bottom: 1px solid
|
|
11
|
-
padding: 0
|
|
9
|
+
border-bottom: 1px solid colors.$gray-20;
|
|
10
|
+
padding: 0 layout.$spacing-04;
|
|
12
11
|
|
|
13
12
|
&:hover,
|
|
14
13
|
&:focus {
|
|
15
|
-
background-color:
|
|
14
|
+
background-color: colors.$gray-10;
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -29,9 +28,9 @@
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
.patientAvatar {
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
34
|
-
margin:
|
|
31
|
+
width: layout.$spacing-09;
|
|
32
|
+
height: layout.$spacing-09;
|
|
33
|
+
margin: layout.$spacing-03 layout.$spacing-05 layout.$spacing-03 0;
|
|
35
34
|
border-radius: 1px;
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -39,26 +38,26 @@
|
|
|
39
38
|
width: 100%;
|
|
40
39
|
display: flex;
|
|
41
40
|
flex-flow: column wrap;
|
|
42
|
-
margin:
|
|
41
|
+
margin: layout.$spacing-05;
|
|
43
42
|
cursor: pointer;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
.demographics {
|
|
47
|
-
margin-top:
|
|
46
|
+
margin-top: layout.$spacing-03;
|
|
48
47
|
@include type.type-style('body-compact-02');
|
|
49
|
-
color:
|
|
48
|
+
color: colors.$gray-70;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
.identifiers {
|
|
53
52
|
@include type.type-style('body-compact-02');
|
|
54
|
-
color:
|
|
53
|
+
color: colors.$gray-50;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
.actionsContainer {
|
|
58
|
-
padding-top:
|
|
59
|
-
margin-top:
|
|
57
|
+
padding-top: layout.$spacing-03;
|
|
58
|
+
margin-top: layout.$spacing-05;
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
.middot {
|
|
63
|
-
margin: 0
|
|
62
|
+
margin: 0 layout.$spacing-03;
|
|
64
63
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
@use '@carbon/
|
|
3
|
-
@use '@carbon/
|
|
4
|
-
@import '~@openmrs/esm-styleguide/src/vars';
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
5
4
|
|
|
6
5
|
.patientSearchBar {
|
|
7
6
|
width: 50vw;
|
|
@@ -11,11 +10,11 @@
|
|
|
11
10
|
.floatingSearchResultsContainer {
|
|
12
11
|
position: absolute;
|
|
13
12
|
overflow-y: auto;
|
|
14
|
-
box-shadow: 0
|
|
13
|
+
box-shadow: 0 layout.$spacing-03 layout.$spacing-05 colors.$gray-20;
|
|
15
14
|
z-index: 99;
|
|
16
|
-
border: 0 1px 1px 1px solid
|
|
15
|
+
border: 0 1px 1px 1px solid colors.$gray-20;
|
|
17
16
|
width: 100%;
|
|
18
|
-
background-color:
|
|
17
|
+
background-color: colors.$white-0;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
.searchArea {
|
|
@@ -23,7 +22,7 @@
|
|
|
23
22
|
display: flex;
|
|
24
23
|
justify-content: center;
|
|
25
24
|
align-items: center;
|
|
26
|
-
border: 1px solid
|
|
25
|
+
border: 1px solid colors.$gray-50;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
.patientSearchInput {
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
@use '@carbon/
|
|
2
|
-
@use '@carbon/
|
|
3
|
-
@
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
6
4
|
|
|
7
5
|
.searchResultsContainer {
|
|
8
6
|
width: 100%;
|
|
9
|
-
background-color:
|
|
7
|
+
background-color: colors.$white-0;
|
|
10
8
|
|
|
11
9
|
a {
|
|
12
10
|
text-decoration: none;
|
|
13
11
|
@include type.type-style('heading-02');
|
|
14
|
-
color:
|
|
12
|
+
color: colors.$gray-70;
|
|
15
13
|
margin: 0rem;
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -22,7 +20,7 @@
|
|
|
22
20
|
|
|
23
21
|
:global(.omrs-breakpoint-gt-tablet) .searchResultsContainer {
|
|
24
22
|
padding: 0;
|
|
25
|
-
top:
|
|
23
|
+
top: layout.$spacing-09;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
.searchResults {
|
|
@@ -30,7 +28,6 @@
|
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
|
|
33
|
-
|
|
34
31
|
.searchTerm {
|
|
35
32
|
@include type.type-style('heading-03');
|
|
36
33
|
margin-top: 0.375rem;
|
|
@@ -38,9 +35,9 @@
|
|
|
38
35
|
|
|
39
36
|
.resultsText {
|
|
40
37
|
@include type.type-style('label-01');
|
|
41
|
-
color:
|
|
42
|
-
line-height:
|
|
43
|
-
margin:
|
|
38
|
+
color: colors.$gray-70;
|
|
39
|
+
line-height: layout.$spacing-05;
|
|
40
|
+
margin: layout.$spacing-03 layout.$spacing-05;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
.helperText {
|
|
@@ -50,46 +47,46 @@
|
|
|
50
47
|
|
|
51
48
|
.emptyResultText {
|
|
52
49
|
@include type.type-style('heading-compact-01');
|
|
53
|
-
color:
|
|
54
|
-
margin-top:
|
|
50
|
+
color: colors.$gray-70;
|
|
51
|
+
margin-top: layout.$spacing-05;
|
|
55
52
|
margin-bottom: 0.313rem;
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
.actionText {
|
|
59
56
|
@include type.type-style('body-01');
|
|
60
|
-
color:
|
|
57
|
+
color: colors.$gray-70;
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
.pagination {
|
|
64
61
|
display: flex;
|
|
65
62
|
justify-content: space-evenly;
|
|
66
|
-
padding: 4.688rem 0
|
|
63
|
+
padding: 4.688rem 0 layout.$spacing-06;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
.emptySearchResultsTile {
|
|
70
67
|
text-align: center;
|
|
71
|
-
margin-top:
|
|
72
|
-
padding:
|
|
68
|
+
margin-top: layout.$spacing-05;
|
|
69
|
+
padding: layout.$spacing-09 0rem;
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
:global(.omrs-breakpoint-gt-tablet) .emptySearchResultsTile {
|
|
76
|
-
margin:
|
|
73
|
+
margin: layout.$spacing-05;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
.errorMessage {
|
|
80
77
|
@include type.type-style('heading-compact-02');
|
|
81
78
|
margin-top: 2.25rem;
|
|
82
|
-
margin-bottom:
|
|
79
|
+
margin-bottom: layout.$spacing-03;
|
|
83
80
|
}
|
|
84
81
|
|
|
85
82
|
.errorCopy {
|
|
86
|
-
margin-bottom:
|
|
83
|
+
margin-bottom: layout.$spacing-03;
|
|
87
84
|
@include type.type-style('body-01');
|
|
88
|
-
color:
|
|
85
|
+
color: colors.$gray-70;
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
.lastItem {
|
|
92
|
-
padding:
|
|
89
|
+
padding: layout.$spacing-05;
|
|
93
90
|
display: flex;
|
|
94
91
|
justify-content: center;
|
|
95
92
|
align-items: center;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { Close, Add } from
|
|
2
|
-
import { Button } from
|
|
3
|
-
import React, { useCallback, useContext, useState } from
|
|
4
|
-
import GroupFormWorkflowContext from
|
|
5
|
-
import styles from
|
|
6
|
-
import { useTranslation } from
|
|
7
|
-
import CompactGroupSearch from
|
|
8
|
-
import AddGroupModal from
|
|
1
|
+
import { Close, Add } from '@carbon/react/icons';
|
|
2
|
+
import { Button } from '@carbon/react';
|
|
3
|
+
import React, { useCallback, useContext, useState } from 'react';
|
|
4
|
+
import GroupFormWorkflowContext from '../../context/GroupFormWorkflowContext';
|
|
5
|
+
import styles from './styles.scss';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import CompactGroupSearch from '../group-search/CompactGroupSearch';
|
|
8
|
+
import AddGroupModal from '../../add-group-modal/AddGroupModal';
|
|
9
9
|
|
|
10
10
|
const GroupSearchHeader = () => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
|
-
const { activeGroupUuid, setGroup, destroySession } = useContext(
|
|
13
|
-
GroupFormWorkflowContext
|
|
14
|
-
);
|
|
12
|
+
const { activeGroupUuid, setGroup, destroySession } = useContext(GroupFormWorkflowContext);
|
|
15
13
|
const [isOpen, setOpen] = useState(false);
|
|
16
14
|
const handleSelectGroup = (group) => {
|
|
15
|
+
group.cohortMembers.sort((a, b) => {
|
|
16
|
+
const aName = a?.patient?.person?.names?.[0]?.display;
|
|
17
|
+
const bName = b?.patient?.person?.names?.[0]?.display;
|
|
18
|
+
return aName.localeCompare(bName, undefined, { sensitivity: 'base' });
|
|
19
|
+
});
|
|
17
20
|
setGroup(group);
|
|
18
21
|
};
|
|
19
22
|
|
|
@@ -33,24 +36,20 @@ const GroupSearchHeader = () => {
|
|
|
33
36
|
|
|
34
37
|
return (
|
|
35
38
|
<div className={styles.searchHeaderContainer}>
|
|
36
|
-
<span className={styles.padded}>{t(
|
|
39
|
+
<span className={styles.padded}>{t('findGroup', 'Find group')}:</span>
|
|
37
40
|
<span className={styles.searchBarWrapper}>
|
|
38
41
|
<CompactGroupSearch selectGroupAction={handleSelectGroup} />
|
|
39
42
|
</span>
|
|
40
|
-
<span className={styles.padded}>{t(
|
|
43
|
+
<span className={styles.padded}>{t('or', 'or')}</span>
|
|
41
44
|
<span>
|
|
42
|
-
<Button
|
|
43
|
-
|
|
44
|
-
renderIcon={Add}
|
|
45
|
-
iconDescription="Add"
|
|
46
|
-
>
|
|
47
|
-
{t("createNewGroup", "Create New Group")}
|
|
45
|
+
<Button onClick={handleOpenClick} renderIcon={Add} iconDescription="Add">
|
|
46
|
+
{t('createNewGroup', 'Create New Group')}
|
|
48
47
|
</Button>
|
|
49
48
|
<AddGroupModal
|
|
50
49
|
{...{
|
|
51
50
|
isCreate: true,
|
|
52
51
|
isOpen: isOpen,
|
|
53
|
-
|
|
52
|
+
onPostCancel: handleCancel,
|
|
54
53
|
onPostSubmit: onPostSubmit,
|
|
55
54
|
}}
|
|
56
55
|
/>
|
|
@@ -63,7 +62,7 @@ const GroupSearchHeader = () => {
|
|
|
63
62
|
destroySession();
|
|
64
63
|
}}
|
|
65
64
|
>
|
|
66
|
-
{t(
|
|
65
|
+
{t('cancel', 'Cancel')} <Close size={20} />
|
|
67
66
|
</Button>
|
|
68
67
|
</span>
|
|
69
68
|
</div>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
@use '@carbon/
|
|
2
|
-
@
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
3
|
|
|
4
4
|
.searchHeaderContainer {
|
|
5
|
-
height:
|
|
5
|
+
height: layout.$spacing-11;
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
|
-
background-color:
|
|
9
|
-
border-top: 0.0125rem solid
|
|
10
|
-
border-bottom: 0.0125rem solid
|
|
11
|
-
padding: 0
|
|
8
|
+
background-color: colors.$white-0;
|
|
9
|
+
border-top: 0.0125rem solid colors.$gray-20;
|
|
10
|
+
border-bottom: 0.0125rem solid colors.$gray-20;
|
|
11
|
+
padding: 0 layout.$spacing-05;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.searchBarWrapper {
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.padded {
|
|
19
|
-
padding:
|
|
19
|
+
padding: layout.$spacing-05;
|
|
20
20
|
}
|