@openmrs/esm-fast-data-entry-app 1.0.0-pre.59 → 1.0.1-pre.10
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/.husky/pre-push +0 -0
- package/.tx/config +9 -0
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/45b499b6.yml +0 -0
- package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
- package/jest.config.json +20 -18
- package/package.json +31 -38
- package/src/FormBootstrap.tsx +9 -2
- package/src/Root.tsx +12 -5
- package/src/add-group-modal/AddGroupModal.tsx +209 -0
- package/src/add-group-modal/styles.scss +35 -0
- package/src/context/FormWorkflowContext.tsx +1 -1
- package/src/context/FormWorkflowReducer.ts +1 -1
- package/src/context/GroupFormWorkflowContext.tsx +141 -0
- package/src/context/GroupFormWorkflowReducer.ts +272 -0
- package/src/empty-state/EmptyState.tsx +12 -8
- package/src/form-entry-workflow/FormEntryWorkflow.tsx +23 -13
- package/src/{form-review-card → form-entry-workflow/form-review-card}/FormReviewCard.tsx +3 -3
- package/src/{form-review-card → form-entry-workflow/form-review-card}/index.ts +0 -0
- package/src/form-entry-workflow/form-review-card/styles.scss +39 -0
- package/src/{patient-banner → form-entry-workflow/patient-banner}/PatientBanner.test.tsx +0 -0
- package/src/{patient-banner → form-entry-workflow/patient-banner}/PatientBanner.tsx +3 -3
- package/src/{patient-banner → form-entry-workflow/patient-banner}/index.ts +0 -0
- package/src/{patient-banner → form-entry-workflow/patient-banner}/styles.scss +8 -7
- package/src/{patient-search-header → form-entry-workflow/patient-search-header}/PatientSearchHeader.tsx +13 -11
- package/src/{patient-search-header → form-entry-workflow/patient-search-header}/index.ts +0 -0
- package/src/form-entry-workflow/patient-search-header/styles.scss +22 -0
- package/src/form-entry-workflow/styles.scss +14 -13
- package/src/{workflow-review → form-entry-workflow/workflow-review}/WorkflowReview.tsx +6 -6
- package/src/{workflow-review → form-entry-workflow/workflow-review}/index.ts +0 -0
- package/src/{workflow-review → form-entry-workflow/workflow-review}/styles.scss +0 -0
- package/src/forms-app-menu-link.tsx +2 -2
- package/src/forms-page/FormsPage.tsx +55 -21
- package/src/{forms-table → forms-page/forms-table}/FormsTable.tsx +14 -6
- package/src/{forms-table → forms-page/forms-table}/index.ts +0 -0
- package/src/{forms-table → forms-page/forms-table}/styles.scss +0 -0
- package/src/forms-page/styles.scss +5 -5
- package/src/group-form-entry-workflow/GroupFormEntryWorkflow.tsx +413 -0
- package/src/group-form-entry-workflow/group-banner/GroupBanner.test.tsx +9 -0
- package/src/group-form-entry-workflow/group-banner/GroupBanner.tsx +45 -0
- package/src/group-form-entry-workflow/group-banner/index.ts +3 -0
- package/src/group-form-entry-workflow/group-banner/styles.scss +60 -0
- package/src/group-form-entry-workflow/group-search/CompactGroupResults.tsx +106 -0
- package/src/group-form-entry-workflow/group-search/CompactGroupSearch.tsx +63 -0
- package/src/group-form-entry-workflow/group-search/GroupSearch.tsx +93 -0
- package/src/group-form-entry-workflow/group-search/compact-group-result.scss +64 -0
- package/src/group-form-entry-workflow/group-search/compact-group-search.scss +35 -0
- package/src/group-form-entry-workflow/group-search/group-search.scss +94 -0
- package/src/group-form-entry-workflow/group-search/mock-group-data.ts +79 -0
- package/src/group-form-entry-workflow/group-search/useGroupSearch.ts +14 -0
- package/src/group-form-entry-workflow/group-search-header/GroupSearchHeader.tsx +42 -0
- package/src/group-form-entry-workflow/group-search-header/index.ts +3 -0
- package/src/{patient-search-header → group-form-entry-workflow/group-search-header}/styles.scss +5 -6
- package/src/group-form-entry-workflow/index.ts +3 -0
- package/src/group-form-entry-workflow/styles.scss +86 -0
- package/src/hooks/useKeyPress.ts +31 -0
- package/src/hooks/usePostCohort.ts +18 -0
- package/src/index.ts +5 -1
- package/src/patient-card/PatientCard.tsx +11 -9
- package/src/patient-card/styles.scss +9 -8
- package/translations/en.json +30 -1
- package/.github/pull_request_template.md +0 -18
- package/.github/workflows/node.js.yml +0 -121
- package/dist/132.js +0 -1
- package/dist/187.js +0 -1
- package/dist/247.js +0 -1
- package/dist/294.js +0 -2
- package/dist/294.js.LICENSE.txt +0 -14
- package/dist/312.js +0 -1
- package/dist/412.js +0 -1
- package/dist/536.js +0 -2
- package/dist/536.js.LICENSE.txt +0 -8
- package/dist/574.js +0 -1
- package/dist/592.js +0 -1
- package/dist/595.js +0 -2
- package/dist/595.js.LICENSE.txt +0 -1
- package/dist/776.js +0 -1
- package/dist/804.js +0 -1
- package/dist/880.js +0 -2
- package/dist/880.js.LICENSE.txt +0 -20
- package/dist/906.js +0 -1
- package/dist/935.js +0 -2
- package/dist/935.js.LICENSE.txt +0 -23
- package/dist/990.js +0 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +0 -433
- package/dist/openmrs-esm-fast-data-entry-app.old +0 -1
- package/src/form-review-card/styles.scss +0 -38
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { Layer, Tile } from "@carbon/react";
|
|
4
|
+
import styles from "./group-search.scss";
|
|
5
|
+
import { EmptyDataIllustration } from "../../empty-state/EmptyDataIllustration";
|
|
6
|
+
import { useGroupSearch } from "./useGroupSearch";
|
|
7
|
+
import CompactGroupResults, {
|
|
8
|
+
SearchResultSkeleton,
|
|
9
|
+
} from "./CompactGroupResults";
|
|
10
|
+
import { GroupType } from "../../context/GroupFormWorkflowContext";
|
|
11
|
+
|
|
12
|
+
interface GroupSearchProps {
|
|
13
|
+
query: string;
|
|
14
|
+
selectGroupAction?: (group: GroupType) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const GroupSearch: React.FC<GroupSearchProps> = ({
|
|
18
|
+
query = "",
|
|
19
|
+
selectGroupAction,
|
|
20
|
+
}) => {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const results = useGroupSearch(query);
|
|
23
|
+
const error = false;
|
|
24
|
+
|
|
25
|
+
if (error) {
|
|
26
|
+
return (
|
|
27
|
+
<div className={styles.searchResults}>
|
|
28
|
+
<Layer>
|
|
29
|
+
<Tile className={styles.emptySearchResultsTile}>
|
|
30
|
+
<EmptyDataIllustration />
|
|
31
|
+
<div>
|
|
32
|
+
<p className={styles.errorMessage}>{t("error", "Error")}</p>
|
|
33
|
+
<p className={styles.errorCopy}>
|
|
34
|
+
{t(
|
|
35
|
+
"errorCopy",
|
|
36
|
+
"Sorry, there was an error. You can try to reload this page, or contact the site administrator and quote the error code above."
|
|
37
|
+
)}
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
</Tile>
|
|
41
|
+
</Layer>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (query.length <= 2) return <SearchResultSkeleton />;
|
|
47
|
+
|
|
48
|
+
if (results.length === 0) {
|
|
49
|
+
return (
|
|
50
|
+
<div className={styles.searchResults}>
|
|
51
|
+
<Layer>
|
|
52
|
+
<Tile className={styles.emptySearchResultsTile}>
|
|
53
|
+
<EmptyDataIllustration />
|
|
54
|
+
<p className={styles.emptyResultText}>
|
|
55
|
+
{t("noGroupsFoundMessage", "Sorry, no groups have been found")}
|
|
56
|
+
</p>
|
|
57
|
+
<p className={styles.actionText}>
|
|
58
|
+
<span>
|
|
59
|
+
{t(
|
|
60
|
+
"trySearchWithPatientUniqueID",
|
|
61
|
+
"Try searching with the cohort's description"
|
|
62
|
+
)}
|
|
63
|
+
</span>
|
|
64
|
+
<br />
|
|
65
|
+
<span>{t("orLabelName", "OR label name")}</span>
|
|
66
|
+
</p>
|
|
67
|
+
</Tile>
|
|
68
|
+
</Layer>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div className={styles.searchResultsContainer}>
|
|
75
|
+
<div
|
|
76
|
+
className={styles.searchResults}
|
|
77
|
+
style={{
|
|
78
|
+
maxHeight: "22rem",
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<p className={styles.resultsText}>
|
|
82
|
+
{results.length} {t("searchResultsText", "search result(s)")}
|
|
83
|
+
</p>
|
|
84
|
+
<CompactGroupResults
|
|
85
|
+
groups={results}
|
|
86
|
+
selectGroupAction={selectGroupAction}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default GroupSearch;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@use '@carbon/styles/scss/colors';
|
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
5
|
+
|
|
6
|
+
.patientSearchResult {
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
border-bottom: 1px solid $ui-03;
|
|
11
|
+
padding: 0 spacing.$spacing-04;
|
|
12
|
+
|
|
13
|
+
&:hover,
|
|
14
|
+
&:focus {
|
|
15
|
+
background-color: $ui-01;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.patientSearchResultSelected {
|
|
20
|
+
background-color: colors.$gray-20;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.patientBanner {
|
|
24
|
+
display: flex;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.patientName {
|
|
28
|
+
@include type.type-style('heading-02');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.patientAvatar {
|
|
32
|
+
width: spacing.$spacing-09;
|
|
33
|
+
height: spacing.$spacing-09;
|
|
34
|
+
margin: spacing.$spacing-03 spacing.$spacing-05 spacing.$spacing-03 0;
|
|
35
|
+
border-radius: 1px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.patientInfo {
|
|
39
|
+
width: 100%;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-flow: column wrap;
|
|
42
|
+
margin: spacing.$spacing-05;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.demographics {
|
|
47
|
+
margin-top: spacing.$spacing-03;
|
|
48
|
+
@include type.type-style('body-compact-02');
|
|
49
|
+
color: $text-02;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.identifiers {
|
|
53
|
+
@include type.type-style('body-compact-02');
|
|
54
|
+
color: $ui-04;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.actionsContainer {
|
|
58
|
+
padding-top: spacing.$spacing-03;
|
|
59
|
+
margin-top: spacing.$spacing-05;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.middot {
|
|
63
|
+
margin: 0 spacing.$spacing-03;
|
|
64
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
@use '@carbon/styles/scss/spacing';
|
|
3
|
+
@use '@carbon/styles/scss/colors';
|
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
5
|
+
|
|
6
|
+
.patientSearchBar {
|
|
7
|
+
width: 50vw;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.floatingSearchResultsContainer {
|
|
12
|
+
position: absolute;
|
|
13
|
+
overflow-y: auto;
|
|
14
|
+
box-shadow: 0 spacing.$spacing-03 spacing.$spacing-05 $ui-03;
|
|
15
|
+
z-index: 99;
|
|
16
|
+
border: 0 1px 1px 1px solid $ui-03;
|
|
17
|
+
width: 100%;
|
|
18
|
+
background-color: $ui-02;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.searchArea {
|
|
22
|
+
width: inherit;
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
align-items: center;
|
|
26
|
+
border: 1px solid $ui-04;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.patientSearchInput {
|
|
30
|
+
border: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.patientSearchInput input:focus {
|
|
34
|
+
outline: 1px solid 1px solid colors.$orange-40;
|
|
35
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
.searchResultsContainer {
|
|
8
|
+
width: 100%;
|
|
9
|
+
background-color: $ui-02;
|
|
10
|
+
|
|
11
|
+
a {
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
@include type.type-style('heading-02');
|
|
14
|
+
color: $text-02;
|
|
15
|
+
margin: 0rem;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:global(.omrs-breakpoint-lt-desktop) .searchResultsContainer {
|
|
20
|
+
top: 6.25rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:global(.omrs-breakpoint-gt-tablet) .searchResultsContainer {
|
|
24
|
+
padding: 0;
|
|
25
|
+
top: spacing.$spacing-09;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.searchResults {
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.loadingIcon {
|
|
33
|
+
padding: spacing.$spacing-05 0;
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.searchTerm {
|
|
40
|
+
@include type.type-style('heading-03');
|
|
41
|
+
margin-top: 0.375rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.resultsText {
|
|
45
|
+
@include type.type-style('label-01');
|
|
46
|
+
color: $text-02;
|
|
47
|
+
line-height: spacing.$spacing-05;
|
|
48
|
+
margin: spacing.$spacing-03 spacing.$spacing-05;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.helperText {
|
|
52
|
+
color: var(--omrs-color-ink-medium-contrast);
|
|
53
|
+
margin-left: 2.375rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.emptyResultText {
|
|
57
|
+
@include type.type-style('heading-compact-01');
|
|
58
|
+
color: $text-02;
|
|
59
|
+
margin-top: spacing.$spacing-05;
|
|
60
|
+
margin-bottom: 0.313rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.actionText {
|
|
64
|
+
@include type.type-style('body-01');
|
|
65
|
+
color: $text-02;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pagination {
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: space-evenly;
|
|
71
|
+
padding: 4.688rem 0 spacing.$spacing-06;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.emptySearchResultsTile {
|
|
75
|
+
text-align: center;
|
|
76
|
+
margin-top: spacing.$spacing-05;
|
|
77
|
+
padding: spacing.$spacing-09 0rem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:global(.omrs-breakpoint-gt-tablet) .emptySearchResultsTile {
|
|
81
|
+
margin: spacing.$spacing-05;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.errorMessage {
|
|
85
|
+
@include type.type-style('heading-compact-02');
|
|
86
|
+
margin-top: 2.25rem;
|
|
87
|
+
margin-bottom: spacing.$spacing-03;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.errorCopy {
|
|
91
|
+
margin-bottom: spacing.$spacing-03;
|
|
92
|
+
@include type.type-style('body-01');
|
|
93
|
+
color: $text-02;
|
|
94
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const mockGroupData = [
|
|
2
|
+
{
|
|
3
|
+
id: 1,
|
|
4
|
+
name: "Teal Group",
|
|
5
|
+
description: "Coping skills group - Calgary",
|
|
6
|
+
members: [
|
|
7
|
+
{
|
|
8
|
+
name: "Donna Campbell",
|
|
9
|
+
uuid: "f87cae5e-6b64-4f64-884d-d46043a3b7da",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "Agnes Lewis",
|
|
13
|
+
uuid: "8af48d72-b155-4b41-ba9c-39e017fcf452",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "Daniel Mitchell",
|
|
17
|
+
uuid: "63665703-de71-4a2b-baa4-1a3acf995b7f",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 2,
|
|
23
|
+
name: "Orange Group",
|
|
24
|
+
description: "Thursday night depression session",
|
|
25
|
+
members: [
|
|
26
|
+
{
|
|
27
|
+
name: "Mark Martin",
|
|
28
|
+
uuid: "eaef5256-ce7c-402c-9e56-f8e5d1fba22f",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "Robert Evans",
|
|
32
|
+
uuid: "8648a68d-1d68-4293-9d1a-a7a188b91418",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "Linda Johnson",
|
|
36
|
+
uuid: "8078cc5f-3cd7-4ebb-9ade-515c0dd5f85f",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Daniel Green",
|
|
40
|
+
uuid: "4ff33dfa-e4ad-4cb5-bbad-8936f9d162df",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "Kimberly Adams",
|
|
44
|
+
uuid: "65bb2ebd-fef9-48c4-9c64-16445fa4fe7c",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "Daniel Lee",
|
|
48
|
+
uuid: "7d46336f-4b6e-4daa-a122-77a7efeb7a2e",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "Nancy Hernández",
|
|
52
|
+
uuid: "89ee2163-4dd4-4d4b-9882-f6be19c15b8f",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 3,
|
|
58
|
+
name: "Blue Group",
|
|
59
|
+
description: "Thursday night depression session",
|
|
60
|
+
members: [
|
|
61
|
+
{
|
|
62
|
+
name: "Patty Patterson",
|
|
63
|
+
uuid: "9bf3adf4-3a5e-48b2-9adf-e117ce2ecdc5",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "Johnny Cash",
|
|
67
|
+
uuid: "f43172b8-a6fc-4edb-b92b-8d759ed9da50",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "John Doe Two",
|
|
71
|
+
uuid: "fa918efe-a4a4-4ac8-8381-3ba14ac61953",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "Foo Bazzi Bar",
|
|
75
|
+
uuid: "791c9475-8396-4519-a8ab-905cee8cccd3",
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mockGroupData } from "./mock-group-data";
|
|
2
|
+
|
|
3
|
+
export function useGroupSearch(filter) {
|
|
4
|
+
const searchHistory = mockGroupData || [];
|
|
5
|
+
// if (filter.length <= 2) return [];
|
|
6
|
+
|
|
7
|
+
return filter
|
|
8
|
+
? searchHistory?.filter(
|
|
9
|
+
(item) =>
|
|
10
|
+
item?.description?.toLowerCase()?.includes(filter?.toLowerCase()) ||
|
|
11
|
+
item?.name?.toLowerCase()?.includes(filter?.toLowerCase())
|
|
12
|
+
)
|
|
13
|
+
: searchHistory;
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Close } from "@carbon/react/icons";
|
|
2
|
+
import { Button } from "@carbon/react";
|
|
3
|
+
import React, { useContext } from "react";
|
|
4
|
+
import { Link } from "react-router-dom";
|
|
5
|
+
import GroupFormWorkflowContext from "../../context/GroupFormWorkflowContext";
|
|
6
|
+
import styles from "./styles.scss";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
8
|
+
import CompactGroupSearch from "../group-search/CompactGroupSearch";
|
|
9
|
+
import AddGroupModal from "../../add-group-modal/AddGroupModal";
|
|
10
|
+
|
|
11
|
+
const GroupSearchHeader = () => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const { activeGroupUuid, setGroup } = useContext(GroupFormWorkflowContext);
|
|
14
|
+
const handleSelectGroup = (group) => {
|
|
15
|
+
setGroup(group);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (activeGroupUuid) return null;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={styles.searchHeaderContainer}>
|
|
22
|
+
<span className={styles.padded}>{t("findGroup", "Find group")}:</span>
|
|
23
|
+
<span className={styles.searchBarWrapper}>
|
|
24
|
+
<CompactGroupSearch selectGroupAction={handleSelectGroup} />
|
|
25
|
+
</span>
|
|
26
|
+
<span className={styles.padded}>{t("or", "or")}</span>
|
|
27
|
+
<span>
|
|
28
|
+
<AddGroupModal />
|
|
29
|
+
</span>
|
|
30
|
+
<span style={{ flexGrow: 1 }} />
|
|
31
|
+
<span>
|
|
32
|
+
<Link to="..">
|
|
33
|
+
<Button kind="ghost">
|
|
34
|
+
{t("cancel", "Cancel")} <Close size={20} />
|
|
35
|
+
</Button>
|
|
36
|
+
</Link>
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default GroupSearchHeader;
|
package/src/{patient-search-header → group-form-entry-workflow/group-search-header}/styles.scss
RENAMED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
@
|
|
2
|
-
@import
|
|
3
|
-
@import "~carbon-components/src/globals/scss/mixins";
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
3
|
|
|
5
4
|
.searchHeaderContainer {
|
|
6
|
-
height:
|
|
5
|
+
height: spacing.$spacing-11;
|
|
7
6
|
display: flex;
|
|
8
7
|
align-items: center;
|
|
9
8
|
background-color: $ui-02;
|
|
10
9
|
border-top: 0.0125rem solid $ui-03;
|
|
11
10
|
border-bottom: 0.0125rem solid $ui-03;
|
|
12
|
-
padding: 0
|
|
11
|
+
padding: 0 spacing.$spacing-05;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
.searchBarWrapper {
|
|
@@ -17,5 +16,5 @@
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
.padded {
|
|
20
|
-
padding:
|
|
19
|
+
padding: spacing.$spacing-05;
|
|
21
20
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/colors';
|
|
3
|
+
@use '@carbon/styles/scss/type';
|
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
.breadcrumbsContainer > div > div > nav {
|
|
8
|
+
background-color: $ui-02;
|
|
9
|
+
padding: spacing.$spacing-04 spacing.$spacing-05;
|
|
10
|
+
height: spacing.$spacing-08;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.workspaceWrapper {
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.workspace {
|
|
19
|
+
width: 1100px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.selectPatientMessage {
|
|
23
|
+
@include type.type-style('productive-heading-03');
|
|
24
|
+
margin: spacing.$spacing-07;
|
|
25
|
+
text-align: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.formMainContent {
|
|
29
|
+
display: flex;
|
|
30
|
+
text-align: center;
|
|
31
|
+
margin-top: spacing.$spacing-05;
|
|
32
|
+
column-gap: spacing.$spacing-05;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.formContainer {
|
|
36
|
+
flex-grow: 1;
|
|
37
|
+
max-height: calc(100vh - 14rem);
|
|
38
|
+
overflow-y: scroll;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.formContainer :global(.cds--form-item) :global(.question-area) {
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.rightPanel {
|
|
46
|
+
width: 13rem;
|
|
47
|
+
text-align: left;
|
|
48
|
+
overflow-y: scroll;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
row-gap: spacing.$spacing-05;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.patientCardsSection {
|
|
55
|
+
margin: spacing.$spacing-05 0;
|
|
56
|
+
border-bottom: 1px solid colors.$gray-10;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.rightPanelActionButtons {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
row-gap: spacing.$spacing-03;
|
|
63
|
+
& button {
|
|
64
|
+
width: 100%;
|
|
65
|
+
text-decoration: "none";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.formSection {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
row-gap: 1rem;
|
|
73
|
+
justify-content: flex-start;
|
|
74
|
+
align-items: flex-start;
|
|
75
|
+
text-align: left;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.formSectionTile {
|
|
79
|
+
width: 500px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
.formError {
|
|
84
|
+
@include type.type-style("helper-text-02");
|
|
85
|
+
color: colors.$red-60;
|
|
86
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
const useKeyPress = (targetKey) => {
|
|
4
|
+
const [keyPressed, setKeyPressed] = useState(false);
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const downHandler = ({ key }) => {
|
|
8
|
+
if (key === targetKey) {
|
|
9
|
+
setKeyPressed(true);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const upHandler = ({ key }) => {
|
|
14
|
+
if (key === targetKey) {
|
|
15
|
+
setKeyPressed(false);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
window.addEventListener("keydown", downHandler);
|
|
20
|
+
window.addEventListener("keyup", upHandler);
|
|
21
|
+
|
|
22
|
+
return () => {
|
|
23
|
+
window.removeEventListener("keydown", downHandler);
|
|
24
|
+
window.removeEventListener("keyup", upHandler);
|
|
25
|
+
};
|
|
26
|
+
}, [targetKey]);
|
|
27
|
+
|
|
28
|
+
return keyPressed;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default useKeyPress;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { openmrsFetch } from "@openmrs/esm-framework";
|
|
2
|
+
|
|
3
|
+
const usePostCohort = () => {
|
|
4
|
+
const cohortURL = `/ws/rest/v1/cohortm/cohort`;
|
|
5
|
+
const fetcher = openmrsFetch(cohortURL, {
|
|
6
|
+
method: "POST",
|
|
7
|
+
headers: {
|
|
8
|
+
"Content-Type": "application/json",
|
|
9
|
+
},
|
|
10
|
+
body: {
|
|
11
|
+
name: "Magenta",
|
|
12
|
+
cohortType: "hello",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return fetcher;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default usePostCohort;
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
} from "@openmrs/esm-framework";
|
|
13
13
|
import { configSchema } from "./config-schema";
|
|
14
14
|
|
|
15
|
+
declare let __VERSION__: string;
|
|
16
|
+
// __VERSION__ is replaced by Webpack with the version from package.json
|
|
17
|
+
const version = __VERSION__;
|
|
18
|
+
|
|
15
19
|
/**
|
|
16
20
|
* This tells the app shell how to obtain translation files: that they
|
|
17
21
|
* are JSON files in the directory `../translations` (which you should
|
|
@@ -84,4 +88,4 @@ function setupOpenMRS() {
|
|
|
84
88
|
};
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
export { backendDependencies, importTranslation, setupOpenMRS };
|
|
91
|
+
export { backendDependencies, importTranslation, setupOpenMRS, version };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SkeletonText } from "carbon
|
|
3
|
-
import React
|
|
4
|
-
import FormWorkflowContext from "../context/FormWorkflowContext";
|
|
1
|
+
import { CheckmarkOutline, WarningAlt } from "@carbon/react/icons";
|
|
2
|
+
import { SkeletonText } from "@carbon/react";
|
|
3
|
+
import React from "react";
|
|
5
4
|
import useGetPatient from "../hooks/useGetPatient";
|
|
6
5
|
import styles from "./styles.scss";
|
|
7
6
|
|
|
@@ -18,9 +17,12 @@ const CardContainer = ({ onClick = () => undefined, active, children }) => {
|
|
|
18
17
|
);
|
|
19
18
|
};
|
|
20
19
|
|
|
21
|
-
const PatientCard = ({
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const PatientCard = ({
|
|
21
|
+
patientUuid,
|
|
22
|
+
activePatientUuid,
|
|
23
|
+
editEncounter,
|
|
24
|
+
encounters,
|
|
25
|
+
}) => {
|
|
24
26
|
const patient = useGetPatient(patientUuid);
|
|
25
27
|
const givenName = patient?.name?.[0]?.given?.[0];
|
|
26
28
|
const familyName = patient?.name?.[0]?.family;
|
|
@@ -53,9 +55,9 @@ const PatientCard = ({ patientUuid }) => {
|
|
|
53
55
|
</div>
|
|
54
56
|
<div>
|
|
55
57
|
{patientUuid in encounters ? (
|
|
56
|
-
<
|
|
58
|
+
<CheckmarkOutline size={16} className={styles.statusSuccess} />
|
|
57
59
|
) : (
|
|
58
|
-
<
|
|
60
|
+
<WarningAlt size={16} className={styles.statusWarning} />
|
|
59
61
|
)}
|
|
60
62
|
</div>
|
|
61
63
|
</CardContainer>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
3
|
-
@
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/colors';
|
|
3
|
+
// @use '@carbon/styles/scss/type';
|
|
4
|
+
// @import '~@openmrs/esm-styleguide/src/vars';
|
|
4
5
|
|
|
5
6
|
.cardContainer {
|
|
6
|
-
padding:
|
|
7
|
+
padding: spacing.$spacing-05;
|
|
7
8
|
display: flex;
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -22,12 +23,12 @@
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.activeDisplayName {
|
|
25
|
-
color:
|
|
26
|
+
color: colors.$blue-50;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
.inactiveCard {
|
|
29
30
|
&:hover {
|
|
30
|
-
background-color:
|
|
31
|
+
background-color: colors.$gray-30;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -36,9 +37,9 @@
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
.statusSuccess {
|
|
39
|
-
fill:
|
|
40
|
+
fill: colors.$green-60;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
.statusWarning {
|
|
43
|
-
fill:
|
|
44
|
+
fill: colors.$yellow-40;
|
|
44
45
|
}
|